Skip to content

Commit 518ef04

Browse files
authored
Merge pull request #1876 from ucb-bar/obus_switch
Support switchable C2C links through the OBUS
2 parents f86a397 + aac31c4 commit 518ef04

File tree

9 files changed

+80
-4
lines changed

9 files changed

+80
-4
lines changed

.github/scripts/defaults.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ mapping["chipyard-spiflashwrite"]=" CONFIG=SmallSPIFlashRocketConfig EXTRA_SIM_F
6060
mapping["chipyard-manyperipherals"]=" CONFIG=ManyPeripheralsRocketConfig EXTRA_SIM_FLAGS='+spiflash0=${LOCAL_CHIPYARD_DIR}/tests/spiflash.img'"
6161
mapping["chipyard-chiplike"]=" CONFIG=ChipLikeRocketConfig MODEL=FlatTestHarness MODEL_PACKAGE=chipyard.example verilog"
6262
mapping["chipyard-tethered"]=" CONFIG=VerilatorCITetheredChipLikeRocketConfig"
63-
mapping["chipyard-symmetric"]=" CONFIG=MultiSimSymmetricChipletRocketConfig"
63+
mapping["chipyard-symmetric"]=" CONFIG=MultiSimMultiLinkSymmetricChipletRocketConfig"
6464
mapping["chipyard-llcchiplet"]=" CONFIG=MultiSimLLCChipletRocketConfig"
6565
mapping["chipyard-cloneboom"]=" CONFIG=Cloned64MegaBoomV3Config verilog"
6666
mapping["chipyard-nocores"]=" CONFIG=NoCoresConfig verilog"

.github/scripts/run-tests.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ case $1 in
118118
chipyard-symmetric)
119119
build_tests
120120

121-
run_binary BINARY=$LOCAL_CHIPYARD_DIR/tests/symmetric.riscv LOADMEM=1
121+
run_binary BINARY=$LOCAL_CHIPYARD_DIR/tests/symmetric.riscv LOADMEM=1 EXTRA_SIM_FLAGS="+offchip_sel=0"
122+
run_binary BINARY=$LOCAL_CHIPYARD_DIR/tests/symmetric.riscv LOADMEM=1 EXTRA_SIM_FLAGS="+offchip_sel=1"
122123
;;
123124
chipyard-llcchiplet)
124125
build_tests

generators/chipyard/src/main/scala/DigitalTop.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class DigitalTop(implicit p: Parameters) extends ChipyardSystem
1919
with testchipip.boot.CanHavePeripheryCustomBootPin // Enables optional custom boot pin
2020
with testchipip.boot.CanHavePeripheryBootAddrReg // Use programmable boot address register
2121
with testchipip.cosim.CanHaveTraceIO // Enables optionally adding trace IO
22+
with testchipip.soc.CanHaveSwitchableOffchipBus // Enables optional off-chip-bus with interface-switch
2223
with testchipip.soc.CanHaveBankedScratchpad // Enables optionally adding a banked scratchpad
2324
with testchipip.iceblk.CanHavePeripheryBlockDevice // Enables optionally adding the block device
2425
with testchipip.serdes.CanHavePeripheryTLSerial // Enables optionally adding the tl-serial interface

generators/chipyard/src/main/scala/config/AbstractConfig.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class AbstractConfig extends Config(
3030
new chipyard.harness.WithCustomBootPinPlusArg ++ /** drive custom-boot pin with a plusarg, if custom-boot-pin is present */
3131
new chipyard.harness.WithDriveChipIdPin ++ /** drive chip id pin from harness binder, if chip id pin is present */
3232
new chipyard.harness.WithSimUARTToUARTTSI ++ /** connect a SimUART to the UART-TSI port */
33+
new chipyard.harness.WithOffchipBusSelPlusArg ++ /** drive offchip-bus-sel pin from plusArg */
3334
new chipyard.harness.WithClockFromHarness ++ /** all Clock I/O in ChipTop should be driven by harnessClockInstantiator */
3435
new chipyard.harness.WithResetFromHarness ++ /** reset controlled by harness */
3536
new chipyard.harness.WithAbsoluteFreqHarnessClockInstantiator ++ /** generate clocks in harness with unsynthesizable ClockSourceAtFreqMHz */
@@ -62,6 +63,7 @@ class AbstractConfig extends Config(
6263
new chipyard.iobinders.WithUARTTSIPunchthrough ++
6364
new chipyard.iobinders.WithGCDBusyPunchthrough ++
6465
new chipyard.iobinders.WithNMITiedOff ++
66+
new chipyard.iobinders.WithOffchipBusSel ++
6567

6668

6769
// ================================================

generators/chipyard/src/main/scala/config/ChipletConfigs.scala

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,57 @@ class MultiSimSymmetricChipletRocketConfig extends Config(
4646
new chipyard.harness.WithMultiChip(1, new SymmetricChipletRocketConfig)
4747
)
4848

49+
// Similar to the SymmetricChipletRocketConfig, but demonstrates a selectable c2c link
50+
// with two variants of the SerialTL interface
51+
class MultiLinkSymmetricChipletRocketConfig extends Config(
52+
new testchipip.soc.WithChipIdPin ++ // Add pin to identify chips
53+
new chipyard.harness.WithSerialTLTiedOff(tieoffs=Some(Seq(1))) ++ // Tie-off the chip-to-chip link in single-chip sims
54+
new testchipip.serdes.WithSerialTL(Seq(
55+
testchipip.serdes.SerialTLParams( // 0th serial-tl is chip-to-bringup-fpga
56+
client = Some(testchipip.serdes.SerialTLClientParams()), // bringup serial-tl acts only as a client
57+
phyParams = testchipip.serdes.DecoupledExternalSyncSerialPhyParams() // bringup serial-tl is sync'd to external clock
58+
),
59+
testchipip.serdes.SerialTLParams( // 1st serial-tl is narrow chip-to-chip
60+
client = Some(testchipip.serdes.SerialTLClientParams()), // chip-to-chip serial-tl acts as a client
61+
manager = Some(testchipip.serdes.SerialTLManagerParams( // chip-to-chip serial-tl managers other chip's memory
62+
memParams = Seq(testchipip.serdes.ManagerRAMParams(
63+
address = 0,
64+
size = 1L << 32,
65+
)),
66+
slaveWhere = OBUS
67+
)),
68+
phyParams = testchipip.serdes.CreditedSourceSyncSerialPhyParams(phitWidth=1) // narrow link
69+
),
70+
testchipip.serdes.SerialTLParams( // 2nd serial-tl is wide chip-to-chip
71+
client = Some(testchipip.serdes.SerialTLClientParams()), // chip-to-chip serial-tl acts as a client
72+
manager = Some(testchipip.serdes.SerialTLManagerParams( // chip-to-chip serial-tl managers other chip's memory
73+
memParams = Seq(testchipip.serdes.ManagerRAMParams(
74+
address = 0,
75+
size = 1L << 32,
76+
)),
77+
slaveWhere = OBUS
78+
)),
79+
phyParams = testchipip.serdes.CreditedSourceSyncSerialPhyParams(phitWidth=16) // wide link
80+
))
81+
) ++
82+
new testchipip.soc.WithOffchipBusClient(SBUS, // obus provides path to other chip's memory
83+
blockRange = Seq(AddressSet(0, (1L << 32) - 1)), // The lower 4GB is mapped to this chip
84+
replicationBase = Some(1L << 32) // The upper 4GB goes off-chip
85+
) ++
86+
new testchipip.soc.WithOffchipBus ++
87+
new freechips.rocketchip.rocket.WithNBigCores(1) ++
88+
new chipyard.config.AbstractConfig)
89+
90+
// Simulates 2X of the SymmetricChipletRocketConfig in a multi-sim config
91+
class MultiSimMultiLinkSymmetricChipletRocketConfig extends Config(
92+
new chipyard.harness.WithAbsoluteFreqHarnessClockInstantiator ++
93+
new chipyard.harness.WithMultiChipSerialTL(chip0=0, chip1=1, chip0portId=1, chip1portId=1) ++
94+
new chipyard.harness.WithMultiChipSerialTL(chip0=0, chip1=1, chip0portId=2, chip1portId=2) ++
95+
new chipyard.harness.WithMultiChip(0, new MultiLinkSymmetricChipletRocketConfig) ++
96+
new chipyard.harness.WithMultiChip(1, new MultiLinkSymmetricChipletRocketConfig)
97+
)
98+
99+
49100
// Core-only chiplet config, where the coherent memory is located on the LLC-chiplet
50101
class RocketCoreChipletConfig extends Config(
51102
new testchipip.serdes.WithSerialTL(Seq(

generators/chipyard/src/main/scala/harness/HarnessBinders.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,3 +334,10 @@ class WithResetFromHarness extends HarnessBinder({
334334
}
335335
})
336336

337+
class WithOffchipBusSelPlusArg extends HarnessBinder({
338+
case (th: HasHarnessInstantiators, port: OffchipSelPort, chipId: Int) => {
339+
val pin = PlusArg("offchip_sel", width=port.io.getWidth)
340+
port.io := pin
341+
}
342+
})
343+

generators/chipyard/src/main/scala/iobinders/IOBinders.scala

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import chipyard.iocell._
3232
import testchipip.serdes.{CanHavePeripheryTLSerial, SerialTLKey}
3333
import testchipip.spi.{SPIChipIO}
3434
import testchipip.boot.{CanHavePeripheryCustomBootPin}
35-
import testchipip.soc.{CanHavePeripheryChipIdPin}
35+
import testchipip.soc.{CanHavePeripheryChipIdPin, CanHaveSwitchableOffchipBus}
3636
import testchipip.util.{ClockedIO}
3737
import testchipip.iceblk.{CanHavePeripheryBlockDevice, BlockDeviceKey, BlockDeviceIO}
3838
import testchipip.cosim.{CanHaveTraceIO, TraceOutputTop, SpikeCosimConfig}
@@ -567,3 +567,13 @@ class WithGCDBusyPunchthrough extends OverrideIOBinder({
567567
(Seq(GCDBusyPort(() => io_gcd_busy)), Nil)
568568
}.getOrElse((Nil, Nil))
569569
})
570+
571+
class WithOffchipBusSel extends OverrideIOBinder({
572+
(system: CanHaveSwitchableOffchipBus) => {
573+
system.io_obus_sel.getWrappedValue.map { sel =>
574+
val sys = system.asInstanceOf[BaseSubsystem]
575+
val (port, cells) = IOCell.generateIOFromSignal(sel, "obus_sel", sys.p(IOCellKey))
576+
(Seq(OffchipSelPort(() => port)), cells)
577+
}.getOrElse(Nil, Nil)
578+
}
579+
})

generators/chipyard/src/main/scala/iobinders/Ports.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,7 @@ case class TLMemPort (val getIO: () => HeterogeneousBag[TLBundle])
111111

112112
case class GCDBusyPort (val getIO: () => Bool)
113113
extends Port[Bool]
114+
115+
case class OffchipSelPort (val getIO: () => UInt)
116+
extends Port[UInt]
117+

0 commit comments

Comments
 (0)