14.2 EBox – Integer Execution Box

<< Click to Display Table of Contents >>

Navigation:  ASA-EMulatR Reference Guide > Introduction > Architecture Overview > Chapter 14 – Execution Domains (“Boxes”) >

14.2 EBox – Integer Execution Box

The EBox is the integer execution unit. On the 21264 silicon, the Ebox contained four 64-bit adders, four logic units, two barrel shifters, and byte-manipulation hardware split across two subpipelines (U0 and U1). In EmulatR, the EBox encapsulates all integer ALU operations as inline methods that operate on PipelineSlot references, writing results into the slot payLoad field for downstream writeback.

 

14.2.1 Responsibilities

 

Integer arithmetic: ADDL/ADDQ, SUBL/SUBQ, MULL/MULQ, UMULH

Logical operations: AND, BIS (OR), XOR, BIC, ORNOT, EQV

Shift operations: SLL, SRL, SRA

Byte manipulation: SEXTB, SEXTW, ZAP, ZAPNOT, EXTBL, INSBL (delegated to alpha_int_byteops_inl.h)

Scaled arithmetic: S4ADDL, S4ADDQ, S8ADDL, S8ADDQ, S4SUBL, S4SUBQ, S8SUBL, S8SUBQ

Comparison: CMPEQ, CMPLT, CMPLE, CMPULT, CMPULE, CMPBGE

Conditional move: CMOVEQ, CMOVNE, CMOVLT, CMOVGE, CMOVLE, CMOVGT

Address calculation: LDA, LDAH

Implementation-specific: AMASK, IMPLVER, RC (Read and Clear), RS (Read and Set)

Integer overflow trap detection and FaultDispatcher integration

Scoreboard management for register hazard tracking

 


 

14.2.2 Operand Handling

 

All EBox instructions follow a uniform operand model. Source operand A (Ra) is always read from the integer register file. Source operand B (Rb) is resolved dynamically: if the instruction's literal flag is set, an 8-bit zero-extended immediate is used; otherwise, Rb is read from the register file. This logic is encapsulated in the getOperandB_64() helper method. All 32-bit results (ADDL, SUBL, MULL, S4ADDL, etc.) are sign-extended from bit 31 into the full 64-bit destination register per the Alpha architecture specification.

 


 

14.2.3 Code Example – Integer Add (Quadword)

 

AXP_HOT AXP_ALWAYS_INLINE auto executeADDQ(PipelineSlot& slot) const noexcept -> void

{

    const quint64 raValue = slot.readIntReg(slot.di.ra);

    const quint64 rbValue = getOperandB_64(slot);

    const quint64 result  = raValue + rbValue;

    slot.payLoad = result;

}

 


 

14.2.4 Source Files

 

File

Lines (approx)

Content

EBoxLib/EBoxBase.h

~2,257

Complete EBox class: all integer ALU, logic, shift, compare, cmov, scaled ops

 

See Also: coreLib/alpha_alu_inl.h – Shared ALU helpers; coreLib/alpha_int_byteops_inl.h – ZAP/ZAPNOT/EXT/INS byte operations; coreLib/alpha_int_helpers_inl.h – Integer utility functions; machineLib/PipeLineSlot.h – PipelineSlot structure definition.