FPGA開発日記

カテゴリ別記事インデックス https://msyksphinz.github.io/github_pages , English Version https://fpgadevdiary.hatenadiary.com/

自作CPUコアとBOOMv3のPPA(Performance, Power, Area)を比較する (6. FPNewをRegister Retimingして周波数を向上させる)

今のところ自作CPUは面積が大きすぎる。Vivadoでの論理合成結果をもっと詳細に見ていくことにする。

FPUの動作周波数がMETしない。FPNewの既存のIPを使っているので、そんなに変なことにはならないはずだ。原因を調査する。 FPNewは内部のレジスタ数を調整できるので、基本的に論理合成でRegister Retimingをすることの想定だ。

Register Retimingのためのオプションは以下のように説明してある。

github.com

今まではパイプラインの条件をBEFOREにしていたのでRetimingができていなかったようだ。 すべてのFMAの演算パイプラインををDISTRIBUTEDに変更みる。

Enumerator Description
BEFORE All pipeline registers are inserted at the inputs of the operational unit
AFTER All pipeline registers are inserted at the outputs of the operational unit
INSIDE All registers are inserted at roughly the middle of the operational unit (if not possible, BEFORE)
DISTRIBUTED Registers are evenly distributed to INSIDE, BEFORE, and AFTER (if no INSIDE, all BEFORE)

これでかなり周波数が改善された。

+++ b/src/scariv_fpnew_wrapper.sv
@@ -221,7 +221,7 @@ fpnew_fma
   #(
     .FpFormat   (fpnew_pkg::FP32),
     .NumPipeRegs(scariv_conf_pkg::FPNEW_LATENCY),
-    .PipeConfig (fpnew_pkg::BEFORE),
+    .PipeConfig (fpnew_pkg::DISTRIBUTED),
     .TagType    (aux_fpnew_t),
     .AuxType    (logic)
     )
@@ -264,7 +264,7 @@ assign w_fma32_out_fflags = {w_fma32_fflags.NV,
 fpnew_noncomp #(
     .FpFormat   (fpnew_pkg::FP32),
     .NumPipeRegs(scariv_conf_pkg::FPNEW_LATENCY),
-    .PipeConfig (fpnew_pkg::BEFORE),
+    .PipeConfig (fpnew_pkg::DISTRIBUTED),
     .TagType    (aux_fpnew_t),
     .AuxType    (logic)
 ) fpnew_noncomp32 (
@@ -332,7 +332,7 @@ fpnew_opgroup_multifmt_slice /* #(
 ) */
   #(
     .NumPipeRegs(scariv_conf_pkg::FPNEW_LATENCY),
-    .PipeConfig (fpnew_pkg::BEFORE),
+    .PipeConfig (fpnew_pkg::DISTRIBUTED),
     .TagType    (aux_fpnew_t)
     ) fpnew_cvt (
   .clk_i           ( i_clk     ),
@@ -376,7 +376,7 @@ fpnew_divsqrt_multi
   #(
     .FpFmtConfig (FpFmtConfig      ),
     .NumPipeRegs (32/2             ),
-    .PipeConfig  (fpnew_pkg::BEFORE),
+    .PipeConfig  (fpnew_pkg::DISTRIBUTED),
     .TagType     (aux_fpnew_t      ),
     .AuxType     (logic            )
     )
@@ -444,7 +444,7 @@ generate if (riscv_fpu_pkg::FLEN_W == 64) begin : fma64
     #(
       .FpFormat   (fpnew_pkg::FP64),
       .NumPipeRegs(scariv_conf_pkg::FPNEW_LATENCY),
-      .PipeConfig (fpnew_pkg::BEFORE),
+      .PipeConfig (fpnew_pkg::DISTRIBUTED),
       .TagType    (aux_fpnew_t),
       .AuxType    (logic)
       )
@@ -493,7 +493,7 @@ generate if (riscv_fpu_pkg::FLEN_W == 64) begin : fma64
   fpnew_noncomp #(
       .FpFormat   (fpnew_pkg::FP64),
       .NumPipeRegs(scariv_conf_pkg::FPNEW_LATENCY),
-      .PipeConfig (fpnew_pkg::BEFORE),
+      .PipeConfig (fpnew_pkg::DISTRIBUTED),
       .TagType    (aux_fpnew_t),
       .AuxType    (logic)
   ) fpnew_noncomp64 (