Created
December 13, 2018 21:43
-
-
Save olofk/a2549ce902e8e7e61e88d45d8199253e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sympy.logic import SOPform | |
from sympy import symbols | |
a, w, x, y, z = symbols('opcode[4] opcode[3] opcode[2] opcode[1] opcode[0]') | |
dontcares = [ | |
# [0, 0, 0, 0, 0], | |
[0, 0, 0, 0, 1], | |
[0, 0, 0, 1, 0], | |
[0, 0, 0, 1, 1], | |
# [0, 0, 1, 0, 0], | |
# [0, 0, 1, 0, 1], | |
[0, 0, 1, 1, 0], | |
[0, 0, 1, 1, 1], | |
# [0, 1, 0, 0, 0], | |
[0, 1, 0, 0, 1], | |
[0, 1, 0, 1, 0], | |
[0, 1, 0, 1, 1], | |
[0, 1, 1, 0, 0], | |
# [0, 1, 1, 0, 1], | |
[0, 1, 1, 1, 0], | |
[0, 1, 1, 1, 1], | |
[1, 0, 0, 0, 0], | |
[1, 0, 0, 0, 1], | |
[1, 0, 0, 1, 0], | |
[1, 0, 0, 1, 1], | |
[1, 0, 1, 0, 0], | |
[1, 0, 1, 0, 1], | |
[1, 0, 1, 1, 0], | |
[1, 0, 1, 1, 1], | |
# [1, 1, 0, 0, 0], | |
# [1, 1, 0, 0, 1], | |
[1, 1, 0, 1, 0], | |
# [1, 1, 0, 1, 1], | |
# [1, 1, 1, 0, 0], | |
[1, 1, 1, 0, 1], | |
[1, 1, 1, 1, 0], | |
[1, 1, 1, 1, 1], | |
] | |
itype = [ | |
[0, 0, 0, 0, 0], | |
[0, 0, 1, 0, 0], | |
[1, 1, 0, 0, 1], | |
[1, 1, 1, 0, 0], | |
] | |
jtype = [[1,1,0,1,1]] | |
print("wire itype = {};".format(SOPform([a, w, x, y, z], itype, dontcares))) | |
print("wire jtype = {};".format(SOPform([a, w, x, y, z], jtype, dontcares))) | |
print("wire iorjtype = {};".format(SOPform([a, w, x, y, z], itype+jtype, dontcares))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment