Add assertion for no replacements given unique inputs
This commit is contained in:
parent
67130ed79e
commit
b7a69557de
|
@ -165,5 +165,22 @@ class OutputNetwork(Elaboratable):
|
||||||
# for i in range(len(self.input)):
|
# for i in range(len(self.input)):
|
||||||
# m.d.comb += Assert(appeared[i])
|
# m.d.comb += Assert(appeared[i])
|
||||||
|
|
||||||
|
# If the valid bit / channel no. combinations of all input data are
|
||||||
|
# unique then there should be no replacements
|
||||||
|
with m.If(f_output_valid):
|
||||||
|
nodes_unique = Signal(reset=1)
|
||||||
|
for node1 in range(len(self.input)):
|
||||||
|
for node2 in range(node1):
|
||||||
|
k1 = Cat(Past(self.input[node1].payload.channel, clocks=network_latency), ~Past(self.input[node1].valid, clocks=network_latency))
|
||||||
|
k2 = Cat(Past(self.input[node2].payload.channel, clocks=network_latency), ~Past(self.input[node2].valid, clocks=network_latency))
|
||||||
|
with m.If(k1 == k2):
|
||||||
|
m.d.comb += nodes_unique.eq(0)
|
||||||
|
with m.If(nodes_unique):
|
||||||
|
replacement_occurred = Signal()
|
||||||
|
for output_node in self.output:
|
||||||
|
with m.If(output_node.replace_occured):
|
||||||
|
m.d.comb += replacement_occurred.eq(1)
|
||||||
|
m.d.comb += Assert(~replacement_occurred)
|
||||||
|
|
||||||
def elaborate(self, platform):
|
def elaborate(self, platform):
|
||||||
return self.m
|
return self.m
|
||||||
|
|
Loading…
Reference in New Issue