Overview
The decode macro decomposes an instruction word into several bit fields according to the instruction-set specification. The decoded fields of the current instruction are kept in an instruction_t record-like data type, where they can be used by the ISA transition logic.
In the architectural-style ISA property, the decoded instruction is bound with a freeze expression such as:
instr = decode(instruction) @ t
The resulting instr value is then passed to next_state, which computes the architectural state after executing the current instruction.
Role in ISS generation
When generating the C++ instruction set simulator (ISS), decode is one of the public functions emitted for the simulator class, alongside next_state and the interface macros. The generated simulator class contains the code for instruction execution and holds the architectural state.
Performance use: cached decoding
The decoded fields can be cached in the simulator. Because software often has locality, for example due to loops, this avoids repeated decoding of the same instruction and reduces simulation run time. The cited ISS-generation approach explicitly uses caching of the decode function result as an optimization analogous in spirit to just-in-time compiled simulation.