|
|
@ -287,23 +287,6 @@ def bp_not(out, inp): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def bp_or(out, *ins): |
|
|
|
def bp_or(out, *ins): |
|
|
|
# 4-valued: |
|
|
|
|
|
|
|
# 0 1 - X |
|
|
|
|
|
|
|
# 0 0 1 X X |
|
|
|
|
|
|
|
# 1 1 1 1 1 |
|
|
|
|
|
|
|
# - X 1 X X |
|
|
|
|
|
|
|
# X X 1 X X |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 8-valued: o[0]: o[1]: o[2]: |
|
|
|
|
|
|
|
# 0 1 - X R F P N 0 1 - X R F P N 0 1 - X R F P N 0 1 - X R F P N |
|
|
|
|
|
|
|
# 0 0 1 X X R F P N 0 1 1 1 0 1 0 1 1 0 1 1 0 1 1 0 0 0 0 0 1 1 1 1 |
|
|
|
|
|
|
|
# 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 |
|
|
|
|
|
|
|
# - X 1 X X X X X X 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 |
|
|
|
|
|
|
|
# X X 1 X X X X X X 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 |
|
|
|
|
|
|
|
# R R 1 X X R N R R 0 1 1 1 0 1 0 0 0 0 1 1 0 0 0 0 1 0 0 0 1 1 1 1 |
|
|
|
|
|
|
|
# F F 1 X X N F F F 1 1 1 1 1 1 1 1 1 0 1 1 0 1 1 1 1 0 0 0 1 1 1 1 |
|
|
|
|
|
|
|
# P P 1 X X R F P N 0 1 1 1 0 1 0 1 1 0 1 1 0 1 1 0 1 0 0 0 1 1 1 1 |
|
|
|
|
|
|
|
# N N 1 X X R F N N 1 1 1 1 0 1 1 1 0 0 1 1 0 1 0 0 1 0 0 0 1 1 1 1 |
|
|
|
|
|
|
|
md = out.shape[-2] |
|
|
|
md = out.shape[-2] |
|
|
|
for inp in ins: assert md == inp.shape[-2] |
|
|
|
for inp in ins: assert md == inp.shape[-2] |
|
|
|
out[...] = 0 |
|
|
|
out[...] = 0 |
|
|
@ -329,23 +312,6 @@ def bp_or(out, *ins): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def bp_and(out, *ins): |
|
|
|
def bp_and(out, *ins): |
|
|
|
# 4-valued: |
|
|
|
|
|
|
|
# 0 1 - X |
|
|
|
|
|
|
|
# 0 0 0 0 0 |
|
|
|
|
|
|
|
# 1 0 1 X X |
|
|
|
|
|
|
|
# - 0 X X X |
|
|
|
|
|
|
|
# X 0 X X X |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 8-valued: |
|
|
|
|
|
|
|
# 0 1 - X R F P N |
|
|
|
|
|
|
|
# 0 0 0 0 0 0 0 0 0 |
|
|
|
|
|
|
|
# 1 0 1 X X R F P N |
|
|
|
|
|
|
|
# - 0 X X X X X X X |
|
|
|
|
|
|
|
# X 0 X X X X X X X |
|
|
|
|
|
|
|
# R 0 R X X R R P R |
|
|
|
|
|
|
|
# F 0 F X X R F P F |
|
|
|
|
|
|
|
# P 0 P X X P P P P |
|
|
|
|
|
|
|
# N 0 N X X R F P N |
|
|
|
|
|
|
|
md = out.shape[-2] |
|
|
|
md = out.shape[-2] |
|
|
|
for inp in ins: assert md == inp.shape[-2] |
|
|
|
for inp in ins: assert md == inp.shape[-2] |
|
|
|
out[...] = 0xff |
|
|
|
out[...] = 0xff |
|
|
@ -372,23 +338,6 @@ def bp_and(out, *ins): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def bp_xor(out, *ins): |
|
|
|
def bp_xor(out, *ins): |
|
|
|
# 4-valued: |
|
|
|
|
|
|
|
# 0 1 - X |
|
|
|
|
|
|
|
# 0 0 1 X X |
|
|
|
|
|
|
|
# 1 1 0 X X |
|
|
|
|
|
|
|
# - X X X X |
|
|
|
|
|
|
|
# X X X X X |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 8-valued: o[0]: o[1]: o[2]: |
|
|
|
|
|
|
|
# 0 1 - X R F P N 0 1 - X R F P N 0 1 - X R F P N 0 1 - X R F P N |
|
|
|
|
|
|
|
# 0 0 1 X X R F P N 0 1 1 1 0 1 0 1 1 0 1 1 0 1 1 0 0 0 0 0 1 1 1 1 |
|
|
|
|
|
|
|
# 1 1 0 X X F R N P 1 0 1 1 1 0 1 0 0 1 1 1 1 0 0 1 0 0 0 0 1 1 1 1 |
|
|
|
|
|
|
|
# - X X X X X X X X 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 |
|
|
|
|
|
|
|
# X X X X X X X X X 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 |
|
|
|
|
|
|
|
# R R F X X P N R F 0 1 1 1 0 1 0 1 0 1 1 1 1 0 0 1 1 1 0 0 1 1 1 1 |
|
|
|
|
|
|
|
# F F R X X N P F R 1 0 1 1 1 0 1 0 1 0 1 1 0 1 1 0 1 1 0 0 1 1 1 1 |
|
|
|
|
|
|
|
# P P N X X R F P N 0 1 1 1 0 1 0 1 1 0 1 1 0 1 1 0 1 1 0 0 1 1 1 1 |
|
|
|
|
|
|
|
# N N P X X F R N P 1 0 1 1 1 0 1 0 0 1 1 1 1 0 0 1 1 1 0 0 1 1 1 1 |
|
|
|
|
|
|
|
md = out.shape[-2] |
|
|
|
md = out.shape[-2] |
|
|
|
for inp in ins: assert md == inp.shape[-2] |
|
|
|
for inp in ins: assert md == inp.shape[-2] |
|
|
|
out[...] = 0 |
|
|
|
out[...] = 0 |
|
|
|