1
0

tilelink2: statically check Operations are remotely plausible

This commit is contained in:
Wesley W. Terpstra 2016-08-22 13:28:52 -07:00
parent 8cff45f254
commit 6599bcb77b
2 changed files with 34 additions and 0 deletions

View File

@ -11,6 +11,7 @@ class TLEdgeOut(
{ {
// Transfers // Transfers
def Acquire(fromSource: UInt, toAddress: UInt, lgSize: UInt, growPermissions: UInt) = { def Acquire(fromSource: UInt, toAddress: UInt, lgSize: UInt, growPermissions: UInt) = {
require (manager.anySupportAcquire)
val legal = manager.supportsAcquire(toAddress, lgSize) val legal = manager.supportsAcquire(toAddress, lgSize)
val a = new TLBundleA(bundle) val a = new TLBundleA(bundle)
a.opcode := TLMessages.Acquire a.opcode := TLMessages.Acquire
@ -24,6 +25,7 @@ class TLEdgeOut(
} }
def Release(fromSource: UInt, toAddress: UInt, lgSize: UInt, shrinkPermissions: UInt) = { def Release(fromSource: UInt, toAddress: UInt, lgSize: UInt, shrinkPermissions: UInt) = {
require (manager.anySupportAcquire)
val legal = manager.supportsAcquire(toAddress, lgSize) val legal = manager.supportsAcquire(toAddress, lgSize)
val c = new TLBundleC(bundle) val c = new TLBundleC(bundle)
c.opcode := TLMessages.Release c.opcode := TLMessages.Release
@ -37,6 +39,7 @@ class TLEdgeOut(
} }
def Release(fromSource: UInt, toAddress: UInt, lgSize: UInt, shrinkPermissions: UInt, data: UInt) = { def Release(fromSource: UInt, toAddress: UInt, lgSize: UInt, shrinkPermissions: UInt, data: UInt) = {
require (manager.anySupportAcquire)
val legal = manager.supportsAcquire(toAddress, lgSize) val legal = manager.supportsAcquire(toAddress, lgSize)
val c = new TLBundleC(bundle) val c = new TLBundleC(bundle)
c.opcode := TLMessages.ReleaseData c.opcode := TLMessages.ReleaseData
@ -81,6 +84,7 @@ class TLEdgeOut(
// Accesses // Accesses
def Get(fromSource: UInt, toAddress: UInt, lgSize: UInt) = { def Get(fromSource: UInt, toAddress: UInt, lgSize: UInt) = {
require (manager.anySupportGet)
val legal = manager.supportsGet(toAddress, lgSize) val legal = manager.supportsGet(toAddress, lgSize)
val a = new TLBundleA(bundle) val a = new TLBundleA(bundle)
a.opcode := TLMessages.Get a.opcode := TLMessages.Get
@ -94,6 +98,7 @@ class TLEdgeOut(
} }
def Put(fromSource: UInt, toAddress: UInt, lgSize: UInt, data: UInt) = { def Put(fromSource: UInt, toAddress: UInt, lgSize: UInt, data: UInt) = {
require (manager.anySupportPutFull)
val legal = manager.supportsPutFull(toAddress, lgSize) val legal = manager.supportsPutFull(toAddress, lgSize)
val a = new TLBundleA(bundle) val a = new TLBundleA(bundle)
a.opcode := TLMessages.PutFullData a.opcode := TLMessages.PutFullData
@ -107,6 +112,7 @@ class TLEdgeOut(
} }
def Put(fromSource: UInt, toAddress: UInt, lgSize: UInt, data: UInt, wmask: UInt) = { def Put(fromSource: UInt, toAddress: UInt, lgSize: UInt, data: UInt, wmask: UInt) = {
require (manager.anySupportPutPartial)
val legal = manager.supportsPutPartial(toAddress, lgSize) val legal = manager.supportsPutPartial(toAddress, lgSize)
val a = new TLBundleA(bundle) val a = new TLBundleA(bundle)
a.opcode := TLMessages.PutPartialData a.opcode := TLMessages.PutPartialData
@ -120,6 +126,7 @@ class TLEdgeOut(
} }
def Arithmetic(fromSource: UInt, toAddress: UInt, lgSize: UInt, data: UInt, atomic: UInt) = { def Arithmetic(fromSource: UInt, toAddress: UInt, lgSize: UInt, data: UInt, atomic: UInt) = {
require (manager.anySupportArithmetic)
val legal = manager.supportsArithmetic(toAddress, lgSize) val legal = manager.supportsArithmetic(toAddress, lgSize)
val a = new TLBundleA(bundle) val a = new TLBundleA(bundle)
a.opcode := TLMessages.ArithmeticData a.opcode := TLMessages.ArithmeticData
@ -133,6 +140,7 @@ class TLEdgeOut(
} }
def Logical(fromSource: UInt, toAddress: UInt, lgSize: UInt, data: UInt, atomic: UInt) = { def Logical(fromSource: UInt, toAddress: UInt, lgSize: UInt, data: UInt, atomic: UInt) = {
require (manager.anySupportLogical)
val legal = manager.supportsLogical(toAddress, lgSize) val legal = manager.supportsLogical(toAddress, lgSize)
val a = new TLBundleA(bundle) val a = new TLBundleA(bundle)
a.opcode := TLMessages.LogicalData a.opcode := TLMessages.LogicalData
@ -146,6 +154,7 @@ class TLEdgeOut(
} }
def Hint(fromSource: UInt, toAddress: UInt, lgSize: UInt, param: UInt) = { def Hint(fromSource: UInt, toAddress: UInt, lgSize: UInt, param: UInt) = {
require (manager.anySupportHint)
val legal = manager.supportsHint(toAddress) val legal = manager.supportsHint(toAddress)
val a = new TLBundleA(bundle) val a = new TLBundleA(bundle)
a.opcode := TLMessages.Hint a.opcode := TLMessages.Hint
@ -190,6 +199,7 @@ class TLEdgeIn(
{ {
// Transfers // Transfers
def Probe(fromAddress: UInt, toSource: UInt, lgSize: UInt, capPermissions: UInt) = { def Probe(fromAddress: UInt, toSource: UInt, lgSize: UInt, capPermissions: UInt) = {
require (client.anySupportProbe)
val legal = client.supportsProbe(fromAddress, lgSize) val legal = client.supportsProbe(fromAddress, lgSize)
val b = new TLBundleB(bundle) val b = new TLBundleB(bundle)
b.opcode := TLMessages.Probe b.opcode := TLMessages.Probe
@ -240,6 +250,7 @@ class TLEdgeIn(
// Accesses // Accesses
def Get(fromAddress: UInt, toSource: UInt, lgSize: UInt) = { def Get(fromAddress: UInt, toSource: UInt, lgSize: UInt) = {
require (client.anySupportGet)
val legal = client.supportsGet(toSource, lgSize) val legal = client.supportsGet(toSource, lgSize)
val b = new TLBundleB(bundle) val b = new TLBundleB(bundle)
b.opcode := TLMessages.Get b.opcode := TLMessages.Get
@ -253,6 +264,7 @@ class TLEdgeIn(
} }
def Put(fromAddress: UInt, toSource: UInt, lgSize: UInt, data: UInt) = { def Put(fromAddress: UInt, toSource: UInt, lgSize: UInt, data: UInt) = {
require (client.anySupportPutFull)
val legal = client.supportsPutFull(toSource, lgSize) val legal = client.supportsPutFull(toSource, lgSize)
val b = new TLBundleB(bundle) val b = new TLBundleB(bundle)
b.opcode := TLMessages.PutFullData b.opcode := TLMessages.PutFullData
@ -266,6 +278,7 @@ class TLEdgeIn(
} }
def Put(fromAddress: UInt, toSource: UInt, lgSize: UInt, data: UInt, wmask: UInt) = { def Put(fromAddress: UInt, toSource: UInt, lgSize: UInt, data: UInt, wmask: UInt) = {
require (client.anySupportPutPartial)
val legal = client.supportsPutPartial(toSource, lgSize) val legal = client.supportsPutPartial(toSource, lgSize)
val b = new TLBundleB(bundle) val b = new TLBundleB(bundle)
b.opcode := TLMessages.PutPartialData b.opcode := TLMessages.PutPartialData
@ -279,6 +292,7 @@ class TLEdgeIn(
} }
def Arithmetic(fromAddress: UInt, toSource: UInt, lgSize: UInt, data: UInt, atomic: UInt) = { def Arithmetic(fromAddress: UInt, toSource: UInt, lgSize: UInt, data: UInt, atomic: UInt) = {
require (client.anySupportArithmetic)
val legal = client.supportsArithmetic(toSource, lgSize) val legal = client.supportsArithmetic(toSource, lgSize)
val b = new TLBundleB(bundle) val b = new TLBundleB(bundle)
b.opcode := TLMessages.ArithmeticData b.opcode := TLMessages.ArithmeticData
@ -292,6 +306,7 @@ class TLEdgeIn(
} }
def Logical(fromAddress: UInt, toSource: UInt, lgSize: UInt, data: UInt, atomic: UInt) = { def Logical(fromAddress: UInt, toSource: UInt, lgSize: UInt, data: UInt, atomic: UInt) = {
require (client.anySupportLogical)
val legal = client.supportsLogical(toSource, lgSize) val legal = client.supportsLogical(toSource, lgSize)
val b = new TLBundleB(bundle) val b = new TLBundleB(bundle)
b.opcode := TLMessages.LogicalData b.opcode := TLMessages.LogicalData
@ -305,6 +320,7 @@ class TLEdgeIn(
} }
def Hint(fromAddress: UInt, toSource: UInt, lgSize: UInt, param: UInt) = { def Hint(fromAddress: UInt, toSource: UInt, lgSize: UInt, param: UInt) = {
require (client.anySupportHint)
val legal = client.supportsHint(toSource) val legal = client.supportsHint(toSource)
val b = new TLBundleB(bundle) val b = new TLBundleB(bundle)
b.opcode := TLMessages.Hint b.opcode := TLMessages.Hint

View File

@ -147,6 +147,15 @@ case class TLManagerPortParameters(managers: Seq[TLManagerParameters], beatBytes
val allSupportPutPartial = managers.map(_.supportsPutPartial).reduce(_ intersect _) val allSupportPutPartial = managers.map(_.supportsPutPartial).reduce(_ intersect _)
val allSupportHint = managers.map(_.supportsHint) .reduce(_ && _) val allSupportHint = managers.map(_.supportsHint) .reduce(_ && _)
// Operation supported by at least one outward Managers
val anySupportAcquire = managers.map(!_.supportsAcquire.none) .reduce(_ || _)
val anySupportArithmetic = managers.map(!_.supportsArithmetic.none).reduce(_ || _)
val anySupportLogical = managers.map(!_.supportsLogical.none) .reduce(_ || _)
val anySupportGet = managers.map(!_.supportsGet.none) .reduce(_ || _)
val anySupportPutFull = managers.map(!_.supportsPutFull.none) .reduce(_ || _)
val anySupportPutPartial = managers.map(!_.supportsPutPartial.none).reduce(_ || _)
val anySupportHint = managers.map( _.supportsHint) .reduce(_ || _)
// These return Option[TLManagerParameters] for your convenience // These return Option[TLManagerParameters] for your convenience
def find(address: BigInt) = managers.find(_.address.exists(_.contains(address))) def find(address: BigInt) = managers.find(_.address.exists(_.contains(address)))
def findById(id: Int) = managers.find(_.sinkId.contains(id)) def findById(id: Int) = managers.find(_.sinkId.contains(id))
@ -216,6 +225,15 @@ case class TLClientPortParameters(clients: Seq[TLClientParameters]) {
val allSupportPutPartial = clients.map(_.supportsPutPartial).reduce(_ intersect _) val allSupportPutPartial = clients.map(_.supportsPutPartial).reduce(_ intersect _)
val allSupportHint = clients.map(_.supportsHint) .reduce(_ && _) val allSupportHint = clients.map(_.supportsHint) .reduce(_ && _)
// Operation is supported by at least one client
val anySupportProbe = clients.map(!_.supportsProbe.none) .reduce(_ || _)
val anySupportArithmetic = clients.map(!_.supportsArithmetic.none).reduce(_ || _)
val anySupportLogical = clients.map(!_.supportsLogical.none) .reduce(_ || _)
val anySupportGet = clients.map(!_.supportsGet.none) .reduce(_ || _)
val anySupportPutFull = clients.map(!_.supportsPutFull.none) .reduce(_ || _)
val anySupportPutPartial = clients.map(!_.supportsPutPartial.none).reduce(_ || _)
val anySupportHint = clients.map( _.supportsHint) .reduce(_ || _)
// These return Option[TLClientParameters] for your convenience // These return Option[TLClientParameters] for your convenience
def find(id: Int) = clients.find(_.sourceId.contains(id)) def find(id: Int) = clients.find(_.sourceId.contains(id))