microprobe.target.isa.comparator.Comparator¶
-
class
Comparator(arch)[source]¶ Bases:
objectAbstract class to perform comparisons.
Comparatorobjects are in charge of performing comparisons between values while providing an architecture independent and modular interface. They are registered in anISAobject using theregister_value_comparator(). Once registered, whenever a comparison is needed to perform a given operation, it is possible to check (check()) if theComparatorcan perform the requested comparison, and if so, it can generate (generate()) the requiredlistofInstructionto perform it.- Parameters
isa – Architecture to operate on.
Methods
__init__(arch)- param arch
check(reg, value)Checks whether the
Registerreg instance can be compared with the value, which can be a :intor anotherRegister.generate(reg, value, helper_instr)Generate the
Instructionto perform the comparison.Attributes
Architecture on this
Comparatorwill work on (ISA).Value comparator name, usually the opcode of the instruction it uses (
str).
-
abstract
check(reg, value)[source]¶ Checks whether the
Registerreg instance can be compared with the value, which can be a :intor anotherRegister. If is not possible to perform the comparison, a None value is returned. Otherwise, theRegisterinstance where the result of the comparison would be placed is returned.
-
abstract
generate(reg, value, helper_instr)[source]¶ Generate the
Instructionto perform the comparison. If the required instruction is found within thelistofInstructionhelper_instr, no new instruction is generated and the matching instruction operands are set accordingly.
-
abstract property
instr_name¶ Value comparator name, usually the opcode of the instruction it uses (
str).
-
property
arch¶ Architecture on this
Comparatorwill work on (ISA).