Cycle 4c: R-type result write (add, and) Inf2C Computer Systems - - - PowerPoint PPT Presentation

cycle 4c r type result write add and
SMART_READER_LITE
LIVE PREVIEW

Cycle 4c: R-type result write (add, and) Inf2C Computer Systems - - - PowerPoint PPT Presentation

Lecture 9: Processor design multi cycle Aren t single cycle processors good enough? No! Speed: cycle time must be long enough for the most complex instruction to complete But the average instruction needs less time Cost:


slide-1
SLIDE 1

Inf2C Computer Systems - 2013-2014 1

Lecture 9: Processor design – multi cycle

§ Aren’t single cycle processors good enough? No!

– Speed: cycle time must be long enough for the most complex instruction to complete – But the average instruction needs less time – Cost: functional units (e.g. adders) cannot be re-used within one cycle

§ Multiple & varied cycles per instruction means that no instruction takes more time or uses more

  • func. units than required
slide-2
SLIDE 2

Inf2C Computer Systems - 2013-2014 2

Lecture outline

§ Brief processor performance evaluation § Determine the components § Build the datapath § Build the control

slide-3
SLIDE 3

Inf2C Computer Systems - 2013-2014 3

Measuring processor speed

Execution time is instruction count x cycles per instruction x cycle time

slide-4
SLIDE 4

Inf2C Computer Systems - 2013-2014 4

Determine the components

Processor task § Instruction fetch from memory § Read registers § Execution

– Data processing instructions – Data transfer instructions – Branch instructions

Component list § PC register § Memory (instructions) § Adder: PC+4 § Register file

– 2 read, 1 write

§ ALU

slide-5
SLIDE 5

Inf2C Computer Systems - 2013-2014 5

Design guidelines

§ Cycle time determined by the delay through the slowest functional unit § Reuse functional units as much as possible

– Multiplexors added to select the different inputs

§ At end of each cycle, data required in subsequent cycles must be stored somewhere

– Data for other instructions are kept in the memory, register file, or the PC – Data for same instruction are kept in new registers not visible to the programmer

slide-6
SLIDE 6

Inf2C Computer Systems - 2013-2014 6

Multi-cycle datapath

slide-7
SLIDE 7

Inf2C Computer Systems - 2013-2014 7

How to design the control part

§ The control unit of a multicycle processor is an FSM § Determine exactly what happens in each cycle § and what is the next step § Be careful with register load-enable control signals

slide-8
SLIDE 8

Inf2C Computer Systems - 2013-2014 8

What happens in each cycle – 1 & 2

  • 1. Instruction fetch

IR <= Mem[PC] PC <= PC+4

  • 2. Instruction decode and register fetch

A <= Reg[IR[25:21]] B <= Reg[IR[20:16]] ALUOut <= PC+sgnext(IR[15:0]<<2)

slide-9
SLIDE 9

Inf2C Computer Systems - 2013-2014 9

Cycle 1 – instruction fetch (all)

slide-10
SLIDE 10

Inf2C Computer Systems - 2013-2014 10

Cycle 2 –instr decode & reg read (all)

slide-11
SLIDE 11

Inf2C Computer Systems - 2013-2014 11

What happens in each cycle – 3

  • 3a. Memory address generation

ALUOut <= A+sgnext(IR[15:0])

  • 3b. R-type arithmetic-logical instruction

ALUOut <= A op B

  • 3c. Branch completion

if (A == B) PC <= ALUOut

  • 3d. Jump completion

PC <= {PC[31:28],IR[25:0],2’b00}

slide-12
SLIDE 12

Inf2C Computer Systems - 2013-2014 12

Cycle 3a: add imm arg (addi, lw, sw)

slide-13
SLIDE 13

Inf2C Computer Systems - 2013-2014 13

Cycle 3b: R-type ALU op (add, and)

slide-14
SLIDE 14

Inf2C Computer Systems - 2013-2014 14

Cycle 3c: Branch taken (beq, bne)

slide-15
SLIDE 15

Inf2C Computer Systems - 2013-2014 15

Cycle 3d: jump (j)

slide-16
SLIDE 16

Inf2C Computer Systems - 2013-2014 16

What happens in each cycle – 4

  • 4a. Memory access (load)

MDR <= Mem[ALUOut]

  • 4b. Memory access (store) & completion

Mem[ALUOut] <= B

  • 4c. R-type arith-logical instruction completion

Reg[IR[15:11]] = ALUOut

slide-17
SLIDE 17

Inf2C Computer Systems - 2013-2014 17

Cycle 4a: Load from mem (lw)

slide-18
SLIDE 18

Inf2C Computer Systems - 2013-2014 18

Cycle 4b: Store to mem (sw)

slide-19
SLIDE 19

Inf2C Computer Systems - 2013-2014 19

Cycle 4c: R-type result write (add, and)

slide-20
SLIDE 20

Inf2C Computer Systems - 2013-2014 20

What happens in each cycle – 5

  • 5. Load instruction completion

Reg[IR[20:16]] <= MDR

slide-21
SLIDE 21

Inf2C Computer Systems - 2013-2014 21

Cycle 5: save of loaded value (lw)

slide-22
SLIDE 22

Inf2C Computer Systems - 2013-2014 22

State diagram

1