La Tecnica PIPELINE

17
La Tecnica PIPELINE Il DLX - Pipeline Il DLX - Pipeline

description

La Tecnica PIPELINE. Il DLX - Pipeline. OVERVIEW. Significato Presupposti Operativi Sincronismo Presupposti per una Pipeline efficiente Bilanciamento delle fasi Under e Super Pipeline Vantaggi Svantaggi Pipeline nel processore Deluxe. Unità Operative. Speed – Up: N. - PowerPoint PPT Presentation

Transcript of La Tecnica PIPELINE

Page 1: La Tecnica PIPELINE

La Tecnica PIPELINELa Tecnica PIPELINEIl DLX - PipelineIl DLX - PipelineIl DLX - PipelineIl DLX - Pipeline

Page 2: La Tecnica PIPELINE

OVERVIEWOVERVIEW

Significato Presupposti Operativi

Sincronismo Presupposti per una Pipeline

efficiente Bilanciamento delle fasi

UnderUnder e SuperSuper Pipeline Vantaggi Svantaggi Pipeline nel processore DeluxeDeluxe

Significato Presupposti Operativi

Sincronismo Presupposti per una Pipeline

efficiente Bilanciamento delle fasi

UnderUnder e SuperSuper Pipeline Vantaggi Svantaggi Pipeline nel processore DeluxeDeluxe

Page 3: La Tecnica PIPELINE

SignificatoSignificatoPipelinePipeline come una Catena di MontaggioCatena di Montaggio

Invece di utilizzare piu unità operative specializzate su tutte le fasi dell’intero processo impiega più unità operative indipendenti, non interscambiaili e specializzate su diverse fasi dell’intero processo

meno complessemeno costose

facilmente riproducibili

Unità OperativeUnità Operative

centralizzatonon troppo complesso

Unità di ControlloUnità di Controllo

dopo una latenza NxT completo ogni processo

in un tempo T

Speed – Up: Speed – Up: NNN: num Unità OperativeT: tempo massimo per operazione

complessità proporzionale a N

ArchitetturaArchitettura

Page 4: La Tecnica PIPELINE

554433

SignificatoSignificato

2211

Fasi Non BilanciateNon Bilanciate e AtomicheAtomiche

Il processore è costruito da più Unità Differenti e Indipendenti che lavorano: in Parallelo su fasi differenti di istruzioni differenti in Serie su diverse fasi dell’esecuzione della medesima istruzioneOgni unità preleva dall’unità precedente l’istruzione trasformata e la trasforma ulteriormente passandola all’unità successiva

PipelinePipeline come una Catena di MontaggioCatena di Montaggio

Le diverse Fasi dell’Esecuzione le possiamo identificare in corrispondenza delle differenti unità o macro unità hardware

(Memoria, ALU, Registri ...) interessate dall’esecuzione dell’istruzione

Risultato dell’esecuzione

Programma

Processore Pipeline con 5 unità operative parallele

1 Istr.1 Istr.22 Istr.Istr.

33 Istr.Istr.44 Istr.Istr.

112233441122334455 55

Page 5: La Tecnica PIPELINE

Gestione della PipelineGestione della Pipeline

5544332211

5544332211

5544332211

4411 22 33 554411 22 33 55

4411 22 33 554411 22 33 55

4411 22 33 554411 22 33 55

NONO

5544332211

Fasi Non BilanciateNon Bilanciate e AtomicheAtomiche

La Fase 3 più Lenta fissa la latenza T anche per le altre FasiContestoContesto

SincronoSincrono

12

34

54411 22 33 55

TT TT TT

Presupposti Operativi:Presupposti Operativi: Sincronismo Sincronismo

Page 6: La Tecnica PIPELINE

5544332211

Fasi Non BilanciateNon Bilanciate e AtomicheAtomiche

Hardware più sempliceHardware più semplice (costruisco 3 fasi indipendenti)Basso Speed-UpBasso Speed-Up (sovrappongo fino a 3 istruzioni)

3’3’

Fasi BilanciateBilanciate e Non AtomicheAtomiche

Fase unione di più fasi atomicheFase unione di più fasi atomiche

Bilanciamento delle Fasi

Bilanciamento delle Fasi

2’2’1’1’

UNDER – Pipeline UNDER – Pipeline ((DSP))

Page 7: La Tecnica PIPELINE

5544332211

Fasi Non BilanciateNon Bilanciate e AtomicheAtomiche

Hardware più complessoHardware più complesso (costruisco 9 fasi indipendenti)Alto Speed-UpAlto Speed-Up (sovrappongo fino a 9 istruzioni)

Fasi BilanciateBilanciate e AtomicheAtomiche

SottoFasi come scomposizione di Fasi

SottoFasi come scomposizione di Fasi

Bilanciamento delle Fasi

Bilanciamento delle Fasi

SUPER – PipelineSUPER – Pipeline

554b4b4a4a3c3c3b3b3a3a221b1b1a1a

Page 8: La Tecnica PIPELINE

554433

332211

Duplico le risorseDuplico le risorse ma ne Dimezzo la latenzaDimezzo la latenza

Ridondanza HardwareRidondanza Hardware

Bilanciamento delle Fasi

Bilanciamento delle Fasi

5544332211

Fasi Non BilanciateNon Bilanciate e AtomicheAtomiche

Aumenta lo Speed-UpAumenta lo Speed-Up Complico poco l’architettura

Page 9: La Tecnica PIPELINE

VantaggiVantaggiLa tecnica pipeline (con K fasi) al crescere del numero di istruzioni (N>>K) impiega un tempo complessivo di

esecuzione N x T (dove T è il tempo di fase)

Ridurre il tempo di fase T Ridurre il tempo di fase T (aumentando la lunghezza della pipeline k oppure utilizzando la ridondanza

hardware) fa aumentare lo Speed-Up del processore fa aumentare lo Speed-Up del processore

T minimo T minimo è intimamente legato alla tecnologia utilizzata tecnologia utilizzata

Page 10: La Tecnica PIPELINE

SvantaggiSvantaggi

Aumentare la lunghezza della pipeline k fa sì aumentare lo Speed-Up del processore ma:

Aumenta il numero di Conflitti Aumenta il numero di Conflitti (rallentandone l’esecuzione) e aumenta la Gestione del processore aumenta la Gestione del processore (che

volutamente non risolve ogni tipo di conflitto)

Page 11: La Tecnica PIPELINE

Il processore Deluxe - DLXDLXIl processore Deluxe - DLXDLXArchitettura Pipeline a 5 fasiPipeline a 5 fasi

Page 12: La Tecnica PIPELINE

Instruction Fetch cycle:Instruction Fetch cycle:

IR       <- MEM [PC] IR       <- MEM [PC] NPC  <- PC + 4NPC  <- PC + 4

Operation:

• Send out the PC and fetch the instruction from memory into the instruction register (IR) • Increment the PC by 4 to address the next sequential instruction • The IR is used to hold the instruction that will be needed on subsequent clock cycles • The NPC is used to hold the next sequential PC (program counter)

[[ II FF ]]

Il processore Deluxe - DLXDLXIl processore Deluxe - DLXDLXFasi dell’EsecuzioneFasi dell’Esecuzione

dell’Istruzione

Page 13: La Tecnica PIPELINE

Instruction Decode/register fetch cycle:Instruction Decode/register fetch cycle:A <- Regs [IR6..10] A <- Regs [IR6..10] B <- Regs [IR11..15] B <- Regs [IR11..15] Imm <- ( (IR16)16 ## IR16..31 )Imm <- ( (IR16)16 ## IR16..31 )

Operation:

- Decode the instruction and access the register file to read the registers. - the output of the general-purpose registers are read into two temporary registers (A and B) for use in later clock cycles. - the lower 16 bits of the IR are also sign-extended and stored into the temporary register IMM, for use in the next cycle. - decoding is done in parallel with reading registers, which is possible because these fields are at a fixedfixed location in the DLX Instruction FormatDLX Instruction Format. This technique is known as fixed-field decodingfixed-field decoding.

[[ II

DD ]]

Il processore Deluxe - DLXDLXIl processore Deluxe - DLXDLXFasi dell’EsecuzioneFasi dell’Esecuzione

dell’Istruzione

Page 14: La Tecnica PIPELINE

Memory reference:Memory reference:

ALUOutput <- A + ImmALUOutput <- A + Imm

Register - Register Register - Register (ALU)(ALU)::

ALUOutput <- A ALUOutput <- A opop B B

Register - Immediate Register - Immediate (ALU)(ALU)::

ALUOutput <- A ALUOutput <- A opop Imm Imm

Branch:Branch:

ALUOutput <- NPC + Imm ALUOutput <- NPC + Imm Cond <- ( A op 0 )Cond <- ( A op 0 )

The ALU adds the operands to form the effective address and

places the result into the register ALUOutput

The ALU performs the operation specified by the

opcode on the value in register A and on the value in register B.

The result is placed in the

register ALUOutput.

The ALU performs the operation specified by the

opcode on the value in register A and on the value in register

Imm. The result is placed in  the register ALUOutput.

The ALU adds the NPC to the sign-extended immediate value in Imm to compute the address of the branch target.

Register A, which has been read in the prior cycle, is checked to determine whether the branch is taken.

The comparison operation op is the relational operator determined by the branch opcode (e.g. op is "==" for the

instruction BEQZ)

[[ EE

XX ]]

Execution/effective address cycle:Execution/effective address cycle:

Il processore Deluxe - DLXDLXIl processore Deluxe - DLXDLXFasi dell’EsecuzioneFasi dell’Esecuzione

dell’Istruzione

Page 15: La Tecnica PIPELINE

Memory reference:Memory reference:

LMD <- Mem [ALUOutput] or  Mem [ALUOutput] <- BLMD <- Mem [ALUOutput] or  Mem [ALUOutput] <- B

Operation:Operation: - Access memory if needed - If the instruction is load , data returns from memory and is placed in the LMD (load memory data) register - If the instruction is store, data from the B register is written into memory. - In either case the address used is the one computed during the prior cycle and stored in the register ALUOutput

Branch:Branch:

if (cond) PC <- ALUOutput if (cond) PC <- ALUOutput else PC <- NPCelse PC <- NPC

Operation:Operation: - If the instruction branches, the PC is replaced with branch destination address in the register ALUOutput - Otherwise, PC is replaced with the incremented PC in the register NPC

Memory access/branch completion cycle: Memory access/branch completion cycle:

[[ MM EE MM ]]

Il processore Deluxe - DLXDLXIl processore Deluxe - DLXDLXFasi dell’EsecuzioneFasi dell’Esecuzione

dell’Istruzione

Page 16: La Tecnica PIPELINE

Register-Register Register-Register (ALU)(ALU)::

Regs [IRRegs [IR16..2016..20] <- ALUOutput] <- ALUOutput

Register-ImmediateRegister-Immediate (ALU)(ALU)::

Regs [IRRegs [IR11..1511..15] <- ALUOutput] <- ALUOutput

Load instruction:Load instruction:

Regs [IRRegs [IR11..1511..15] <- LMD] <- LMD

Operation: - Write the result into the register file, whether it comes from the memory(LMD) or from ALU (ALUOutput) - the register destination field is in one of two positions depending on the opcode

Write-back cycle:Write-back cycle:

[[ WW BB ]]

Il processore Deluxe - DLXDLXIl processore Deluxe - DLXDLXFasi dell’EsecuzioneFasi dell’Esecuzione

dell’Istruzione

Page 17: La Tecnica PIPELINE

Architettura PipelineArchitettura PipelineVector Processor

Architettura PipelineArchitettura PipelineVector Processor

Calcolo Vettoriale su CPU DLX - PipelineDLX - Pipeline:

Calcolo eseguitosu CPU parallela

Calcolo eseguitosu CPU pipeline