tilelink2: statically check Operations are remotely plausible
This commit is contained in:
		@@ -11,6 +11,7 @@ class TLEdgeOut(
 | 
			
		||||
{
 | 
			
		||||
  // Transfers
 | 
			
		||||
  def Acquire(fromSource: UInt, toAddress: UInt, lgSize: UInt, growPermissions: UInt) = {
 | 
			
		||||
    require (manager.anySupportAcquire)
 | 
			
		||||
    val legal = manager.supportsAcquire(toAddress, lgSize)
 | 
			
		||||
    val a = new TLBundleA(bundle)
 | 
			
		||||
    a.opcode  := TLMessages.Acquire
 | 
			
		||||
@@ -24,6 +25,7 @@ class TLEdgeOut(
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  def Release(fromSource: UInt, toAddress: UInt, lgSize: UInt, shrinkPermissions: UInt) = {
 | 
			
		||||
    require (manager.anySupportAcquire)
 | 
			
		||||
    val legal = manager.supportsAcquire(toAddress, lgSize)
 | 
			
		||||
    val c = new TLBundleC(bundle)
 | 
			
		||||
    c.opcode  := TLMessages.Release
 | 
			
		||||
@@ -37,6 +39,7 @@ class TLEdgeOut(
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  def Release(fromSource: UInt, toAddress: UInt, lgSize: UInt, shrinkPermissions: UInt, data: UInt) = {
 | 
			
		||||
    require (manager.anySupportAcquire)
 | 
			
		||||
    val legal = manager.supportsAcquire(toAddress, lgSize)
 | 
			
		||||
    val c = new TLBundleC(bundle)
 | 
			
		||||
    c.opcode  := TLMessages.ReleaseData
 | 
			
		||||
@@ -81,6 +84,7 @@ class TLEdgeOut(
 | 
			
		||||
 | 
			
		||||
  // Accesses
 | 
			
		||||
  def Get(fromSource: UInt, toAddress: UInt, lgSize: UInt) = {
 | 
			
		||||
    require (manager.anySupportGet)
 | 
			
		||||
    val legal = manager.supportsGet(toAddress, lgSize)
 | 
			
		||||
    val a = new TLBundleA(bundle)
 | 
			
		||||
    a.opcode  := TLMessages.Get
 | 
			
		||||
@@ -94,6 +98,7 @@ class TLEdgeOut(
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  def Put(fromSource: UInt, toAddress: UInt, lgSize: UInt, data: UInt) = {
 | 
			
		||||
    require (manager.anySupportPutFull)
 | 
			
		||||
    val legal = manager.supportsPutFull(toAddress, lgSize)
 | 
			
		||||
    val a = new TLBundleA(bundle)
 | 
			
		||||
    a.opcode  := TLMessages.PutFullData
 | 
			
		||||
@@ -107,6 +112,7 @@ class TLEdgeOut(
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  def Put(fromSource: UInt, toAddress: UInt, lgSize: UInt, data: UInt, wmask: UInt) = {
 | 
			
		||||
    require (manager.anySupportPutPartial)
 | 
			
		||||
    val legal = manager.supportsPutPartial(toAddress, lgSize)
 | 
			
		||||
    val a = new TLBundleA(bundle)
 | 
			
		||||
    a.opcode  := TLMessages.PutPartialData
 | 
			
		||||
@@ -120,6 +126,7 @@ class TLEdgeOut(
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  def Arithmetic(fromSource: UInt, toAddress: UInt, lgSize: UInt, data: UInt, atomic: UInt) = {
 | 
			
		||||
    require (manager.anySupportArithmetic)
 | 
			
		||||
    val legal = manager.supportsArithmetic(toAddress, lgSize)
 | 
			
		||||
    val a = new TLBundleA(bundle)
 | 
			
		||||
    a.opcode  := TLMessages.ArithmeticData
 | 
			
		||||
@@ -133,6 +140,7 @@ class TLEdgeOut(
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  def Logical(fromSource: UInt, toAddress: UInt, lgSize: UInt, data: UInt, atomic: UInt) = {
 | 
			
		||||
    require (manager.anySupportLogical)
 | 
			
		||||
    val legal = manager.supportsLogical(toAddress, lgSize)
 | 
			
		||||
    val a = new TLBundleA(bundle)
 | 
			
		||||
    a.opcode  := TLMessages.LogicalData
 | 
			
		||||
@@ -146,6 +154,7 @@ class TLEdgeOut(
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  def Hint(fromSource: UInt, toAddress: UInt, lgSize: UInt, param: UInt) = {
 | 
			
		||||
    require (manager.anySupportHint)
 | 
			
		||||
    val legal = manager.supportsHint(toAddress)
 | 
			
		||||
    val a = new TLBundleA(bundle)
 | 
			
		||||
    a.opcode  := TLMessages.Hint
 | 
			
		||||
@@ -190,6 +199,7 @@ class TLEdgeIn(
 | 
			
		||||
{
 | 
			
		||||
  // Transfers
 | 
			
		||||
  def Probe(fromAddress: UInt, toSource: UInt, lgSize: UInt, capPermissions: UInt) = {
 | 
			
		||||
    require (client.anySupportProbe)
 | 
			
		||||
    val legal = client.supportsProbe(fromAddress, lgSize)
 | 
			
		||||
    val b = new TLBundleB(bundle)
 | 
			
		||||
    b.opcode  := TLMessages.Probe
 | 
			
		||||
@@ -240,6 +250,7 @@ class TLEdgeIn(
 | 
			
		||||
 | 
			
		||||
  // Accesses
 | 
			
		||||
  def Get(fromAddress: UInt, toSource: UInt, lgSize: UInt) = {
 | 
			
		||||
    require (client.anySupportGet)
 | 
			
		||||
    val legal = client.supportsGet(toSource, lgSize)
 | 
			
		||||
    val b = new TLBundleB(bundle)
 | 
			
		||||
    b.opcode  := TLMessages.Get
 | 
			
		||||
@@ -253,6 +264,7 @@ class TLEdgeIn(
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  def Put(fromAddress: UInt, toSource: UInt, lgSize: UInt, data: UInt) = {
 | 
			
		||||
    require (client.anySupportPutFull)
 | 
			
		||||
    val legal = client.supportsPutFull(toSource, lgSize)
 | 
			
		||||
    val b = new TLBundleB(bundle)
 | 
			
		||||
    b.opcode  := TLMessages.PutFullData
 | 
			
		||||
@@ -266,6 +278,7 @@ class TLEdgeIn(
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  def Put(fromAddress: UInt, toSource: UInt, lgSize: UInt, data: UInt, wmask: UInt) = {
 | 
			
		||||
    require (client.anySupportPutPartial)
 | 
			
		||||
    val legal = client.supportsPutPartial(toSource, lgSize)
 | 
			
		||||
    val b = new TLBundleB(bundle)
 | 
			
		||||
    b.opcode  := TLMessages.PutPartialData
 | 
			
		||||
@@ -279,6 +292,7 @@ class TLEdgeIn(
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  def Arithmetic(fromAddress: UInt, toSource: UInt, lgSize: UInt, data: UInt, atomic: UInt) = {
 | 
			
		||||
    require (client.anySupportArithmetic)
 | 
			
		||||
    val legal = client.supportsArithmetic(toSource, lgSize)
 | 
			
		||||
    val b = new TLBundleB(bundle)
 | 
			
		||||
    b.opcode  := TLMessages.ArithmeticData
 | 
			
		||||
@@ -292,6 +306,7 @@ class TLEdgeIn(
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  def Logical(fromAddress: UInt, toSource: UInt, lgSize: UInt, data: UInt, atomic: UInt) = {
 | 
			
		||||
    require (client.anySupportLogical)
 | 
			
		||||
    val legal = client.supportsLogical(toSource, lgSize)
 | 
			
		||||
    val b = new TLBundleB(bundle)
 | 
			
		||||
    b.opcode  := TLMessages.LogicalData
 | 
			
		||||
@@ -305,6 +320,7 @@ class TLEdgeIn(
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  def Hint(fromAddress: UInt, toSource: UInt, lgSize: UInt, param: UInt) = {
 | 
			
		||||
    require (client.anySupportHint)
 | 
			
		||||
    val legal = client.supportsHint(toSource)
 | 
			
		||||
    val b = new TLBundleB(bundle)
 | 
			
		||||
    b.opcode  := TLMessages.Hint
 | 
			
		||||
 
 | 
			
		||||
@@ -147,6 +147,15 @@ case class TLManagerPortParameters(managers: Seq[TLManagerParameters], beatBytes
 | 
			
		||||
  val allSupportPutPartial = managers.map(_.supportsPutPartial).reduce(_ intersect _)
 | 
			
		||||
  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
 | 
			
		||||
  def find(address: BigInt) = managers.find(_.address.exists(_.contains(address)))
 | 
			
		||||
  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 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
 | 
			
		||||
  def find(id: Int) = clients.find(_.sourceId.contains(id))
 | 
			
		||||
  
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user