From 1c2ab7472e44866bc09940a47d8d61dc951eeb22 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Thu, 22 Mar 2018 05:04:15 +0000 Subject: [PATCH] consistent naming on io interface --- src/interface_decl.py | 25 ++++++++++++++----------- src/interface_def.py | 18 +++++++++--------- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/src/interface_decl.py b/src/interface_decl.py index 1d22bbf..50f8ce7 100644 --- a/src/interface_decl.py +++ b/src/interface_decl.py @@ -104,14 +104,17 @@ class Interface(object): self.ifacefmtdecfn2) def ifacedef(self, *args): - res = '\n'.join(map(self.ifacefmtpin, self.pins)).format(*args) + res = '\n'.join(map(self.ifacefmtpin, self.pins)) + print res + res = res.format(*args) return '\n' + res + '\n' class IOInterface(Interface): def ifacefmtoutfn(self, name): - return "cell{0}_mux_out.%s" % (name[3:-4]) + """ for now strip off io{0}_ part """ + return "cell{0}_mux_out.%s" % name[6:] def ifacefmtinfn(self, name): return "cell{0}_mux_in" @@ -123,15 +126,15 @@ mux_interface = Interface([{'name': 'cell{0}_mux', 'ready':False, 'enabled':False, 'bitspec': '{1}', 'action': True}]) -io_interface = IOInterface([{'name': 'io_outputval_{0}', 'enabled': False}, - {'name': 'io_output_en_{0}', 'enabled': False}, - {'name': 'io_input_en_{0}', 'enabled': False}, - {'name': 'io_pullup_en_{0}', 'enabled': False}, - {'name': 'io_pulldown_en_{0}', 'enabled': False}, - {'name': 'io_drivestrength_{0}', 'enabled': False}, - {'name': 'io_pushpull_en_{0}', 'enabled': False}, - {'name': 'io_opendrain_en_{0}', 'enabled': False}, - {'name': 'io_inputval_{0}', 'action': True, 'io': True}, +io_interface = IOInterface([{'name': 'io{0}_outputval', 'enabled': False}, + {'name': 'io{0}_output_en', 'enabled': False}, + {'name': 'io{0}_input_en', 'enabled': False}, + {'name': 'io{0}_pullup_en', 'enabled': False}, + {'name': 'io{0}_pulldown_en', 'enabled': False}, + {'name': 'io{0}_drivestrength', 'enabled': False}, + {'name': 'io{0}_pushpull_en', 'enabled': False}, + {'name': 'io{0}_opendrain_en', 'enabled': False}, + {'name': 'io{0}_inputval', 'action': True, 'io': True}, ]) # == Peripheral Interface definitions == # diff --git a/src/interface_def.py b/src/interface_def.py index 0dbe922..07088b1 100644 --- a/src/interface_def.py +++ b/src/interface_def.py @@ -5,15 +5,15 @@ mux_interface_def = ''' endmethod ''' io_interface_def = ''' - method io_outputval_{0}=cell{0}_mux_out.outputval; - method io_output_en_{0}=cell{0}_mux_out.output_en; - method io_input_en_{0}=cell{0}_mux_out.input_en; - method io_pullup_en_{0}=cell{0}_mux_out.pullup_en; - method io_pulldown_en_{0}=cell{0}_mux_out.pulldown_en; - method io_drivestrength_{0}=cell{0}_mux_out.drivestrength; - method io_pushpull_en_{0}=cell{0}_mux_out.pushpull_en; - method io_opendrain_en_{0}=cell{0}_mux_out.opendrain_en; - method Action io_inputval_{0}(Bit#(1) in); + 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 ''' -- 2.30.2