Skip to content

Commit

Permalink
Add TutorialNoCConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
jerryz123 committed Sep 28, 2022
1 parent f634fde commit 07cad27
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 19 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ env-riscv-tools.sh
env-esp-tools.sh
.bsp/
.conda-env/
.#*
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
48 changes: 48 additions & 0 deletions generators/chipyard/src/main/scala/config/TutorialConfigs.scala
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
)
4 changes: 2 additions & 2 deletions generators/chipyard/src/main/scala/example/GCD.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down
2 changes: 1 addition & 1 deletion generators/constellation
2 changes: 1 addition & 1 deletion generators/fft-generator
2 changes: 1 addition & 1 deletion tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 $<
Expand Down
6 changes: 3 additions & 3 deletions tests/fft.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#include <inttypes.h>
#include <math.h>

#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)
Expand Down Expand Up @@ -68,4 +68,4 @@ int main(void) {

printf("PASS: FFT Test Passed\n");
return 0;
}
}
9 changes: 5 additions & 4 deletions tests/gcd.c
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down Expand Up @@ -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
8 changes: 4 additions & 4 deletions tests/streaming-passthrough.c
Original file line number Diff line number Diff line change
@@ -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"

Expand Down

0 comments on commit 07cad27

Please sign in to comment.