From: Luke Kenneth Casson Leighton Date: Tue, 20 Mar 2018 15:55:30 +0000 (+0000) Subject: add pin class for auto-generating interface lines X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e33257d08b26ea3ff71b15d1d6aa3a59e59af979;p=pinmux.git add pin class for auto-generating interface lines --- diff --git a/src/interface_decl.py b/src/interface_decl.py index df54caf..3297f7c 100644 --- a/src/interface_decl.py +++ b/src/interface_decl.py @@ -69,3 +69,30 @@ pwminterface_decl = ''' (*always_ready,always_enabled*) method Action pwm{0}(Bit#(1) in); ''' # ======================================= # + +class Pin(object): + + def __init__(self, name, ready, enabled, action, inout): + self.name = name + self.ready = ready + self.enabled = enabled + self.action = action + self.inout = inout + + def __str__(self): + res = ' (*' + status = [] + if self.ready: + status.append('always_ready') + if self.enabled: + status.append('always_enabled') + res += ','.join(status) + res += "*) method " + if self.action: + res += " Action " + res += self.name + if inout: + res += ' (Bit#(1) in)' + res += ";" + return res +