from UserDict import UserDict
from wire_def import generic_io # special case
+from wire_def import muxwire # special case
class Pin(object):
""" pin interface declaration.
res = res.format(*args)
return '\n' + res + '\n'
+class MuxInterface(Interface):
+
+ def wirefmt(self, *args):
+ return muxwire.format(*args)
class IOInterface(Interface):
# ========= Interface declarations ================ #
-mux_interface = Interface('cell', [{'name': 'mux', 'ready': False,
+mux_interface = MuxInterface('cell', [{'name': 'mux', 'ready': False,
'enabled': False,
'bitspec': '{1}', 'action': True}])
# project module imports
from interface_decl import Interfaces, mux_interface, io_interface
-from wire_def import muxwire
from parse import Parse
from actual_pinmux import init
from bus_transactors import axi4_lite
Bit#(1) opendrain_en; // opendrain enable form core to io_cell bit0
} GenericIOType deriving(Eq,Bits,FShow);
- interface MuxSelectionLines;
'''
footer = '''
endinterface;
with open("./bsv_src/pinmux.bsv", "w") as bsv_file:
bsv_file.write(header)
- bsv_file.write('''
+ bsv_file.write('''\
+ interface MuxSelectionLines;
// declare the method which will capture the user pin-mux
// selection values.The width of the input is dependent on the number
// values for each mux assigned to a CELL
''')
for cell in p.muxed_cells:
- bsv_file.write(muxwire.format(
+ bsv_file.write(mux_interface.wirefmt(
cell[0], int(math.log(len(cell) - 1, 2))))
ifaces.wirefmt(bsv_file)