From fdeede7b0bbbf1ce818812f27264da7363cda274 Mon Sep 17 00:00:00 2001 From: Jerry Zhao Date: Tue, 26 Dec 2023 12:55:32 -0800 Subject: [PATCH] Add tests for symmetric rocket chiplet config --- .github/scripts/defaults.sh | 3 ++- .github/scripts/run-tests.sh | 4 ++++ .github/workflows/chipyard-run-tests.yml | 24 +++++++++++++++++++ generators/testchipip | 2 +- tests/Makefile | 2 +- tests/symmetric.c | 30 ++++++++++++++++++++++++ 6 files changed, 62 insertions(+), 3 deletions(-) create mode 100644 tests/symmetric.c diff --git a/.github/scripts/defaults.sh b/.github/scripts/defaults.sh index d4eb7b56..94339a5b 100755 --- a/.github/scripts/defaults.sh +++ b/.github/scripts/defaults.sh @@ -29,7 +29,7 @@ REMOTE_COURSIER_CACHE=$REMOTE_WORK_DIR/.coursier-cache # key value store to get the build groups declare -A grouping grouping["group-cores"]="chipyard-cva6 chipyard-ibex chipyard-rocket chipyard-hetero chipyard-boom chipyard-sodor chipyard-digitaltop chipyard-multiclock-rocket chipyard-nomem-scratchpad chipyard-spike chipyard-clone chipyard-prefetchers chipyard-shuttle" -grouping["group-peripherals"]="chipyard-dmirocket chipyard-dmiboom chipyard-spiflashwrite chipyard-mmios chipyard-nocores chipyard-manyperipherals chipyard-chiplike chipyard-tethered" +grouping["group-peripherals"]="chipyard-dmirocket chipyard-dmiboom chipyard-spiflashwrite chipyard-mmios chipyard-nocores chipyard-manyperipherals chipyard-chiplike chipyard-tethered chipyard-symmetric" grouping["group-accels"]="chipyard-mempress chipyard-sha3 chipyard-hwacha chipyard-gemmini chipyard-manymmioaccels chipyard-nvdla chipyard-aes256ecb" grouping["group-constellation"]="chipyard-constellation" grouping["group-tracegen"]="tracegen tracegen-boom" @@ -58,6 +58,7 @@ mapping["chipyard-spiflashwrite"]=" CONFIG=SmallSPIFlashRocketConfig EXTRA_SIM_F mapping["chipyard-manyperipherals"]=" CONFIG=ManyPeripheralsRocketConfig EXTRA_SIM_FLAGS='+spiflash0=${LOCAL_CHIPYARD_DIR}/tests/spiflash.img'" mapping["chipyard-chiplike"]=" CONFIG=ChipLikeRocketConfig MODEL=FlatTestHarness MODEL_PACKAGE=chipyard.example verilog" mapping["chipyard-tethered"]=" CONFIG=VerilatorCITetheredChipLikeRocketConfig" +mapping["chipyard-symmetric"]=" CONFIG=MultiSimSymmetricChipletRocketConfig" mapping["chipyard-cloneboom"]=" CONFIG=Cloned64MegaBoomConfig verilog" mapping["chipyard-nocores"]=" CONFIG=NoCoresConfig verilog" mapping["tracegen"]=" CONFIG=NonBlockingTraceGenL2Config" diff --git a/.github/scripts/run-tests.sh b/.github/scripts/run-tests.sh index ce272737..eccc5563 100755 --- a/.github/scripts/run-tests.sh +++ b/.github/scripts/run-tests.sh @@ -118,6 +118,10 @@ case $1 in make -C $LOCAL_CHIPYARD_DIR/tests run_binary BINARY=$LOCAL_CHIPYARD_DIR/tests/hello.riscv LOADMEM=1 EXTRA_SIM_FLAGS="+cflush_addr=0x2010200" ;; + chipyard-symmetric) + make -C $LOCAL_CHIPYARD_DIR/tests + run_binary BINARY=$LOCAL_CHIPYARD_DIR/tests/symmetric.riscv LOADMEM=1 + ;; tracegen) run_tracegen ;; diff --git a/.github/workflows/chipyard-run-tests.yml b/.github/workflows/chipyard-run-tests.yml index 1c0f10d8..b524ae37 100644 --- a/.github/workflows/chipyard-run-tests.yml +++ b/.github/workflows/chipyard-run-tests.yml @@ -708,6 +708,29 @@ jobs: group-key: "group-peripherals" project-key: "chipyard-tethered" + chipyard-symmetric-run-tests: + name: chipyard-symmetric-run-tests + needs: prepare-chipyard-peripherals + runs-on: as4 + steps: + - name: Delete old checkout + run: | + ls -alh . + rm -rf ${{ github.workspace }}/* || true + rm -rf ${{ github.workspace }}/.* || true + ls -alh . + - name: Checkout + uses: actions/checkout@v3 + - name: Git workaround + uses: ./.github/actions/git-workaround + - name: Create conda env + uses: ./.github/actions/create-conda-env + - name: Run tests + uses: ./.github/actions/run-tests + with: + group-key: "group-peripherals" + project-key: "chipyard-symmetric" + chipyard-sha3-run-tests: name: chipyard-sha3-run-tests needs: prepare-chipyard-accels @@ -1071,6 +1094,7 @@ jobs: chipyard-spiflashwrite-run-tests, chipyard-manyperipherals-run-tests, chipyard-tethered-run-tests, + chipyard-symmetric-run-tests, chipyard-sha3-run-tests, chipyard-gemmini-run-tests, chipyard-manymmioaccels-run-tests, # chipyard-nvdla-run-tests, diff --git a/generators/testchipip b/generators/testchipip index 11551255..9d1a2125 160000 --- a/generators/testchipip +++ b/generators/testchipip @@ -1 +1 @@ -Subproject commit 11551255834ff4f98c1474a806b7c733cb53d6ee +Subproject commit 9d1a2125799cd7179e280e6901e84235f3f479a8 diff --git a/tests/Makefile b/tests/Makefile index 670b49ea..1c6df31b 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -29,7 +29,7 @@ include libgloss.mk PROGRAMS = pwm blkdev accum charcount nic-loopback big-blkdev pingd \ streaming-passthrough streaming-fir nvdla spiflashread spiflashwrite fft gcd \ - hello mt-hello + hello mt-hello symmetric .DEFAULT_GOAL := default diff --git a/tests/symmetric.c b/tests/symmetric.c new file mode 100644 index 00000000..a6d37627 --- /dev/null +++ b/tests/symmetric.c @@ -0,0 +1,30 @@ +#include +#include +#include +#include "marchid.h" + +#define OBUS_OFFSET (0x1L << 32) + +char src[] = "This is a test string. It will be written into the off-chip memory address, then copied back."; +char dest[4096]; +char test[4096]; + +int main(void) { + size_t write_start = rdcycle(); + memcpy(dest + OBUS_OFFSET, src, sizeof(src)); + size_t write_end = rdcycle(); + + printf("Wrote %ld bytes in %ld cycles\n", sizeof(src), write_end - write_start); + + size_t read_start = rdcycle(); + memcpy(test, dest + OBUS_OFFSET, sizeof(src)); + size_t read_end = rdcycle(); + + if (memcmp(src, test, sizeof(src))) { + printf("Remote write/read failed\n"); + exit(1); + } + printf("Read %ld bytes in %ld cycles\n", sizeof(src), read_end - read_start); + + return 0; +}