Port pressure returned in tuple with Memory Operand

This commit is contained in:
stefandesouza
2024-03-04 20:00:43 +01:00
parent 46004add41
commit 38781ecc94
9 changed files with 46 additions and 46 deletions

View File

@@ -63,7 +63,7 @@ class TestBaseParser(unittest.TestCase):
self.parser.get_full_reg_name(reg_a1)
def test_normalize_imd(self):
imd_hex_1 = ImmediateOperand(value_id="0x4f")
imd_hex_1 = ImmediateOperand(value="0x4f")
with self.assertRaises(NotImplementedError):
self.parser.normalize_imd(imd_hex_1)

View File

@@ -7,9 +7,9 @@ import unittest
from io import StringIO
import osaca.db_interface as dbi
from osaca.db_interface import sanity_check
from osaca.db_interface import sanity_check, _get_full_instruction_name
from osaca.semantics import MachineModel
from osaca.parser import instructionForm
from osaca.parser import InstructionForm
from osaca.parser.memory import MemoryOperand
from osaca.parser.register import RegisterOperand
import copy
@@ -18,10 +18,10 @@ import copy
class TestDBInterface(unittest.TestCase):
@classmethod
def setUpClass(self):
sample_entry = instructionForm(
instruction_id="DoItRightAndDoItFast",
sample_entry = InstructionForm(
mnemonic="DoItRightAndDoItFast",
operands_id=[
MemoryOperand(offset_ID="imd", base_id="gpr", index_id="gpr", scale_id=8),
MemoryOperand(offset="imd", base="gpr", index="gpr", scale=8),
RegisterOperand(name="xmm"),
],
throughput=1.25,
@@ -61,7 +61,7 @@ class TestDBInterface(unittest.TestCase):
mm_csx.set_instruction_entry(self.entry_csx)
mm_tx2.set_instruction_entry(self.entry_tx2)
mm_zen1.set_instruction_entry(instructionForm(instruction_id="empty_operation"))
mm_zen1.set_instruction_entry(InstructionForm(mnemonic="empty_operation"))
num_entries_csx = len(mm_csx["instruction_forms"]) - num_entries_csx
num_entries_tx2 = len(mm_tx2["instruction_forms"]) - num_entries_tx2
@@ -72,7 +72,7 @@ class TestDBInterface(unittest.TestCase):
self.assertEqual(num_entries_zen1, 1)
def test_invalid_add(self):
entry = instructionForm()
entry = InstructionForm()
with self.assertRaises(KeyError):
MachineModel("csx").set_instruction_entry(entry)
with self.assertRaises(TypeError):

View File

@@ -233,7 +233,7 @@ class TestParserAArch64(unittest.TestCase):
operands_id=[
{"prfop": {"type": ["PLD"], "target": ["L1"], "policy": ["KEEP"]}},
MemoryOperand(
offset=ImmediateOperand(value_id=2048),
offset=ImmediateOperand(value=2048),
base=RegisterOperand(prefix="x", name="26"),
index=None,
scale=1,
@@ -251,7 +251,7 @@ class TestParserAArch64(unittest.TestCase):
RegisterOperand(prefix="x", name="29"),
RegisterOperand(prefix="x", name="30"),
MemoryOperand(
offset=ImmediateOperand(value_id=-16),
offset=ImmediateOperand(value=-16),
base=RegisterOperand(name="sp", prefix="x"),
index=None,
scale=1,
@@ -290,7 +290,7 @@ class TestParserAArch64(unittest.TestCase):
RegisterOperand(prefix="p", name="0", predication="m"),
RegisterOperand(prefix="z", name="29", shape="d"),
RegisterOperand(prefix="z", name="21", shape="d"),
ImmediateOperand(value_id=90, type_id="int"),
ImmediateOperand(value=90, imd_type="int"),
],
directive_id=None,
comment_id=None,
@@ -302,8 +302,8 @@ class TestParserAArch64(unittest.TestCase):
mnemonic="ccmn",
operands_id=[
RegisterOperand(prefix="x", name="11"),
ImmediateOperand(value_id=1, type_id="int"),
ImmediateOperand(value_id=3, type_id="int"),
ImmediateOperand(value=1, imd_type="int"),
ImmediateOperand(value=3, imd_type="int"),
{"condition": "EQ"},
],
directive_id=None,
@@ -339,21 +339,21 @@ class TestParserAArch64(unittest.TestCase):
self.assertEqual(len(parsed), 645)
def test_normalize_imd(self):
imd_decimal_1 = ImmediateOperand(value_id="79")
imd_hex_1 = ImmediateOperand(value_id="0x4f")
imd_decimal_2 = ImmediateOperand(value_id="8")
imd_hex_2 = ImmediateOperand(value_id="0x8")
imd_decimal_1 = ImmediateOperand(value="79")
imd_hex_1 = ImmediateOperand(value="0x4f")
imd_decimal_2 = ImmediateOperand(value="8")
imd_hex_2 = ImmediateOperand(value="0x8")
imd_float_11 = ImmediateOperand(
type_id="float", value_id={"mantissa": "0.79", "e_sign": "+", "exponent": "2"}
imd_type="float", value={"mantissa": "0.79", "e_sign": "+", "exponent": "2"}
)
imd_float_12 = ImmediateOperand(
type_id="float", value_id={"mantissa": "790.0", "e_sign": "-", "exponent": "1"}
imd_type="float", value={"mantissa": "790.0", "e_sign": "-", "exponent": "1"}
)
imd_double_11 = ImmediateOperand(
type_id="double", value_id={"mantissa": "0.79", "e_sign": "+", "exponent": "2"}
imd_type="double", value={"mantissa": "0.79", "e_sign": "+", "exponent": "2"}
)
imd_double_12 = ImmediateOperand(
type_id="double", value_id={"mantissa": "790.0", "e_sign": "-", "exponent": "1"}
imd_type="double", value={"mantissa": "790.0", "e_sign": "-", "exponent": "1"}
)
identifier = IdentifierOperand(name="..B1.4")

View File

@@ -246,10 +246,10 @@ class TestParserX86ATT(unittest.TestCase):
self.assertIsNone(self.parser.parse_register("rax"))
def test_normalize_imd(self):
imd_decimal_1 = ImmediateOperand(value_id="79")
imd_hex_1 = ImmediateOperand(value_id="0x4f")
imd_decimal_2 = ImmediateOperand(value_id="8")
imd_hex_2 = ImmediateOperand(value_id="8")
imd_decimal_1 = ImmediateOperand(value="79")
imd_hex_1 = ImmediateOperand(value="0x4f")
imd_decimal_2 = ImmediateOperand(value="8")
imd_hex_2 = ImmediateOperand(value="8")
self.assertEqual(
self.parser.normalize_imd(imd_decimal_1),
self.parser.normalize_imd(imd_hex_1),