Explicitly pass chipId to all HarnessBinders
This commit is contained in:
@@ -15,19 +15,19 @@ import chipyard.harness.{HarnessBinder}
|
||||
import chipyard.iobinders._
|
||||
|
||||
class WithArtyDebugResetHarnessBinder extends HarnessBinder({
|
||||
case (th: Arty35THarness, port: DebugResetPort) => {
|
||||
case (th: Arty35THarness, port: DebugResetPort, chipId: Int) => {
|
||||
th.dut_ndreset := port.io // Debug module reset
|
||||
}
|
||||
})
|
||||
|
||||
class WithArtyJTAGResetHarnessBinder extends HarnessBinder({
|
||||
case (th: Arty35THarness, port: JTAGResetPort) => {
|
||||
case (th: Arty35THarness, port: JTAGResetPort, chipId: Int) => {
|
||||
port.io := PowerOnResetFPGAOnly(th.clock_32MHz) // JTAG module reset
|
||||
}
|
||||
})
|
||||
|
||||
class WithArtyJTAGHarnessBinder extends HarnessBinder({
|
||||
case (th: Arty35THarness, port: JTAGPort) => {
|
||||
case (th: Arty35THarness, port: JTAGPort, chipId: Int) => {
|
||||
val jtag_wire = Wire(new JTAGIO)
|
||||
jtag_wire.TDO.data := port.io.TDO
|
||||
jtag_wire.TDO.driven := true.B
|
||||
@@ -62,7 +62,7 @@ class WithArtyJTAGHarnessBinder extends HarnessBinder({
|
||||
})
|
||||
|
||||
class WithArtyUARTHarnessBinder extends HarnessBinder({
|
||||
case (th: Arty35THarness, port: UARTPort) => {
|
||||
case (th: Arty35THarness, port: UARTPort, chipId: Int) => {
|
||||
withClockAndReset(th.clock_32MHz, th.ck_rst) {
|
||||
IOBUF(th.uart_rxd_out, port.io.txd)
|
||||
port.io.rxd := IOBUF(th.uart_txd_in)
|
||||
|
||||
@@ -22,7 +22,7 @@ import chipyard.iobinders._
|
||||
import testchipip.serdes._
|
||||
|
||||
class WithArty100TUARTTSI extends HarnessBinder({
|
||||
case (th: HasHarnessInstantiators, port: UARTTSIPort) => {
|
||||
case (th: HasHarnessInstantiators, port: UARTTSIPort, chipId: Int) => {
|
||||
val ath = th.asInstanceOf[LazyRawModuleImp].wrapper.asInstanceOf[Arty100THarness]
|
||||
ath.io_uart_bb.bundle <> port.io.uart
|
||||
ath.other_leds(1) := port.io.dropped
|
||||
@@ -34,7 +34,7 @@ class WithArty100TUARTTSI extends HarnessBinder({
|
||||
})
|
||||
|
||||
class WithArty100TDDRTL extends HarnessBinder({
|
||||
case (th: HasHarnessInstantiators, port: TLMemPort) => {
|
||||
case (th: HasHarnessInstantiators, port: TLMemPort, chipId: Int) => {
|
||||
val artyTh = th.asInstanceOf[LazyRawModuleImp].wrapper.asInstanceOf[Arty100THarness]
|
||||
val bundles = artyTh.ddrClient.out.map(_._1)
|
||||
val ddrClientBundle = Wire(new HeterogeneousBag(bundles.map(_.cloneType)))
|
||||
@@ -45,7 +45,7 @@ class WithArty100TDDRTL extends HarnessBinder({
|
||||
|
||||
// Uses PMOD JA/JB
|
||||
class WithArty100TSerialTLToGPIO extends HarnessBinder({
|
||||
case (th: HasHarnessInstantiators, port: SerialTLPort) => {
|
||||
case (th: HasHarnessInstantiators, port: SerialTLPort, chipId: Int) => {
|
||||
val artyTh = th.asInstanceOf[LazyRawModuleImp].wrapper.asInstanceOf[Arty100THarness]
|
||||
val harnessIO = IO(chiselTypeOf(port.io)).suggestName("serial_tl")
|
||||
harnessIO <> port.io
|
||||
|
||||
@@ -15,7 +15,7 @@ import chipyard.harness._
|
||||
import chipyard.iobinders._
|
||||
|
||||
class WithNexysVideoUARTTSI(uartBaudRate: BigInt = 115200) extends HarnessBinder({
|
||||
case (th: HasHarnessInstantiators, port: UARTTSIPort) => {
|
||||
case (th: HasHarnessInstantiators, port: UARTTSIPort, chipId: Int) => {
|
||||
val nexysvideoth = th.asInstanceOf[LazyRawModuleImp].wrapper.asInstanceOf[NexysVideoHarness]
|
||||
nexysvideoth.io_uart_bb.bundle <> port.io.uart
|
||||
nexysvideoth.other_leds(1) := port.io.dropped
|
||||
@@ -27,7 +27,7 @@ class WithNexysVideoUARTTSI(uartBaudRate: BigInt = 115200) extends HarnessBinder
|
||||
})
|
||||
|
||||
class WithNexysVideoDDRTL extends HarnessBinder({
|
||||
case (th: HasHarnessInstantiators, port: TLMemPort) => {
|
||||
case (th: HasHarnessInstantiators, port: TLMemPort, chipId: Int) => {
|
||||
val nexysTh = th.asInstanceOf[LazyRawModuleImp].wrapper.asInstanceOf[NexysVideoHarness]
|
||||
val bundles = nexysTh.ddrClient.get.out.map(_._1)
|
||||
val ddrClientBundle = Wire(new HeterogeneousBag(bundles.map(_.cloneType)))
|
||||
|
||||
@@ -16,21 +16,21 @@ import chipyard.iobinders._
|
||||
|
||||
/*** UART ***/
|
||||
class WithVC707UARTHarnessBinder extends HarnessBinder({
|
||||
case (th: VC707FPGATestHarnessImp, port: UARTPort) => {
|
||||
case (th: VC707FPGATestHarnessImp, port: UARTPort, chipId: Int) => {
|
||||
th.vc707Outer.io_uart_bb.bundle <> port.io
|
||||
}
|
||||
})
|
||||
|
||||
/*** SPI ***/
|
||||
class WithVC707SPISDCardHarnessBinder extends HarnessBinder({
|
||||
case (th: VC707FPGATestHarnessImp, port: SPIPort) => {
|
||||
case (th: VC707FPGATestHarnessImp, port: SPIPort, chipId: Int) => {
|
||||
th.vc707Outer.io_spi_bb.bundle <> port.io
|
||||
}
|
||||
})
|
||||
|
||||
/*** Experimental DDR ***/
|
||||
class WithVC707DDRMemHarnessBinder extends HarnessBinder({
|
||||
case (th: VC707FPGATestHarnessImp, port: TLMemPort) => {
|
||||
case (th: VC707FPGATestHarnessImp, port: TLMemPort, chipId: Int) => {
|
||||
val bundles = th.vc707Outer.ddrClient.out.map(_._1)
|
||||
val ddrClientBundle = Wire(new HeterogeneousBag(bundles.map(_.cloneType)))
|
||||
bundles.zip(ddrClientBundle).foreach { case (bundle, io) => bundle <> io }
|
||||
|
||||
@@ -15,21 +15,21 @@ import chipyard.iobinders._
|
||||
|
||||
/*** UART ***/
|
||||
class WithUART extends HarnessBinder({
|
||||
case (th: VCU118FPGATestHarnessImp, port: UARTPort) => {
|
||||
case (th: VCU118FPGATestHarnessImp, port: UARTPort, chipId: Int) => {
|
||||
th.vcu118Outer.io_uart_bb.bundle <> port.io
|
||||
}
|
||||
})
|
||||
|
||||
/*** SPI ***/
|
||||
class WithSPISDCard extends HarnessBinder({
|
||||
case (th: VCU118FPGATestHarnessImp, port: SPIPort) => {
|
||||
case (th: VCU118FPGATestHarnessImp, port: SPIPort, chipId: Int) => {
|
||||
th.vcu118Outer.io_spi_bb.bundle <> port.io
|
||||
}
|
||||
})
|
||||
|
||||
/*** Experimental DDR ***/
|
||||
class WithDDRMem extends HarnessBinder({
|
||||
case (th: VCU118FPGATestHarnessImp, port: TLMemPort) => {
|
||||
case (th: VCU118FPGATestHarnessImp, port: TLMemPort, chipId: Int) => {
|
||||
val bundles = th.vcu118Outer.ddrClient.out.map(_._1)
|
||||
val ddrClientBundle = Wire(new HeterogeneousBag(bundles.map(_.cloneType)))
|
||||
bundles.zip(ddrClientBundle).foreach { case (bundle, io) => bundle <> io }
|
||||
|
||||
@@ -18,34 +18,34 @@ import chipyard.iobinders._
|
||||
|
||||
/*** UART ***/
|
||||
class WithBringupUART extends HarnessBinder({
|
||||
case (th: BringupVCU118FPGATestHarnessImp, port: UARTPort) => {
|
||||
case (th: BringupVCU118FPGATestHarnessImp, port: UARTPort, chipId: Int) => {
|
||||
th.bringupOuter.io_fmc_uart_bb.bundle <> port.io
|
||||
}
|
||||
})
|
||||
|
||||
/*** I2C ***/
|
||||
class WithBringupI2C extends HarnessBinder({
|
||||
case (th: BringupVCU118FPGATestHarnessImp, port: chipyard.iobinders.I2CPort) => {
|
||||
case (th: BringupVCU118FPGATestHarnessImp, port: chipyard.iobinders.I2CPort, chipId: Int) => {
|
||||
th.bringupOuter.io_i2c_bb.bundle <> port.io
|
||||
}
|
||||
})
|
||||
|
||||
/*** GPIO ***/
|
||||
class WithBringupGPIO extends HarnessBinder({
|
||||
case (th: BringupVCU118FPGATestHarnessImp, port: GPIOPort) => {
|
||||
case (th: BringupVCU118FPGATestHarnessImp, port: GPIOPort, chipId: Int) => {
|
||||
th.bringupOuter.io_gpio_bb(port.pinId).bundle <> port.io
|
||||
}
|
||||
})
|
||||
|
||||
/*** TSI Host Widget ***/
|
||||
class WithBringupTSIHost extends HarnessBinder({
|
||||
case (th: BringupVCU118FPGATestHarnessImp, port: TLMemPort) => {
|
||||
case (th: BringupVCU118FPGATestHarnessImp, port: TLMemPort, chipId: Int) => {
|
||||
val tsiBundles = th.bringupOuter.tsiDdrClient.out.map(_._1)
|
||||
val tsiDdrClientBundle = Wire(new HeterogeneousBag(tsiBundles.map(_.cloneType)))
|
||||
tsiBundles.zip(tsiDdrClientBundle).foreach { case (bundle, io) => bundle <> io }
|
||||
tsiDdrClientBundle <> port.io
|
||||
}
|
||||
case (th: BringupVCU118FPGATestHarnessImp, port: TSIHostWidgetPort) => {
|
||||
case (th: BringupVCU118FPGATestHarnessImp, port: TSIHostWidgetPort, chipId: Int) => {
|
||||
th.bringupOuter.io_tsi_serial_bb.bundle <> port.io
|
||||
}
|
||||
})
|
||||
|
||||
@@ -28,8 +28,8 @@ import chipyard.iobinders._
|
||||
case object HarnessBinders extends Field[HarnessBinderFunction]({case _ => })
|
||||
|
||||
object ApplyHarnessBinders {
|
||||
def apply(th: HasHarnessInstantiators, ports: Seq[Port[_]])(implicit p: Parameters): Unit = {
|
||||
ports.foreach(port => p(HarnessBinders)(th, port))
|
||||
def apply(th: HasHarnessInstantiators, ports: Seq[Port[_]], chipId: Int)(implicit p: Parameters): Unit = {
|
||||
ports.foreach(port => p(HarnessBinders)(th, port, chipId))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,14 +41,14 @@ class HarnessBinder[T <: HasHarnessInstantiators, S <: Port[_]](
|
||||
|
||||
|
||||
class WithGPIOTiedOff extends HarnessBinder({
|
||||
case (th: HasHarnessInstantiators, port: GPIOPort) => {
|
||||
case (th: HasHarnessInstantiators, port: GPIOPort, chipId: Int) => {
|
||||
port.io <> AnalogConst(0)
|
||||
}
|
||||
})
|
||||
|
||||
// DOC include start: WithUARTAdapter
|
||||
class WithUARTAdapter extends HarnessBinder({
|
||||
case (th: HasHarnessInstantiators, port: UARTPort) => {
|
||||
case (th: HasHarnessInstantiators, port: UARTPort, chipId: Int) => {
|
||||
val div = (th.getHarnessBinderClockFreqMHz.toDouble * 1000000 / port.io.c.initBaudRate.toDouble).toInt
|
||||
UARTAdapter.connect(Seq(port.io), div, false)
|
||||
}
|
||||
@@ -56,7 +56,7 @@ class WithUARTAdapter extends HarnessBinder({
|
||||
// DOC include end: WithUARTAdapter
|
||||
|
||||
class WithSimSPIFlashModel(rdOnly: Boolean = true) extends HarnessBinder({
|
||||
case (th: HasHarnessInstantiators, port: SPIFlashPort) => {
|
||||
case (th: HasHarnessInstantiators, port: SPIFlashPort, chipId: Int) => {
|
||||
val spi_mem = Module(new SimSPIFlashModel(port.params.fSize, port.spiId, rdOnly)).suggestName(s"spi_mem${port.spiId}")
|
||||
spi_mem.io.sck := port.io.sck
|
||||
require(port.params.csWidth == 1, "I don't know what to do with your extra CS bits. Fix me please.")
|
||||
@@ -67,7 +67,7 @@ class WithSimSPIFlashModel(rdOnly: Boolean = true) extends HarnessBinder({
|
||||
})
|
||||
|
||||
class WithSimBlockDevice extends HarnessBinder({
|
||||
case (th: HasHarnessInstantiators, port: BlockDevicePort) => {
|
||||
case (th: HasHarnessInstantiators, port: BlockDevicePort, chipId: Int) => {
|
||||
val sim_blkdev = Module(new SimBlockDevice(port.params))
|
||||
sim_blkdev.io.bdev <> port.io.bits
|
||||
sim_blkdev.io.clock := port.io.clock
|
||||
@@ -76,7 +76,7 @@ class WithSimBlockDevice extends HarnessBinder({
|
||||
})
|
||||
|
||||
class WithBlockDeviceModel extends HarnessBinder({
|
||||
case (th: HasHarnessInstantiators, port: BlockDevicePort) => {
|
||||
case (th: HasHarnessInstantiators, port: BlockDevicePort, chipId: Int) => {
|
||||
val blkdev_model = Module(new BlockDeviceModel(16, port.params))
|
||||
blkdev_model.io <> port.io.bits
|
||||
blkdev_model.clock := port.io.clock
|
||||
@@ -85,19 +85,19 @@ class WithBlockDeviceModel extends HarnessBinder({
|
||||
})
|
||||
|
||||
class WithLoopbackNIC extends HarnessBinder({
|
||||
case (th: HasHarnessInstantiators, port: NICPort) => {
|
||||
case (th: HasHarnessInstantiators, port: NICPort, chipId: Int) => {
|
||||
withClock(port.io.clock) { NicLoopback.connect(port.io.bits, port.params) }
|
||||
}
|
||||
})
|
||||
|
||||
class WithSimNetwork extends HarnessBinder({
|
||||
case (th: HasHarnessInstantiators, port: NICPort) => {
|
||||
case (th: HasHarnessInstantiators, port: NICPort, chipId: Int) => {
|
||||
withClock(port.io.clock) { SimNetwork.connect(Some(port.io.bits), port.io.clock, th.harnessBinderReset.asBool) }
|
||||
}
|
||||
})
|
||||
|
||||
class WithSimAXIMem extends HarnessBinder({
|
||||
case (th: HasHarnessInstantiators, port: AXI4MemPort) => {
|
||||
case (th: HasHarnessInstantiators, port: AXI4MemPort, chipId: Int) => {
|
||||
val mem = LazyModule(new SimAXIMem(port.edge, size=port.params.master.size)(Parameters.empty))
|
||||
withClock(port.io.clock) { Module(mem.module) }
|
||||
mem.io_axi4.head <> port.io
|
||||
@@ -105,13 +105,13 @@ class WithSimAXIMem extends HarnessBinder({
|
||||
})
|
||||
|
||||
class WithBlackBoxSimMem(additionalLatency: Int = 0) extends HarnessBinder({
|
||||
case (th: HasHarnessInstantiators, port: AXI4MemPort) => {
|
||||
case (th: HasHarnessInstantiators, port: AXI4MemPort, chipId: Int) => {
|
||||
// TODO FIX: This currently makes each SimDRAM contain the entire memory space
|
||||
val memSize = port.params.master.size
|
||||
val memBase = port.params.master.base
|
||||
val lineSize = 64 // cache block size
|
||||
val clockFreq = port.clockFreqMHz
|
||||
val mem = Module(new SimDRAM(memSize, lineSize, clockFreq, memBase, port.edge.bundle, th.p(MultiChipIdx))).suggestName("simdram")
|
||||
val mem = Module(new SimDRAM(memSize, lineSize, clockFreq, memBase, port.edge.bundle, chipId)).suggestName("simdram")
|
||||
|
||||
mem.io.clock := port.io.clock
|
||||
mem.io.reset := th.harnessBinderReset.asAsyncReset
|
||||
@@ -138,7 +138,7 @@ class WithBlackBoxSimMem(additionalLatency: Int = 0) extends HarnessBinder({
|
||||
})
|
||||
|
||||
class WithSimAXIMMIO extends HarnessBinder({
|
||||
case (th: HasHarnessInstantiators, port: AXI4MMIOPort) => {
|
||||
case (th: HasHarnessInstantiators, port: AXI4MMIOPort, chipId: Int) => {
|
||||
val mmio_mem = LazyModule(new SimAXIMem(port.edge, size = port.params.size)(Parameters.empty))
|
||||
withClock(port.io.clock) { Module(mmio_mem.module).suggestName("mmio_mem") }
|
||||
mmio_mem.io_axi4.head <> port.io.bits
|
||||
@@ -146,13 +146,13 @@ class WithSimAXIMMIO extends HarnessBinder({
|
||||
})
|
||||
|
||||
class WithTieOffInterrupts extends HarnessBinder({
|
||||
case (th: HasHarnessInstantiators, port: ExtIntPort) => {
|
||||
case (th: HasHarnessInstantiators, port: ExtIntPort, chipId: Int) => {
|
||||
port.io := 0.U
|
||||
}
|
||||
})
|
||||
|
||||
class WithTieOffL2FBusAXI extends HarnessBinder({
|
||||
case (th: HasHarnessInstantiators, port: AXI4InPort) => {
|
||||
case (th: HasHarnessInstantiators, port: AXI4InPort, chipId: Int) => {
|
||||
port.io := DontCare
|
||||
port.io.bits.aw.valid := false.B
|
||||
port.io.bits.w.valid := false.B
|
||||
@@ -163,7 +163,7 @@ class WithTieOffL2FBusAXI extends HarnessBinder({
|
||||
})
|
||||
|
||||
class WithSimJTAGDebug extends HarnessBinder({
|
||||
case (th: HasHarnessInstantiators, port: JTAGPort) => {
|
||||
case (th: HasHarnessInstantiators, port: JTAGPort, chipId: Int) => {
|
||||
val dtm_success = WireInit(false.B)
|
||||
when (dtm_success) { th.success := true.B }
|
||||
val jtag_wire = Wire(new JTAGIO)
|
||||
@@ -178,7 +178,7 @@ class WithSimJTAGDebug extends HarnessBinder({
|
||||
})
|
||||
|
||||
class WithSimDMI extends HarnessBinder({
|
||||
case (th: HasHarnessInstantiators, port: DMIPort) => {
|
||||
case (th: HasHarnessInstantiators, port: DMIPort, chipId: Int) => {
|
||||
val dtm_success = WireInit(false.B)
|
||||
when (dtm_success) { th.success := true.B }
|
||||
val dtm = Module(new TestchipSimDTM()(Parameters.empty)).connect(th.harnessBinderClock, th.harnessBinderReset.asBool, port.io, dtm_success)
|
||||
@@ -186,7 +186,7 @@ class WithSimDMI extends HarnessBinder({
|
||||
})
|
||||
|
||||
class WithTiedOffJTAG extends HarnessBinder({
|
||||
case (th: HasHarnessInstantiators, port: JTAGPort) => {
|
||||
case (th: HasHarnessInstantiators, port: JTAGPort, chipId: Int) => {
|
||||
port.io.TCK := true.B.asClock
|
||||
port.io.TMS := true.B
|
||||
port.io.TDI := true.B
|
||||
@@ -194,7 +194,7 @@ class WithTiedOffJTAG extends HarnessBinder({
|
||||
})
|
||||
|
||||
class WithTiedOffDMI extends HarnessBinder({
|
||||
case (th: HasHarnessInstantiators, port: DMIPort) => {
|
||||
case (th: HasHarnessInstantiators, port: DMIPort, chipId: Int) => {
|
||||
port.io.dmi.req.valid := false.B
|
||||
port.io.dmi.req.bits := DontCare
|
||||
port.io.dmi.resp.ready := true.B
|
||||
@@ -206,7 +206,7 @@ class WithTiedOffDMI extends HarnessBinder({
|
||||
// If tieoffs is specified, a list of serial portIds to tie off
|
||||
// If tieoffs is unspecified, ties off all serial ports
|
||||
class WithSerialTLTiedOff(tieoffs: Option[Seq[Int]] = None) extends HarnessBinder({
|
||||
case (th: HasHarnessInstantiators, port: SerialTLPort) if (tieoffs.map(_.contains(port.portId)).getOrElse(true)) => {
|
||||
case (th: HasHarnessInstantiators, port: SerialTLPort, chipId: Int) if (tieoffs.map(_.contains(port.portId)).getOrElse(true)) => {
|
||||
port.io match {
|
||||
case io: DecoupledSerialIO => io.out.ready := false.B; io.in.valid := false.B; io.in.bits := DontCare;
|
||||
case io: SourceSyncSerialIO => {
|
||||
@@ -225,7 +225,7 @@ class WithSerialTLTiedOff(tieoffs: Option[Seq[Int]] = None) extends HarnessBinde
|
||||
})
|
||||
|
||||
class WithSimTSIOverSerialTL extends HarnessBinder({
|
||||
case (th: HasHarnessInstantiators, port: SerialTLPort) if (port.portId == 0) => {
|
||||
case (th: HasHarnessInstantiators, port: SerialTLPort, chipId: Int) if (port.portId == 0) => {
|
||||
port.io match {
|
||||
case io: InternalSyncSerialIO =>
|
||||
case io: ExternalSyncSerialIO => io.clock_in := th.harnessBinderClock
|
||||
@@ -244,7 +244,7 @@ class WithSimTSIOverSerialTL extends HarnessBinder({
|
||||
ram.io.ser.in <> io.out
|
||||
io.in <> ram.io.ser.out
|
||||
|
||||
val success = SimTSI.connect(ram.io.tsi, clock, th.harnessBinderReset, th.p(MultiChipIdx))
|
||||
val success = SimTSI.connect(ram.io.tsi, clock, th.harnessBinderReset, chipId)
|
||||
when (success) { th.success := true.B }
|
||||
}
|
||||
}
|
||||
@@ -253,7 +253,7 @@ class WithSimTSIOverSerialTL extends HarnessBinder({
|
||||
})
|
||||
|
||||
class WithSimUARTToUARTTSI extends HarnessBinder({
|
||||
case (th: HasHarnessInstantiators, port: UARTPort) => {
|
||||
case (th: HasHarnessInstantiators, port: UARTPort, chipId: Int) => {
|
||||
UARTAdapter.connect(Seq(port.io),
|
||||
baudrate=port.io.c.initBaudRate,
|
||||
clockFrequency=th.getHarnessBinderClockFreqHz.toInt,
|
||||
@@ -262,7 +262,7 @@ class WithSimUARTToUARTTSI extends HarnessBinder({
|
||||
})
|
||||
|
||||
class WithSimTSIToUARTTSI extends HarnessBinder({
|
||||
case (th: HasHarnessInstantiators, port: UARTTSIPort) => {
|
||||
case (th: HasHarnessInstantiators, port: UARTTSIPort, chipId: Int) => {
|
||||
val freq = th.getHarnessBinderClockFreqHz.toInt
|
||||
val uart_to_serial = Module(new UARTToSerial(freq, port.io.uart.c))
|
||||
val serial_width_adapter = Module(new SerialWidthAdapter(8, TSI.WIDTH))
|
||||
@@ -276,27 +276,27 @@ class WithSimTSIToUARTTSI extends HarnessBinder({
|
||||
})
|
||||
|
||||
class WithTraceGenSuccess extends HarnessBinder({
|
||||
case (th: HasHarnessInstantiators, port: SuccessPort) => {
|
||||
case (th: HasHarnessInstantiators, port: SuccessPort, chipId: Int) => {
|
||||
when (port.io) { th.success := true.B }
|
||||
}
|
||||
})
|
||||
|
||||
class WithCospike extends HarnessBinder({
|
||||
case (th: HasHarnessInstantiators, port: TracePort) => {
|
||||
case (th: HasHarnessInstantiators, port: TracePort, chipId: Int) => {
|
||||
port.io.traces.zipWithIndex.map(t => SpikeCosim(t._1, t._2, port.cosimCfg))
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
class WithCustomBootPinPlusArg extends HarnessBinder({
|
||||
case (th: HasHarnessInstantiators, port: CustomBootPort) => {
|
||||
case (th: HasHarnessInstantiators, port: CustomBootPort, chipId: Int) => {
|
||||
val pin = PlusArg("custom_boot_pin", width=1)
|
||||
port.io := pin
|
||||
}
|
||||
})
|
||||
|
||||
class WithClockFromHarness extends HarnessBinder({
|
||||
case (th: HasHarnessInstantiators, port: ClockPort) => {
|
||||
case (th: HasHarnessInstantiators, port: ClockPort, chipId: Int) => {
|
||||
// DOC include start: HarnessClockInstantiatorEx
|
||||
port.io := th.harnessClockInstantiator.requestClockMHz(s"clock_${port.freqMHz}MHz", port.freqMHz)
|
||||
// DOC include end: HarnessClockInstantiatorEx
|
||||
@@ -304,7 +304,7 @@ class WithClockFromHarness extends HarnessBinder({
|
||||
})
|
||||
|
||||
class WithResetFromHarness extends HarnessBinder({
|
||||
case (th: HasHarnessInstantiators, port: ResetPort) => {
|
||||
case (th: HasHarnessInstantiators, port: ResetPort, chipId: Int) => {
|
||||
port.io := th.referenceReset.asAsyncReset
|
||||
}
|
||||
})
|
||||
|
||||
@@ -89,7 +89,7 @@ trait HasHarnessInstantiators {
|
||||
withClockAndReset (harnessBinderClock, harnessBinderReset) {
|
||||
lazyDuts.zipWithIndex.foreach {
|
||||
case (d: HasChipyardPorts, i: Int) => {
|
||||
ApplyHarnessBinders(this, d.ports)(chipParameters(i))
|
||||
ApplyHarnessBinders(this, d.ports, i)(chipParameters(i))
|
||||
}
|
||||
case _ =>
|
||||
}
|
||||
|
||||
@@ -38,10 +38,10 @@ class MultiHarnessBinder[T <: Port[_], S <: HasHarnessInstantiators](
|
||||
)(implicit tag0: ClassTag[T], tag1: ClassTag[S]) extends Config((site, here, up) => {
|
||||
// Override any HarnessBinders for chip0/chip1
|
||||
case MultiChipParameters(`chip0`) => new Config(
|
||||
new HarnessBinder({case (th: S, port: T) if chip0portFn(port) => }) ++ up(MultiChipParameters(chip0))
|
||||
new HarnessBinder({case (th: S, port: T, chipId: Int) if chip0portFn(port) => }) ++ up(MultiChipParameters(chip0))
|
||||
)
|
||||
case MultiChipParameters(`chip1`) => new Config(
|
||||
new HarnessBinder({case (th: S, port: T) if chip1portFn(port) => }) ++ up(MultiChipParameters(chip1))
|
||||
new HarnessBinder({case (th: S, port: T, chipId: Int) if chip1portFn(port) => }) ++ up(MultiChipParameters(chip1))
|
||||
)
|
||||
// Set the multiharnessbinder key
|
||||
case MultiHarnessBinders(`chip0`, `chip1`) => up(MultiHarnessBinders(chip0, chip1)) :+ {
|
||||
|
||||
@@ -6,6 +6,6 @@ import scala.collection.immutable.ListMap
|
||||
package object harness
|
||||
{
|
||||
import chipyard.iobinders.Port
|
||||
type HarnessBinderFunction = PartialFunction[(HasHarnessInstantiators, Port[_]), Unit]
|
||||
type HarnessBinderFunction = PartialFunction[(HasHarnessInstantiators, Port[_], Int), Unit]
|
||||
type MultiHarnessBinderFunction = (HasHarnessInstantiators, Seq[Port[_]], Seq[Port[_]]) => Unit
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ class WithFireSimIOCellModels extends Config((site, here, up) => {
|
||||
})
|
||||
|
||||
class WithTSIBridgeAndHarnessRAMOverSerialTL extends HarnessBinder({
|
||||
case (th: FireSim, port: SerialTLPort) => {
|
||||
case (th: FireSim, port: SerialTLPort, chipId: Int) => {
|
||||
port.io match {
|
||||
case io: ExternalSyncSerialIO => {
|
||||
io.clock_in := th.harnessBinderClock
|
||||
@@ -78,8 +78,8 @@ class WithTSIBridgeAndHarnessRAMOverSerialTL extends HarnessBinder({
|
||||
// This assumes that:
|
||||
// If ExtMem for the target is defined, then FASED bridge will be attached
|
||||
// If FASED bridge is attached, loadmem widget is present
|
||||
val hasMainMemory = th.chipParameters(th.p(MultiChipIdx))(ExtMem).isDefined
|
||||
val mainMemoryName = Option.when(hasMainMemory)(MainMemoryConsts.globalName(th.p(MultiChipIdx)))
|
||||
val hasMainMemory = th.chipParameters(chipId)(ExtMem).isDefined
|
||||
val mainMemoryName = Option.when(hasMainMemory)(MainMemoryConsts.globalName(chipId))
|
||||
TSIBridge(th.harnessBinderClock, ram.io.tsi.get, mainMemoryName, th.harnessBinderReset.asBool)(th.p)
|
||||
}
|
||||
}
|
||||
@@ -87,26 +87,26 @@ class WithTSIBridgeAndHarnessRAMOverSerialTL extends HarnessBinder({
|
||||
})
|
||||
|
||||
class WithNICBridge extends HarnessBinder({
|
||||
case (th: FireSim, port: NICPort) => {
|
||||
case (th: FireSim, port: NICPort, chipId: Int) => {
|
||||
NICBridge(port.io.clock, port.io.bits)(th.p)
|
||||
}
|
||||
})
|
||||
|
||||
class WithUARTBridge extends HarnessBinder({
|
||||
case (th: FireSim, port: UARTPort) =>
|
||||
case (th: FireSim, port: UARTPort, chipId: Int) =>
|
||||
val uartSyncClock = th.harnessClockInstantiator.requestClockMHz("uart_clock", port.freqMHz)
|
||||
UARTBridge(uartSyncClock, port.io, th.harnessBinderReset.asBool, port.freqMHz)(th.p)
|
||||
})
|
||||
|
||||
class WithBlockDeviceBridge extends HarnessBinder({
|
||||
case (th: FireSim, port: BlockDevicePort) => {
|
||||
case (th: FireSim, port: BlockDevicePort, chipId: Int) => {
|
||||
BlockDevBridge(port.io.clock, port.io.bits, th.harnessBinderReset.asBool)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
class WithFASEDBridge extends HarnessBinder({
|
||||
case (th: FireSim, port: AXI4MemPort) => {
|
||||
case (th: FireSim, port: AXI4MemPort, chipId: Int) => {
|
||||
val nastiKey = NastiParameters(port.io.bits.r.bits.data.getWidth,
|
||||
port.io.bits.ar.bits.addr.getWidth,
|
||||
port.io.bits.ar.bits.id.getWidth)
|
||||
@@ -114,24 +114,24 @@ class WithFASEDBridge extends HarnessBinder({
|
||||
CompleteConfig(th.p(firesim.configs.MemModelKey),
|
||||
nastiKey,
|
||||
Some(AXI4EdgeSummary(port.edge)),
|
||||
Some(MainMemoryConsts.globalName(th.p(MultiChipIdx)))))(th.p)
|
||||
Some(MainMemoryConsts.globalName(chipId))))(th.p)
|
||||
}
|
||||
})
|
||||
|
||||
class WithTracerVBridge extends HarnessBinder({
|
||||
case (th: FireSim, port: TracePort) => {
|
||||
case (th: FireSim, port: TracePort, chipId: Int) => {
|
||||
port.io.traces.map(tileTrace => TracerVBridge(tileTrace)(th.p))
|
||||
}
|
||||
})
|
||||
|
||||
class WithCospikeBridge extends HarnessBinder({
|
||||
case (th: FireSim, port: TracePort) => {
|
||||
case (th: FireSim, port: TracePort, chipId: Int) => {
|
||||
port.io.traces.zipWithIndex.map(t => CospikeBridge(t._1, t._2, port.cosimCfg))
|
||||
}
|
||||
})
|
||||
|
||||
class WithSuccessBridge extends HarnessBinder({
|
||||
case (th: FireSim, port: SuccessPort) => {
|
||||
case (th: FireSim, port: SuccessPort, chipId: Int) => {
|
||||
GroundTestBridge(th.harnessBinderClock, port.io)(th.p)
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user