Browse Source

support for det vars

devel
Stefan Holst 2 years ago
parent
commit
d6d981a351
  1. 15
      src/kyupy/wave_sim.py

15
src/kyupy/wave_sim.py

@ -76,8 +76,14 @@ class WaveSim(sim.SimOps): @@ -76,8 +76,14 @@ class WaveSim(sim.SimOps):
final values in the waveforms are still valid.
"""
self.simctl_int = np.zeros((1, sims), dtype=np.int32)
self.simctl_int[0] = range(sims)
self.simctl_int = np.zeros((2, sims), dtype=np.int32)
"""Per-simulation delay configuration.
* ``simctl_int[0]`` delay dataset or random seed for picking a delay
* ``simctl_int[1]`` 0: seed parameter specifies dataset, 1: simctl_int[0] specifies dataset, 2: simctl_int[0] + seed param. is a random seed for picking a delay dataset
"""
self.simctl_int[0] = range(sims) # unique seed for each sim by default, zero this to pick same delays for all sims.
self.simctl_int[1] = 2 # random picking by default.
self.nbytes = sum([a.nbytes for a in (self.c, self.s, self.c_locs, self.c_caps, self.ops, self.simctl_int)])
@ -137,6 +143,11 @@ def _wave_eval(lut, z_idx, a_idx, b_idx, c_idx, d_idx, cbuf, c_locs, c_caps, sim @@ -137,6 +143,11 @@ def _wave_eval(lut, z_idx, a_idx, b_idx, c_idx, d_idx, cbuf, c_locs, c_caps, sim
overflows = int(0)
if len(delays) > 1:
if simctl_int[1] == 0:
delays = delays[seed]
elif simctl_int[1] == 1:
delays = delays[simctl_int[0]]
else:
_rnd = (seed << 4) + (z_idx << 20) + simctl_int[0]
for _ in range(4):
_rnd = int(0xDEECE66D) * _rnd + 0xB

Loading…
Cancel
Save