Subversion Repositories programming

Rev

Rev 196 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 196 Rev 197
Line 14... Line 14...
14
    ALU1 bit2 (a[2], b[2], bit3_cout, op, bit2_cout, result[2]);
14
    ALU1 bit2 (a[2], b[2], bit3_cout, op, bit2_cout, result[2]);
15
    ALU1 bit1 (a[1], b[1], bit2_cout, op, bit1_cout, result[1]);
15
    ALU1 bit1 (a[1], b[1], bit2_cout, op, bit1_cout, result[1]);
16
    ALU1 bit0 (a[0], b[0], bit1_cout, op, cout, result[0]);
16
    ALU1 bit0 (a[0], b[0], bit1_cout, op, cout, result[0]);
17
endmodule
17
endmodule
18
 
18
 
19
module test_ALU4;
-
 
20
    reg[0:3] x;
-
 
21
    reg[0:3] y;
-
 
22
    reg[0:1] op;
-
 
23
    reg cin;
-
 
24
 
-
 
25
    wire[0:3] result;
-
 
26
    wire cout;
-
 
27
 
-
 
28
    initial begin
-
 
29
        $monitor ("time=%0d a=%b b=%b op=%b cin=%b cout=%b result=%b",
-
 
30
                $time, x, y, op, cin, cout, result);
-
 
31
    end
-
 
32
 
-
 
33
    initial begin
-
 
34
 
-
 
35
           x='b0101; y='b1011; op='b00; cin=0;
-
 
36
        #1 x='b0101; y='b1011; op='b01; cin=0;
-
 
37
        #1 x='b0101; y='b1011; op='b10; cin=0;
-
 
38
        #1 x='b1101; y='b0011; op='b00; cin=0;
-
 
39
        #1 x='b1010; y='b0011; op='b01; cin=0;
-
 
40
        #1 x='b0101; y='b0011; op='b10; cin=0;
-
 
41
        #1 x='b1010; y='b1001; op='b10; cin=0;
-
 
42
        
-
 
43
    end
-
 
44
 
-
 
45
    ALU4 alu4 (x, y, cin, op, cout, result);
-
 
46
    
-
 
47
endmodule
-