Browse Source

improve robustness of sdf annotation and wave sim

devel
Stefan Holst 3 years ago
parent
commit
7c03271048
  1. 12
      src/kyupy/sdf.py
  2. 1
      src/kyupy/wave_sim.py

12
src/kyupy/sdf.py

@ -92,7 +92,7 @@ class DelayFile: @@ -92,7 +92,7 @@ class DelayFile:
continue
cell = find_cell(cn)
if cell is None:
log.warn(f'Cell from SDF not found in circuit: {cn}')
#log.warn(f'Cell from SDF not found in circuit: {cn}')
continue
ipn = re.sub(r'\((neg|pos)edge ([^)]+)\)', r'\2', ipn)
ipin = tlib.pin_index(cell.kind, ipn)
@ -111,12 +111,15 @@ class DelayFile: @@ -111,12 +111,15 @@ class DelayFile:
if ffdelays and (len(cell.outs) > opin):
add_delays(cell.outs[opin])
else:
if ipin < len(cell.ins):
if kind.startswith(('xor', 'xnor')):
# print(ipn, ipin, times[cell.i_lines[ipin], 0, 0])
take_avg = timing[cell.ins[ipin]].sum() > 0
add_delays(cell.ins[ipin])
if take_avg:
timing[cell.ins[ipin]] /= 2
else:
log.warn(f'No line to annotate pin {ipn} of {cell}')
if not interconnect or self.interconnects is None:
return timing
@ -139,14 +142,17 @@ class DelayFile: @@ -139,14 +142,17 @@ class DelayFile:
cn2, pn2 = (n2, 'IN')
c1 = find_cell(cn1)
if c1 is None:
log.warn(f'Cell from SDF not found in circuit: {cn1}')
#log.warn(f'Cell from SDF not found in circuit: {cn1}')
continue
c2 = find_cell(cn2)
if c2 is None:
log.warn(f'Cell from SDF not found in circuit: {cn2}')
#log.warn(f'Cell from SDF not found in circuit: {cn2}')
continue
p1, p2 = tlib.pin_index(c1.kind, pn1), tlib.pin_index(c2.kind, pn2)
line = None
if len(c2.ins) <= p2:
log.warn(f'No line to annotate pin {pn2} of {c2}')
continue
f1, f2 = c1.outs[p1].reader, c2.ins[p2].driver
if f1 != f2: # possible branchfork
assert len(f2.ins) == 1

1
src/kyupy/wave_sim.py

@ -161,6 +161,7 @@ class WaveSim: @@ -161,6 +161,7 @@ class WaveSim:
if kind == '__fork__':
if not strip_forks:
for o_line in n.outs:
if o_line is not None:
ops.append((0b1010, o_line.index, i0_idx, i1_idx))
elif kind.startswith('nand'):
ops.append((0b0111, o0_idx, i0_idx, i1_idx))

Loading…
Cancel
Save