The document describes three Verilog code modules:
1) A 1-bit full adder module that takes two 1-bit inputs (a and b) and a carry-in (cin) and produces a sum (s) and carry-out (cout).
2) A 4-bit full adder module that uses four instances of the 1-bit full adder module to add four 1-bit inputs (a and b) and a carry-in and produces a 4-bit sum and carry-out.
3) A 2-to-4 decoder module that takes a 2-bit input (a) and uses NOT gates and AND gates to decode it into a 4-bit output (
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
52 views5 pages
Lab 02 Submitted To
The document describes three Verilog code modules:
1) A 1-bit full adder module that takes two 1-bit inputs (a and b) and a carry-in (cin) and produces a sum (s) and carry-out (cout).
2) A 4-bit full adder module that uses four instances of the 1-bit full adder module to add four 1-bit inputs (a and b) and a carry-in and produces a 4-bit sum and carry-out.
3) A 2-to-4 decoder module that takes a 2-bit input (a) and uses NOT gates and AND gates to decode it into a 4-bit output (
Modeling Code: module TwointoFourbitdecoderusinganarray(o,a); input[1:0]a; output[3:0]o; wire [1:0]w; not n1(w[0],a[0]); not n2(w[1],a[1]); and a1(o[0],a[0],a[1]); and a2(o[1],a[1],w[0]); and a3(o[2],w[1],a[0]); and a4(o[3],w[1],w[0]); endmodule