From b813caf6fd08d294dc73bd98a39097aebaaff5d4 Mon Sep 17 00:00:00 2001 From: Howard Mao Date: Wed, 22 Apr 2020 19:58:24 -0700 Subject: [PATCH 1/4] get icenet and testchipip unit tests working --- .../src/main/scala/unittest/TestHarness.scala | 9 +++++++ .../main/scala/unittest/UnitTestSuite.scala | 8 +++++++ generators/icenet | 2 +- generators/testchipip | 2 +- sims/vcs/Makefile | 2 +- variables.mk | 24 +++++++++++++++++++ 6 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 generators/chipyard/src/main/scala/unittest/TestHarness.scala create mode 100644 generators/chipyard/src/main/scala/unittest/UnitTestSuite.scala diff --git a/generators/chipyard/src/main/scala/unittest/TestHarness.scala b/generators/chipyard/src/main/scala/unittest/TestHarness.scala new file mode 100644 index 00000000..8bb4bbd9 --- /dev/null +++ b/generators/chipyard/src/main/scala/unittest/TestHarness.scala @@ -0,0 +1,9 @@ +package chipyard.unittest + +import chisel3._ +import freechips.rocketchip.config.Parameters + +class TestHarness(implicit val p: Parameters) extends Module { + val io = IO(new Bundle { val success = Output(Bool()) }) + io.success := Module(new UnitTestSuite).io.finished +} diff --git a/generators/chipyard/src/main/scala/unittest/UnitTestSuite.scala b/generators/chipyard/src/main/scala/unittest/UnitTestSuite.scala new file mode 100644 index 00000000..40e991a2 --- /dev/null +++ b/generators/chipyard/src/main/scala/unittest/UnitTestSuite.scala @@ -0,0 +1,8 @@ +package chipyard.unittest + +import freechips.rocketchip.config.Parameters +import freechips.rocketchip.util.{ElaborationArtefacts, PlusArgArtefacts} + +class UnitTestSuite(implicit p: Parameters) extends freechips.rocketchip.unittest.UnitTestSuite { + ElaborationArtefacts.add("plusArgs", PlusArgArtefacts.serialize_cHeader) +} diff --git a/generators/icenet b/generators/icenet index 4522a397..705ca506 160000 --- a/generators/icenet +++ b/generators/icenet @@ -1 +1 @@ -Subproject commit 4522a3979be092c4221f186bdd93bf330fdca134 +Subproject commit 705ca50690383aa589dc560a5e7c152af04c46ad diff --git a/generators/testchipip b/generators/testchipip index b8d6f210..ba705408 160000 --- a/generators/testchipip +++ b/generators/testchipip @@ -1 +1 @@ -Subproject commit b8d6f2101947e9f80f896dbaa5802946e2a3b9f0 +Subproject commit ba705408fa707d8e4e132fabd59dacb9eb12e985 diff --git a/sims/vcs/Makefile b/sims/vcs/Makefile index 659d1fc0..c00819c2 100644 --- a/sims/vcs/Makefile +++ b/sims/vcs/Makefile @@ -56,7 +56,7 @@ VCS_CC_OPTS = \ VCS_NONCC_OPTS = \ +lint=all,noVCDE,noONGS,noUI \ -error=PCWM-L \ - -timescale=1ns/10ps \ + -timescale=1ns/1ps \ -quiet \ -q \ +rad \ diff --git a/variables.mk b/variables.mk index 80e10a0c..ad981245 100644 --- a/variables.mk +++ b/variables.mk @@ -50,6 +50,30 @@ ifeq ($(SUB_PROJECT),hwacha) TB ?= TestDriver TOP ?= ExampleRocketSystem endif +# For TestChipIP developers +ifeq ($(SUB_PROJECT),testchipip) + SBT_PROJECT ?= chipyard + MODEL ?= TestHarness + VLOG_MODEL ?= TestHarness + MODEL_PACKAGE ?= chipyard.unittest + CONFIG ?= TestChipUnitTestConfig + CONFIG_PACKAGE ?= testchipip + GENERATOR_PACKAGE ?= chipyard + TB ?= TestDriver + TOP ?= UnitTestSuite +endif +# For IceNet developers +ifeq ($(SUB_PROJECT),icenet) + SBT_PROJECT ?= chipyard + MODEL ?= TestHarness + VLOG_MODEL ?= TestHarness + MODEL_PACKAGE ?= chipyard.unittest + CONFIG ?= IceNetUnitTestConfig + CONFIG_PACKAGE ?= icenet + GENERATOR_PACKAGE ?= chipyard + TB ?= TestDriver + TOP ?= UnitTestSuite +endif ######################################################################################### # path to rocket-chip and testchipip From a905dbedcc5d85bfec60c01c7ae934ef9f2f5e75 Mon Sep 17 00:00:00 2001 From: Howard Mao Date: Fri, 24 Apr 2020 17:08:58 -0700 Subject: [PATCH 2/4] add make rules for running simulator without executable --- common.mk | 14 ++++++++++++++ sims/vcs/Makefile | 4 ++++ sims/verilator/Makefile | 6 ++++++ 3 files changed, 24 insertions(+) diff --git a/common.mk b/common.mk index 696e0f83..b5a5bb07 100644 --- a/common.mk +++ b/common.mk @@ -136,6 +136,12 @@ run-binary-debug: $(sim_debug) run-fast: run-asm-tests-fast run-bmark-tests-fast +run-none: $(output_dir)/none.out + +run-none-fast: $(output_dir)/none.run + +run-none-debug: $(output_dir)/none.vpd + ######################################################################################### # run assembly/benchmarks rules ######################################################################################### @@ -149,6 +155,14 @@ $(output_dir)/%.run: $(output_dir)/% $(sim) $(output_dir)/%.out: $(output_dir)/% $(sim) (set -o pipefail && $(sim) $(PERMISSIVE_ON) $(SIM_FLAGS) $(EXTRA_SIM_FLAGS) $(VERBOSE_FLAGS) $(PERMISSIVE_OFF) $< >(spike-dasm > $@) | tee $<.log) +$(output_dir)/none.run: $(sim) + mkdir -p $(output_dir) + (set -o pipefail && $(sim) $(PERMISSIVE_ON) $(SIM_FLAGS) $(EXTRA_SIM_FLAGS) $(PERMISSIVE_OFF) $< >(spike-dasm > $@) | tee $(output_dir)/none.log) + ######################################################################################### # include build/project specific makefrags made from the generator ######################################################################################### diff --git a/sims/vcs/Makefile b/sims/vcs/Makefile index c00819c2..f5b7e5db 100644 --- a/sims/vcs/Makefile +++ b/sims/vcs/Makefile @@ -102,6 +102,10 @@ $(sim_debug): $(sim_vsrcs) $(sim_common_files) $(dramsim_lib) $(EXTRA_SIM_REQS) $(output_dir)/%.vpd: $(output_dir)/% $(sim_debug) (set -o pipefail && $(sim_debug) $(PERMISSIVE_ON) $(SIM_FLAGS) $(EXTRA_SIM_FLAGS) $(VERBOSE_FLAGS) +vcdplusfile=$@ $(PERMISSIVE_OFF) $< >(spike-dasm > $<.out) | tee $<.log) +$(output_dir)/none.vpd: $(sim_debug) + mkdir -p $(output_dir) + (set -o pipefail && $(sim_debug) $(PERMISSIVE_ON) $(SIM_FLAGS) $(EXTRA_SIM_FLAGS) $(VERBOSE_FLAGS) +vcdplusfile=$@ $(PERMISSIVE_OFF) none >(spike-dasm > $(output_dir)/none.out) | tee $(output_dir)/none.log) + ######################################################################################### # general cleanup rule ######################################################################################### diff --git a/sims/verilator/Makefile b/sims/verilator/Makefile index 0ab0016c..432169d6 100644 --- a/sims/verilator/Makefile +++ b/sims/verilator/Makefile @@ -145,6 +145,12 @@ $(output_dir)/%.vpd: $(output_dir)/% $(sim_debug) vcd2vpd $@.vcd $@ > /dev/null & (set -o pipefail && $(sim_debug) $(PERMISSIVE_ON) $(SIM_FLAGS) $(EXTRA_SIM_FLAGS) $(VERBOSE_FLAGS) -v$@.vcd $(PERMISSIVE_OFF) $< >(spike-dasm > $<.out) | tee $<.log) +$(output_dir)/none.vpd: $(sim_debug) + mkdir -p $(output_dir) + rm -f $@.vcd && mkfifo $@.vcd + vcd2vpd $@.vcd $@ > /dev/null & + (set -o pipefail && $(sim_debug) $(PERMISSIVE_ON) $(SIM_FLAGS) $(EXTRA_SIM_FLAGS) $(VERBOSE_FLAGS) -v$@.vcd $(PERMISSIVE_OFF) none >(spike-dasm > $(output_dir)/none.out) | tee $(output_dir)/none.log) + ######################################################################################### # general cleanup rule ######################################################################################### From 8df43203a2bff518f0225507bfbe6fc73bad5bf4 Mon Sep 17 00:00:00 2001 From: Howard Mao Date: Fri, 24 Apr 2020 17:09:05 -0700 Subject: [PATCH 3/4] separate testchipip ClockUtilTests and TestChipUnitTests --- generators/testchipip | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generators/testchipip b/generators/testchipip index ba705408..cec2c0b6 160000 --- a/generators/testchipip +++ b/generators/testchipip @@ -1 +1 @@ -Subproject commit ba705408fa707d8e4e132fabd59dacb9eb12e985 +Subproject commit cec2c0b6d66c3df05d08462167bb8a58c0912d06 From 94628e78b2b2bf7aaa296481d5a63809af065d9f Mon Sep 17 00:00:00 2001 From: Howard Mao Date: Fri, 24 Apr 2020 17:15:15 -0700 Subject: [PATCH 4/4] add icenet and testchipip unit tests to CI --- .circleci/config.yml | 40 ++++++++++++++++++++++++++++++++++++++++ .circleci/defaults.sh | 2 ++ .circleci/run-tests.sh | 6 ++++++ 3 files changed, 48 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 801c3b85..ff691e41 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -252,6 +252,16 @@ jobs: steps: - prepare-rtl: project-key: "chipyard-ariane" + prepare-icenet: + executor: main-env + steps: + - prepare-rtl: + project-key: "icenet" + prepare-testchipip: + executor: main-env + steps: + - prepare-rtl: + project-key: "testchipip" chipyard-rocket-run-tests: executor: main-env steps: @@ -337,6 +347,18 @@ jobs: - run-tests: project-key: "chipyard-ariane" timeout: "30m" + icenet-run-tests: + executor: main-env + steps: + - run-tests: + project-key: "icenet" + timeout: "30m" + testchipip-run-tests: + executor: main-env + steps: + - run-tests: + project-key: "testchipip" + timeout: "30m" # Order and dependencies of jobs to run workflows: @@ -431,6 +453,16 @@ workflows: - install-riscv-toolchain - install-verilator + - prepare-icenet: + requires: + - install-riscv-toolchain + - install-verilator + + - prepare-testchipip: + requires: + - install-riscv-toolchain + - install-verilator + # Run the respective tests # Run midasexamples test @@ -495,3 +527,11 @@ workflows: - chipyard-ariane-run-tests: requires: - prepare-chipyard-ariane + + - icenet-run-tests: + requires: + - prepare-icenet + + - testchipip-run-tests: + requires: + - prepare-testchipip diff --git a/.circleci/defaults.sh b/.circleci/defaults.sh index 9dfff4d5..38da902b 100755 --- a/.circleci/defaults.sh +++ b/.circleci/defaults.sh @@ -57,3 +57,5 @@ mapping["tracegen-boom"]="SUB_PROJECT=chipyard CONFIG=BoomTraceGenConfig TOP=Tra mapping["firesim"]="SCALA_TEST=firesim.firesim.RocketNICF1Tests" mapping["firesim-multiclock"]="SCALA_TEST=firesim.firesim.RocketMulticlockF1Tests" mapping["fireboom"]="SCALA_TEST=firesim.firesim.BoomF1Tests" +mapping["icenet"]="SUB_PROJECT=icenet" +mapping["testchipip"]="SUB_PROJECT=testchipip" diff --git a/.circleci/run-tests.sh b/.circleci/run-tests.sh index 480908c9..5f305617 100755 --- a/.circleci/run-tests.sh +++ b/.circleci/run-tests.sh @@ -71,6 +71,12 @@ case $1 in chipyard-ariane) make run-binary-fast -C $LOCAL_SIM_DIR ${mapping[$1]} BINARY=$RISCV/riscv64-unknown-elf/share/riscv-tests/benchmarks/dhrystone.riscv ;; + icenet) + make run-none-fast -C $LOCAL_SIM_DIR ${mapping[$1]} + ;; + testchipip) + make run-none-fast -C $LOCAL_SIM_DIR ${mapping[$1]} + ;; *) echo "No set of tests for $1. Did you spell it right?" exit 1