0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

高位合成言語アセンブラを作る。 その6

Posted at

#概要

高位合成言語アセンブラを作る。
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

以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?