3 from helpers
import l
, u
, n
7 def _byteify(data
, ignore_dicts
= False):
8 # if this is a unicode string, return its string representation
9 if isinstance(data
, unicode):
10 return data
.encode('utf-8')
11 # if this is a list of values, return list of byteified values
12 if isinstance(data
, list):
13 return [ _byteify(item
, ignore_dicts
=True) for item
in data
]
14 # if this is a dictionary, return dictionary of byteified keys and values
15 # but only if we haven't already byteified it
16 if isinstance(data
, dict) and not ignore_dicts
:
17 return dict((_byteify(key
, ignore_dicts
=True),
18 _byteify(value
, ignore_dicts
=True))
19 for key
, value
in data
.iteritems())
20 # if it's anything else, return it in its original form
23 # load JSON-formatted pad info from pinmux
24 pth
= os
.path
.abspath(__file__
)
25 pth
= os
.path
.split(pth
)[0]
27 with
open("%s/ls180/litex_pinpads.json" % pth
) as f
:
29 chip
= json
.loads(txt
, object_hook
=_byteify
)
30 chip
= _byteify(chip
, ignore_dicts
=True)
33 chip
.update({ 'pads.ioPadGauge' : 'pxlib',
34 # core option (big, time-consuming)
35 #'core.size' : ( l(28000), l(28000) ),
36 #'chip.size' : ( l(30200), l(30200) ),
37 # no-core option (test_issuer but no actual core)
38 'core.size' : ( l(13000), l(13000) ),
39 'chip.size' : ( l(14400), l(14400) ),
40 'pads.useCoreSize': True,
41 'chip.clockTree' : True,