2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-27 20:28:25 +08:00
artiq/soc/artiqlib/rtio/rbus.py

32 lines
796 B
Python
Raw Normal View History

2014-07-26 06:23:35 +08:00
from migen.fhdl.std import *
from migen.genlib.record import Record
2014-09-05 17:06:41 +08:00
2014-11-30 00:13:54 +08:00
def create_rbus(fine_ts_bits, pads, output_only_pads):
2014-09-05 12:03:22 +08:00
rbus = []
for pad in pads:
layout = [
("o_stb", 1),
("o_value", 2)
]
if fine_ts_bits:
layout.append(("o_fine_ts", fine_ts_bits))
2014-11-30 00:13:54 +08:00
if pad not in output_only_pads:
2014-09-05 12:03:22 +08:00
layout += [
("oe", 1),
("i_stb", 1),
("i_value", 1),
("i_pileup", 1)
2014-09-05 12:03:22 +08:00
]
if fine_ts_bits:
layout.append(("i_fine_ts", fine_ts_bits))
2014-11-30 00:13:54 +08:00
rbus.append(Record(layout))
2014-09-05 12:03:22 +08:00
return rbus
2014-07-26 06:23:35 +08:00
2014-09-05 17:06:41 +08:00
2014-07-26 06:23:35 +08:00
def get_fine_ts_width(rbus):
2014-09-05 12:03:22 +08:00
if hasattr(rbus[0], "o_fine_ts"):
return flen(rbus[0].o_fine_ts)
else:
return 0