projects
/
pinmux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5345d48
)
correct SPI interface, use QSPI class, rename to NSPI
author
Luke Kenneth Casson Leighton
<lkcl@lkcl.net>
Tue, 24 Jul 2018 09:37:43 +0000
(10:37 +0100)
committer
Luke Kenneth Casson Leighton
<lkcl@lkcl.net>
Tue, 24 Jul 2018 09:37:43 +0000
(10:37 +0100)
src/bsv/interface_decl.py
patch
|
blob
|
history
diff --git
a/src/bsv/interface_decl.py
b/src/bsv/interface_decl.py
index 6ab29615d371e59625478624e84fbae8764d75a5..fcd1b72b6b70931569519adc1c0bfed224b4cf23 100644
(file)
--- a/
src/bsv/interface_decl.py
+++ b/
src/bsv/interface_decl.py
@@
-412,18
+412,24
@@
class IOInterface(Interface):
return generic_io.format(*args)
return generic_io.format(*args)
-class InterfaceQSPI(Interface):
+class InterfaceNSPI(Interface):
+
+ def get_n_iopins(self, pins): # HACK! assume in/out/outen so div by 3
+ return len(pins) / 3
def ifacepfmt(self, *args):
pins = filter(lambda x: not x.name_.startswith('io'), self.pins)
res = '\n'.join(map(self.ifacepfmtdecpin, pins)).format(*args)
res = res.format(*args)
def ifacepfmt(self, *args):
pins = filter(lambda x: not x.name_.startswith('io'), self.pins)
res = '\n'.join(map(self.ifacepfmtdecpin, pins)).format(*args)
res = res.format(*args)
+ pins = filter(lambda x: x.name_.startswith('io'), self.pins)
+ plen = self.get_n_iopins(pins)
+
return "\n" + res + """
return "\n" + res + """
- interface Put#(Bit#(
4
)) io_out;
- interface Put#(Bit#(
4
)) io_out_en;
- interface Get#(Bit#(
4
)) io_in;
-""".format(
len(self.pinspecs)
)
+ interface Put#(Bit#(
{0}
)) io_out;
+ interface Put#(Bit#(
{0}
)) io_out_en;
+ interface Get#(Bit#(
{0}
)) io_in;
+""".format(
plen
)
def ifacedef2(self, *args):
pins = filter(lambda x: not x.name_.startswith('io'), self.pins)
def ifacedef2(self, *args):
pins = filter(lambda x: not x.name_.startswith('io'), self.pins)
@@
-431,9
+437,11
@@
class InterfaceQSPI(Interface):
res = res.format(*args)
pins = filter(lambda x: x.name_.startswith('io'), self.pins)
res = res.format(*args)
pins = filter(lambda x: x.name_.startswith('io'), self.pins)
- return '\n' + res + self.vectorifacedef2(pins, 4,
+ plen = self.get_n_iopins(pins)
+ bitspec = "Bit#({0})".format(plen)
+ return '\n' + res + self.vectorifacedef2(pins, plen,
['io_out', 'io_out_en', 'io_in'],
['io_out', 'io_out_en', 'io_in'],
-
"Bit#(4)"
, *args) + '\n'
+
bitspec
, *args) + '\n'
def ifacedef3pin(self, idx, pin):
decfn = self.ifacefmtdecfn2
def ifacedef3pin(self, idx, pin):
decfn = self.ifacefmtdecfn2
@@
-491,7
+499,8
@@
class Interfaces(InterfacesBase, PeripheralInterfaces):
def __init__(self, pth=None):
InterfacesBase.__init__(self, Interface, pth,
{'gpio': InterfaceGPIO,
def __init__(self, pth=None):
InterfacesBase.__init__(self, Interface, pth,
{'gpio': InterfaceGPIO,
- 'qspi': InterfaceQSPI,
+ 'spi': InterfaceNSPI,
+ 'qspi': InterfaceNSPI,
'eint': InterfaceEINT})
PeripheralInterfaces.__init__(self)
'eint': InterfaceEINT})
PeripheralInterfaces.__init__(self)