Ibex has either 31 or 15 32-bit registers if the RV32E extension is disabled or enabled, respectively.
x0 is statically bound to 0 and can only be read, it does not contain any sequential logic.
The register file has two read ports and one write port, register file data is available the same cycle a read is requested. There is no write to read forwarding path so if one register is being both read and written the read will return the current value rather than the value being written.
There are three flavors of register file available, each having their own benefits and trade-offs.
The register file flavor is selected via the enumerated parameter
RegFile defined in
Flip-Flop-Based Register File
The flip-flop-based register file uses regular, positive-edge-triggered flip-flops to implement the registers.
This makes it the first choice when simulating the design using Verilator.
This implementation can be selected by setting the
RegFile parameter to “ibex_pkg::RegFileFF”.
It is the default selection.
FPGA Register File
The FPGA register file leverages synchronous-write / asynchronous-read RAM design elements, where available on FPGA targets.
For Xilinx FPGAs, synthesis results in an implementation using RAM32M primitives. Using this design with a Xilinx Artya7-100 FPGA conserves around 600 Logic LUTs and 1000 flip-flops at the expense of 48 LUTRAMs for the 31-entry register file as compared to the flip-flop-based register file.
This makes it the first choice for FPGA synthesis.
To select the FPGA register file, set the
RegFile parameter to “ibex_pkg::RegFileFPGA”.
Latch-Based Register File
The latch-based register file uses level-sensitive latches to implement the registers.
This allows for significant area savings compared to an implementation using regular flip-flops and thus makes the latch-based register file the first choice for ASIC implementations. Simulation of the latch-based register file is possible using commercial tools.
The latch-based register file cannot be simulated using Verilator.
The latch-based register file can also be used for FPGA synthesis, but this is not recommended as FPGAs usually do not well support latches.
To select the latch-based register file, set the
RegFile parameter to “ibex_pkg::RegFileLatch”.
In addition, a technology-specific clock gating cell must be provided to keep the clock inactive when the latches are not written.
This cell must be wrapped in a module called
For more information regarding the clock gating cell, checkout Getting Started with Ibex.
The latch-based register file requires the gated clock to be enabled in the cycle after the write enable
we_a_i signal was set high.
This can be achieved by latching
we_a_i in the clock gating cell during the low phase of
The resulting behavior of the latch-based register file is visualized in Figure 9.
The input data
wdata_a_i is sampled into a flip-flop-based register
The actual latch-based registers
mem are transparent during high phases of
Their content is sampled from
wdata_a_q on falling edges of these clocks.