From: Luke Kenneth Casson Leighton Date: Fri, 23 Mar 2018 14:20:15 +0000 (+0000) Subject: move interface and pinmux definition to test directory X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5767eae83f9825bba59adb98b198c8d70a015572;p=pinmux.git move interface and pinmux definition to test directory --- diff --git a/interfaces.txt b/interfaces.txt deleted file mode 100644 index 5a1a4e2..0000000 --- a/interfaces.txt +++ /dev/null @@ -1,6 +0,0 @@ -uart 4 -spi 1 -twi 2 -sd 2 -jtag 2 -pwm 1 diff --git a/jtag.txt b/jtag.txt deleted file mode 100644 index 494fbd2..0000000 --- a/jtag.txt +++ /dev/null @@ -1,5 +0,0 @@ -tdi in -tms in -tclk in -trst in -tdo out diff --git a/pinmap.txt b/pinmap.txt deleted file mode 100644 index f2fbccb..0000000 --- a/pinmap.txt +++ /dev/null @@ -1,21 +0,0 @@ -muxed -0 uart0_tx spi0_sclk uart2_tx uart3_tx -1 uart0_rx spi0_mosi uart2_rx uart3_rx -2 twi0_sda spi0_ss -3 twi0_scl spi0_miso -8 sd0_clk sd1_clk -9 sd0_cmd sd1_cmd -10 sd0_d0 sd1_d0 -11 sd0_d1 sd1_d1 -12 sd0_d2 sd1_d2 -13 sd0_d3 sd1_d3 pwm0_pwm -dedicated -4 uart1_tx -5 uart1_rx -6 twi1_sda -7 twi1_scl -14 jtag0_tclk -15 jtag0_tdo -16 jtag0_tdi -17 jtag0_tms -18 jtag0_tdo diff --git a/pwm.txt b/pwm.txt deleted file mode 100644 index 76b0c8b..0000000 --- a/pwm.txt +++ /dev/null @@ -1 +0,0 @@ -pwm out diff --git a/sd.txt b/sd.txt deleted file mode 100644 index 4096e06..0000000 --- a/sd.txt +++ /dev/null @@ -1,6 +0,0 @@ -clk out -cmd out -d0 inout -d1 inout -d2 inout -d3 inout diff --git a/spi.txt b/spi.txt deleted file mode 100644 index 2528c8d..0000000 --- a/spi.txt +++ /dev/null @@ -1,4 +0,0 @@ -sclk out -mosi out -ss out -miso in diff --git a/src/interface_decl.py b/src/interface_decl.py index 81fcb56..51e56b2 100644 --- a/src/interface_decl.py +++ b/src/interface_decl.py @@ -1,3 +1,5 @@ +import os.path + from UserDict import UserDict from wire_def import generic_io # special case @@ -185,16 +187,20 @@ class Interfaces(UserDict): """ contains a list of interface definitions """ - def __init__(self): + def __init__(self, pth): + self.pth = pth self.ifacecount = [] UserDict.__init__(self, {}) - with open('interfaces.txt', 'r') as ifile: + ift = 'interfaces.txt' + if pth: + ift = os.path.join(pth, ift) + with open(ift, 'r') as ifile: for ln in ifile.readlines(): ln = ln.strip() ln = ln.split("\t") name = ln[0] count = int(ln[1]) - spec = self.read_spec(name) + spec = self.read_spec(pth, name) self.ifaceadd(name, count, Interface(name, spec)) def ifaceadd(self, name, count, iface, at=None): @@ -203,9 +209,12 @@ class Interfaces(UserDict): self.ifacecount.insert(at, (name, count)) self[name] = iface - def read_spec(self, name): + def read_spec(self, pth, name): spec = [] - with open('%s.txt' % name, 'r') as sfile: + fname = '%s.txt' % name + if pth: + ift = os.path.join(pth, fname) + with open(ift, 'r') as sfile: for ln in sfile.readlines(): ln = ln.strip() ln = ln.split("\t") diff --git a/src/pinmux_generator.py b/src/pinmux_generator.py index cefc77d..e8d629d 100644 --- a/src/pinmux_generator.py +++ b/src/pinmux_generator.py @@ -65,7 +65,7 @@ def pinmuxgen(pth=None, verify=True): p = Parse(pth, verify) init(p) - ifaces = Interfaces() + ifaces = Interfaces(pth) ifaces.ifaceadd('io', p.N_IO, io_interface, 0) bp = 'bsv_src' diff --git a/test/interfaces.txt b/test/interfaces.txt new file mode 100644 index 0000000..5a1a4e2 --- /dev/null +++ b/test/interfaces.txt @@ -0,0 +1,6 @@ +uart 4 +spi 1 +twi 2 +sd 2 +jtag 2 +pwm 1 diff --git a/test/jtag.txt b/test/jtag.txt new file mode 100644 index 0000000..494fbd2 --- /dev/null +++ b/test/jtag.txt @@ -0,0 +1,5 @@ +tdi in +tms in +tclk in +trst in +tdo out diff --git a/test/pinmap.txt b/test/pinmap.txt new file mode 100644 index 0000000..f2fbccb --- /dev/null +++ b/test/pinmap.txt @@ -0,0 +1,21 @@ +muxed +0 uart0_tx spi0_sclk uart2_tx uart3_tx +1 uart0_rx spi0_mosi uart2_rx uart3_rx +2 twi0_sda spi0_ss +3 twi0_scl spi0_miso +8 sd0_clk sd1_clk +9 sd0_cmd sd1_cmd +10 sd0_d0 sd1_d0 +11 sd0_d1 sd1_d1 +12 sd0_d2 sd1_d2 +13 sd0_d3 sd1_d3 pwm0_pwm +dedicated +4 uart1_tx +5 uart1_rx +6 twi1_sda +7 twi1_scl +14 jtag0_tclk +15 jtag0_tdo +16 jtag0_tdi +17 jtag0_tms +18 jtag0_tdo diff --git a/test/pwm.txt b/test/pwm.txt new file mode 100644 index 0000000..76b0c8b --- /dev/null +++ b/test/pwm.txt @@ -0,0 +1 @@ +pwm out diff --git a/test/sd.txt b/test/sd.txt new file mode 100644 index 0000000..4096e06 --- /dev/null +++ b/test/sd.txt @@ -0,0 +1,6 @@ +clk out +cmd out +d0 inout +d1 inout +d2 inout +d3 inout diff --git a/test/spi.txt b/test/spi.txt new file mode 100644 index 0000000..2528c8d --- /dev/null +++ b/test/spi.txt @@ -0,0 +1,4 @@ +sclk out +mosi out +ss out +miso in diff --git a/test/twi.txt b/test/twi.txt new file mode 100644 index 0000000..31fbc5a --- /dev/null +++ b/test/twi.txt @@ -0,0 +1,2 @@ +sda inout +scl inout diff --git a/test/uart.txt b/test/uart.txt new file mode 100644 index 0000000..9af527f --- /dev/null +++ b/test/uart.txt @@ -0,0 +1,2 @@ +rx in +tx out diff --git a/twi.txt b/twi.txt deleted file mode 100644 index 31fbc5a..0000000 --- a/twi.txt +++ /dev/null @@ -1,2 +0,0 @@ -sda inout -scl inout diff --git a/uart.txt b/uart.txt deleted file mode 100644 index 9af527f..0000000 --- a/uart.txt +++ /dev/null @@ -1,2 +0,0 @@ -rx in -tx out