Question

In: Electrical Engineering

Design a 32 bit adder using a single 4 bit adder using verilog code

Design a 32 bit adder using a single 4 bit adder using verilog code

Solutions

Expert Solution

module 32_bit_adder(input [31:0] A,input [31:0] B,input Cin,output [31:0] S,output Cout);
    wire C1, C2, C3, C4, C5, C6, C7;
    4_bit_adder ad0 (A[3:0], B[3:0], Cin, S[3:0], C1);
    4_bit_adder ad1 (A[7:4], B[7:4], C1, S[7:4], C2);
    4_bit_adder ad2 (A[11:8], B[11:8], C2, S[11:8], C3);
    4_bit_adder ad3 (A[15:12], B[15:12], C3, S[15:12], C4);
    4_bit_adder ad4 (A[19:16], B[19:16], C4, S[19:16], C5);
    4_bit_adder ad5 (A[23:20], B[23:20], C5, S[23:20], C6);
    4_bit_adder ad6 (A[27:24], B[27:24], C6, S[27:24], C7);
    4_bit_adder ad7 (A[31:28], B[31:28], C7, S[31:28], Cout);
endmodule

//1 bit full adder...

module full_adder(input A,input B,input Cin,output S,output Cout);
    assign S = A ^ B ^ CIN;
    assign COUT = (A & B) | (CIN & (A ^ B));
endmodule     //end 1 bit full adder...
//4 bit full adder...
module 4_bit_adder(input [3:0] A,input [3:0] B,input C0,output [3:0] S,output C4);
    wire C1, C2, C3;
    full_adder fu0 (A[0], B[0], C0, S[0], C1);
    full_adder fu1 (A[1], B[1], C1, S[1], C2);
    full_adder fu2 (A[2], B[2], C2, S[2], C3);
    full_adder fu3 (A[3], B[3], C3, S[3], C4);
endmodule    //end of 4 bit full adder...

Related Solutions

Design a 32 bit after using a single 4 bit using verilog code
Design a 32 bit after using a single 4 bit using verilog code
Design a 4-bit multiplier by using 4 bit full adder and write a verilog code.
Design a 4-bit multiplier by using 4 bit full adder and write a verilog code.
Design of 4 Bit Adder/Subtractor using Loops (Behavior Modeling Style) (verilog Code) -
Design of 4 Bit Adder/Subtractor using Loops (Behavior Modeling Style) (verilog Code) -
Design an 8-bit adder. Show Verilog code and testbench.
Design an 8-bit adder. Show Verilog code and testbench.
verilog code to implement 32 bit Floating Point Adder in Verilog using IEEE 754 floating point...
verilog code to implement 32 bit Floating Point Adder in Verilog using IEEE 754 floating point representation.
Design and Test an 8-bit Adder using 4-bit adder. Use 4-bit adder coded in class using...
Design and Test an 8-bit Adder using 4-bit adder. Use 4-bit adder coded in class using full adder that is coded using data flow model. Use test bench to test 8-bit adder and consider at least five different test vectors to test it.
Design an 8-bit adder. Show the truth table, logic circuit, and Verilog code.
Design an 8-bit adder. Show the truth table, logic circuit, and Verilog code.
SYSTEM VERILOG: Using your preferred HDL program, design a complete 4-bit Carry Look Ahead (CLA) adder...
SYSTEM VERILOG: Using your preferred HDL program, design a complete 4-bit Carry Look Ahead (CLA) adder module.
Write a verilog code for 5 to 8 multiplier using fourbit adder
Write a verilog code for 5 to 8 multiplier using fourbit adder
Design a circuit and write a verilog code description of the 16-bit right rotator using barrel...
Design a circuit and write a verilog code description of the 16-bit right rotator using barrel shift method
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT