projects
/
pinmux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
use class iterator for mk_connection (all of them)
[pinmux.git]
/
src
/
bsv
/
peripheral_gen
/
gpio.py
diff --git
a/src/bsv/peripheral_gen/gpio.py
b/src/bsv/peripheral_gen/gpio.py
index 9419f1c5bab85955ac5dd7c3c637c94863f04579..50b9f63c3f7dd2a25885e94ddd4ebac8e37e4610 100644
(file)
--- a/
src/bsv/peripheral_gen/gpio.py
+++ b/
src/bsv/peripheral_gen/gpio.py
@@
-4,18
+4,25
@@
from bsv.peripheral_gen.base import PBase
class gpio(PBase):
def slowimport(self):
class gpio(PBase):
def slowimport(self):
- return "
import pinmux::*;\n" + \
- "
import mux::*;\n" + \
- "
import gpio::*;\n"
+ return "import pinmux::*;\n" + \
+ "import mux::*;\n" + \
+ "import gpio::*;\n"
- def slowifdeclmux(self):
+ def extifinstance2(self, name, count):
+ template = "interface pad_config{0} = {1}.pad_config;"
+ dname = self.mksuffix(self.name, count)
+ return template.format(dname, name)
+
+ def slowifdeclmux(self, name, count):
size = len(self.peripheral.pinspecs)
size = len(self.peripheral.pinspecs)
- return " interface GPIO_config#(%d) pad_config{0};" % size
+ dname = self.mksuffix(self.name, count)
+ return "interface GPIO_config#(%d) pad_config%s;" % \
+ (size, dname)
def num_axi_regs32(self):
return 2
def num_axi_regs32(self):
return 2
- def axi_slave_idx(self, idx, name, ifacenum):
+ def axi_slave_idx(self, idx, name, ifacenum
, typ
):
""" generates AXI slave number definition, except
GPIO also has a muxer per bank
"""
""" generates AXI slave number definition, except
GPIO also has a muxer per bank
"""
@@
-23,22
+30,26
@@
class gpio(PBase):
mname = 'mux' + name[4:]
mname = mname.upper()
print "AXIslavenum", name, mname
mname = 'mux' + name[4:]
mname = mname.upper()
print "AXIslavenum", name, mname
- (ret, x) = PBase.axi_slave_idx(self, idx, name, ifacenum)
- (ret2, x) = PBase.axi_slave_idx(self, idx + 1, mname, ifacenum)
+ (ret, x) = PBase.axi_slave_idx(self, idx, name, ifacenum
, typ
)
+ (ret2, x) = PBase.axi_slave_idx(self, idx + 1, mname, ifacenum
, typ
)
return ("%s\n%s" % (ret, ret2), 2)
def mkslow_peripheral(self, size=0):
print "gpioslow", self.peripheral, dir(self.peripheral)
return ("%s\n%s" % (ret, ret2), 2)
def mkslow_peripheral(self, size=0):
print "gpioslow", self.peripheral, dir(self.peripheral)
+ print "gpioslow", self.peripheral.configs
size = len(self.peripheral.pinspecs)
size = len(self.peripheral.pinspecs)
- return " MUX#(%d) mux{0} <- mkmux();\n" % size + \
- " GPIO#(%d) gpio{0} <- mkgpio();" % size
+ dflt_ = "%s" % ("0" * size * 2) # default if not set in spec
+ dflt = self.peripheral.configs[0].get("muxconfig", dflt_)
+ return "MUX#(%d) mux{0} <- mkmux('b%s);\n" % (size, dflt) + \
+ "GPIO#(%d) gpio{0} <- mkgpio();" % size
- def mk_connection(self,
count
):
+ def mk_connection(self,
name, count, fabricname, typ
):
print "GPIO mk_conn", self.name, count
res = []
dname = self.mksuffix(self.name, count)
for i, n in enumerate(['gpio' + dname, 'mux' + dname]):
print "GPIO mk_conn", self.name, count
res = []
dname = self.mksuffix(self.name, count)
for i, n in enumerate(['gpio' + dname, 'mux' + dname]):
- res.append(PBase.mk_connection(self, count, n))
+ res.append(PBase.mk_connection(self, name, count, fabricname, typ,
+ name_override=n))
return '\n'.join(res)
def _mk_connection(self, name=None, count=0):
return '\n'.join(res)
def _mk_connection(self, name=None, count=0):
@@
-53,10
+64,10
@@
class gpio(PBase):
return name[3:]
return name[4:]
return name[3:]
return name[4:]
- def mk_cellconn(self,
cellnum, name, count
):
+ def mk_cellconn(self,
name, count, cellnum
):
ret = []
bank = self.mksuffix(name, count)
ret = []
bank = self.mksuffix(name, count)
- txt = "
pinmux.mux_lines.cell{0}_mux(mux{1}.mux_config.mux[{2}]);"
+ txt = "pinmux.mux_lines.cell{0}_mux(mux{1}.mux_config.mux[{2}]);"
for p in self.peripheral.pinspecs:
ret.append(txt.format(cellnum, bank, p['name'][1:]))
cellnum += 1
for p in self.peripheral.pinspecs:
ret.append(txt.format(cellnum, bank, p['name'][1:]))
cellnum += 1
@@
-68,12
+79,13
@@
class gpio(PBase):
def pinname_outen(self, pname):
return "func.gpio_out_en[{0}]".format(pname[1:])
def pinname_outen(self, pname):
return "func.gpio_out_en[{0}]".format(pname[1:])
- def
mk_pincon(self, name, count
):
+ def
_mk_pincon(self, name, count, typ
):
#ret = [PBase.mk_pincon(self, name, count)]
# special-case for gpio in, store in a temporary vector
#ret = [PBase.mk_pincon(self, name, count)]
# special-case for gpio in, store in a temporary vector
+ assert typ == 'slow'
ret = []
plen = len(self.peripheral.pinspecs)
ret = []
plen = len(self.peripheral.pinspecs)
- template = "
mkConnection({0}.{1},\n\t\t\t{2}_{1});"
+ template = "mkConnection({0}.{1},\n\t\t\t{2}_{1});"
ps = "pinmux.peripheral_side.%s" % name
n = "{0}.func.gpio".format(name)
for ptype in ['out', 'out_en', 'in']:
ps = "pinmux.peripheral_side.%s" % name
n = "{0}.func.gpio".format(name)
for ptype in ['out', 'out_en', 'in']: