Skip to content

Commit

Permalink
cappuccino/rf: *really* fix RF_ADDR_WIDTH
Browse files Browse the repository at this point in the history
As Stefan W pointed out to me, my previous fix
was completely incorrect and only correctly for
OPTION_RF_NUM_SHADOW_GPR = 1.
This is based on a patch he presented, but makes
use of the `clog2 macro to maintain compatibility with
icarus.

Also, remove the unused RF_WORDS localparam.
  • Loading branch information
skristiansson committed Oct 21, 2014
1 parent 4c4403d commit a960440
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions rtl/verilog/mor1kx_rf_cappuccino.v
Expand Up @@ -74,8 +74,11 @@ module mor1kx_rf_cappuccino
output [OPTION_OPERAND_WIDTH-1:0] execute_rfb_o
);

localparam RF_ADDR_WIDTH = OPTION_RF_ADDR_WIDTH + OPTION_RF_NUM_SHADOW_GPR;
localparam RF_WORDS = OPTION_RF_WORDS * (OPTION_RF_NUM_SHADOW_GPR+1);
`include "mor1kx_utils.vh"

localparam RF_ADDR_WIDTH = OPTION_RF_ADDR_WIDTH +
((OPTION_RF_NUM_SHADOW_GPR == 1) ? 1 :
`clog2(OPTION_RF_NUM_SHADOW_GPR));

wire [OPTION_OPERAND_WIDTH-1:0] rfa_ram_o;
wire [OPTION_OPERAND_WIDTH-1:0] rfb_ram_o;
Expand Down

0 comments on commit a960440

Please sign in to comment.