1
0

tilelink2 Parameters: poison ports with unsafe atomics

We need to detect if an AtomicAutomata's output ever gets mixed
with some other source of operations.
This commit is contained in:
Wesley W. Terpstra 2016-09-19 12:27:14 -07:00
parent d1151e2f0f
commit f5d604d8f8
2 changed files with 10 additions and 7 deletions

View File

@ -289,7 +289,10 @@ case class TLClientParameters(
val name = nodePath.lastOption.map(_.lazyModule.name).getOrElse("disconnected") val name = nodePath.lastOption.map(_.lazyModule.name).getOrElse("disconnected")
} }
case class TLClientPortParameters(clients: Seq[TLClientParameters]) { case class TLClientPortParameters(
clients: Seq[TLClientParameters],
unsafeAtomics: Boolean = false) // Atomics are executed as get+put
{
require (!clients.isEmpty) require (!clients.isEmpty)
// Require disjoint ranges for Ids // Require disjoint ranges for Ids

View File

@ -45,24 +45,24 @@ class TLXbar(policy: (Vec[Bool], Bool) => Seq[Bool] = TLXbar.lowestIndex) extend
numClientPorts = 1 to 32, numClientPorts = 1 to 32,
numManagerPorts = 1 to 32, numManagerPorts = 1 to 32,
clientFn = { seq => clientFn = { seq =>
val clients = (mapInputIds(seq) zip seq) flatMap { case (range, port) => // An unsafe atomic port can not be combined with any other!
require (!seq.exists(_.unsafeAtomics) || seq.size == 1)
seq(0).copy(clients = (mapInputIds(seq) zip seq) flatMap { case (range, port) =>
port.clients map { client => client.copy( port.clients map { client => client.copy(
sourceId = client.sourceId.shift(range.start) sourceId = client.sourceId.shift(range.start)
)} )}
} })
TLClientPortParameters(clients)
}, },
managerFn = { seq => managerFn = { seq =>
val fifoIdFactory = relabeler() val fifoIdFactory = relabeler()
val managers = (mapOutputIds(seq) zip seq) flatMap { case (range, port) => seq(0).copy(managers = (mapOutputIds(seq) zip seq) flatMap { case (range, port) =>
require (port.beatBytes == seq(0).beatBytes) require (port.beatBytes == seq(0).beatBytes)
val fifoIdMapper = fifoIdFactory() val fifoIdMapper = fifoIdFactory()
port.managers map { manager => manager.copy( port.managers map { manager => manager.copy(
sinkId = manager.sinkId.shift(range.start), sinkId = manager.sinkId.shift(range.start),
fifoId = manager.fifoId.map(fifoIdMapper(_)) fifoId = manager.fifoId.map(fifoIdMapper(_))
)} )}
} })
TLManagerPortParameters(managers, seq(0).beatBytes)
}) })
lazy val module = new LazyModuleImp(this) { lazy val module = new LazyModuleImp(this) {