# Verilog code for 8 bit MUX based adder

Discussion in 'Microcontrollers, Programming and IoT' started by Researchers, Sep 22, 2017.

1. ### Researchers

5
0
Sep 22, 2017
The adder is most widely used in digital system. we all are aware with full adder and parallel adder. but they give less response because of the delay. Delay pays an important role for deciding the efficiency of the circuit. now i am discussing the MUX based adder which offer less delay as compared to conventional adder. The concept of multiplexer is used to minimize the delay. Here we are discussed the verilog code of 8 bit MUx based adder.

module add8(
input [7:0] a,
input [7:0] b,
output [8:0] sum
);
wire s0;
wire c1;
wire s1;
wire c2;
wire s2;
wire c3;
wire s3;
wire c4;
wire s4;
wire c5;
wire s5;
wire c6;
wire s6;
wire s7;
wire c7;
wire carry;
assign s0 = a ^ b;
assign c1 = ((a ^ b) & 1'b0 )| (a & b); // for select line and ? for condition statement

assign s1 = a ^ b ^ c1;
assign c2 = ((a ^ b) & c1) | (a & b);

assign s2 = a ^ b ^ c2;
assign c3 = ((a ^ b)& c2) | (a & b);

assign s3 = a ^ b ^ c3;
assign c4= ((a ^ b)& c3) | (a & b);

assign s4 = a ^ b ^ c4;
assign c5= ((a ^ b)& c4) | (a& b);

assign s5 = a ^ b ^ c5;
assign c6 = ((a ^ b)& c5) | (a & b) ;
assign s6 = a ^ b ^ c6;
assign c7 = ((a ^ b)& c6) | (a & b);
assign s7 = a ^ b ^ c7;
assign carry = ((a ^ b)& c7) | (a & b) ;

assign sum = { carry, s7, s6, s5, s4, s3, s2, s1, s0};

endmodule

2. ### Researchers

5
0
Sep 22, 2017

Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.  Continue to site