from Hurricane import DbU
if True: # change this to False to get errors to "go away" so that
# print / debug statements in generation of spec can be seen
- # without the critical dependence of having to run via "cgt"
+ # without the hard dependence of having to run via "cgt"
from plugins.alpha.block.configuration import IoPin
from plugins.alpha.block.block import Block
from plugins.alpha.block.configuration import GaugeConf
af = CRL.AllianceFramework.get()
-
+# converts unicode strings to utf-8 because coriolis2 python code is expecting
+# str not unicode
def _byteify(data, ignore_dicts = False):
# if this is a unicode string, return its string representation
if isinstance(data, unicode):
'chip.clockTree' : True,
})
+# this function is the equivalent of statically-declared io pad specs.
+# it is not ok to have io declared manually, duplicated in (literally) 5
+# different places, too many mistakes can be made and changes are a
+# nightmare.
+#
+# therefore the pinmux code takes responsibility for declaring the pinouts,
+# generates a JSON file which is read (above) and *creates* the list from
+# that auto-generated file. the core, litex peripheral code, *and* the C4M
+# JTAG Boundary Scan code do *EXACTLY* the same thing and in this way they
+# all "match".
+#
+# here we do some weirdness to convert from the ioring.py pads list format over
+# to the new niolib format.
+
def generate_spec():
# convert old ioring format to ioPadsSpec
ioPadsSpec = []
# sides[side] = {}
for pinname in chip[side]:
sides[pinname] = io_pin_spec
+
# now go through pads.instances
pprint (sides)
for pad in chip['pads.instances']:
padname = pad[0]
padside = sides[padname]
print ("padside", padname, padside)
+
+ # format here is ['padname', 'to core', 'from core', 'direction']
+ # where direction is "+" for out, "-" for in, "*" for bi-directionaly
if len(pad) == 4:
+ print("4-long io", pad)
if pad[-1] == '-':
en_sig = 'io_in'
if pad[-1] == '+':
en_sig = 'io_out'
padspec = [padside, None, padname, pad[1], pad[2], en_sig]
- print("4-long io", pad)
+
+ # format here is:
+ # ['padname', 'something', 'to core', 'from core', 'en', 'direction']
elif len(pad) == 6:
print("6-long io", pad)
padspec = [padside, None, padname] + pad[1:5]
assert False
print ("padspec", padspec)
ioPadsSpec.append(tuple(padspec))
+
return ioPadsSpec
ioPadsSpec = generate_spec()