Initial release of CAR
This commit is contained in:
33
helper.py
Normal file
33
helper.py
Normal file
@ -0,0 +1,33 @@
|
||||
try:
|
||||
from colorama import Fore, Style
|
||||
HAS_COLORAMA = True
|
||||
except ImportError:
|
||||
HAS_COLORAMA = False
|
||||
|
||||
if not HAS_COLORAMA:
|
||||
print("Warning: colorama is not installed.")
|
||||
print("Install it with: pip install colorama or sudo apt install python3-colorama or sudo pacman -S python-colorama")
|
||||
exit(-1);
|
||||
|
||||
|
||||
def is_number(s):
|
||||
try:
|
||||
if s.lower().startswith(("0x", "0b", "0o")):
|
||||
int(s, 0)
|
||||
else:
|
||||
int(s)
|
||||
return True
|
||||
except ValueError:
|
||||
return False
|
||||
|
||||
|
||||
REG_OPCODE_MASK = 0x3f800000
|
||||
REG_DEST_MASK = 0x001f0000
|
||||
REG_SRC2_MASK = 0x0000f800
|
||||
REG_SRC1_MASK = 0x000007f0
|
||||
|
||||
LS_OPCODE_MASK = 0x3c000000
|
||||
LS_IMM_MASK = 0x03ffffff
|
||||
|
||||
|
||||
print("this helper function is not ready yet!")
|
||||
Reference in New Issue
Block a user