|
|
|
@ -93,8 +93,9 @@ class WaveSim(sim.SimOps):
@@ -93,8 +93,9 @@ class WaveSim(sim.SimOps):
|
|
|
|
|
self.nbytes = sum([a.nbytes for a in (self.c, self.s, self.c_locs, self.c_caps, self.ops, self.simctl_int)]) |
|
|
|
|
|
|
|
|
|
def __repr__(self): |
|
|
|
|
return f'<{type(self).__name__} {self.circuit.name} sims={self.sims} ops={len(self.ops)} ' + \ |
|
|
|
|
f'levels={len(self.level_starts)} mem={hr_bytes(self.nbytes)}>' |
|
|
|
|
dev = 'GPU' if hasattr(self.c, 'copy_to_host') else 'CPU' |
|
|
|
|
return f'{{name: "{self.circuit.name}", device: "{dev}", sims: {self.sims}, ops: {len(self.ops)}, ' + \ |
|
|
|
|
f'levels: {len(self.level_starts)}, nbytes: {self.nbytes}}}' |
|
|
|
|
|
|
|
|
|
def s_to_c(self): |
|
|
|
|
"""Transfers values of sequential elements and primary inputs to the combinational portion. |
|
|
|
@ -198,27 +199,27 @@ def _wave_eval(op, cbuf, c_locs, c_caps, sim, delays, simctl_int, seed=0):
@@ -198,27 +199,27 @@ def _wave_eval(op, cbuf, c_locs, c_caps, sim, delays, simctl_int, seed=0):
|
|
|
|
|
if a == current_t: |
|
|
|
|
a_cur += 1 |
|
|
|
|
inputs ^= 1 |
|
|
|
|
thresh = delays[a_idx, 0, z_val] |
|
|
|
|
a = cbuf[a_mem + a_cur, sim] + delays[a_idx, 0, z_val] |
|
|
|
|
next_t = cbuf[a_mem + a_cur, sim] + delays[a_idx, 0, z_val ^ 1] |
|
|
|
|
thresh = delays[a_idx, a_cur & 1, z_val] |
|
|
|
|
a = cbuf[a_mem + a_cur, sim] + delays[a_idx, a_cur & 1, z_val] |
|
|
|
|
next_t = cbuf[a_mem + a_cur, sim] + delays[a_idx, (a_cur & 1) ^ 1, z_val ^ 1] |
|
|
|
|
elif b == current_t: |
|
|
|
|
b_cur += 1 |
|
|
|
|
inputs ^= 2 |
|
|
|
|
thresh = delays[b_idx, 0, z_val] |
|
|
|
|
b = cbuf[b_mem + b_cur, sim] + delays[b_idx, 0, z_val] |
|
|
|
|
next_t = cbuf[b_mem + b_cur, sim] + delays[b_idx, 0, z_val ^ 1] |
|
|
|
|
thresh = delays[b_idx, b_cur & 1, z_val] |
|
|
|
|
b = cbuf[b_mem + b_cur, sim] + delays[b_idx, b_cur & 1, z_val] |
|
|
|
|
next_t = cbuf[b_mem + b_cur, sim] + delays[b_idx, (b_cur & 1) ^ 1, z_val ^ 1] |
|
|
|
|
elif c == current_t: |
|
|
|
|
c_cur += 1 |
|
|
|
|
inputs ^= 4 |
|
|
|
|
thresh = delays[c_idx, 0, z_val] |
|
|
|
|
c = cbuf[c_mem + c_cur, sim] + delays[c_idx, 0, z_val] |
|
|
|
|
next_t = cbuf[c_mem + c_cur, sim] + delays[c_idx, 0, z_val ^ 1] |
|
|
|
|
thresh = delays[c_idx, c_cur & 1, z_val] |
|
|
|
|
c = cbuf[c_mem + c_cur, sim] + delays[c_idx, c_cur & 1, z_val] |
|
|
|
|
next_t = cbuf[c_mem + c_cur, sim] + delays[c_idx, (c_cur & 1) ^ 1, z_val ^ 1] |
|
|
|
|
else: |
|
|
|
|
d_cur += 1 |
|
|
|
|
inputs ^= 8 |
|
|
|
|
thresh = delays[d_idx, 0, z_val] |
|
|
|
|
d = cbuf[d_mem + d_cur, sim] + delays[d_idx, 0, z_val] |
|
|
|
|
next_t = cbuf[d_mem + d_cur, sim] + delays[d_idx, 0, z_val ^ 1] |
|
|
|
|
thresh = delays[d_idx, d_cur & 1, z_val] |
|
|
|
|
d = cbuf[d_mem + d_cur, sim] + delays[d_idx, d_cur & 1, z_val] |
|
|
|
|
next_t = cbuf[d_mem + d_cur, sim] + delays[d_idx, (d_cur & 1) ^ 1, z_val ^ 1] |
|
|
|
|
|
|
|
|
|
if (z_cur & 1) != ((lut >> inputs) & 1): |
|
|
|
|
# we generate an edge in z_mem, if ... |
|
|
|
@ -240,10 +241,10 @@ def _wave_eval(op, cbuf, c_locs, c_caps, sim, delays, simctl_int, seed=0):
@@ -240,10 +241,10 @@ def _wave_eval(op, cbuf, c_locs, c_caps, sim, delays, simctl_int, seed=0):
|
|
|
|
|
|
|
|
|
|
# output value of cell changed. update all delayed inputs. |
|
|
|
|
z_val = z_val ^ 1 |
|
|
|
|
a = cbuf[a_mem + a_cur, sim] + delays[a_idx, 0, z_val] |
|
|
|
|
b = cbuf[b_mem + b_cur, sim] + delays[b_idx, 0, z_val] |
|
|
|
|
c = cbuf[c_mem + c_cur, sim] + delays[c_idx, 0, z_val] |
|
|
|
|
d = cbuf[d_mem + d_cur, sim] + delays[d_idx, 0, z_val] |
|
|
|
|
a = cbuf[a_mem + a_cur, sim] + delays[a_idx, a_cur & 1, z_val] |
|
|
|
|
b = cbuf[b_mem + b_cur, sim] + delays[b_idx, b_cur & 1, z_val] |
|
|
|
|
c = cbuf[c_mem + c_cur, sim] + delays[c_idx, c_cur & 1, z_val] |
|
|
|
|
d = cbuf[d_mem + d_cur, sim] + delays[d_idx, d_cur & 1, z_val] |
|
|
|
|
|
|
|
|
|
current_t = min(a, b, c, d) |
|
|
|
|
|
|
|
|
|