Create a high-level synthesis language assembler. I tried to find a logical formula from the truth table with python.
import sympy as sym
#xor
print (sym.POSform(['a', 'b'], [[1, 0], [0, 1]]))
#or
print (sym.POSform(['a', 'b'], [[1, 1], [0, 1], [1, 0]]))
#and
print (sym.POSform(['a', 'b'], [[1, 1]]))
#nand
print (sym.POSform(['a', 'b'], [[0, 0], [0, 1], [1, 0]]))
#nor
print (sym.POSform(['a', 'b'], [[0, 0]]))
print (sym.POSform(['a', 'b', 'c'], [[1, 1, 1]]))
(a | b) & (~a | ~b)
a | b
a & b
~a | ~b
~a & ~b
a & b & c
that's all.
Recommended Posts