4.3 Execution Flow: Grains, Pipeline, and Boxes

<< Click to Display Table of Contents >>

Navigation:  ASA-EMulatR Reference Guide > Introduction > Architecture Overview > Chapter 4 - Functional Execution Domains ("Boxes) >

4.3 Execution Flow: Grains, Pipeline, and Boxes

4.3.1 Execution Flow Summary

 

Execution always follows this pattern:

1.Instruction is decoded into a Grain by IBox (via GrainResolver)

2.Grain enters the pipeline, populating a PipelineSlot

3.In the Execute (EX) stage, the grain's execute() method runs

4.The grain dispatches work to one or more Boxes

5.Boxes perform architectural actions synchronously, writing results into the slot

6.Results flow through MEM (deferred register commit) to WB (store commit, retirement)

 

Boxes never call the pipeline and never call other Boxes directly unless explicitly allowed by the interaction rules.

 


 

4.3.2 Box Routing

 

Each PipelineSlot carries pointers to all five Boxes (m_eBox, m_fBox, m_mBox, m_palBox, m_cBox), injected once during pipeline initialization. The Decode stage (DE) classifies each instruction into its target Box via executionBoxDecoder(opCode), setting the slot's execUnit field. This routing determines which Box the grain's execute() method will call.

 

The six Box types and their ExecUnit identifiers:

 

IBox (ExecUnit::IBOX) — Instruction frontend only, never called during EX

EBox (ExecUnit::EBOX) — Integer and control-flow execution

FBox (ExecUnit::FBOX) — Floating-point execution

MBox (ExecUnit::MBOX) — Memory access execution

CBox (ExecUnit::CBOX) — Serialization and coherency

PalBox (ExecUnit::PALBOX) — Privileged execution

 


 

4.3.3 Execution Flow Example: LDQ R1, 0(R2)

 

IBox:

 - Fetch instruction at current PC

 - Decode raw bits → GrainResolver resolves to LDQ grain

 - Cache grain in InstructionGrainRegistry

 

Pipeline EX (grain->execute()):

 → MBox::executeLDQ(slot)

 - Calculate EA: slot.va = Rb + SEXT(disp)

 - Check alignment (8-byte for LDQ)

 - Translate VA → PA via Ev6Translator (DTB lookup)

 - Read from GuestMemory: m_guestMemory->read64(pa)

 - Store result: slot.payLoad = data

 - Set: slot.needsWriteback = true

 

Pipeline MEM:

 - commitPending() writes previous cycle's result to register file

 

Pipeline WB:

 - Register R1 updated with slot.payLoad

 - Instruction retired

 

No other Box participates. EBox is not involved because MBox handles the entire load operation including address calculation.

 

See Also: 3.7 Execute Stage (EX); 3.16 Grain System.