Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix no-debug-node designs (backport #3322) #3323

Merged
merged 1 commit into from
Apr 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/scala/devices/debug/Periphery.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import freechips.rocketchip.jtag._
import freechips.rocketchip.util._
import freechips.rocketchip.prci.{ClockSinkParameters, ClockSinkNode}
import freechips.rocketchip.tilelink._
import freechips.rocketchip.interrupts.{NullIntSyncSource}
import freechips.rocketchip.interrupts.{NullIntSyncSource, IntSyncXbar}

/** Protocols used for communicating with external debugging tools */
sealed trait DebugExportProtocol
Expand Down Expand Up @@ -99,7 +99,7 @@ trait HasPeripheryDebug { this: BaseSubsystem =>
tlDM
}

lazy val debugNode = debugOpt.map(_.intnode).getOrElse(NullIntSyncSource())
lazy val debugNode = debugOpt.map(_.intnode).getOrElse(IntSyncXbar() := NullIntSyncSource())

val psd = InModuleBody {
val psd = IO(new PSDIO)
Expand Down
8 changes: 8 additions & 0 deletions src/main/scala/interrupts/Nodes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,11 @@ case class IntSyncSinkNode(sync: Int)(implicit valName: ValName)
{
override lazy val nodedebugstring = s"sync:${sync}"
}

case class IntSyncNexusNode(
sourceFn: Seq[IntSourcePortParameters] => IntSourcePortParameters,
sinkFn: Seq[IntSinkPortParameters] => IntSinkPortParameters,
inputRequiresOutput: Boolean = true,
outputRequiresInput: Boolean = true)(
implicit valName: ValName)
extends NexusNode(IntSyncImp)(sourceFn, sinkFn, inputRequiresOutput, outputRequiresInput) with IntFormatNode
29 changes: 28 additions & 1 deletion src/main/scala/interrupts/Xbar.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,36 @@ class IntXbar()(implicit p: Parameters) extends LazyModule
}
}

class IntSyncXbar()(implicit p: Parameters) extends LazyModule
{
val intnode = new IntSyncNexusNode(
sinkFn = { _ => IntSinkPortParameters(Seq(IntSinkParameters())) },
sourceFn = { seq =>
IntSourcePortParameters((seq zip seq.map(_.num).scanLeft(0)(_+_).init).map {
case (s, o) => s.sources.map(z => z.copy(range = z.range.offset(o)))
}.flatten)
})
{
override def circuitIdentity = outputs == 1 && inputs == 1
}

lazy val module = new Impl
class Impl extends LazyModuleImp(this) {
val cat = intnode.in.map { case (i, e) => i.sync.take(e.source.num) }.flatten
intnode.out.foreach { case (o, _) => o.sync := cat }
}
}

object IntXbar {
def apply(implicit p: Parameters): IntNode = {
def apply()(implicit p: Parameters): IntNode = {
val xbar = LazyModule(new IntXbar)
xbar.intnode
}
}

object IntSyncXbar {
def apply()(implicit p: Parameters): IntSyncNode = {
val xbar = LazyModule(new IntSyncXbar)
xbar.intnode
}
}
6 changes: 3 additions & 3 deletions src/main/scala/subsystem/HasTiles.scala
Original file line number Diff line number Diff line change
Expand Up @@ -205,15 +205,15 @@ trait HasTileInputConstants extends InstantiatesTiles { this: BaseSubsystem =>
* They need to be instantiated before tiles are attached to the subsystem containing them.
*/
trait HasTileNotificationSinks { this: LazyModule =>
val tileHaltXbarNode = IntXbar(p)
val tileHaltXbarNode = IntXbar()
val tileHaltSinkNode = IntSinkNode(IntSinkPortSimple())
tileHaltSinkNode := tileHaltXbarNode

val tileWFIXbarNode = IntXbar(p)
val tileWFIXbarNode = IntXbar()
val tileWFISinkNode = IntSinkNode(IntSinkPortSimple())
tileWFISinkNode := tileWFIXbarNode

val tileCeaseXbarNode = IntXbar(p)
val tileCeaseXbarNode = IntXbar()
val tileCeaseSinkNode = IntSinkNode(IntSinkPortSimple())
tileCeaseSinkNode := tileCeaseXbarNode
}
Expand Down