m2isar.transforms.encode_instructions.operands ============================================== .. py:module:: m2isar.transforms.encode_instructions.operands .. autoapi-nested-parse:: Operands used in parsing the instructions Attributes ---------- .. autoapisummary:: m2isar.transforms.encode_instructions.operands.XLEN m2isar.transforms.encode_instructions.operands.MetamodelRef Classes ------- .. autoapisummary:: m2isar.transforms.encode_instructions.operands.ComplexOperand m2isar.transforms.encode_instructions.operands.Operand Functions --------- .. autoapisummary:: m2isar.transforms.encode_instructions.operands.to_metamodel_operands m2isar.transforms.encode_instructions.operands.get_immediates m2isar.transforms.encode_instructions.operands.get_immediates_with_name m2isar.transforms.encode_instructions.operands.get_register_names m2isar.transforms.encode_instructions.operands.simplify_operands m2isar.transforms.encode_instructions.operands.create_operand_combinations Module Contents --------------- .. py:data:: XLEN :value: 32 .. py:data:: MetamodelRef .. py:class:: ComplexOperand(width: Union[Union[int, str], List[Union[int, str]]], sign: Union[str, List[str]], immediate: bool = False) A Operand with a list of bitwidths and signs. .. py:attribute:: width .. py:attribute:: sign :type: List[str] .. py:attribute:: immediate :type: bool :value: False .. py:class:: Operand A simple operand used in the Instruction Class .. py:attribute:: width :type: int .. py:attribute:: sign :type: str .. py:attribute:: immediate :type: bool :value: False .. py:property:: f_width Can be used in the yaml file to make the instruction names prettier .. py:method:: to_metamodel_ref(name: str, cast: bool = True) -> MetamodelRef Returns either: - IndexedReference if the operand is a register - NamedReference if the operand is an immediate - Or a TypeConv, explained below Return Value gets wrapped in a TypeConv if its smaller than XLEN or signed, This can be turned off by passing "cast=False" .. py:method:: to_simd_slices(name: str) -> List[m2isar.metamodel.behav.SliceOperation] Returns a list of SliceOperations on register['name'] .. py:function:: to_metamodel_operands(operands: Dict[str, Operand]) -> Dict[str, MetamodelRef] Converts a dict of operands to dict of metamodel references of those operands .. py:function:: get_immediates(operands: Dict[str, Operand]) -> List[Operand] returns a subset of the given operands that are immediates .. py:function:: get_immediates_with_name(operands: Dict[str, Operand]) -> List[Tuple[str, Operand]] returns a list of immediates with their name; (name, operand) .. py:function:: get_register_names(operands: Dict[str, Operand]) -> List[Tuple[str, Operand]] returns an ordered list of register names .. py:function:: simplify_operands(operands: Dict[str, ComplexOperand]) -> Dict[str, List[Operand]] Simplifying the operands, returns a list where the ComplexOperands have been turned into simple Operands with only 1 sign and width Width or sign references need to be resolved once the operands are put into groups .. py:function:: create_operand_combinations(operand_lists: Dict[str, List[Operand]]) -> List[Dict[str, Operand]] Create every possible combination of the supplied operands