Programming Assignment Solution-Week2
Programming Assignment Solution-Week2
Write a verilog module to implement a 4-bit ripple carry adder. The module will take the
following arguments:
i. Two 4-bit inputs A and B,
ii. 1-bit carry input Cin,
iii. 4-bit output Sum,
iv. 1-bit carry output Cout
Implement the above module by instantiating four 1-bit full adder (A 1-bit full adder
takes as arguments two input bits to add, a carry input bit, one bit sum and one bit
output carry).
//write the verilog modules to implement 4-bit ripple carry adder and
//keep the module name of 4-bit adder "rcadder_4"
IMPORTANT POINTS:
The order of the arguments was clearly mentioned in the problem statement.
You can of course use any names for the arguments.
The test bench that evaluates the program will apply the inputs in this specific
order.
ASSIGNMENT 2: 4-bit latch
Write verilog modules to implement a 4-bit latch, by instantiating four D-type latch. The
module will take as arguments the following:
i. 4-bit D inputs for all four D-latches
ii. 1-bit latch enable input En
iii. 4-bit Q outputs from all four D-latches
Here all four D-latches activates on a common enable En input line.
IMPORTANT POINTS:
The order of the arguments was clearly mentioned in the problem statement.
You can of course use any names for the arguments.
The test bench that evaluates the program will apply the inputs in this specific
order.
ASSIGNMENT 3: 4-to-1 Multiplexer
Write verilog module to implement a 4-to-1 multiplexer by using gate level structural
description. The module will take as arguments the following:
i. 4 input bits,
ii. 2 selection bits and
iii. 1 output bit.
Realize the operation of 4-to-1 multiplexer by instantiating required number of different
logical gates and passing appropriate input and output parameters to each such logic
gate.
IMPORTANT POINTS:
The order of the arguments was clearly mentioned in the problem statement.
You can of course use any names for the arguments.
The select input has to be applied properly. If sel = 00; in[0] should be selected;
if sel = 01, in[1] should be selected; if sel = 10, in[2] should be selected; if sel =
11, in[3] should be selected.
In the sample test cases the two pass cases has been mentioned as:
For s = 00 and a = 0001, out = 1
For s = 00 and a = 0010, out = 0
This clearly shows that the rightmost bit of a is a[0]. If s = 01, the second bit from
the right should be selected, and so on.