Not able to understand Verilog Code for parameterized N-bit adder
I recently got a code for parameterized n-bit adder, but I didn't understand the meaning behind the code. I know that an n-bit full adder without input carry has a half adder and N-1 full adders. Have a look at the code: module nbitadder (input1, input2, sum); parameter N = 10; input [N-1:0] input1, input2; output [N-1:0] sum; wire carry_out; wire [N-1:0] carry; genvar i; generate for (i=0; i<N; i=i+1) begin: generate_N_bit_Adder if (i==0) Halfadder f (input1[0], input2[0], carry[0], sum[0]); else Fulladder f (input1[i], input2[i], carry[i-1], carry[i], sum[i]); end assign carry_out = carry[N-
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.