From fabb2ff6e277eea5341b60176a9a18fc90b29cb4 Mon Sep 17 00:00:00 2001 From: Simone Manoni Date: Fri, 31 Oct 2025 17:24:04 +0100 Subject: [PATCH 1/3] add slang linting to makefile --- .gitmodules | 2 ++ Makefile | 46 ++++++++++++++++++++++++++++++++++++++++++++- hw/ips/pulp_cluster | 2 +- 3 files changed, 48 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 3b927f5..e9adccc 100644 --- a/.gitmodules +++ b/.gitmodules @@ -128,3 +128,5 @@ path = hw/ips/serial_link url = https://github.com/pulp-platform/serial_link.git branch = aottaviano/phy +[submodule "pulp_cluster"] + url = git@github.com:pulp-platform/pulp_cluster.git diff --git a/Makefile b/Makefile index 0d9edb6..d2430b9 100644 --- a/Makefile +++ b/Makefile @@ -266,8 +266,52 @@ vcs-sim: vcs-simc: cd sim && ./simv +UVM_NO_RELNOTES -exitstatus $(VCS_SIM_FLAGS) $(SIM_FLAGS) - # +# Slang +# +SLANG ?= oseda slang +SLANG_DIR ?= $(ROOT_DIR)/sim/gen +SLANG_PARSE_LOG ?= $(SLANG_DIR)/parse.log +SLANG_LINT_LOG ?= $(SLANG_DIR)/lint.log +SLANG_ELAB_LOG ?= $(SLANG_DIR)/elab.log +SV_FLIST ?= $(SLANG_DIR)/cp.flist + +SLANG_FLAGS := -f cp.flist --timescale=1ns/1ns --top pms_top +SLANG_FLAGS += -G SIM_STDOUT=0 -G USE_CLUSTER=1 -G CORE_TYPE=0 -G RISCY_FPU=1 +SLANG_FLAGS += --relax-enum-conversions --allow-use-before-declare -Wno-error=duplicate-definition + +FORCE: + +$(SV_FLIST): FORCE $(ROOT_DIR)/Bender.yml $(ROOT_DIR)/Bender.lock + $(BENDER) script flist-plus $(BENDER_BASE_TARGETS) -D SYNTHESIS > $@ + +$(SLANG_PARSE_LOG): FORCE $(SV_FLIST) + @cd $(SLANG_DIR) && $(SLANG) $(SLANG_FLAGS) --parse-only 2>&1 | tee $@ + @echo "Slang parsing logged at: $@" + +$(SLANG_LINT_LOG): FORCE $(SV_FLIST) + @cd $(SLANG_DIR) && $(SLANG) $(SLANG_FLAGS) --lint-only 2>&1 | tee $@ + @echo "Slang linting logged at: $@" + +$(SLANG_ELAB_LOG): FORCE $(SV_FLIST) + @cd $(SLANG_DIR) && $(SLANG) $(SLANG_FLAGS) 2>&1 | tee $@ + @echo "Slang elaboration logged at: $@" + +## Generate Control Pulp .flist +cp-slang-flist: FORCE $(SV_FLIST) + +## Parse Control Pulp RTL with Slang. +cp-slang-parse: FORCE $(SLANG_PARSE_LOG) + +## Parse and lint Control Pulp RTL with Slang. +cp-slang-lint: FORCE $(SLANG_LINT_LOG) + +## Elaborate Control Pulp RTL with Slang (includes parse and lint steps). +cp-slang-elaborate: FORCE $(SLANG_ELAB_LOG) + +## All +cp-slang-all: cp-slang-flist cp-slang-parse cp-slang-lint cp-slang-elaborate + # DPI libraries # diff --git a/hw/ips/pulp_cluster b/hw/ips/pulp_cluster index d1aee05..d485967 160000 --- a/hw/ips/pulp_cluster +++ b/hw/ips/pulp_cluster @@ -1 +1 @@ -Subproject commit d1aee051c6cf092a34599d7db8594e1dcbf1d331 +Subproject commit d485967b92feacd65e4411232e931d98e985686f From 1b1f2c778430b404ab9df2b38084bc6b6dda535d Mon Sep 17 00:00:00 2001 From: Simone Manoni Date: Tue, 4 Nov 2025 19:24:35 +0100 Subject: [PATCH 2/3] Readd lint with slang --- .gitlab-ci.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b9ff1e5..061035f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -21,6 +21,7 @@ variables: stages: - prepare + - lint - build - test @@ -60,6 +61,13 @@ prepare: # Install components for compiling Rust code on RV32 - rustup target add riscv32imac-unknown-none-elf +slang: + extends: .base + stage: lint + script: + - make cp-slang-all + - (! grep -n "error:" sim/gen/elab.log) + artifacts: name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA" paths: From 6ae7c0dc5b25de358e42dc7ca3aaf82cb8057bac Mon Sep 17 00:00:00 2001 From: Simone Manoni Date: Wed, 5 Nov 2025 09:38:45 +0100 Subject: [PATCH 3/3] Rebase on main and clean Makefile --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index d2430b9..c495a06 100644 --- a/Makefile +++ b/Makefile @@ -155,7 +155,6 @@ gen: update-serial-link # Custom serial link update-serial-link: $(ROOT_DIR)/hw/serial_link.hjson cp $< $(CPULP_SLINK_DIR)/src/regs/serial_link.hjson - export TERM=dumb $(MAKE) -C $(CPULP_SLINK_DIR) update-regs BENDER="$(BENDER)" | tr -d '\033' .PHONY: gen-with-vip