projects
/
pinmux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix cell bit widths if muxwidth = 1
[pinmux.git]
/
src
/
parse.py
diff --git
a/src/parse.py
b/src/parse.py
index 6ab3dd094230c4a3ce66f34f8f0f8228da78342c..b2e017ab2dd54e2c75ea6960fc756a7ed2c6c1cc 100644
(file)
--- a/
src/parse.py
+++ b/
src/parse.py
@@
-22,17
+22,23
@@
class Parse(object):
max_io = 0
self.muxed_cells = []
max_io = 0
self.muxed_cells = []
+ self.muxed_cells_width = []
+ self.muxed_cells_bank = []
self.dedicated_cells = []
self.pinnumbers = []
self.bankwidths = {}
self.dedicated_cells = []
self.pinnumbers = []
self.bankwidths = {}
+ self.banksize = {}
+ self.bankstart = {}
- fname = '
bankwidths
.txt'
+ fname = '
pinspec
.txt'
if pth:
fname = os.path.join(pth, fname)
with open(fname) as bankwidths:
for lineno, line in enumerate(bankwidths):
line1 = line[:-1].split('\t')
if pth:
fname = os.path.join(pth, fname)
with open(fname) as bankwidths:
for lineno, line in enumerate(bankwidths):
line1 = line[:-1].split('\t')
- self.bankwidths[line1[0]] = int(line1[1])
+ self.bankwidths[line1[0]] = int(line1[3])
+ self.banksize[line1[0]] = int(line1[2])
+ self.bankstart[line1[0]] = int(line1[1])
# == capture the number of IO cells required == #
fname = 'pinmap.txt'
# == capture the number of IO cells required == #
fname = 'pinmap.txt'
@@
-41,17
+47,21
@@
class Parse(object):
with open(fname) as pinmapfile:
for lineno, line in enumerate(pinmapfile):
line1 = line[:-1].split('\t')
with open(fname) as pinmapfile:
for lineno, line in enumerate(pinmapfile):
line1 = line[:-1].split('\t')
- if len(line1) <=
2
:
+ if len(line1) <=
3
:
continue
self.pinnumbers.append(int(line1[0]))
continue
self.pinnumbers.append(int(line1[0]))
+ self.muxed_cells_bank.append(line1[1])
+ self.muxed_cells_width.append(int(line1[2]))
# XXX TODO: dedicated pins in separate file
#if len(line1) == 2: # dedicated
# self.dedicated_cells.append(line1)
#else:
# XXX TODO: dedicated pins in separate file
#if len(line1) == 2: # dedicated
# self.dedicated_cells.append(line1)
#else:
- for i in range(
1
, len(line1)):
+ for i in range(
3
, len(line1)):
# XXX HORRIBLE HACK!!
if line1[i].startswith('pwm'):
line1[i] = 'pwm%s_out' % line1[i][4:]
# XXX HORRIBLE HACK!!
if line1[i].startswith('pwm'):
line1[i] = 'pwm%s_out' % line1[i][4:]
+ line1 = [line1[0]] + line1[3:]
+ print "line", line1
self.muxed_cells.append(line1)
self.pinnumbers = sorted(self.pinnumbers)
self.muxed_cells.append(line1)
self.pinnumbers = sorted(self.pinnumbers)
@@
-102,13
+112,22
@@
class Parse(object):
# TODO
# TODO
- def get_
cell_bit_widths(self, banks
):
+ def get_
max_cell_bitwidth(self
):
max_num_cells = 0
for cell in self.muxed_cells:
print cell
max_num_cells = max(len(cell) - 1, max_num_cells)
return int(math.log(max_num_cells + 1, 2))
max_num_cells = 0
for cell in self.muxed_cells:
print cell
max_num_cells = max(len(cell) - 1, max_num_cells)
return int(math.log(max_num_cells + 1, 2))
+ def get_muxwidth(self, cellnum):
+ return self.muxed_cells_width[int(cellnum)]
+
+ def get_muxbitwidth(self, cellnum):
+ wid = self.get_muxwidth(cellnum)
+ if wid == 1:
+ return 0
+ return int(math.log(wid + 1, 2))
+
if __name__ == '__main__':
p = Parse()
if __name__ == '__main__':
p = Parse()