Hardware interview practice
Four-bit adder and synthesized structure
Write a synthesizable 4-bit unsigned adder with carry-in and carry-out, then explain the ripple-carry structure and its critical path.
Starting point
Question code
module add4 (
input logic [3:0] a, b,
input logic cin,
output logic [3:0] sum,
output logic cout
);Reviewed example
Work through one case
Input
a=4'd15, b=4'd1, cin=0Expected output
cout=1, sum=4'd0The fifth result bit must not be discarded.
What to cover
Requirements
- Preserve the complete 5-bit result.
- Describe a four-stage full-adder carry chain.
- Explain propagate and generate terms.
- Contrast ripple carry with a carry-lookahead structure.
