Go to the first, previous, next, last section; table of contents; home; full screen; PSIM.

igen: decoding instructions

Instruction unpacking

Once the instruction has been decoded, the register (and other) fields within the instruction need to be extracted.

The table that follows determines how each field should be treated. Importantly it considers the case where the extracted field is to be used immediatly or stored in an instruction cache.

<valid>

Zero marks the end of the table. More importantly 1. indicates that the entry is valid and can be cached. 2. indicates that that the entry is valid but can not be cached.

<old_name>

The field name as given in the instruction spec.

<new_name>

A name for <old_name> once it has been extracted from the instructioin (and possibly stored in the instruction cache).

<type>

String specifying the storage type for <new_name> (the extracted field>.

<expression>

Specifies how to get <new_name> from <old_name>. If null, old and

Instruction decode table

<options>:<first>:<last>:<force-first>:<force-last>:<force-expand>:<special>...

Ignore the below:

The instruction decode table contains rules that dictate how igen is going to firstly break down the opcode table and secondly

The table that follows is used by gen to construct a decision tree that can identify each possible instruction. Gen then outputs this decision tree as (according to config) a table or switch statement as the function idecode.

In parallel to this, as mentioned above, WITH_EXPANDED_SEMANTICS determines of the semantic functions themselves should be expanded in a similar way.

<first> <last>

Range of bits (within the instruction) that should be searched for an instruction field. Within such ranges, gen looks for opcodes (constants), registers (strings) and reserved bits (slash) and according to the rules that follows includes or excludes them from a possible instruction field.

<force_first> <force_last>

If an instruction field was found, enlarge the field size so that it is forced to at least include bits starting from <force_first> (<force_last>). To stop this occuring, use <force_first> = <last> + 1 and <force_last> = <first> - 1.

<force_slash>

Treat `/' fields as a constant instead of variable when looking for an instruction field.

<force_expansion>

Treat any contained register (string) fields as constant when determining the instruction field. For the instruction decode (and controled by IDECODE_EXPAND_SEMANTICS) this forces the expansion of what would otherwize be non constant bits of an instruction.

<use_switch>

Should this table be expanded using a switch statement (val 1) and if so, should it be padded with entries so as to force the compiler to generate a jump table (val 2). Or a branch table (val 3).

<special_mask> <special_value> <special_rule> <special_constant>

Special rule to fine tune how specific (or groups) of instructions are expanded. The applicability of the rule is determined by

<special_mask> != 0 && (instruction> & <special_mask>) == <special_value>

Where <instruction> is obtained by looking only at constant fields with in an instructions spec. When determining an expansion, the rule is only considered when a node contains a single instruction. <special_rule> can be any of:

0: for this instruction, expand by earlier rules 1: expand bits <force_low> .. <force_hi> only 2: boolean expansion of only zero/non-zero cases 3: boolean expansion of equality of special constant


Go to the first, previous, next, last section; table of contents; home; full screen.