3.5 Decode Stage (DE)

<< Click to Display Table of Contents >>

Navigation:  ASA-EMulatR Reference Guide > Introduction > Architecture Overview > Chapter 3 - Pipeline Architecture >

3.5 Decode Stage (DE)

Responsibilities

 

The Decode stage is intentionally minimal. The grain was already resolved during IBox fetch, so Decode performs validation and routing:

Validates the grain pointer — if the slot has a non-null grain, the instruction is legal

Determines the execution Box via executionBoxDecoder(opCode) — classifies the instruction as EBox, MBox, FBox, CBox, PalBox, or other

Sets the slot's execUnit field for pipeline routing

Forwards the slot to the Issue stage if valid

 

The execution Box classification maps opcodes to their target functional domain:

 

switch (executionBoxDecoder(opCode)) {

 case ExecutionBox::EBox: slot.execUnit = ExecUnit::EBOX; break;

 case ExecutionBox::MBox: slot.execUnit = ExecUnit::MBOX; break;

 case ExecutionBox::FBox: slot.execUnit = ExecUnit::FBOX; break;

 case ExecutionBox::CBox: slot.execUnit = ExecUnit::CBOX; break;

 case ExecutionBox::HWBox: slot.execUnit = ExecUnit::PALBOX; break;

}

 

Decode Cache Invariant

 

Decoding occurs once per unique instruction pattern via the GrainResolver. The resolved grain is cached in the InstructionGrainRegistry and reused on subsequent fetches of the same opcode/function-code pair. Execution may occur many times from a single decode.

 

See Also: 3.16 Grain System ; grainFactoryLib/GrainResolver.h; grainFactoryLib/executionBoxDecoder_inl.h.