When a subvector of a Cat is assigned a value, the rest of the vector is written over with zeros. This results in only the last assignment actually taking effect.
Here is an example:
from migen import *
from migen.fhdl import verilog
class Example(Module):
def __init__(self):
a = Signal(4)
b = Signal(4)
c = Signal(4)
z = Cat(a, b, c)
self.comb += z[:7].eq(1)
self.comb += z[7:].eq(1)
if __name__ == "__main__":
print(verilog.convert(Example()))
Since slice_proxy0 and slice_proxy1 are the same length as the concatenated vector and filled in with zeros the first assignment is overwritten by the second and the lower bits in this example do not change correctly.
If a proxy signal is inserted in place of the raw concatenation the python code the generated output will behave correctly but I believe this also inserts an unnecessary register vector depending on the synthesis tools.
When a subvector of a
Cat
is assigned a value, the rest of the vector is written over with zeros. This results in only the last assignment actually taking effect.Here is an example:
generates the output :
Since
slice_proxy0
andslice_proxy1
are the same length as the concatenated vector and filled in with zeros the first assignment is overwritten by the second and the lower bits in this example do not change correctly.If a proxy signal is inserted in place of the raw concatenation the python code the generated output will behave correctly but I believe this also inserts an unnecessary register vector depending on the synthesis tools.