1
0

tilelink: use the Monitor to enforce Probe sourcing

This commit is contained in:
Wesley W. Terpstra 2017-07-28 18:08:00 -07:00
parent 573890e102
commit a0db929003

View File

@ -106,10 +106,12 @@ class TLMonitor(args: TLMonitorArgs) extends TLMonitorBase(args)
val address_ok = edge.manager.containsSafe(edge.address(bundle)) val address_ok = edge.manager.containsSafe(edge.address(bundle))
val is_aligned = edge.isAligned(bundle.address, bundle.size) val is_aligned = edge.isAligned(bundle.address, bundle.size)
val mask = edge.full_mask(bundle) val mask = edge.full_mask(bundle)
val legal_source = Mux1H(edge.client.find(bundle.source), edge.client.clients.map(c => UInt(c.sourceId.start))) === bundle.source
when (bundle.opcode === TLMessages.Probe) { when (bundle.opcode === TLMessages.Probe) {
assert (edge.client.supportsProbe(bundle.source, bundle.size), "'B' channel carries Probe type unsupported by client" + extra) assert (edge.client.supportsProbe(bundle.source, bundle.size), "'B' channel carries Probe type unsupported by client" + extra)
assert (address_ok, "'B' channel Probe carries unmanaged address" + extra) assert (address_ok, "'B' channel Probe carries unmanaged address" + extra)
assert (legal_source, "'B' channel Probe carries source that is not first source" + extra)
assert (is_aligned, "'B' channel Probe address not aligned to size" + extra) assert (is_aligned, "'B' channel Probe address not aligned to size" + extra)
assert (TLPermissions.isCap(bundle.param), "'B' channel Probe carries invalid cap param" + extra) assert (TLPermissions.isCap(bundle.param), "'B' channel Probe carries invalid cap param" + extra)
assert (bundle.mask === mask, "'B' channel Probe contains invalid mask" + extra) assert (bundle.mask === mask, "'B' channel Probe contains invalid mask" + extra)
@ -118,6 +120,7 @@ class TLMonitor(args: TLMonitorArgs) extends TLMonitorBase(args)
when (bundle.opcode === TLMessages.Get) { when (bundle.opcode === TLMessages.Get) {
assert (edge.client.supportsGet(bundle.source, bundle.size), "'B' channel carries Get type unsupported by client" + extra) assert (edge.client.supportsGet(bundle.source, bundle.size), "'B' channel carries Get type unsupported by client" + extra)
assert (address_ok, "'B' channel Get carries unmanaged address" + extra) assert (address_ok, "'B' channel Get carries unmanaged address" + extra)
assert (legal_source, "'B' channel Get carries source that is not first source" + extra)
assert (is_aligned, "'B' channel Get address not aligned to size" + extra) assert (is_aligned, "'B' channel Get address not aligned to size" + extra)
assert (bundle.param === UInt(0), "'B' channel Get carries invalid param" + extra) assert (bundle.param === UInt(0), "'B' channel Get carries invalid param" + extra)
assert (bundle.mask === mask, "'B' channel Get contains invalid mask" + extra) assert (bundle.mask === mask, "'B' channel Get contains invalid mask" + extra)
@ -126,6 +129,7 @@ class TLMonitor(args: TLMonitorArgs) extends TLMonitorBase(args)
when (bundle.opcode === TLMessages.PutFullData) { when (bundle.opcode === TLMessages.PutFullData) {
assert (edge.client.supportsPutFull(bundle.source, bundle.size), "'B' channel carries PutFull type unsupported by client" + extra) assert (edge.client.supportsPutFull(bundle.source, bundle.size), "'B' channel carries PutFull type unsupported by client" + extra)
assert (address_ok, "'B' channel PutFull carries unmanaged address" + extra) assert (address_ok, "'B' channel PutFull carries unmanaged address" + extra)
assert (legal_source, "'B' channel PutFull carries source that is not first source" + extra)
assert (is_aligned, "'B' channel PutFull address not aligned to size" + extra) assert (is_aligned, "'B' channel PutFull address not aligned to size" + extra)
assert (bundle.param === UInt(0), "'B' channel PutFull carries invalid param" + extra) assert (bundle.param === UInt(0), "'B' channel PutFull carries invalid param" + extra)
assert (bundle.mask === mask, "'B' channel PutFull contains invalid mask" + extra) assert (bundle.mask === mask, "'B' channel PutFull contains invalid mask" + extra)
@ -134,6 +138,7 @@ class TLMonitor(args: TLMonitorArgs) extends TLMonitorBase(args)
when (bundle.opcode === TLMessages.PutPartialData) { when (bundle.opcode === TLMessages.PutPartialData) {
assert (edge.client.supportsPutPartial(bundle.source, bundle.size), "'B' channel carries PutPartial type unsupported by client" + extra) assert (edge.client.supportsPutPartial(bundle.source, bundle.size), "'B' channel carries PutPartial type unsupported by client" + extra)
assert (address_ok, "'B' channel PutPartial carries unmanaged address" + extra) assert (address_ok, "'B' channel PutPartial carries unmanaged address" + extra)
assert (legal_source, "'B' channel PutPartial carries source that is not first source" + extra)
assert (is_aligned, "'B' channel PutPartial address not aligned to size" + extra) assert (is_aligned, "'B' channel PutPartial address not aligned to size" + extra)
assert (bundle.param === UInt(0), "'B' channel PutPartial carries invalid param" + extra) assert (bundle.param === UInt(0), "'B' channel PutPartial carries invalid param" + extra)
assert ((bundle.mask & ~mask) === UInt(0), "'B' channel PutPartial contains invalid mask" + extra) assert ((bundle.mask & ~mask) === UInt(0), "'B' channel PutPartial contains invalid mask" + extra)
@ -142,6 +147,7 @@ class TLMonitor(args: TLMonitorArgs) extends TLMonitorBase(args)
when (bundle.opcode === TLMessages.ArithmeticData) { when (bundle.opcode === TLMessages.ArithmeticData) {
assert (edge.client.supportsArithmetic(bundle.source, bundle.size), "'B' channel carries Arithmetic type unsupported by client" + extra) assert (edge.client.supportsArithmetic(bundle.source, bundle.size), "'B' channel carries Arithmetic type unsupported by client" + extra)
assert (address_ok, "'B' channel Arithmetic carries unmanaged address" + extra) assert (address_ok, "'B' channel Arithmetic carries unmanaged address" + extra)
assert (legal_source, "'B' channel Arithmetic carries source that is not first source" + extra)
assert (is_aligned, "'B' channel Arithmetic address not aligned to size" + extra) assert (is_aligned, "'B' channel Arithmetic address not aligned to size" + extra)
assert (TLAtomics.isArithmetic(bundle.param), "'B' channel Arithmetic carries invalid opcode param" + extra) assert (TLAtomics.isArithmetic(bundle.param), "'B' channel Arithmetic carries invalid opcode param" + extra)
assert (bundle.mask === mask, "'B' channel Arithmetic contains invalid mask" + extra) assert (bundle.mask === mask, "'B' channel Arithmetic contains invalid mask" + extra)
@ -150,6 +156,7 @@ class TLMonitor(args: TLMonitorArgs) extends TLMonitorBase(args)
when (bundle.opcode === TLMessages.LogicalData) { when (bundle.opcode === TLMessages.LogicalData) {
assert (edge.client.supportsLogical(bundle.source, bundle.size), "'B' channel carries Logical type unsupported by client" + extra) assert (edge.client.supportsLogical(bundle.source, bundle.size), "'B' channel carries Logical type unsupported by client" + extra)
assert (address_ok, "'B' channel Logical carries unmanaged address" + extra) assert (address_ok, "'B' channel Logical carries unmanaged address" + extra)
assert (legal_source, "'B' channel Logical carries source that is not first source" + extra)
assert (is_aligned, "'B' channel Logical address not aligned to size" + extra) assert (is_aligned, "'B' channel Logical address not aligned to size" + extra)
assert (TLAtomics.isLogical(bundle.param), "'B' channel Logical carries invalid opcode param" + extra) assert (TLAtomics.isLogical(bundle.param), "'B' channel Logical carries invalid opcode param" + extra)
assert (bundle.mask === mask, "'B' channel Logical contains invalid mask" + extra) assert (bundle.mask === mask, "'B' channel Logical contains invalid mask" + extra)
@ -158,6 +165,7 @@ class TLMonitor(args: TLMonitorArgs) extends TLMonitorBase(args)
when (bundle.opcode === TLMessages.Hint) { when (bundle.opcode === TLMessages.Hint) {
assert (edge.client.supportsHint(bundle.source, bundle.size), "'B' channel carries Hint type unsupported by client" + extra) assert (edge.client.supportsHint(bundle.source, bundle.size), "'B' channel carries Hint type unsupported by client" + extra)
assert (address_ok, "'B' channel Hint carries unmanaged address" + extra) assert (address_ok, "'B' channel Hint carries unmanaged address" + extra)
assert (legal_source, "'B' channel Hint carries source that is not first source" + extra)
assert (is_aligned, "'B' channel Hint address not aligned to size" + extra) assert (is_aligned, "'B' channel Hint address not aligned to size" + extra)
assert (bundle.mask === mask, "'B' channel Hint contains invalid mask" + extra) assert (bundle.mask === mask, "'B' channel Hint contains invalid mask" + extra)
} }