Skip to content

Commit 739258b

Browse files
[simple_system] Instruction cycle delay parameter
Add a parameter to Simple system to delay the instruction requests and expose this in the FuseSoC build instruction.
1 parent 61eb6b1 commit 739258b

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

examples/simple_system/ibex_simple_system.core

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ parameters:
4343
paramtype: vlogdefine
4444
description: "Register file implementation parameter enum. See the ibex_pkg::regfile_e enum in ibex_pkg.sv for permitted values."
4545

46+
InstrCycleDelay:
47+
datatype: str
48+
default: ibex_pkg::RegFileFF
49+
paramtype: vlogdefine
50+
description: "Number of cycles to delay the instruction RAM access. This is on top of the single-cycle access that the RAM requires."
51+
4652
ICache:
4753
datatype: int
4854
default: 0
@@ -137,6 +143,7 @@ targets:
137143
- RV32B
138144
- RV32ZC
139145
- RegFile
146+
- InstrCycleDelay
140147
- ICache
141148
- ICacheScramble
142149
- ICacheECC

examples/simple_system/rtl/ibex_simple_system.sv

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
`define RegFile ibex_pkg::RegFileFF
2323
`endif
2424

25+
`ifndef InstrCycleDelay
26+
`define InstrCycleDelay 0
27+
`endif
28+
2529
/**
2630
* Ibex simple system
2731
*
@@ -274,6 +278,7 @@ module ibex_simple_system (
274278
// SRAM block for instruction and data storage
275279
ram_2p #(
276280
.Depth(1024*1024/4),
281+
.BExtraDelay(`InstrCycleDelay),
277282
.MemInitFile(SRAMInitFile)
278283
) u_ram (
279284
.clk_i (clk_sys),

examples/sw/benchmarks/README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Benchmarks
22

3-
This directory contains benchmarks that can be run on ibex simple system.
3+
This directory contains benchmarks that can be run on Ibex simple system.
44
Benchmarks may rely on code external to this directory (e.g. it may be found in
55
`vendor/`) see the specific benchmark information below for details on how to
66
build and run each benchmark and where benchmark code is located.
@@ -10,14 +10,21 @@ build and run each benchmark and where benchmark code is located.
1010
All of these benchmarks run on Simple System. A verilator simulation suitable
1111
for running them can be built with:
1212

13-
```
13+
```shell
1414
fusesoc --cores-root=. run --target=sim --setup --build lowrisc:ibex:ibex_simple_system `./util/ibex_config.py maxperf fusesoc_opts`
1515
```
1616

1717
This will build a simulation of Ibex in the 'maxperf' configuration.
1818
It is one of several pre-defined ibex configurations, others can be used.
1919
These are specified in the `ibex_configs.yaml` file.
2020

21+
You can also test how the instruction cache affects performance.
22+
To see this effect you must specify a delay on the instruction accesses becaus with single-cycle RAM access an isntruction cache does not help.
23+
24+
```shell
25+
fusesoc --cores-root=. run --target=sim --setup --build lowrisc:ibex:ibex_simple_system `./util/ibex_config.py maxperf-pmp-bmfull-icache fusesoc_opts` --InstrCycleDelay=5
26+
```
27+
2128
See examples/simple_system/README.md for full details.
2229

2330
## CoreMark
@@ -32,13 +39,13 @@ running on simple system is found in `examples/sw/benchmarks/coremark`.
3239

3340
To build CoreMark:
3441

35-
```
42+
```shell
3643
make -C ./examples/sw/benchmarks/coremark/
3744
```
3845

3946
To run CoreMark (after building a suitable simulator binary, see above):
4047

41-
```
48+
```shell
4249
build/lowrisc_ibex_ibex_simple_system_0/sim-verilator/Vibex_simple_system --meminit=ram,examples/sw/benchmarks/coremark/coremark.elf
4350
```
4451

@@ -71,7 +78,7 @@ Correct operation validated. See README.md for run and reporting rules.
7178
Different ISAs (to choose different RISC-V ISA extensions) can be selected by
7279
passing the desired ISA string into `RV_ISA` when invoking make.
7380

74-
```
81+
```shell
7582
make -C ./examples/sw/benchmarks/coremark clean
7683
make -C ./examples/sw/benchmarks/coremark RV_ISA=rv32imc
7784
```

0 commit comments

Comments
 (0)