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

Align the Snitch cluster and Occamy #20

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
name: build-docker
on:
push:
branches: [main]
branches: [vivianep/sn-cluster-align]
workflow_dispatch:
jobs:
build-docker:
Expand Down
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ occamy-full-vsim:
script:
- cd target/sim
- make CFG_OVERRIDE=cfg/full.hjson rtl
- make LENGTH=384 sw
- make sw
- make bin/occamy_top.vsim
- ./run.py sw/run-full-occamy.yaml --simulator vsim
2 changes: 1 addition & 1 deletion Bender.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ dependencies:
cva6: { path: hw/vendor/openhwgroup_cva6 }
opentitan_peripherals: { path: hw/vendor/pulp_platform_opentitan_peripherals }
register_interface: { git: https://github.com/pulp-platform/register_interface.git, version: 0.3.8 }
snitch_cluster: { git: https://github.com/pulp-platform/snitch_cluster.git, rev: ae02a03d7d401ed486dac80a3a1d77e1a89c395d }
snitch_cluster: { git: https://github.com/pulp-platform/snitch_cluster.git, rev: 1f17d1fd04ccab4651c88ff7165c30011e3524ca }
tech_cells_generic: { git: https://github.com/pulp-platform/tech_cells_generic.git, rev: v0.2.11 }

workspace:
Expand Down
56 changes: 26 additions & 30 deletions target/sim/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,28 @@ CFG_OVERRIDE ?= # Override default config file
.DEFAULT_GOAL := help
.PHONY: all clean
all: rtl sw addrmap
clean: clean-bender clean-rtl clean-sw clean-addrmap clean-vlt clean-vsim clean-vcs clean-logs
clean: clean-bender clean-rtl clean-sw clean-addrmap clean-vlt clean-vcs clean-logs

############
# Makefrag #
############

# Common definitions used by included Makefiles

MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
MKFILE_DIR := $(dir $(MKFILE_PATH))
ROOT := $(MKFILE_DIR)../..
SNITCH_ROOT := $(shell bender path snitch_cluster)

TARGET = occamy_top

CVA6_TXT_TRACE = $(LOGS_DIR)/trace_hart_00000.txt
CVA6_PERF_DUMP = $(LOGS_DIR)/hart_00000_perf.json
CVA6_ANNOTATED_TRACE = $(LOGS_DIR)/trace_hart_00000.s
TXT_TRACES += $(CVA6_TXT_TRACE)
PERF_DUMPS += $(CVA6_PERF_DUMP)
ANNOTATED_TRACES += $(CVA6_ANNOTATED_TRACE)

include $(SNITCH_ROOT)/target/common/common.mk

############
Expand Down Expand Up @@ -510,56 +521,41 @@ $(VLT_BUILDDIR)/test/uartdpi/uartdpi.o: test/uartdpi/uartdpi.c
$(CC) $(CFLAGS) $(VLT_CFLAGS) -c $< -o $@

# Link verilated archive wich $(VLT_COBJ)
$(BIN_DIR)/occamy_top.vlt: $(VLT_AR) $(VLT_COBJ) ${VLT_BUILDDIR}/lib/libfesvr.a
$(BIN_DIR)/$(TARGET).vlt: $(VLT_AR) $(VLT_COBJ) ${VLT_BUILDDIR}/lib/libfesvr.a
mkdir -p $(dir $@)
$(CXX) $(LDFLAGS) -std=c++14 -L ${VLT_BUILDDIR}/lib -o $@ $(VLT_COBJ) $(VLT_AR) -lfesvr -lpthread -lutil

# Clean all build directories and temporary files for Verilator simulation
.PHONY: clean-vlt
clean-vlt: clean-work
rm -rf work-vlt
rm -f $(BIN_DIR)/occamy_top.vlt
rm -f $(BIN_DIR)/$(TARGET).vlt

############
# Modelsim #
# Questasim #
############

${VSIM_BUILDDIR}/compile.vsim.tcl: $(VSIM_SOURCES) ${TB_SRCS} ${TB_CC_SOURCES} test/bootrom.bin | $(VSIM_BUILDDIR)
$(VLIB) $(dir $@)
${BENDER} script vsim ${VSIM_BENDER} --vlog-arg="${VLOG_FLAGS} -work $(dir $@) " > $@
echo '${VLOG} -work $(dir $@) $(TB_CC_SOURCES) -ccflags "$(TB_CC_FLAGS)"' >> $@
echo 'return 0' >> $@

# Build compilation script and compile all sources for Questasim simulation
$(BIN_DIR)/occamy_top.vsim: ${VSIM_BUILDDIR}/compile.vsim.tcl work/lib/libfesvr.a
$(call QUESTASIM,tb_bin)
@# Rename CVA6 trace to align with Snitch trace names
@echo "mv ${CVA6_TRACE} $(LOGS_DIR)/trace_hart_00000.txt" >> $@
@echo "mv ${CVA6_TRACE} $(LOGS_DIR)/trace_hart_00000.txt" >> $@.gui
@# Move all other traces to logs folder as well
@echo "mv *trace*.log $(LOGS_DIR)/" >> $@
@echo "mv *trace*.log $(LOGS_DIR)/" >> $@.gui

# Clean all build directories and temporary files for Questasim simulation
clean-vsim: clean-work
rm -rf $(BIN_DIR)/occamy_top.vsim $(BIN_DIR)/occamy_top.vsim.gui $(VSIM_BUILDDIR) vsim.wlf
include $(SNITCH_ROOT)/target/common/vsim.mk

# Add dependency on bootrom
$(BIN_DIR)/$(TARGET).vsim: test/bootrom.bin

#######
# VCS #
#######

# Build compilation script and compile all sources for VCS simulation
$(BIN_DIR)/occamy_top.vcs: work-vcs/compile.sh work/lib/libfesvr.a ${TB_CC_SOURCES} test/bootrom.bin
$(BIN_DIR)/$(TARGET).vcs: work-vcs/compile.sh work/lib/libfesvr.a ${TB_CC_SOURCES} test/bootrom.bin
mkdir -p bin
vcs $(VCS_FLAGS) -o $(BIN_DIR)/occamy_top.vcs tb_bin -cc $(CC) -cpp $(CXX) \
vcs $(VCS_FLAGS) -o $(BIN_DIR)/$(TARGET).vcs tb_bin -cc $(CC) -cpp $(CXX) \
$(TB_CC_SOURCES) -CFLAGS "$(TB_CC_FLAGS)" -LDFLAGS "-L${FESVR}/lib" -lfesvr -lutil

# Clean all build directories and temporary files for VCS simulation
.PHONY: clean-vcs
clean-vcs: clean-work
rm -rf AN.DB
rm -rf work-vcs
rm -f $(BIN_DIR)/occamy_top.vcs
rm -f $(BIN_DIR)/$(TARGET).vcs

########
# FPGA #
Expand All @@ -580,7 +576,7 @@ clean-work:
rm -rf work

clean-bender:
rm -rf $(ROOT)/Bender.lock $(ROOT)/.bender/ $(ROOT)/deps
rm -rf $(BENDER_LOCK) $(ROOT)/.bender/ $(ROOT)/deps

clean-logs:
rm -rf $(LOGS_DIR)/
Expand All @@ -594,9 +590,9 @@ help:
@echo -e ""
@echo -e "${Blue}help ${Black}Show an overview of all Makefile targets."
@echo -e ""
@echo -e "${Blue}bin/occamy_top.vcs ${Black}Build compilation script and compile all sources for VCS simulation. @IIS: vcs-2020.12 make bin/occamy_top.vcs"
@echo -e "${Blue}bin/occamy_top.vlt ${Black}Build compilation script and compile all sources for Verilator simulation."
@echo -e "${Blue}bin/occamy_top.vsim ${Black}Build compilation script and compile all sources for Questasim simulation. @IIS: QUESTA_HOME=/usr/pack/modelsim-10.7b-kgf/questasim/ CC=$(QUESTA_HOME)/gcc-5.3.0-linux_x86_64/bin/gcc CXX=$(QUESTA_HOME)/gcc-5.3.0-linux_x86_64/bin/g++ LD=$(QUESTA_HOME)/gcc-5.3.0-linux_x86_64/bin/ld make bin/occamy_top.vsim"
@echo -e "${Blue}bin/$(TARGET).vcs ${Black}Build compilation script and compile all sources for VCS simulation. @IIS: vcs-2020.12 make bin/$(TARGET).vcs"
@echo -e "${Blue}bin/$(TARGET).vlt ${Black}Build compilation script and compile all sources for Verilator simulation."
@echo -e "${Blue}bin/$(TARGET).vsim ${Black}Build compilation script and compile all sources for Questasim simulation. @IIS: QUESTA_HOME=/usr/pack/modelsim-10.7b-kgf/questasim/ CC=$(QUESTA_HOME)/gcc-5.3.0-linux_x86_64/bin/gcc CXX=$(QUESTA_HOME)/gcc-5.3.0-linux_x86_64/bin/g++ LD=$(QUESTA_HOME)/gcc-5.3.0-linux_x86_64/bin/ld make bin/$(TARGET).vsim"
@echo -e ""
@echo -e "${Blue}all ${Black}Update all SW and HW related sources (by, e.g., re-generating the RegGen registers and their c-header files)."
@echo -e "${Blue}fpga ${Black}Build a small Occamy version (CVA6 + 1xcluster) for the VCU128 FPGA board."
Expand Down
10 changes: 6 additions & 4 deletions target/sim/sw/run-full-occamy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@

runs:
- elf: host/apps/offload/build/offload-axpy.elf
cmd: [../../../deps/snitch_cluster/sw/blas/axpy/verify.py, --symbols-bin,
./device/apps/blas/axpy/build/axpy.elf, "${sim_bin}", "${elf}"]
cmd: [../../../deps/snitch_cluster/sw/blas/axpy/scripts/verify.py,
--symbols-bin, ./device/apps/blas/axpy/build/axpy.elf,
"${sim_bin}", "${elf}"]
- elf: host/apps/offload/build/offload-gemm.elf
cmd: [../../../deps/snitch_cluster/sw/blas/gemm/verify.py, --symbols-bin,
./device/apps/blas/gemm/build/gemm.elf, "${sim_bin}", "${elf}"]
cmd: [../../../deps/snitch_cluster/sw/blas/gemm/scripts/verify.py,
--symbols-bin, ./device/apps/blas/gemm/build/gemm.elf,
"${sim_bin}", "${elf}"]
10 changes: 6 additions & 4 deletions target/sim/sw/run-single-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@

runs:
- elf: host/apps/offload/build/offload-axpy.elf
cmd: [../../../deps/snitch_cluster/sw/blas/axpy/verify.py, --symbols-bin,
./device/apps/blas/axpy/build/axpy.elf, "${sim_bin}", "${elf}"]
cmd: [../../../deps/snitch_cluster/sw/blas/axpy/scripts/verify.py,
--symbols-bin, ./device/apps/blas/axpy/build/axpy.elf,
"${sim_bin}", "${elf}"]
- elf: host/apps/offload/build/offload-gemm.elf
cmd: [../../../deps/snitch_cluster/sw/blas/gemm/verify.py, --symbols-bin,
./device/apps/blas/gemm/build/gemm.elf, "${sim_bin}", "${elf}"]
cmd: [../../../deps/snitch_cluster/sw/blas/gemm/scripts/verify.py,
--symbols-bin, ./device/apps/blas/gemm/build/gemm.elf,
"${sim_bin}", "${elf}"]
- elf: host/apps/hello_world/build/hello_world.elf
cmd: [./host/apps/hello_world/verify.py, "${sim_bin}", "${elf}"]
2 changes: 1 addition & 1 deletion util/occamygen/occamy.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def __init__(self, cfg):
# Overwrite boot address with base of bootrom
self.cluster.cfg["boot_addr"] = self.cfg["peripherals"]["rom"]["address"]

self.cluster.cfg['tie_ports'] = False
self.cluster.cfg['cluster_base_expose'] = True

if "ro_cache_cfg" in self.cfg["s1_quadrant"]:
ro_cache = self.cfg["s1_quadrant"]["ro_cache_cfg"]
Expand Down
Loading