From: Luke Kenneth Casson Leighton Date: Thu, 22 Mar 2018 09:43:22 +0000 (+0000) Subject: corrections to inferface reader, add unit tests X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=96aaf0dd84e54f54428b845af10e6eb2649665c8;p=pinmux.git corrections to inferface reader, add unit tests --- diff --git a/sd.txt b/sd.txt index f06731c..4096e06 100644 --- 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 diff --git a/src/interface_decl.py b/src/interface_decl.py index 1e85581..4226999 100644 --- a/src/interface_decl.py +++ b/src/interface_decl.py @@ -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 a673042..31fbc5a 100644 --- a/twi.txt +++ b/twi.txt @@ -1,2 +1,2 @@ -sda outen -scl outen +sda inout +scl inout