litex/examples/using_record.py

21 lines
372 B
Python
Raw Normal View History

2012-01-06 05:20:44 -05:00
from migen.fhdl.structure import *
from migen.corelogic.record import *
2012-01-09 09:14:42 -05:00
L = [
2012-01-09 13:16:11 -05:00
("x", BV(10), 8),
("y", BV(10), 8),
2012-01-06 05:20:44 -05:00
("level2", [
2012-01-09 13:16:11 -05:00
("a", BV(5), 32),
("b", BV(5), 16)
2012-01-06 05:20:44 -05:00
])
]
2012-01-09 09:14:42 -05:00
myrec = Record(L)
2012-01-06 05:20:44 -05:00
print(myrec.flatten())
2012-01-09 13:16:11 -05:00
print(myrec.flatten(True))
2012-01-06 05:20:44 -05:00
s = myrec.subrecord("level2/a", "x")
print(s.flatten())
2012-01-09 09:14:42 -05:00
print(s.level2.layout())
2012-01-06 05:20:44 -05:00
myrec2 = myrec.copy()
print(myrec2.flatten())