Use async queue to connect serdesser + other components

This commit is contained in:
abejgonzalez
2021-03-19 20:49:49 -07:00
3 changed files with 46 additions and 30 deletions

View File

@@ -152,24 +152,27 @@ class WithSimAXIMemOverSerialTL extends OverrideHarnessBinder({
ports.map({ port => ports.map({ port =>
// DOC include start: HarnessClockInstantiatorEx // DOC include start: HarnessClockInstantiatorEx
val memOverSerialTLClockBundle = p(HarnessClockInstantiatorKey).requestClockBundle("mem_over_serial_tl_clock", memFreq) withClockAndReset(th.harnessClock, th.harnessReset) {
val harnessMultiClockAXIRAM = SerialAdapter.connectHarnessMultiClockAXIRAM( val memOverSerialTLClockBundle = p(HarnessClockInstantiatorKey).requestClockBundle("mem_over_serial_tl_clock", memFreq)
system.serdesser.get, val serial_bits = SerialAdapter.asyncQueue(port, th.harnessClock, th.harnessReset)
port, val harnessMultiClockAXIRAM = SerialAdapter.connectHarnessMultiClockAXIRAM(
memOverSerialTLClockBundle, system.serdesser.get,
th.harnessReset) serial_bits,
memOverSerialTLClockBundle,
th.harnessReset)
// DOC include end: HarnessClockInstantiatorEx // DOC include end: HarnessClockInstantiatorEx
val success = SerialAdapter.connectSimSerial(harnessMultiClockAXIRAM.module.io.tsi_ser, port.clock, th.harnessReset.asBool) val success = SerialAdapter.connectSimSerial(harnessMultiClockAXIRAM.module.io.tsi_ser, th.harnessClock, th.harnessReset.asBool)
when (success) { th.success := true.B } when (success) { th.success := true.B }
// connect SimDRAM from the AXI port coming from the harness multi clock axi ram // connect SimDRAM from the AXI port coming from the harness multi clock axi ram
(harnessMultiClockAXIRAM.mem_axi4 zip harnessMultiClockAXIRAM.memNode.edges.in).map { case (axi_port, edge) => (harnessMultiClockAXIRAM.mem_axi4 zip harnessMultiClockAXIRAM.memNode.edges.in).map { case (axi_port, edge) =>
val memSize = sVal.memParams.size val memSize = sVal.memParams.size
val lineSize = p(CacheBlockBytes) val lineSize = p(CacheBlockBytes)
val mem = Module(new SimDRAM(memSize, lineSize, BigInt(memFreq.toInt), edge.bundle)).suggestName("simdram") val mem = Module(new SimDRAM(memSize, lineSize, BigInt(memFreq.toInt), edge.bundle)).suggestName("simdram")
mem.io.axi <> axi_port.bits mem.io.axi <> axi_port.bits
mem.io.clock := axi_port.clock mem.io.clock := axi_port.clock
mem.io.reset := axi_port.reset mem.io.reset := axi_port.reset
}
} }
}) })
}) })
@@ -279,8 +282,11 @@ class WithSerialAdapterTiedOff extends OverrideHarnessBinder({
(system: CanHavePeripheryTLSerial, th: HasHarnessSignalReferences, ports: Seq[ClockedIO[SerialIO]]) => { (system: CanHavePeripheryTLSerial, th: HasHarnessSignalReferences, ports: Seq[ClockedIO[SerialIO]]) => {
implicit val p = chipyard.iobinders.GetSystemParameters(system) implicit val p = chipyard.iobinders.GetSystemParameters(system)
ports.map({ port => ports.map({ port =>
val ram = SerialAdapter.connectHarnessRAM(system.serdesser.get, port, th.harnessReset) val bits = SerialAdapter.asyncQueue(port, th.harnessClock, th.harnessReset)
SerialAdapter.tieoff(ram.module.io.tsi_ser) withClockAndReset(th.harnessClock, th.harnessReset) {
val ram = SerialAdapter.connectHarnessRAM(system.serdesser.get, bits, th.harnessReset)
SerialAdapter.tieoff(ram.module.io.tsi_ser)
}
}) })
} }
}) })
@@ -289,9 +295,12 @@ class WithSimSerial extends OverrideHarnessBinder({
(system: CanHavePeripheryTLSerial, th: HasHarnessSignalReferences, ports: Seq[ClockedIO[SerialIO]]) => { (system: CanHavePeripheryTLSerial, th: HasHarnessSignalReferences, ports: Seq[ClockedIO[SerialIO]]) => {
implicit val p = chipyard.iobinders.GetSystemParameters(system) implicit val p = chipyard.iobinders.GetSystemParameters(system)
ports.map({ port => ports.map({ port =>
val ram = SerialAdapter.connectHarnessRAM(system.serdesser.get, port, th.harnessReset) val bits = SerialAdapter.asyncQueue(port, th.harnessClock, th.harnessReset)
val success = SerialAdapter.connectSimSerial(ram.module.io.tsi_ser, port.clock, th.harnessReset.asBool) withClockAndReset(th.harnessClock, th.harnessReset) {
when (success) { th.success := true.B } val ram = SerialAdapter.connectHarnessRAM(system.serdesser.get, bits, th.harnessReset)
val success = SerialAdapter.connectSimSerial(ram.module.io.tsi_ser, th.harnessClock, th.harnessReset.asBool)
when (success) { th.success := true.B }
}
}) })
} }
}) })

View File

@@ -72,8 +72,11 @@ class WithSerialBridge extends OverrideHarnessBinder({
(system: CanHavePeripheryTLSerial, th: FireSim, ports: Seq[ClockedIO[SerialIO]]) => { (system: CanHavePeripheryTLSerial, th: FireSim, ports: Seq[ClockedIO[SerialIO]]) => {
ports.map { port => ports.map { port =>
implicit val p = GetSystemParameters(system) implicit val p = GetSystemParameters(system)
val ram = SerialAdapter.connectHarnessRAM(system.serdesser.get, port, th.harnessReset) val bits = SerialAdapter.asyncQueue(port, th.harnessClock, th.harnessReset)
SerialBridge(port.clock, ram.module.io.tsi_ser, p(ExtMem).map(_ => MainMemoryConsts.globalName)) val ram = withClockAndReset(th.harnessClock, th.harnessReset) {
SerialAdapter.connectHarnessRAM(system.serdesser.get, bits, th.harnessReset)
}
SerialBridge(th.harnessClock, ram.module.io.tsi_ser, p(ExtMem).map(_ => MainMemoryConsts.globalName))
} }
Nil Nil
} }
@@ -122,12 +125,16 @@ class WithAXIOverSerialTLCombinedBridges extends OverrideHarnessBinder({
axiClockBundle.clock := axiClock axiClockBundle.clock := axiClock
axiClockBundle.reset := ResetCatchAndSync(axiClock, th.harnessReset.asBool) axiClockBundle.reset := ResetCatchAndSync(axiClock, th.harnessReset.asBool)
val harnessMultiClockAXIRAM = SerialAdapter.connectHarnessMultiClockAXIRAM( val serial_bits = SerialAdapter.asyncQueue(port, th.harnessClock, th.harnessReset)
system.serdesser.get,
port, val harnessMultiClockAXIRAM = withClockAndReset(th.harnessClock, th.harnessReset) {
axiClockBundle, SerialAdapter.connectHarnessMultiClockAXIRAM(
th.harnessReset) system.serdesser.get,
SerialBridge(port.clock, harnessMultiClockAXIRAM.module.io.tsi_ser, Some(MainMemoryConsts.globalName)) port,
axiClockBundle,
th.harnessReset)
}
SerialBridge(th.harnessClock, harnessMultiClockAXIRAM.module.io.tsi_ser, Some(MainMemoryConsts.globalName))
// connect SimAxiMem // connect SimAxiMem
(harnessMultiClockAXIRAM.mem_axi4 zip harnessMultiClockAXIRAM.memNode.edges.in).map { case (axi4, edge) => (harnessMultiClockAXIRAM.mem_axi4 zip harnessMultiClockAXIRAM.memNode.edges.in).map { case (axi4, edge) =>