Skip to content

Commit

Permalink
Cleanup build process
Browse files Browse the repository at this point in the history
  • Loading branch information
micprog committed Feb 6, 2024
1 parent e87fc58 commit d143506
Show file tree
Hide file tree
Showing 6 changed files with 380 additions and 167 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.bender
scripts/compile.tcl

modelsim.ini
work
transcript

26 changes: 10 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ ROOT_DIR = $(strip $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))
GIT ?= git
BENDER ?= bender
VSIM ?= vsim
VLIB ?= vlib
VOPT ?= vopt
top_level ?= pulp_cluster_tb
dpi-library ?= work-dpi
library ?= work
Expand All @@ -24,7 +26,7 @@ XVLOG_ARGS += -64bit -compile -vtimescale 1ns/1ns -quiet

define generate_vsim
echo 'set ROOT [file normalize [file dirname [info script]]/$3]' > $1
bender script $(VSIM) --vlog-arg="$(VLOG_ARGS)" $2 | grep -v "set ROOT" >> $1
bender script vsim --vlog-arg="$(VLOG_ARGS)" $2 | grep -v "set ROOT" >> $1
echo >> $1
endef

Expand Down Expand Up @@ -76,30 +78,22 @@ sim_clean:

scripts/compile.tcl: | Bender.lock
$(call generate_vsim, $@, -t rtl -t test -t cluster_standalone,..)

# compile the elfloader.cpp
$(dpi-library)/%.o: tb/dpi/%.cc $(dpi_hdr)
mkdir -p $(dpi-library)
$(CXX) -shared -fPIC -std=c++0x -Bsymbolic $(CFLAGS) -c $< -o $@

$(dpi-library)/cl_dpi.so: $(dpi)
$(CXX) -shared -m64 -o $(dpi-library)/cl_dpi.so $? -L$(RISCV)/lib -L$(SPIKE_ROOT)/lib -Wl,-rpath,$(RISCV)/lib -Wl,-rpath,$(SPIKE_ROOT)/lib -lfesvr
echo 'vlog "$(realpath $(ROOT_DIR))/tb/dpi/elfloader.cpp" -ccflags "-std=c++11"' >> $@

$(library):
vlib${questa_version} $(library)
$(VLIB) $(library)

compile: $(library) $(dpi) $(dpi-library)/cl_dpi.so
compile: $(library) scripts/compile.tcl
@test -f Bender.lock || { echo "ERROR: Bender.lock file does not exist. Did you run make checkout in bender mode?"; exit 1; }
@test -f scripts/compile.tcl || { echo "ERROR: scripts/compile.tcl file does not exist. Did you run make scripts in bender mode?"; exit 1; }
vsim -c -do 'source scripts/compile.tcl; quit'
$(VSIM) -c -do 'source scripts/compile.tcl; quit'

build: compile $(dpi)
vopt $(compile_flag) -suppress 3053 -suppress 8885 -work $(library) $(top_level) -o $(top_level)_optimized +acc -check_synthesis
build: compile
$(VOPT) $(compile_flag) -suppress 3053 -suppress 8885 -work $(library) $(top_level) -o $(top_level)_optimized +acc -check_synthesis


run:
vsim +permissive $(questa-flags) $(questa-cmd) -suppress 3053 -suppress 8885 -lib $(library) +MAX_CYCLES=$(max_cycles) +UVM_TESTNAME=$(test_case) +APP=$(elf-bin) +notimingchecks +nospecify -t 1ps \
$(uvm-flags) $(QUESTASIM_FLAGS) -sv_lib $(dpi-library)/cl_dpi \
$(VSIM) +permissive $(questa-flags) $(questa-cmd) -suppress 3053 -suppress 8885 -lib $(library) +MAX_CYCLES=$(max_cycles) +UVM_TESTNAME=$(test_case) +APP=$(elf-bin) +notimingchecks +nospecify -t 1ps \
${top_level}_optimized +permissive-off ++$(elf-bin) ++$(target-options) ++$(cl-bin) | tee sim.log

.PHONY: test-rt-par-bare
Expand Down
21 changes: 8 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,25 @@ To simulate the cluster on its own, you can perform the following steps:
RISCV GCC toolchain](https://github.com/pulp-platform/pulp-riscv-gcc) to use
a pre-built release.

2. We need RV64 toolchain to compile DPI libraries. Export it to a `RISCV` env
variable. Please refer to [RISC-V GNU
toolchain](https://github.com/riscv-collab/riscv-gnu-toolchain/) to use a
pre-built release.

3. Compile the hw:
2. Compile the hw:
```
make checkout
make scripts/compile.tcl
make build
```

4. Source the environment:
```
source env/env.sh
```

5. Download the sw stack and bare-metal tests:
3. Download the sw stack and bare-metal tests:
```
make pulp-runtime
make regression-tests
```

6. Run the tests. Choose any test among the `parallel_bare_tests` and the
4. Source the environment:
```
source env/env.sh
```

5. Run the tests. Choose any test among the `parallel_bare_tests` and the
`mchan_tests`, move into the related folder and do:

```
Expand Down
135 changes: 0 additions & 135 deletions tb/dpi/elfloader.cc

This file was deleted.

Loading

0 comments on commit d143506

Please sign in to comment.