|
|
@ -89,10 +89,9 @@ class LogicSim(sim.SimOps): |
|
|
|
elif op == sim.NOR2: self.c[o0] = ~(self.c[i0] | self.c[i1]) |
|
|
|
elif op == sim.NOR2: self.c[o0] = ~(self.c[i0] | self.c[i1]) |
|
|
|
elif op == sim.XOR2: self.c[o0] = self.c[i0] ^ self.c[i1] |
|
|
|
elif op == sim.XOR2: self.c[o0] = self.c[i0] ^ self.c[i1] |
|
|
|
elif op == sim.XNOR2: self.c[o0] = ~(self.c[i0] ^ self.c[i1]) |
|
|
|
elif op == sim.XNOR2: self.c[o0] = ~(self.c[i0] ^ self.c[i1]) |
|
|
|
|
|
|
|
elif op == sim.AOI21: self.c[o0] = ~((self.c[i0] & self.c[i1]) | self.c[i2]) |
|
|
|
else: print(f'unknown op {op}') |
|
|
|
else: print(f'unknown op {op}') |
|
|
|
inject_cb(o0, self.s[o0]) |
|
|
|
inject_cb(o0, self.s[o0]) |
|
|
|
elif self.m == 4: |
|
|
|
|
|
|
|
pass |
|
|
|
|
|
|
|
else: |
|
|
|
else: |
|
|
|
for op, o0, i0, i1, i2, i3 in self.ops: |
|
|
|
for op, o0, i0, i1, i2, i3 in self.ops: |
|
|
|
o0, i0, i1, i2, i3 = [self.c_locs[x] for x in (o0, i0, i1, i2, i3)] |
|
|
|
o0, i0, i1, i2, i3 = [self.c_locs[x] for x in (o0, i0, i1, i2, i3)] |
|
|
@ -104,6 +103,7 @@ class LogicSim(sim.SimOps): |
|
|
|
elif op == sim.NOR2: logic.bp_or(self.c[o0], self.c[i0], self.c[i1]); logic.bp_not(self.c[o0], self.c[o0]) |
|
|
|
elif op == sim.NOR2: logic.bp_or(self.c[o0], self.c[i0], self.c[i1]); logic.bp_not(self.c[o0], self.c[o0]) |
|
|
|
elif op == sim.XOR2: logic.bp_xor(self.c[o0], self.c[i0], self.c[i1]) |
|
|
|
elif op == sim.XOR2: logic.bp_xor(self.c[o0], self.c[i0], self.c[i1]) |
|
|
|
elif op == sim.XNOR2: logic.bp_xor(self.c[o0], self.c[i0], self.c[i1]); logic.bp_not(self.c[o0], self.c[o0]) |
|
|
|
elif op == sim.XNOR2: logic.bp_xor(self.c[o0], self.c[i0], self.c[i1]); logic.bp_not(self.c[o0], self.c[o0]) |
|
|
|
|
|
|
|
elif op == sim.AOI21: logic.bp_and(self.c[self.tmp_idx], self.c[i0], self.c[i1]); logic.bp_or(self.c[o0], self.c[self.tmp_idx], self.c[i2]); logic.bp_not(self.c[o0], self.c[o0]) |
|
|
|
else: print(f'unknown op {op}') |
|
|
|
else: print(f'unknown op {op}') |
|
|
|
if inject_cb is not None: inject_cb(o0, self.s[o0]) |
|
|
|
if inject_cb is not None: inject_cb(o0, self.s[o0]) |
|
|
|
|
|
|
|
|
|
|
@ -145,4 +145,5 @@ def _prop_cpu(ops, c_locs, c): |
|
|
|
elif op == sim.NOR2: c[o0] = ~(c[i0] | c[i1]) |
|
|
|
elif op == sim.NOR2: c[o0] = ~(c[i0] | c[i1]) |
|
|
|
elif op == sim.XOR2: c[o0] = c[i0] ^ c[i1] |
|
|
|
elif op == sim.XOR2: c[o0] = c[i0] ^ c[i1] |
|
|
|
elif op == sim.XNOR2: c[o0] = ~(c[i0] ^ c[i1]) |
|
|
|
elif op == sim.XNOR2: c[o0] = ~(c[i0] ^ c[i1]) |
|
|
|
|
|
|
|
elif op == sim.AOI21: c[o0] = ~((c[i0] & c[i1]) | c[i2]) |
|
|
|
else: print(f'unknown op {op}') |
|
|
|
else: print(f'unknown op {op}') |
|
|
|