Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sam #2220

Closed
wants to merge 34 commits into from
Closed

Sam #2220

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
6985174
ISOLDE initial setup
Sep 1, 2024
6441277
updates in Makefile.tools
Sep 2, 2024
7f8c47a
ISOLDE simple_system inital revision
Sep 4, 2024
9dfe1ec
updates in Makefile
Sep 5, 2024
ecbbeb5
modified start-up code, ecall shall end the simulation
Sep 5, 2024
7894c40
inital version of rtl/isolde_fetch_vleninstr.sv
Sep 7, 2024
8cbbe54
WIP fetch variable lenght instructions
Sep 8, 2024
0274ff8
first attempt to variable length fetch, not working yet
Sep 8, 2024
a9079af
bugfixing rtl/isolde_fetch_vleninstr.sv
Sep 9, 2024
53775e9
WIP bug fixing
Sep 11, 2024
2e1af7e
WIP: fetching a batch of instruction, initial FSM for decoding variab…
Sep 11, 2024
d148a60
Bugfix FSM for decoding variable length instructions
Sep 15, 2024
9359f22
work in progress: llvm toolchain
Sep 16, 2024
6230ab8
LLVM toolchain from https://github.com/riscv-collab/riscv-gnu-toolcha…
Sep 16, 2024
d35937d
refactored isolde/sw/simple_system/common/simple_system_common.c for …
Sep 17, 2024
397bd5a
Updates in Makefile.tools
Sep 17, 2024
865982b
initial version of ISOLDE register file
Sep 19, 2024
2ad3c57
work in progress: ISOLDE register file
Sep 20, 2024
e129216
initial implementation of vle32.q extended ISOLDE instruction
Sep 21, 2024
8108019
bugfix in rtl/isolde_decoder.sv
Sep 21, 2024
3d67c37
test case updates
Sep 21, 2024
8edef1c
inital version of isolde_fetch2exec_if
Sep 22, 2024
c199a74
added rtl/isolde_exec_block.sv
Sep 22, 2024
b26686b
refactored rtl/isolde_register_file_ff.sv
Sep 23, 2024
1f3fa30
NEW: instr encoding
Sep 23, 2024
7755227
improved rtl/isolde_exec_block.sv
Sep 23, 2024
b44f010
extended x register file with additional read ports
Sep 24, 2024
5f9e027
new target, flist, for isolde/simple_system/Makefile
Sep 29, 2024
e212b7d
added tinyprintf in the SW
Sep 29, 2024
a7d4fc4
first attemp to synthesis
Sep 30, 2024
52ea330
ibex_top is synthesisable
Sep 30, 2024
d49750a
added new tests: dhrystone, fibonacci
Sep 30, 2024
5f4dc88
refactored isolde/simple_system/Makefile
Oct 1, 2024
809ca51
Updating some issues in Makefile.tools
MateaSamuel Oct 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,16 @@ __pycache__
# This is generated by Questa tool when running DV simulations
modelsim.ini

vendor/riscv.tar.gz
vendor/verilator/
install/
sim.fst

*.tar.gz
logs*/
*.log
*.csv
*.old*
*.map
*.vc
synth/
69 changes: 69 additions & 0 deletions Makefile.tools
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
prj_path := $(shell git rev-parse --show-toplevel)
num_cores := $(shell nproc)
num_cores_half := $(shell echo "$$(($(num_cores) / 2))")
CXX := g++-10


INSTALL_PREFIX ?= install
INSTALL_DIR ?= $(prj_path)/${INSTALL_PREFIX}
GCC_INSTALL_DIR ?= ${INSTALL_DIR}/riscv-gcc
LLVM_INSTALL_DIR ?= ${INSTALL_DIR}/riscv-llvm
ISA_SIM_INSTALL_DIR ?= ${INSTALL_DIR}/riscv-isa-sim
ISA_SIM_MOD_INSTALL_DIR ?= ${INSTALL_DIR}/riscv-isa-sim-mod
VERIL_SRC_ROOT ?= $(prj_path)/vendor
VERIL_INSTALL_DIR ?= ${INSTALL_DIR}/verilator
VERIL_VERSION ?= v5.028

all: verilator riscv32-gcc riscv32-llvm dev-dep
# Verilator
verilator: ${VERIL_INSTALL_DIR}/bin/verilator

${VERIL_INSTALL_DIR}/bin/verilator:
rm -fr $(VERIL_SRC_ROOT)/verilator
cd $(VERIL_SRC_ROOT) && git clone https://github.com/verilator/verilator.git
# Checkout the right version
cd $(VERIL_SRC_ROOT)/verilator && git reset --hard && git fetch && git checkout ${VERIL_VERSION}
# Compile verilator
cd $(VERIL_SRC_ROOT)/verilator && git clean -xfdf && autoconf && \
./configure --prefix=$(VERIL_INSTALL_DIR) CXX=g++-10 && make -j$(num_cores_half) && make install
touch ${VERIL_INSTALL_DIR}/bin/verilator

cores:
@num_cores=$$(nproc); \
num_cores=$$((num_cores / 2)); \
echo "Number of cores available on this machine (divided by 2): $$num_cores"

riscv32-gcc: $(GCC_INSTALL_DIR)

vendor/riscv32-elf-gcc.tar.gz: vendor/riscv32-elf-gcc.url
cd vendor && \
wget `cat $(CURDIR)/$<` -O riscv32-elf-gcc.tar.gz && \
touch riscv32-elf-gcc.tar.gz

$(GCC_INSTALL_DIR): vendor/riscv32-elf-gcc.tar.gz
rm -fr $(GCC_INSTALL_DIR)
mkdir -p $(INSTALL_DIR)
cd vendor && \
tar -xzvf riscv32-elf-gcc.tar.gz -C $(INSTALL_DIR)/ riscv
mv $(INSTALL_DIR)/riscv $(GCC_INSTALL_DIR)
touch $(GCC_INSTALL_DIR)

riscv32-llvm: $(LLVM_INSTALL_DIR)

vendor/riscv32-elf-llvm.tar.gz: vendor/riscv32-elf-llvm.url
cd vendor && \
wget `cat $(CURDIR)/$<` -O riscv32-elf-llvm.tar.gz && \
touch riscv32-elf-llvm.tar.gz

$(LLVM_INSTALL_DIR): vendor/riscv32-elf-llvm.tar.gz
rm -fr $(LLVM_INSTALL_DIR)
mkdir -p $(INSTALL_DIR)
cd vendor && \
tar -xzvf riscv32-elf-llvm.tar.gz -C $(INSTALL_DIR)/ riscv
mv $(INSTALL_DIR)/riscv $(LLVM_INSTALL_DIR)
touch $(LLVM_INSTALL_DIR)

dev-dep:
sudo apt-get install libelf-dev -y
sudo apt-get install srecord -y

45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,51 @@
<img src="https://ibex.reports.lowrisc.org/opentitan/latest/summary.svg">
</a>

# ISOLDE
First time:
```sh
. ./setup.sh
```
* install toolchain

```sh
make -f Makefile.tools
```
otherwise:
```sh
. ./eth.sh
```
see also [isolde/simple_system/README.md](isolde/simple_system/README.md)
## Run hello-world
```sh
fusesoc --cores-root=. run --target=sim --setup --build lowrisc:ibex:ibex_simple_system $(util/ibex_config.py small fusesoc_opts)
make -C examples/sw/simple_system/hello_test
./build/lowrisc_ibex_ibex_simple_system_0/sim-verilator/Vibex_simple_system -t --meminit=ram,./examples/sw/simple_system/hello_test/hello_test.elf
```
Result
```
Tracing enabled.
Writing simulation traces to sim.fst
TOP.ibex_simple_system.u_top.u_ibex_tracer.unnamedblk2.unnamedblk3: Writing execution trace to trace_core_00000000.log
Terminating simulation by software request.
- ../src/lowrisc_ibex_sim_shared_0/./rtl/sim/simulator_ctrl.sv:93: Verilog $finish
Received $finish() from Verilog, shutting down simulation.

Simulation statistics
=====================
Executed cycles: 13144
Wallclock time: 0.048 s
Simulation speed: 273833 cycles/s (273.833 kHz)
Trace file size: 517730 B

You can view the simulation traces by calling
$ gtkwave sim.fst

Performance Counters
====================
Cycles: 476
Instructions Retired: 261
```
# Ibex RISC-V Core

Ibex is a production-quality open source 32-bit RISC-V CPU core written in
Expand Down
30 changes: 30 additions & 0 deletions eth.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
# Copyleft

# Define environment variables
MINICONDA=~/miniconda3/etc/profile.d/conda.sh
MINICONDA_ENV=ibex
# To activate this environment, use
#
# $ conda activate ibex
#
# To deactivate an active environment, use
#
# $ conda deactivate

# Get the root directory of the Git repository
export ROOT_DIR=$(git rev-parse --show-toplevel)

export BENDER=~/eth/bin/bender
export PULP_RISCV_GCC_TOOLCHAIN=$ROOT_DIR/install/riscv
export GCC_TOOLCHAIN=$ROOT_DIR/install/riscv-gcc/bin
export LLVM_TOOLCHAIN=$ROOT_DIR/install/riscv-llvm/bin
export CC=gcc-10
export CXX=g++-10


source $MINICONDA
conda activate $MINICONDA_ENV

export PATH=~/eth/bin:~/verible/bin:$ROOT_DIR/install/verilator/bin:$GCC_TOOLCHAIN:$PATH
source ~/vivado.sh
1 change: 1 addition & 0 deletions examples/sw/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
*.elf
*.vmem
*.d
*.headers
4 changes: 3 additions & 1 deletion examples/sw/simple_system/common/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ COMMON_SRCS = $(wildcard $(COMMON_DIR)/*.c)
INCS := -I$(COMMON_DIR)

# ARCH = rv32im # to disable compressed instructions
ARCH ?= rv32imc
ARCH ?= rv32imc_zicsr

ifdef PROGRAM
PROGRAM_C := $(PROGRAM).c
Expand Down Expand Up @@ -44,6 +44,8 @@ all: $(OUTFILES)
ifdef PROGRAM
$(PROGRAM).elf: $(OBJS) $(LINKER_SCRIPT)
$(CC) $(CFLAGS) -T $(LINKER_SCRIPT) $(OBJS) -o $@ $(LIBS)
$(OBJDUMP) -dh $@ >[email protected]


.PHONY: disassemble
disassemble: $(PROGRAM).dis
Expand Down
21 changes: 21 additions & 0 deletions ibex_configs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,24 @@ experimental-branch-predictor:
MHPMCounterNum : 0
MHPMCounterWidth : 40

# ===============================
# * ISOLDE *
# ===============================
isolde:
RV32E : 0
RV32M : "ibex_pkg::RV32MSingleCycle"
RV32B : "ibex_pkg::RV32BNone"
RegFile : "ibex_pkg::RegFileFF"
BranchTargetALU : 0
WritebackStage : 0
ICache : 1
ICacheECC : 0
ICacheScramble : 1
BranchPredictor : 0
DbgTriggerEn : 0
SecureIbex : 0
PMPEnable : 0
PMPGranularity : 0
PMPNumRegions : 4
MHPMCounterNum : 0
MHPMCounterWidth : 40
4 changes: 4 additions & 0 deletions ibex_core.core
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ filesets:
- rtl/ibex_wb_stage.sv
- rtl/ibex_dummy_instr.sv
- rtl/ibex_core.sv
- rtl/isolde_fetch2exec_if.sv
- rtl/isolde_fetch_vleninstr.sv
- rtl/isolde_decoder.sv
- rtl/isolde_exec_block.sv
- rtl/ibex_pmp_reset_default.svh: {is_include_file: true}
file_type: systemVerilogSource

Expand Down
2 changes: 2 additions & 0 deletions ibex_pkg.core
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ filesets:
files_rtl:
files:
- rtl/ibex_pkg.sv
- rtl/isolde_register_file_pkg.sv
- rtl/isolde_decoder_pkg.sv
file_type: systemVerilogSource

targets:
Expand Down
3 changes: 3 additions & 0 deletions ibex_top.core
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ filesets:
- lowrisc:prim:onehot_check
- lowrisc:prim:onehot
files:
- rtl/isolde_x_register_file_if.sv
- rtl/isolde_register_file_if.sv
- rtl/isolde_register_file_ff.sv
- rtl/ibex_register_file_ff.sv # generic FF-based
- rtl/ibex_register_file_fpga.sv # FPGA
- rtl/ibex_register_file_latch.sv # ASIC
Expand Down
Loading