From: Luke Kenneth Casson Leighton Date: Thu, 22 Mar 2018 11:57:25 +0000 (+0000) Subject: remove muxwire from generator, call from interface_decl instead X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5173907ae5935454c64857a5bcdf2975212fed99;p=pinmux.git remove muxwire from generator, call from interface_decl instead --- diff --git a/src/interface_decl.py b/src/interface_decl.py index dc6ffa7..c532a84 100644 --- a/src/interface_decl.py +++ b/src/interface_decl.py @@ -1,6 +1,7 @@ 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. @@ -159,6 +160,10 @@ class Interface(object): res = res.format(*args) return '\n' + res + '\n' +class MuxInterface(Interface): + + def wirefmt(self, *args): + return muxwire.format(*args) class IOInterface(Interface): @@ -236,7 +241,7 @@ class Interfaces(UserDict): # ========= Interface declarations ================ # -mux_interface = Interface('cell', [{'name': 'mux', 'ready': False, +mux_interface = MuxInterface('cell', [{'name': 'mux', 'ready': False, 'enabled': False, 'bitspec': '{1}', 'action': True}]) diff --git a/src/pinmux_generator.py b/src/pinmux_generator.py index 15de163..a0ba7fd 100644 --- a/src/pinmux_generator.py +++ b/src/pinmux_generator.py @@ -23,7 +23,6 @@ import math # 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 @@ -59,7 +58,6 @@ package pinmux; Bit#(1) opendrain_en; // opendrain enable form core to io_cell bit0 } GenericIOType deriving(Eq,Bits,FShow); - interface MuxSelectionLines; ''' footer = ''' endinterface; @@ -74,7 +72,8 @@ endpackage 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 @@ -118,7 +117,7 @@ with open("./bsv_src/pinmux.bsv", "w") as bsv_file: // 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)