From e33257d08b26ea3ff71b15d1d6aa3a59e59af979 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Tue, 20 Mar 2018 15:55:30 +0000 Subject: [PATCH] add pin class for auto-generating interface lines --- src/interface_decl.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) 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 + -- 2.30.2