m2isar.transforms.encode_instructions.operands

Operands used in parsing the instructions

Attributes

XLEN

MetamodelRef

Classes

ComplexOperand

A Operand with a list of bitwidths and signs.

Operand

A simple operand used in the Instruction Class

Functions

to_metamodel_operands(operands) → Dict[str, MetamodelRef]

Converts a dict of operands to dict of metamodel references of those operands

get_immediates(operands) → List[Operand]

returns a subset of the given operands that are immediates

get_immediates_with_name(operands) → List[Tuple[str, Operand]]

returns a list of immediates with their name; (name, operand)

get_register_names(operands) → List[Tuple[str, Operand]]

returns an ordered list of register names

simplify_operands(operands) → Dict[str, List[Operand]]

Simplifying the operands, returns a list where

create_operand_combinations(operand_lists) → List[Dict[str, Operand]]

Create every possible combination of the supplied operands

Module Contents

XLEN = 32[source]
MetamodelRef[source]
class ComplexOperand(width: int | str | List[int | str], sign: str | List[str], immediate: bool = False)[source]

A Operand with a list of bitwidths and signs.

width[source]
sign: List[str][source]
immediate: bool = False[source]
class Operand[source]

A simple operand used in the Instruction Class

width: int[source]
sign: str[source]
immediate: bool = False[source]
property f_width[source]

Can be used in the yaml file to make the instruction names prettier

to_metamodel_ref(name: str, cast: bool = True) → MetamodelRef[source]

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”

to_simd_slices(name: str) → List[m2isar.metamodel.behav.SliceOperation][source]

Returns a list of SliceOperations on register[‘name’]

to_metamodel_operands(operands: Dict[str, Operand]) → Dict[str, MetamodelRef][source]

Converts a dict of operands to dict of metamodel references of those operands

get_immediates(operands: Dict[str, Operand]) → List[Operand][source]

returns a subset of the given operands that are immediates

get_immediates_with_name(operands: Dict[str, Operand]) → List[Tuple[str, Operand]][source]

returns a list of immediates with their name; (name, operand)

get_register_names(operands: Dict[str, Operand]) → List[Tuple[str, Operand]][source]

returns an ordered list of register names

simplify_operands(operands: Dict[str, ComplexOperand]) → Dict[str, List[Operand]][source]

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

create_operand_combinations(operand_lists: Dict[str, List[Operand]]) → List[Dict[str, Operand]][source]

Create every possible combination of the supplied operands