HDL Bits Solution: Adder100

In this quiz, I was required to create a 100-bit full adder. If I had created a 1-bit full adder and instantiated it 100 times, it would have taken too much time. Instead, I wrote code to add 100 bits all at once. For the last carry-out bit, I used a wire called ‘wire1’ to get the result of the sum signal and assign it to the ‘cout’ signal

 

Here is my code for this quiz.

module top_module(
input [99:0] a, b,
input cin,
output cout,
output [99:0] sum );

wire [100:0] wire1;

assign wire1 = a+b+cin;
assign sum = a+b+cin;
assign cout = wire1[100];

endmodule

 

Reference:https://hdlbits.01xz.net/wiki/Adder100

Leave a Reply

Your email address will not be published. Required fields are marked *