picoRV32のパラメータを見ていきます。

 

ここでは、ENABLE_REGS_DUALPORTからです。

 

4) ENABLE_REGS_DUALPORT (default = 1)

The register file can be implemented with two or one read ports. A dual ported register file improves performance a bit, but can also increase the size of the core.

 

これは、可能な限り1にすべきですね。基本的にRISC-Vの命令は2レジスタから読み出し、1レジスタに書き込みます。そのために、レジスタへのアクセスポート数により実行するサイクル数が異なります。2ポート無いと、入力のデータをそろえるのに+1サイクルかかってしまいます。

 

以下のコードでENABLE_REGS_DUALPORT==1の場合には、RS1とRS2が同時にアクセスに行くところが見えますが、そうでない場合には、状態によってRS1とRS2を切り替えるようになっています。

 

 

5)LATCHED_MEM_RDATA (default = 0)

Set this to 1 if the mem_rdata is kept stable by the external circuit after a transaction. In the default configuration the PicoRV32 core only expects the mem_rdata input to be valid in the cycle with mem_valid && mem_ready and latches the value internally.

This parameter is only available for the picorv32 core. In the picorv32_axi and picorv32_wb core this is implicitly set to 0.

 

これは1にすると処理の後もmem_rdataを有効にするようです。

今回は0でなので特に意識は不要です

 

6)TWO_STAGE_SHIFT (default = 1)

By default shift operations are performed in two stages: first shifts in units of 4 bits and then shifts in units of 1 bit. This speeds up shift operations, but adds additional hardware. Set this parameter to 0 to disable the two-stage shift to further reduce the size of the core.

 

デフォルトで1ですが、この設定ではシフトは4ビット単位で実施します。

 

 

7)BARREL_SHIFTER (default = 0)

By default shift operations are performed by successively shifting by a small amount (see TWO_STAGE_SHIFT above). With this option set, a barrel shifter is used instead.

 

シフとは6とも絡みますが、1ビットや4ビットずつシフトしていく方法とバレルシフタを使って一気に計算する方法です。1ビットや4ビットずつシフトするより早いのですが、その分ハードウェアが必要となります。

 

 

 

まだ、しばらく続きます。