Browse Source

fix double-free when fo goes to same cell

devel
Stefan Holst 1 year ago
parent
commit
d8f605a47a
  1. 12
      src/kyupy/sim.py

12
src/kyupy/sim.py

@ -279,7 +279,7 @@ class SimOps: @@ -279,7 +279,7 @@ class SimOps:
# allocate memory for the rest of the circuit
for op_start, op_stop in zip(self.level_starts, self.level_stops):
free_list = []
free_set = set()
for op in self.ops[op_start:op_stop]:
# if we fork-strip, always take the stems
i0_idx = stems[op[2]] if stems[op[2]] >= 0 else op[2]
@ -290,15 +290,15 @@ class SimOps: @@ -290,15 +290,15 @@ class SimOps:
ref_count[i1_idx] -= 1
ref_count[i2_idx] -= 1
ref_count[i3_idx] -= 1
if ref_count[i0_idx] <= 0: free_list.append(self.c_locs[i0_idx])
if ref_count[i1_idx] <= 0: free_list.append(self.c_locs[i1_idx])
if ref_count[i2_idx] <= 0: free_list.append(self.c_locs[i2_idx])
if ref_count[i3_idx] <= 0: free_list.append(self.c_locs[i3_idx])
if ref_count[i0_idx] <= 0: free_set.add(self.c_locs[i0_idx])
if ref_count[i1_idx] <= 0: free_set.add(self.c_locs[i1_idx])
if ref_count[i2_idx] <= 0: free_set.add(self.c_locs[i2_idx])
if ref_count[i3_idx] <= 0: free_set.add(self.c_locs[i3_idx])
o_idx = op[1]
cap = max(c_caps_min, c_caps[o_idx])
self.c_locs[o_idx], self.c_caps[o_idx] = h.alloc(cap), cap
if c_reuse:
for loc in free_list:
for loc in free_set:
h.free(loc)
# copy memory location and capacity from stems to fanout lines

Loading…
Cancel
Save