Toto je starší verze dokumentu!


Cvičení 4

2.

module clasum4(x, y, cin, s, p, g, cout);
    input [3:0] x;
    input [3:0] y;
    input cin;     
    output [3:0] s;
    output [3:0] p;
    output [3:0] g;
    output cout;
    wire c1, c2, c3;
 
    assign g[0] = x[0] & y[0], g[1] = x[1] & y[1], g[2] = x[2] & y[2], g[3] = x[3] & y[3]; 
    assign p[0] = x[0] ^ y[0], p[1] = x[1] ^ y[1], p[2] = x[2] ^ y[2], p[3] = x[3] ^ y[3];
 
    assign c1 = g[0] | (p[0] & cin);
    assign c2 = g[1] | (p[1] & g[0]) | (p[1] & p[0] & cin);
    assign c3 = g[2] | (p[2] & g[1]) | (p[2] & p[1]) | (p[2] & p[1] & p[0] & cin);
    assign cout = g[3] | (p[3] & g[2]) | (p[3] & p[2]) | (p[3] & p[2] & p[1]) | (p[3] & p[2] & p[1] & p[0] & cin);
 
    assign s[0] = cin ^ p[0], s[1] = c1 ^ p[1], s[2] = c2 ^ p[2], s[3] = c3 ^ p[3];
endmodule
courses/a4m36pap/cviceni4.1287490400.txt.gz · Poslední úprava: 2025/01/03 18:25 (upraveno mimo DokuWiki)
Nahoru
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0