pass line id to inject_cb
This commit is contained in:
1 parent
1a3b91c1c0
commit
68e8cb844a
1 file changed
+10
-10
+10
-10
@@ -51,7 +51,7 @@ class LogicSim(sim.SimOps):
|
||||
"""
|
||||
self.c[self.pippi_c_locs] = self.s[0, self.pippi_s_locs, :self.mdim]
|
||||
|
||||
def c_prop(self, inject_cb=None):
|
||||
def c_prop(self, sims=None, inject_cb=None):
|
||||
"""Propagate the input values through the combinational circuit towards the outputs.
|
||||
|
||||
Performs all logic operations in topological order.
|
||||
@@ -69,8 +69,8 @@ class LogicSim(sim.SimOps):
|
||||
if inject_cb is None:
|
||||
_prop_cpu(self.ops, self.c_locs, self.c)
|
||||
else:
|
||||
for op, o0, i0, i1, i2, i3 in self.ops[:,:6]:
|
||||
o0, i0, i1, i2, i3 = [self.c_locs[x] for x in (o0, i0, i1, i2, i3)]
|
||||
for op, o0l, i0l, i1l, i2l, i3l in self.ops[:,:6]:
|
||||
o0, i0, i1, i2, i3 = [self.c_locs[x] for x in (o0l, i0l, i1l, i2l, i3l)]
|
||||
if op == sim.BUF1: self.c[o0]=self.c[i0]
|
||||
elif op == sim.INV1: self.c[o0] = ~self.c[i0]
|
||||
elif op == sim.AND2: self.c[o0] = self.c[i0] & self.c[i1]
|
||||
@@ -105,10 +105,10 @@ class LogicSim(sim.SimOps):
|
||||
elif op == sim.OAI211:self.c[o0] = ~((self.c[i0] | self.c[i1]) & self.c[i2] & self.c[i3])
|
||||
elif op == sim.MUX21: self.c[o0] = (self.c[i0] & ~self.c[i2]) | (self.c[i1] & self.c[i2])
|
||||
else: print(f'unknown op {op}')
|
||||
inject_cb(o0, self.c[o0])
|
||||
inject_cb(o0l, self.c[o0])
|
||||
elif self.m == 4:
|
||||
for op, o0, i0, i1, i2, i3 in self.ops[:,:6]:
|
||||
o0, i0, i1, i2, i3 = [self.c_locs[x] for x in (o0, i0, i1, i2, i3)]
|
||||
for op, o0l, i0l, i1l, i2l, i3l in self.ops[:,:6]:
|
||||
o0, i0, i1, i2, i3 = [self.c_locs[x] for x in (o0l, i0l, i1l, i2l, i3l)]
|
||||
if op == sim.BUF1: self.c[o0]=self.c[i0]
|
||||
elif op == sim.INV1: logic.bp4v_not(self.c[o0], self.c[i0])
|
||||
elif op == sim.AND2: logic.bp4v_and(self.c[o0], self.c[i0], self.c[i1])
|
||||
@@ -181,10 +181,10 @@ class LogicSim(sim.SimOps):
|
||||
logic.bp4v_and(self.c[t1], self.c[i1], self.c[i2])
|
||||
logic.bp4v_or(self.c[o0], self.c[t0], self.c[t1])
|
||||
else: print(f'unknown op {op}')
|
||||
if inject_cb is not None: inject_cb(o0, self.c[o0])
|
||||
if inject_cb is not None: inject_cb(o0l, self.c[o0])
|
||||
else:
|
||||
for op, o0, i0, i1, i2, i3 in self.ops[:,:6]:
|
||||
o0, i0, i1, i2, i3 = [self.c_locs[x] for x in (o0, i0, i1, i2, i3)]
|
||||
for op, o0l, i0l, i1l, i2l, i3l in self.ops[:,:6]:
|
||||
o0, i0, i1, i2, i3 = [self.c_locs[x] for x in (o0l, i0l, i1l, i2l, i3l)]
|
||||
if op == sim.BUF1: self.c[o0]=self.c[i0]
|
||||
elif op == sim.INV1: logic.bp8v_not(self.c[o0], self.c[i0])
|
||||
elif op == sim.AND2: logic.bp8v_and(self.c[o0], self.c[i0], self.c[i1])
|
||||
@@ -257,7 +257,7 @@ class LogicSim(sim.SimOps):
|
||||
logic.bp8v_and(self.c[t1], self.c[i1], self.c[i2])
|
||||
logic.bp8v_or(self.c[o0], self.c[t0], self.c[t1])
|
||||
else: print(f'unknown op {op}')
|
||||
if inject_cb is not None: inject_cb(o0, self.c[o0])
|
||||
if inject_cb is not None: inject_cb(o0l, self.c[o0])
|
||||
|
||||
def c_to_s(self):
|
||||
"""Copies (captures) the results of the combinational portion to ``s[1]``.
|
||||
|
||||
Reference in new issue
Block a user