[RTLLM-p001] Arithmetic/Adder/adder_8bit
8 位元串接式加法器
題目說明
請設計一個名為 adder_8bit 的 Verilog 模組,使用多個位元級全加器(Full Adder)組成一個 8 位元組合邏輯加法器。
模組接受兩個 8 位元輸入 a、b,以及一個進位輸入 cin,並輸出加法結果 sum 與最終進位 cout。
請使用多個位元級全加器串接(Ripple Carry)的方式完成設計。
模組介面 (Module Interface)
| 埠 (Port) | 方向 (Direction) | 位元寬度 (Width) | 描述 (Description) |
|---|---|---|---|
a |
輸入 (input) | 8 | 運算元 A |
b |
輸入 (input) | 8 | 運算元 B |
cin |
輸入 (input) | 1 | 初始進位輸入 |
sum |
輸出 (output) | 8 | 加法結果 |
cout |
輸出 (output) | 1 | 最終進位輸出 |
設計要求與提示
- 模組名稱: 您的設計模組名稱必須為
adder_8bit。 - 組合邏輯: 本題不可使用任何時序邏輯或暫存器。
- 位元級設計: 使用多個 Full Adder 串接完成 8 位元加法器。
- Ripple Carry: 每一級 Full Adder 的 Carry-out 應接至下一級 Carry-in。
程式設計模板 (Code Template)
module adder_8bit (
input [7:0] a,
input [7:0] b,
input cin,
output [7:0] sum,
output cout
);
// 在此處填寫您的程式碼
endmodule
評論