corrections to inferface reader, add unit tests
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 22 Mar 2018 09:43:22 +0000 (09:43 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 22 Mar 2018 09:43:22 +0000 (09:43 +0000)
sd.txt
src/interface_decl.py
twi.txt

diff --git a/sd.txt b/sd.txt
index f06731c874c71849296abe9556bb6ca4a63bc395..4096e06182ea69019930ee2ad9718297e0efde16 100644 (file)
--- a/sd.txt
+++ b/sd.txt
@@ -1,6 +1,6 @@
 clk    out
 cmd    out
-d0     outen
-d1     outen
-d2     outen
-d3     outen
+d0     inout
+d1     inout
+d2     inout
+d3     inout
index 1e85581c8bc95e157bfcf3ad3e4b078473067019..42269997d3b240df8e99677d89761623c22dd6a8 100644 (file)
@@ -190,7 +190,9 @@ class Interfaces(UserDict):
         spec = []
         with open('%s.txt' % name, 'r') as sfile:
             for l in sfile.readlines():
+                l = l.strip()
                 l = l.split("\t")
+                print l
                 d = {'name': l[0]}
                 if l[1] == 'out':
                     d['action'] = True
@@ -350,3 +352,33 @@ if __name__ == '__main__':
     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)
+    assert ifaceuart.ifacedef(0) == uartinterface_decl.ifacedef(0)
+
+    ifacetwi = ifaces['twi']
+    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/twi.txt b/twi.txt
index a673042d83e1043c0e56cb8778276c1e0f58538e..31fbc5a9ab78d9392b3068fba45f35b674dd971e 100644 (file)
--- a/twi.txt
+++ b/twi.txt
@@ -1,2 +1,2 @@
-sda    outen
-scl    outen
+sda    inout
+scl    inout