X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Finterface_def.py;h=0d2305d057ed9c7797f9cb77c502d7c4291b34eb;hb=e9e9b9962ef2756056048b69327e0ac2cd95ada9;hp=8da88ee6da7d5a8bd18c4ee1ffdea6774a474e54;hpb=a48cba776b633c35cd1bd8268a24967bcb12303b;p=pinmux.git diff --git a/src/interface_def.py b/src/interface_def.py index 8da88ee..0d2305d 100644 --- a/src/interface_def.py +++ b/src/interface_def.py @@ -1,61 +1,59 @@ from params import * -#=== templates for interface definitions ======# -mux_interface_def=''' - method Action cell{0}_mux (Bit#('''+str(N_MUX)+''') in ); - wrmux{0}<=in; - endmethod +# === templates for interface definitions ====== # +mux_interface_def = ''' + method Action cell{0}_mux (Bit#(''' + str(N_MUX) + ''') in ); + wrmux{0}<=in; + endmethod ''' -io_interface_def=''' - method io_outputval_{0}=cell{0}_out.outputval; - method io_output_en_{0}=cell{0}_out.output_en; - method io_input_en_{0}=cell{0}_out.input_en; - method io_pullup_en_{0}=cell{0}_out.pullup_en; - method io_pulldown_en_{0}=cell{0}_out.pulldown_en; - method io_drivestrength_{0}=cell{0}_out.drivestrength; - method io_pushpull_en_{0}=cell{0}_out.pushpull_en; - method io_opendrain_en_{0}=cell{0}_out.opendrain_en; - method Action io_inputval_{0}(Bit#(1) in); - cell{0}_in<=in; - endmethod +io_interface_def = ''' + method io_outputval_{0}=cell{0}_out.outputval; + method io_output_en_{0}=cell{0}_out.output_en; + method io_input_en_{0}=cell{0}_out.input_en; + method io_pullup_en_{0}=cell{0}_out.pullup_en; + method io_pulldown_en_{0}=cell{0}_out.pulldown_en; + method io_drivestrength_{0}=cell{0}_out.drivestrength; + method io_pushpull_en_{0}=cell{0}_out.pushpull_en; + method io_opendrain_en_{0}=cell{0}_out.opendrain_en; + method Action io_inputval_{0}(Bit#(1) in); + cell{0}_in<=in; + endmethod ''' -uartinterface_def=''' - method rx_{0}=wruart{0}_rx; - method Action tx_{0}(Bit#(1) in); - wruart{0}_tx<=in; - endmethod +uartinterface_def = ''' + method rx_{0}=wruart{0}_rx; + method Action tx_{0}(Bit#(1) in); + wruart{0}_tx<=in; + endmethod ''' -spiinterface_def=''' - method Action sclk_{0} (Bit#(1) in); - wrspi{0}_sclk<=in; - endmethod - method Action mosi_{0} (Bit#(1) in); - wrspi{0}_mosi<=in; - endmethod - method Action ss_{0} (Bit#(1) in); - wrspi{0}_ss<=in; - endmethod - method Bit#(1) miso_{0}=wrspi{0}_miso; +spiinterface_def = ''' + method Action sclk_{0} (Bit#(1) in); + wrspi{0}_sclk<=in; + endmethod + method Action mosi_{0} (Bit#(1) in); + wrspi{0}_mosi<=in; + endmethod + method Action ss_{0} (Bit#(1) in); + wrspi{0}_ss<=in; + endmethod + method Bit#(1) miso_{0}=wrspi{0}_miso; ''' -twiinterface_def=''' +twiinterface_def = ''' - method Action sda{0}_out (Bit#(1) in); - wrtwi{0}_sda_out<=in; - endmethod - method Action sda{0}_outen (Bit#(1) in); - wrtwi{0}_sda_outen<=in; - endmethod - method sda{0}_in=wrtwi{0}_sda_in; - - method Action scl{0}_out (Bit#(1) in); - wrtwi{0}_scl_out<=in; - endmethod - method Action scl{0}_outen (Bit#(1) in); - wrtwi{0}_scl_outen<=in; - endmethod - method scl{0}_in=wrtwi{0}_scl_in; - -''' -#==============================================# + method Action sda{0}_out (Bit#(1) in); + wrtwi{0}_sda_out<=in; + endmethod + method Action sda{0}_outen (Bit#(1) in); + wrtwi{0}_sda_outen<=in; + endmethod + method sda{0}_in=wrtwi{0}_sda_in; + method Action scl{0}_out (Bit#(1) in); + wrtwi{0}_scl_out<=in; + endmethod + method Action scl{0}_outen (Bit#(1) in); + wrtwi{0}_scl_outen<=in; + endmethod + method scl{0}_in=wrtwi{0}_scl_in; +''' +# ============================================== #