Professional Documents
Culture Documents
Lab09 Computer Architecture
Lab09 Computer Architecture
Lab09 Computer Architecture
Lab Assignment 09
ALU
module usman(S, A, M, N, U);
full_adder FA1 (S[0], Wire[1], N[0], I[0], U); full_adder FA2 (S[1], Wire[2], M[1], N[1], Wire[1]);
full_adder FA3 (S[2], Wire[3], M[2], R[2], Wire[2]); full_adder FA4 (S[3], A, M[3], I[3], Wire[3]);
endmodule
endmodule
input in1, in2, carry_in; output sum, carry_out; wire wire1, wire2, wire3;
half_adder HA1 (wire1, wire2, in1, in2); half_adder HA2 (sum, wire3, wire1, carry_in);
endmodule
wire w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11,w12,w13,w14,w15,w16;
endmodule
module test_ALU;
Initial
begin
x=4'b0011 ; y=4'b1101;
sel=3'b000;
#10 sel=3'b001;
#10 sel=3'b010;
#10 sel=3'b011;
#10 sel=3'b100;
#10 sel=3'b101;
#10 sel=3'b110;
#10 sel=3'b111;
end