Skip to content

Instantly share code, notes, and snippets.

@JohnnyonFlame
Created April 26, 2021 21:15
Show Gist options
  • Save JohnnyonFlame/3d918d4bab6550a24357f22f0f298bd8 to your computer and use it in GitHub Desktop.
Save JohnnyonFlame/3d918d4bab6550a24357f22f0f298bd8 to your computer and use it in GitHub Desktop.
SSA ZExt/SExt flags calculator
from itertools import product
def F(x):
# <zear> 0000.0xxx - Z && E
# <zear> 0000.1xxx - Z
# <pcercuei> 1111.0xxx -
# <pcercuei> 1111.1xxx - E
return ['ZE', 'Z ', ' ', ' E'][x]
bits = [0b00, 0b01, 0b10, 0b11]
for (Rs, Rt) in product(bits, repeat=2):
print(f"{F(Rs)} & {F(Rt)} = {F(Rs & Rt)[1] == 'E'}")
@JohnnyonFlame
Copy link
Author

JohnnyonFlame commented Apr 26, 2021

ZE & ZE = True
ZE & Z  = True
ZE &    = True
ZE &  E = True
Z  & ZE = True
Z  & Z  = False
Z  &    = True
Z  &  E = False
   & ZE = True
   & Z  = True
   &    = False
   &  E = False
 E & ZE = True
 E & Z  = False
 E &    = False
 E &  E = True

or:
http://www.32x8.com/sop4_____A-B-C-D_____m_2-3-5-7-8-11-12-13-14-15___________option-0_____889788976078844592720

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment