[RTLLM-p004] Arithmetic/Adder/adder_pipe_64bit


提交解答


分數: 5
時間限制: 2.0s
記憶體限制: 256M

作者:
題目代碼
題目類型
允許的語言
Verilog

64 位元 Pipeline Ripple Carry 加法器

題目說明

請設計一個名為 adder_pipe_64bit 的 Verilog 模組,實作一個具有 Pipeline 架構的 64 位元 Ripple Carry Adder

模組輸入兩個 64 位元運算元:

  • adda
  • addb

並輸出:

  • result:65 位元加法結果(包含 Carry)
  • o_en:表示輸出資料是否有效

本模組需要透過多個 Pipeline Stage 暫存器切割運算流程,並且讓輸入 Enable (i_en) 與計算結果同步通過 Pipeline。


模組介面

方向 位元寬度 描述
clk input 1 時脈
rst_n input 1 Active-low Reset
i_en input 1 輸入資料有效訊號
adda input 64 輸入資料 A
addb input 64 輸入資料 B
result output 65 加法結果
o_en output 1 輸出有效訊號

設計要求與提示

  • 模組名稱: 必須為 adder_pipe_64bit
  • Pipeline: 必須使用暫存器建立多級 Pipeline。
  • Adder: 使用 Ripple Carry Adder 概念。
  • Enable 同步: i_en 必須與資料一起延遲。
  • Reset:rst_n = 0 時清除所有 Pipeline 狀態。
  • Output:o_en = 1 時,result 為有效結果。

程式設計模板 (Code Template)

module adder_pipe_64bit
#(
    parameter DATA_WIDTH = 64,
    parameter STG_WIDTH = 16
)
(
    input clk,
    input rst_n,
    input i_en,
    input [DATA_WIDTH-1:0] adda,
    input [DATA_WIDTH-1:0] addb,
    output [DATA_WIDTH:0] result,
    output reg o_en
);

    // 在此處填寫您的程式碼

endmodule

評論

目前沒有評論。