From 07cad273157e2c424aecb61914799c7db292b063 Mon Sep 17 00:00:00 2001 From: Jerry Zhao Date: Tue, 27 Sep 2022 22:08:12 -0700 Subject: [PATCH] Add TutorialNoCConfig --- .gitignore | 1 + .../src/main/scala/config/RocketConfigs.scala | 2 +- .../main/scala/config/TutorialConfigs.scala | 48 +++++++++++++++++++ .../chipyard/src/main/scala/example/GCD.scala | 4 +- .../dsptools/StreamingPassthrough.scala | 4 +- generators/constellation | 2 +- generators/fft-generator | 2 +- tests/Makefile | 2 +- tests/fft.c | 6 +-- tests/gcd.c | 9 ++-- tests/streaming-passthrough.c | 8 ++-- 11 files changed, 69 insertions(+), 19 deletions(-) diff --git a/.gitignore b/.gitignore index 17a1339a..78994284 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ env-riscv-tools.sh env-esp-tools.sh .bsp/ .conda-env/ +.#* \ No newline at end of file diff --git a/generators/chipyard/src/main/scala/config/RocketConfigs.scala b/generators/chipyard/src/main/scala/config/RocketConfigs.scala index 42805714..4032a43a 100644 --- a/generators/chipyard/src/main/scala/config/RocketConfigs.scala +++ b/generators/chipyard/src/main/scala/config/RocketConfigs.scala @@ -23,7 +23,7 @@ class TinyRocketConfig extends Config( // DOC include start: FFTRocketConfig class FFTRocketConfig extends Config( - new fftgenerator.WithFFTGenerator(baseAddr=0x2000, numPoints=8, width=16, decPt=8) ++ // add 8-point mmio fft at 0x2000 with 16bit fixed-point numbers. + new fftgenerator.WithFFTGenerator(numPoints=8, width=16, decPt=8) ++ // add 8-point mmio fft at 0x2000 with 16bit fixed-point numbers. new freechips.rocketchip.subsystem.WithNBigCores(1) ++ new chipyard.config.AbstractConfig) // DOC include end: FFTRocketConfig diff --git a/generators/chipyard/src/main/scala/config/TutorialConfigs.scala b/generators/chipyard/src/main/scala/config/TutorialConfigs.scala index 3c64958f..c9956b7a 100644 --- a/generators/chipyard/src/main/scala/config/TutorialConfigs.scala +++ b/generators/chipyard/src/main/scala/config/TutorialConfigs.scala @@ -1,6 +1,12 @@ package chipyard import freechips.rocketchip.config.{Config} +import constellation.channel._ +import constellation.routing._ +import constellation.topology._ +import constellation.noc._ +import constellation.soc.{GlobalNoCParams} +import scala.collection.immutable.ListMap // This file is designed to accompany a live tutorial, with slides. // For each of 4 phases, participants will customize and build a @@ -68,3 +74,45 @@ class TutorialSha3BlackBoxConfig extends Config( new freechips.rocketchip.subsystem.WithNBigCores(1) ++ new chipyard.config.AbstractConfig ) + +// Tutorial Phase 5: Map a multicore heterogeneous SoC with multiple cores and memory-mapped accelerators +class TutorialNoCConfig extends Config( + // Try changing the dimensions of the Mesh topology + new constellation.soc.WithGlobalNoC(constellation.soc.GlobalNoCParams( + NoCParams( + topology = TerminalRouter(Mesh2D(3, 4)), + channelParamGen = (a, b) => UserChannelParams(Seq.fill(12) { UserVirtualChannelParams(4) }), + routingRelation = NonblockingVirtualSubnetworksRouting(TerminalRouterRouting( + Mesh2DEscapeRouting()), 10, 1) + ) + )) ++ + // The inNodeMapping and outNodeMapping values are the physical identifiers of + // routers on the topology to map the agents to. Try changing these to any + // value within the range [0, topology.nNodes) + new constellation.soc.WithPbusNoC(constellation.protocol.TLNoCParams( + constellation.protocol.DiplomaticNetworkNodeMapping( + inNodeMapping = ListMap("Core" -> 7), + outNodeMapping = ListMap( + "pbus" -> 8, "uart" -> 9, "control" -> 10, "gcd" -> 11, + "writeQueue[0]" -> 0, "writeQueue[1]" -> 1, "tailChain[0]" -> 2)) + ), true) ++ + new constellation.soc.WithSbusNoC(constellation.protocol.TLNoCParams( + constellation.protocol.DiplomaticNetworkNodeMapping( + inNodeMapping = ListMap( + "Core 0" -> 0, "Core 1" -> 1, + "serial-tl" -> 2), + outNodeMapping = ListMap( + "system[0]" -> 3, "system[1]" -> 4, "system[2]" -> 5, "system[3]" -> 6, + "pbus" -> 7)) + ), true) ++ + new chipyard.example.WithGCD ++ + new chipyard.harness.WithLoopbackNIC ++ + new icenet.WithIceNIC ++ + new fftgenerator.WithFFTGenerator(numPoints=8) ++ + new chipyard.example.WithStreamingFIR ++ + new chipyard.example.WithStreamingPassthrough ++ + + new freechips.rocketchip.subsystem.WithNBanks(4) ++ + new freechips.rocketchip.subsystem.WithNBigCores(2) ++ + new chipyard.config.AbstractConfig +) diff --git a/generators/chipyard/src/main/scala/example/GCD.scala b/generators/chipyard/src/main/scala/example/GCD.scala index 475e0bdc..fe55f288 100644 --- a/generators/chipyard/src/main/scala/example/GCD.scala +++ b/generators/chipyard/src/main/scala/example/GCD.scala @@ -13,7 +13,7 @@ import freechips.rocketchip.util.UIntIsOneOf // DOC include start: GCD params case class GCDParams( - address: BigInt = 0x2000, + address: BigInt = 0x1000, width: Int = 32, useAXI4: Boolean = false, useBlackBox: Boolean = true) @@ -201,7 +201,7 @@ trait CanHavePeripheryGCDModuleImp extends LazyModuleImp { // DOC include start: GCD config fragment -class WithGCD(useAXI4: Boolean, useBlackBox: Boolean) extends Config((site, here, up) => { +class WithGCD(useAXI4: Boolean = false, useBlackBox: Boolean = false) extends Config((site, here, up) => { case GCDKey => Some(GCDParams(useAXI4 = useAXI4, useBlackBox = useBlackBox)) }) // DOC include end: GCD config fragment diff --git a/generators/chipyard/src/main/scala/example/dsptools/StreamingPassthrough.scala b/generators/chipyard/src/main/scala/example/dsptools/StreamingPassthrough.scala index fe02c996..0f04f7e0 100644 --- a/generators/chipyard/src/main/scala/example/dsptools/StreamingPassthrough.scala +++ b/generators/chipyard/src/main/scala/example/dsptools/StreamingPassthrough.scala @@ -16,8 +16,8 @@ import freechips.rocketchip.subsystem._ // Simple passthrough to use as testbed sanity check // StreamingPassthrough params case class StreamingPassthroughParams( - writeAddress: BigInt = 0x2000, - readAddress: BigInt = 0x2100, + writeAddress: BigInt = 0x2200, + readAddress: BigInt = 0x2300, depth: Int ) diff --git a/generators/constellation b/generators/constellation index 2d257478..b93fde3e 160000 --- a/generators/constellation +++ b/generators/constellation @@ -1 +1 @@ -Subproject commit 2d25747867081ec9b258fd056a2b999fccba96b5 +Subproject commit b93fde3e2824f728c404e08984046d41679ec31f diff --git a/generators/fft-generator b/generators/fft-generator index 4c335ff6..40357f00 160000 --- a/generators/fft-generator +++ b/generators/fft-generator @@ -1 +1 @@ -Subproject commit 4c335ff6aba3734fcc373548ea39f4c798f70cea +Subproject commit 40357f00a8f091e97be9dbf39256e511dac6c494 diff --git a/tests/Makefile b/tests/Makefile index 556c6fd3..54959bf0 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -6,7 +6,7 @@ LDFLAGS= -static include libgloss.mk PROGRAMS = pwm blkdev accum charcount nic-loopback big-blkdev pingd \ - streaming-passthrough streaming-fir nvdla spiflashread spiflashwrite fft + streaming-passthrough streaming-fir nvdla spiflashread spiflashwrite fft gcd spiflash.img: spiflash.py python3 $< diff --git a/tests/fft.c b/tests/fft.c index cddfa6db..69aee1af 100644 --- a/tests/fft.c +++ b/tests/fft.c @@ -4,8 +4,8 @@ #include #include -#define FFT_WRITE_LANE 0x2000 -#define FFT_RD_LANE_BASE 0x2008 +#define FFT_WRITE_LANE 0x2400 +#define FFT_RD_LANE_BASE 0x2408 // addr of read lane i is FFT_RD_LANE_BASE + i * 8 // from generators/fft-generator/test_pts.py (in the fft-generator repo) @@ -68,4 +68,4 @@ int main(void) { printf("PASS: FFT Test Passed\n"); return 0; -} \ No newline at end of file +} diff --git a/tests/gcd.c b/tests/gcd.c index a89abf65..1d8ee691 100644 --- a/tests/gcd.c +++ b/tests/gcd.c @@ -1,9 +1,9 @@ #include "mmio.h" -#define GCD_STATUS 0x2000 -#define GCD_X 0x2004 -#define GCD_Y 0x2008 -#define GCD_GCD 0x200C +#define GCD_STATUS 0x1000 +#define GCD_X 0x1004 +#define GCD_Y 0x1008 +#define GCD_GCD 0x100C unsigned int gcd_ref(unsigned int x, unsigned int y) { while (y != 0) { @@ -37,6 +37,7 @@ int main(void) printf("Hardware result %d does not match reference value %d\n", result, ref); return 1; } + printf("Hardware result %d is correct for GCD\n", result); return 0; } // DOC include end: GCD test diff --git a/tests/streaming-passthrough.c b/tests/streaming-passthrough.c index a25e367b..bffd6666 100644 --- a/tests/streaming-passthrough.c +++ b/tests/streaming-passthrough.c @@ -1,7 +1,7 @@ -#define PASSTHROUGH_WRITE 0x2000 -#define PASSTHROUGH_WRITE_COUNT 0x2008 -#define PASSTHROUGH_READ 0x2100 -#define PASSTHROUGH_READ_COUNT 0x2108 +#define PASSTHROUGH_WRITE 0x2200 +#define PASSTHROUGH_WRITE_COUNT 0x2208 +#define PASSTHROUGH_READ 0x2300 +#define PASSTHROUGH_READ_COUNT 0x2308 #include "mmio.h"