13 / 36 · Khái niệm
Half adders and full adders
Compute sum and carry separately, then chain them.
Bài học miễn phí. Đăng ký để lưu tiến độ học tập.
Chưa có bản dịch. Nội dung bài học gốc được hiển thị. (English)
Learning goals
- Distinguish sum width from carry.
- Explain how full adders can be chained.
1+1 produces a two-bit result.
A half adder computes sum=a^b and carry=a&b. Adding 1 and 1 gives binary 10, so sum=0 and carry=1.
A full adder also adds cin from the previous position. Its sum is a^b^cin and cout=(a&b)|(a&cin)|(b&cin). Carry is 1 when at least two inputs are 1.
assign sum = a ^ b ^ cin;
assign cout = (a & b) | (a & cin) | (b & cin);Pass carry to the next bit.
In a chain, cout from bit 0 becomes cin for bit 1. Keeping the final carry when adding two N-bit inputs requires an N+1-bit result.
Make width explicit with assign total = {1'b0, a} + {1'b0, b};. A ripple-carry implementation has propagation delay; the arithmetic expression alone does not verify its speed.
Thay đổi đầu vào
Tự thử
Find sum and cout for a=1, b=0, cin=1.
Đọc giải thích
The total is 2, or binary 10: sum=0 and cout=1.