2 4-bit-adder modules to make an 8-bit adder

Guest
Is this code even compiling without declaring S and Cout as "reg"? 
Anyhow at best, these are one bit full adders, as already mentioned by 
Lothar.
OP
How can I obtain 8Bit full adder from 2 4-bit full adder ?
I found this code for 4-bit full adder and I tried to combined them but 
i didn't do this.
module fullAdder(
         input a,
         input b,
         input cin,
         output s,
         output cout );

        assign {cout,s} = a + b + cin;

endmodule

Could you help me how can I obtain this ?
Guest
how to connect instantiated modules by name:
http://www.asic-world.com/verilog/syntax2.html

e.g a two bit adder:
1
module adder_2bit(
2
         input [1:0] abus,
3
         input [1:0] bbus,
4
         input cin,
5
         output [1:0] sumbus,
6
         output cout );
7

8
  wire ctemp1;
9

10
   fullAdder u0 (
11
           .a(abus[0])      ,
12
           .b(bbus[0])      ,
13
           .cin(ci)      ,
14
           .sum(sumbus[0])    ,
15
           .cout(ctemp1)
16
           );
17
   fullAdder u1 (
18
           .a(abus[1])      ,
19
           .b(bbus[1])      ,
20
           .cin(ctemp1)      ,
21
           .sum(sumbus[1])    ,
22
           .cout(cout)
23
           );
24
endmodule

Reply

A question of your own? This thread is over 12 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

Formatting
  • [c]C-Code[/c]
  • [vhdl]VHDL-Code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.