icode:ifun
rA:rB
valC
Stage | Op rA rB |
Action |
---|---|---|
Fetch | icode:ifun = M1[PC] |
read instruction byte |
rA:rB = M1[PC+1] |
read register byte | |
valP = PC+2 |
compute next PC | |
Decode | valA = R[rA] |
read operand A |
valB = R[rB] |
read operand B | |
Execute | valE = valB OP valA |
Perform ALU operation |
Memory | ||
Write back | R[rB] = valE |
Write back result |
PC update | PC = valP |
update PC |
rmmovq
rmmovq
Stage | rmmovq rA, D(rB) |
Action |
---|---|---|
Fetch | icode:ifun = M1[PC] |
read instruction byte |
rA:rB = M1[PC+1] |
read register byte | |
valC = M8[PC+2] |
read 8 byte displacement | |
valP = PC+10 |
compute next PC | |
Decode | valA = R[rA] |
read operand A |
valB = R[rB] |
read operand B | |
Execute | valE = valB + valC |
compute effective address (ALU) |
Memory | M8[valE] = valA |
write 8 byte value to memory |
Write back | ||
PC update | PC = valP |
update PC |
popq
popq
Stage | popq rA |
Action |
---|---|---|
Fetch | icode:ifun = M1[PC] |
read instruction byte |
rA:rB = M1[PC+1] |
read register byte | |
valP = PC+2 |
compute next PC | |
Decode | valA = R[%rsp] |
read stack pointer |
valB = R[%rsp] |
read stack pointer | |
Execute | valE = valB + 8 |
increment stack pointer (ALU) |
Memory | valM = M8[valA] |
read 8 bytes from stack |
Write back | R[%rsp] = valE |
update stack pointer |
R[rA] = valM |
write back result | |
PC update | PC = valP |
update PC |
0xF
Stage | cmovXX rA, rB |
Action |
---|---|---|
Fetch | icode:ifun = M1[PC] |
read instruction byte |
rA:rB = M1[PC+1] |
read register byte | |
valP = PC+2 |
compute next PC | |
Decode | valA = R[rA] |
read operand A |
valB = 0 |
read stack pointer | |
Execute | valE = valB + valA |
pass val through ALU (valA + 0) |
if !Cond(CC,ifun) rB = 0xF |
(disable register update) | |
Memory | ||
Write back | R[rB] = valE |
write back result |
PC update | PC = valP |
update PC |
Stage | jXX Dest |
Action |
---|---|---|
Fetch | icode:ifun = M1[PC] |
read instruction byte |
valC = M8[PC+1] |
read 8 byte destination address | |
valP = PC+9 |
fall through address | |
Decode | ||
Execute | Cnd = Cond(CC, ifun) |
take branch? |
Memory | ||
Write back | ||
PC update | PC = Cnd ? valC : valP |
update PC |
call
call
Stage | call Dest |
Action |
---|---|---|
Fetch | icode:ifun = M1[PC] |
read instruction byte |
valC = M8[PC+1] |
read 8 byte destination address | |
valP = PC+9 |
compute return point | |
Decode | valB = R[%rsp] |
read stack pointer |
Execute | valE = valB + -8 |
decrement stack pointer (ALU) |
Memory | M8[valE] = valP w |
rite 8 byte return value on stack |
Write back | R[%rsp] = valE |
update stack pointer |
PC update | PC = valC |
set PC to destination |
ret
ret
Stage | ret |
Action |
---|---|---|
Fetch | icode:ifun = M1[PC] |
read instruction byte |
Decode | valA = R[%rsp] |
read operand stack pointer |
valB = R[%rsp] |
read operand stack pointer | |
Execute | valE = valB + 8 |
increment stack pointer (ALU) |
Memory | valM = M8[valA] |
read return address |
Write back | R[%rsp] = valE |
update stack pointer |
PC update | PC = valM |
set PC to return address |
Stage | Steps | Action |
---|---|---|
Fetch | icode:ifun |
read instruction byte |
rA, rB |
[read register byte] | |
valC |
[read constant word] | |
valP |
compute next PC | |
Decode | valA, srcA |
[read operand A] |
valB, srcB |
[read operand B] | |
Execute | valE |
perform ALU operation |
Cond code |
[set/use condition code] | |
Memory | valM |
[memory read/write] |
Write back | dstE |
[write back ALU result] |
dstM |
[write back memory result] | |
PC update | PC |
update PC |
icode
: instruction codeifun
: instruction functionrA
: instruction register ArB
: instruction register BvalC
: instruction constantvalP
: incremented PCsrcA
: register ID AsrcB
: register ID BdstE
: destination register EdstM
: destination register MvalA
: register value AvalB
: register value BvalE
: ALU resultCnd
: branch/move flagvalM
: value from memoryicode
and ifun
rA
, rB
, and valC
icode
, ifun
: generate no-op if invalid addressregids
: does the instruction have a register byte?valC
: does this instruction have a constant word?0xF
) (no access)srcA
, srcB
: read port addressesdstE
, dstM
: write port addressesCnd
: indicate whether or not to perform conditional move (computed in execute stage)