@@ -288,16 +288,18 @@ class WithExtInterruptIOCells extends OverrideIOBinder({
288288})
289289
290290// Rocketchip's JTAGIO exposes the oe signal, which doesn't go off-chip
291- class JTAGChipIO extends Bundle {
291+ class JTAGChipIO ( hasReset : Boolean ) extends Bundle {
292292 val TCK = Input (Clock ())
293293 val TMS = Input (Bool ())
294294 val TDI = Input (Bool ())
295295 val TDO = Output (Bool ())
296+ val reset = Option .when(hasReset)(Input (Bool ()))
296297}
297298
298299// WARNING: Don't disable syncReset unless you are trying to
299300// get around bugs in RTL simulators
300- class WithDebugIOCells (syncReset : Boolean = true ) extends OverrideLazyIOBinder ({
301+ // If externalReset, exposes a reset in through JTAGChipIO, which is sync'd to TCK
302+ class WithDebugIOCells (syncReset : Boolean = true , externalReset : Boolean = true ) extends OverrideLazyIOBinder ({
301303 (system : HasPeripheryDebug ) => {
302304 implicit val p = GetSystemParameters (system)
303305 val tlbus = system.asInstanceOf [BaseSubsystem ].locateTLBusWrapper(p(ExportDebug ).slaveWhere)
@@ -319,13 +321,6 @@ class WithDebugIOCells(syncReset: Boolean = true) extends OverrideLazyIOBinder({
319321 }
320322 // Tie off disableDebug
321323 d.disableDebug.foreach { d => d := false .B }
322- // Drive JTAG on-chip IOs
323- d.systemjtag.map { j =>
324- j.reset := (if (syncReset) ResetCatchAndSync (j.jtag.TCK , clockBundle.reset.asBool) else clockBundle.reset.asBool)
325- j.mfr_id := p(JtagDTMKey ).idcodeManufId.U (11 .W )
326- j.part_number := p(JtagDTMKey ).idcodePartNum.U (16 .W )
327- j.version := p(JtagDTMKey ).idcodeVersion.U (4 .W )
328- }
329324 }
330325 Debug .connectDebugClockAndReset(Some (debug), clockBundle.clock)
331326
@@ -336,7 +331,15 @@ class WithDebugIOCells(syncReset: Boolean = true) extends OverrideLazyIOBinder({
336331 }
337332
338333 val jtagTuple = debug.systemjtag.map { j =>
339- val jtag_wire = Wire (new JTAGChipIO )
334+ val jtag_wire = Wire (new JTAGChipIO (externalReset))
335+
336+ // Drive JTAG on-chip IOs
337+ val jReset = if (externalReset) jtag_wire.reset.get else clockBundle.reset.asBool
338+ j.reset := (if (syncReset) ResetCatchAndSync (j.jtag.TCK , jReset) else jReset)
339+ j.mfr_id := p(JtagDTMKey ).idcodeManufId.U (11 .W )
340+ j.part_number := p(JtagDTMKey ).idcodePartNum.U (16 .W )
341+ j.version := p(JtagDTMKey ).idcodeVersion.U (4 .W )
342+
340343 j.jtag.TCK := jtag_wire.TCK
341344 j.jtag.TMS := jtag_wire.TMS
342345 j.jtag.TDI := jtag_wire.TDI
0 commit comments