From 1abfbd580bcb71a6f40caa9e548c4f9d173d6f7b Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Thu, 22 Mar 2018 10:30:21 +0000 Subject: [PATCH] remove unneeded code --- src/interface_decl.py | 99 ----------------- src/interface_def.py | 111 ------------------- src/wire_def.py | 248 ------------------------------------------ 3 files changed, 458 deletions(-) delete mode 100644 src/interface_def.py diff --git a/src/interface_decl.py b/src/interface_decl.py index 963f283..4f95d9d 100644 --- a/src/interface_decl.py +++ b/src/interface_decl.py @@ -263,39 +263,11 @@ if __name__ == '__main__': {'name': 'tx', 'action': True}, ]) - spiinterface_decl = Interface('spi', - [{'name': 'sclk', 'action': True}, - {'name': 'mosi', 'action': True}, - {'name': 'nss', 'action': True}, - {'name': 'miso'}, - ]) - twiinterface_decl = Interface('twi', [{'name': 'sda', 'outen': True}, {'name': 'scl', 'outen': True}, ]) - sdinterface_decl = Interface('sd', - [{'name': 'clk', 'action': True}, - {'name': 'cmd', 'action': True}, - {'name': 'd0', 'outen': True}, - {'name': 'd1', 'outen': True}, - {'name': 'd2', 'outen': True}, - {'name': 'd3', 'outen': True} - ]) - - jtaginterface_decl = Interface('jtag', - [{'name': 'tdi'}, - {'name': 'tms'}, - {'name': 'tclk'}, - {'name': 'trst'}, - {'name': 'tdo', 'action': True} - ]) - - pwminterface_decl = Interface('pwm', - [{'name': "pwm", 'action': True} - ]) - def _pinmunge(p, sep, repl, dedupe=True): """ munges the text so it's easier to compare. splits by separator, strips out blanks, re-joins. @@ -328,56 +300,6 @@ if __name__ == '__main__': print assert p1 == p2 - from interface_def import io_interface_def - print io_interface_def.format(0) - print io_interface.ifacedef(0) - assert io_interface_def.format(0) == io_interface.ifacedef(0) - - mux_interfacetest = ''' - method Action cell{0}_mux(Bit#({1}) in);''' - print pinmunge(mux_interfacetest.format(0,1)) - print pinmunge(mux_interface.ifacefmt(0, 1)) - from interface_def import mux_interface_def - print repr(mux_interface_def.format(0, 1)) - print repr(mux_interface.ifacedef(0, 1)) - assert mux_interface_def.format(0,1) == mux_interface.ifacedef(0,1) - - from wire_def import uartwires - print uartwires.format(0) - print uartinterface_decl.wirefmt(0) - assert uartwires.format(0) == uartinterface_decl.wirefmt(0), \ - zipcmp(uartwires.format(0), uartinterface_decl.wirefmt(0)) - - from wire_def import spiwires - print spiwires.format(0) - print spiinterface_decl.wirefmt(0) - assert spiwires.format(0) == spiinterface_decl.wirefmt(0), \ - zipcmp(spiwires.format(0), spiinterface_decl.wirefmt(0)) - - from wire_def import jtagwires - print jtagwires.format(0) - print jtaginterface_decl.wirefmt(0) - assert jtagwires.format(0) == jtaginterface_decl.wirefmt(0), \ - zipcmp(jtagwires.format(0), jtaginterface_decl.wirefmt(0)) - - from wire_def import sdwires - print sdwires.format(0) - print sdinterface_decl.wirefmt(0) - assert sdwires.format(0) == sdinterface_decl.wirefmt(0), \ - zipcmp(sdwires.format(0), sdinterface_decl.wirefmt(0)) - - from wire_def import pwmwires - print pwmwires.format(0) - print pwminterface_decl.wirefmt(0) - assert pwmwires.format(0) == pwminterface_decl.wirefmt(0), \ - zipcmp(pwmwires.format(0), pwminterface_decl.wirefmt(0)) - - from wire_def import twiwires - print twiwires.format(0) - print twiinterface_decl.wirefmt(0) - assert twiwires.format(0) == twiinterface_decl.wirefmt(0), \ - zipcmp(twiwires.format(0), twiinterface_decl.wirefmt(0)) - ifaceuart = ifaces['uart'] print ifaceuart.ifacedef(0) print uartinterface_decl.ifacedef(0) @@ -387,24 +309,3 @@ if __name__ == '__main__': print ifacetwi.ifacedef(0) print twiinterface_decl.ifacedef(0) assert ifacetwi.ifacedef(0) == twiinterface_decl.ifacedef(0) - - ifacepwm = ifaces['pwm'] - print ifacepwm.ifacedef(0) - print pwminterface_decl.ifacedef(0) - assert ifacepwm.ifacedef(0) == pwminterface_decl.ifacedef(0) - - ifacesd = ifaces['sd'] - print ifacesd.ifacedef(0) - print sdinterface_decl.ifacedef(0) - assert ifacesd.ifacedef(0) == sdinterface_decl.ifacedef(0) - - ifacespi = ifaces['spi'] - print ifacespi.ifacedef(0) - print spiinterface_decl.ifacedef(0) - assert ifacespi.ifacedef(0) == spiinterface_decl.ifacedef(0) - - ifacejtag = ifaces['jtag'] - print ifacejtag.ifacedef(0) - print jtaginterface_decl.ifacedef(0) - assert ifacejtag.ifacedef(0) == jtaginterface_decl.ifacedef(0) - diff --git a/src/interface_def.py b/src/interface_def.py deleted file mode 100644 index 07088b1..0000000 --- a/src/interface_def.py +++ /dev/null @@ -1,111 +0,0 @@ -# === templates for interface definitions ====== # -mux_interface_def = ''' - method Action cell{0}_mux(Bit#({1}) in); - wrcell{0}_mux<=in; - endmethod -''' -io_interface_def = ''' - method io{0}_outputval=cell{0}_mux_out.outputval; - method io{0}_output_en=cell{0}_mux_out.output_en; - method io{0}_input_en=cell{0}_mux_out.input_en; - method io{0}_pullup_en=cell{0}_mux_out.pullup_en; - method io{0}_pulldown_en=cell{0}_mux_out.pulldown_en; - method io{0}_drivestrength=cell{0}_mux_out.drivestrength; - method io{0}_pushpull_en=cell{0}_mux_out.pushpull_en; - method io{0}_opendrain_en=cell{0}_mux_out.opendrain_en; - method Action io{0}_inputval(Bit#(1) in); - cell{0}_mux_in<=in; - endmethod -''' -uartinterface_def = ''' - method uart{0}_rx=wruart{0}_rx; - method Action uart{0}_tx(Bit#(1) in); - wruart{0}_tx<=in; - endmethod -''' -spiinterface_def = ''' - method Action spi{0}_sclk (Bit#(1) in); - wrspi{0}_sclk<=in; - endmethod - method Action spi{0}_mosi (Bit#(1) in); - wrspi{0}_mosi<=in; - endmethod - method Action spi{0}_nss (Bit#(1) in); - wrspi{0}_nss<=in; - endmethod - method Bit#(1) spi{0}_miso=wrspi{0}_miso; -''' - -twiinterface_def = ''' - - method Action twi{0}_sda_out (Bit#(1) in); - wrtwi{0}_sda_out<=in; - endmethod - method Action twi{0}_sda_outen (Bit#(1) in); - wrtwi{0}_sda_outen<=in; - endmethod - method twi{0}_sda_in=wrtwi{0}_sda_in; - - method Action twi{0}_scl_out (Bit#(1) in); - wrtwi{0}_scl_out<=in; - endmethod - method Action twi{0}_scl_outen (Bit#(1) in); - wrtwi{0}_scl_outen<=in; - endmethod - method twi{0}_scl_in=wrtwi{0}_scl_in; - -''' - -sdinterface_def = ''' - method Action sd{0}_clk (Bit#(1) in); - wrsd{0}_clk<=in; - endmethod - method Action sd{0}_cmd (Bit#(1) in); - wrsd{0}_cmd<=in; - endmethod - method Action sd{0}_d0_out (Bit#(1) in); - wrsd{0}_d0_out<=in; - endmethod - method Action sd{0}_d0_outen (Bit#(1) in); - wrsd{0}_d0_outen<=in; - endmethod - method sd{0}_d0_in=wrsd{0}_d0_in; - method Action sd{0}_d1_out (Bit#(1) in); - wrsd{0}_d1_out<=in; - endmethod - method Action sd{0}_d1_outen (Bit#(1) in); - wrsd{0}_d1_outen<=in; - endmethod - method sd{0}_d1_in=wrsd{0}_d1_in; - method Action sd{0}_d2_out (Bit#(1) in); - wrsd{0}_d2_out<=in; - endmethod - method Action sd{0}_d2_outen (Bit#(1) in); - wrsd{0}_d2_outen<=in; - endmethod - method sd{0}_d2_in=wrsd{0}_d2_in; - method Action sd{0}_d3_out (Bit#(1) in); - wrsd{0}_d3_out<=in; - endmethod - method Action sd{0}_d3_outen (Bit#(1) in); - wrsd{0}_d3_outen<=in; - endmethod - method sd{0}_d3_in=wrsd{0}_d3_in; -''' - -jtaginterface_def = ''' - method Bit#(1) jtag{0}_tdi=wrjtag{0}_tdi; - method Bit#(1) jtag{0}_tms=wrjtag{0}_tms; - method Bit#(1) jtag{0}_tclk=wrjtag{0}_tclk; - method Bit#(1) jtag{0}_trst=wrjtag{0}_trst; - method Action jtag{0}_tdo(Bit#(1) in); - wrjtag{0}_tdo<=in; - endmethod -''' - -pwminterface_def = ''' - method Action pwm{0}_pwm(Bit#(1) in); - wrpwm{0}_pwm<=in; - endmethod -''' -# ============================================== # diff --git a/src/wire_def.py b/src/wire_def.py index 7f5b9f6..f02ce3c 100644 --- a/src/wire_def.py +++ b/src/wire_def.py @@ -5,251 +5,3 @@ generic_io = ''' GenericIOType cell{0}_mux_out=unpack(0); Wire#(Bit#(1)) cell{0}_mux_in<-mkDWire(0); ''' -uartwires = ''' - Wire#(Bit#(1)) wruart{0}_rx<-mkDWire(0); - Wire#(Bit#(1)) wruart{0}_tx<-mkDWire(0); - GenericIOType uart{0}_rx_io = GenericIOType{{ - outputval:0, - output_en:0, - input_en:1, - pullup_en:0, - pulldown_en:0, - pushpull_en:0, - drivestrength:0, - opendrain_en:0 - }}; - GenericIOType uart{0}_tx_io = GenericIOType{{ - outputval:wruart{0}_tx, - output_en:1, - input_en:0, - pullup_en:0, - pulldown_en:0, - pushpull_en:0, - drivestrength:0, - opendrain_en:0 - }}; -''' -spiwires = ''' - Wire#(Bit#(1)) wrspi{0}_sclk<-mkDWire(0); - Wire#(Bit#(1)) wrspi{0}_mosi<-mkDWire(0); - Wire#(Bit#(1)) wrspi{0}_nss<-mkDWire(0); - Wire#(Bit#(1)) wrspi{0}_miso<-mkDWire(0); - GenericIOType spi{0}_sclk_io = GenericIOType{{ - outputval:wrspi{0}_sclk, - output_en:1, - input_en:0, - pullup_en:0, - pulldown_en:0, - pushpull_en:0, - drivestrength:0, - opendrain_en:0 - }}; - GenericIOType spi{0}_mosi_io = GenericIOType{{ - outputval:wrspi{0}_mosi, - output_en:1, - input_en:0, - pullup_en:0, - pulldown_en:0, - pushpull_en:0, - drivestrength:0, - opendrain_en:0 - }}; - GenericIOType spi{0}_nss_io = GenericIOType{{ - outputval:wrspi{0}_nss, - output_en:1, - input_en:0, - pullup_en:0, - pulldown_en:0, - pushpull_en:0, - drivestrength:0, - opendrain_en:0 - }}; - GenericIOType spi{0}_miso_io = GenericIOType{{ - outputval:0, - output_en:0, - input_en:1, - pullup_en:0, - pulldown_en:0, - pushpull_en:0, - drivestrength:0, - opendrain_en:0 - }}; -''' -twiwires = ''' - Wire#(Bit#(1)) wrtwi{0}_sda_out<-mkDWire(0); - Wire#(Bit#(1)) wrtwi{0}_sda_outen<-mkDWire(0); - Wire#(Bit#(1)) wrtwi{0}_sda_in<-mkDWire(0); - Wire#(Bit#(1)) wrtwi{0}_scl_out<-mkDWire(0); - Wire#(Bit#(1)) wrtwi{0}_scl_outen<-mkDWire(0); - Wire#(Bit#(1)) wrtwi{0}_scl_in<-mkDWire(0); - GenericIOType twi{0}_sda_io = GenericIOType{{ - outputval:wrtwi{0}_sda_out, - output_en:wrtwi{0}_sda_outen, - input_en:~wrtwi{0}_sda_outen, - pullup_en:0, - pulldown_en:0, - pushpull_en:0, - drivestrength:0, - opendrain_en:0 - }}; - GenericIOType twi{0}_scl_io = GenericIOType{{ - outputval:wrtwi{0}_scl_out, - output_en:wrtwi{0}_scl_outen, - input_en:~wrtwi{0}_scl_outen, - pullup_en:0, - pulldown_en:0, - pushpull_en:0, - drivestrength:0, - opendrain_en:0 - }}; -''' - -sdwires = ''' - Wire#(Bit#(1)) wrsd{0}_clk<-mkDWire(0); - Wire#(Bit#(1)) wrsd{0}_cmd<-mkDWire(0); - Wire#(Bit#(1)) wrsd{0}_d0_out<-mkDWire(0); - Wire#(Bit#(1)) wrsd{0}_d0_outen<-mkDWire(0); - Wire#(Bit#(1)) wrsd{0}_d0_in<-mkDWire(0); - Wire#(Bit#(1)) wrsd{0}_d1_out<-mkDWire(0); - Wire#(Bit#(1)) wrsd{0}_d1_outen<-mkDWire(0); - Wire#(Bit#(1)) wrsd{0}_d1_in<-mkDWire(0); - Wire#(Bit#(1)) wrsd{0}_d2_out<-mkDWire(0); - Wire#(Bit#(1)) wrsd{0}_d2_outen<-mkDWire(0); - Wire#(Bit#(1)) wrsd{0}_d2_in<-mkDWire(0); - Wire#(Bit#(1)) wrsd{0}_d3_out<-mkDWire(0); - Wire#(Bit#(1)) wrsd{0}_d3_outen<-mkDWire(0); - Wire#(Bit#(1)) wrsd{0}_d3_in<-mkDWire(0); - GenericIOType sd{0}_clk_io = GenericIOType{{ - outputval:wrsd{0}_clk, - output_en:1, - input_en:0, - pullup_en:0, - pulldown_en:0, - pushpull_en:0, - drivestrength:0, - opendrain_en:0 - }}; - GenericIOType sd{0}_cmd_io = GenericIOType{{ - outputval:wrsd{0}_cmd, - output_en:1, - input_en:0, - pullup_en:0, - pulldown_en:0, - pushpull_en:0, - drivestrength:0, - opendrain_en:0 - }}; - GenericIOType sd{0}_d0_io = GenericIOType{{ - outputval:wrsd{0}_d0_out, - output_en:wrsd{0}_d0_outen, - input_en:~wrsd{0}_d0_outen, - pullup_en:0, - pulldown_en:0, - pushpull_en:0, - drivestrength:0, - opendrain_en:0 - }}; - GenericIOType sd{0}_d1_io = GenericIOType{{ - outputval:wrsd{0}_d1_out, - output_en:wrsd{0}_d1_outen, - input_en:~wrsd{0}_d1_outen, - pullup_en:0, - pulldown_en:0, - pushpull_en:0, - drivestrength:0, - opendrain_en:0 - }}; - GenericIOType sd{0}_d2_io = GenericIOType{{ - outputval:wrsd{0}_d2_out, - output_en:wrsd{0}_d2_outen, - input_en:~wrsd{0}_d2_outen, - pullup_en:0, - pulldown_en:0, - pushpull_en:0, - drivestrength:0, - opendrain_en:0 - }}; - GenericIOType sd{0}_d3_io = GenericIOType{{ - outputval:wrsd{0}_d3_out, - output_en:wrsd{0}_d3_outen, - input_en:~wrsd{0}_d3_outen, - pullup_en:0, - pulldown_en:0, - pushpull_en:0, - drivestrength:0, - opendrain_en:0 - }}; -''' - -jtagwires = ''' - Wire#(Bit#(1)) wrjtag{0}_tdi<-mkDWire(0); - Wire#(Bit#(1)) wrjtag{0}_tms<-mkDWire(0); - Wire#(Bit#(1)) wrjtag{0}_tclk<-mkDWire(0); - Wire#(Bit#(1)) wrjtag{0}_trst<-mkDWire(0); - Wire#(Bit#(1)) wrjtag{0}_tdo<-mkDWire(0); - GenericIOType jtag{0}_tdi_io = GenericIOType{{ - outputval:0, - output_en:0, - input_en:1, - pullup_en:0, - pulldown_en:0, - pushpull_en:0, - drivestrength:0, - opendrain_en:0 - }}; - GenericIOType jtag{0}_tms_io = GenericIOType{{ - outputval:0, - output_en:0, - input_en:1, - pullup_en:0, - pulldown_en:0, - pushpull_en:0, - drivestrength:0, - opendrain_en:0 - }}; - GenericIOType jtag{0}_tclk_io = GenericIOType{{ - outputval:0, - output_en:0, - input_en:1, - pullup_en:0, - pulldown_en:0, - pushpull_en:0, - drivestrength:0, - opendrain_en:0 - }}; - GenericIOType jtag{0}_trst_io = GenericIOType{{ - outputval:0, - output_en:0, - input_en:1, - pullup_en:0, - pulldown_en:0, - pushpull_en:0, - drivestrength:0, - opendrain_en:0 - }}; - GenericIOType jtag{0}_tdo_io = GenericIOType{{ - outputval:wrjtag{0}_tdo, - output_en:1, - input_en:0, - pullup_en:0, - pulldown_en:0, - pushpull_en:0, - drivestrength:0, - opendrain_en:0 - }}; -''' - -pwmwires = ''' - Wire#(Bit#(1)) wrpwm{0}_pwm<-mkDWire(0); - GenericIOType pwm{0}_pwm_io = GenericIOType{{ - outputval:wrpwm{0}_pwm, - output_en:1, - input_en:0, - pullup_en:0, - pulldown_en:0, - pushpull_en:0, - drivestrength:0, - opendrain_en:0 - }}; -''' -# =================================== # -- 2.30.2