Sequential Implementation

References

Y86-64 Instruction Set

Y86-64 Instruction Set
Y86-64 Instruction Set

Building Blocks

Sequential Hardware Structure

Sequential Stages

Sequential Hardware Structure

Sequential Hardware Structure
Sequential Hardware Structure

Instruction Decoding

Executing Arithmetic/Logical Operation

Stage Computation: Arithmetic/Logical Operations

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

Executing rmmovq

Stage Computation: 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

Executing popq

Stage Computation: 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

Executing Conditional Moves

Stage Computation: Conditional Move

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

Executing Jumps

Stage Computation: Jumps

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

Executing call

Stage Computation: 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

Executing ret

Stage Computation: 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

Computation Steps

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

Computed Values

Computed Values

Computed Values

Sequential Hardware

Sequential Hardware
Sequential Hardware

Sequential Hardware

Fetch Logic

Fetch Logic

Decode Logic

Decode Logic

Execute Logic

Execute Logic

Memory Logic

Memory Logic

PC Update Logic

Sequential Summary