CSSE232 Computer Architecture I Datapath Class Status - - PowerPoint PPT Presentation

csse232 computer architecture i
SMART_READER_LITE
LIVE PREVIEW

CSSE232 Computer Architecture I Datapath Class Status - - PowerPoint PPT Presentation

CSSE232 Computer Architecture I Datapath Class Status Reading Sec;ons 4.1-3 Project Project group milestone assigned Indicate who you want


slide-1
SLIDE 1

CSSE232 ¡ Computer ¡Architecture ¡I ¡

Datapath ¡

slide-2
SLIDE 2

Class ¡Status ¡

  • Reading ¡

– Sec;ons ¡4.1-­‑3 ¡

  • Project ¡

– Project ¡group ¡milestone ¡assigned ¡ – Indicate ¡who ¡you ¡want ¡to ¡work ¡with ¡ – Indicate ¡who ¡you ¡don’t ¡want ¡to ¡work ¡with ¡ – Due ¡next ¡Friday ¡(before ¡exam) ¡

slide-3
SLIDE 3

Review ¡so ¡far ¡

  • Performance ¡
  • Instruc;on ¡Sets ¡(ISAs) ¡
  • MIPS ¡assembly ¡

– Register ¡conven;on ¡ – Procedure ¡calls ¡ – Alignment ¡ – Excep;ons ¡

slide-4
SLIDE 4

Outline ¡ ¡

  • Today, ¡we ¡begin ¡hardware ¡

– Datapath ¡

  • Stages ¡of ¡execu;on ¡
  • CPU ¡overview ¡
  • Building ¡a ¡datapath ¡
slide-5
SLIDE 5

Introduc;on ¡

  • CPU ¡performance ¡factors ¡

– Instruc;on ¡count ¡

  • Determined ¡by ¡ISA ¡and ¡compiler ¡

– CPI ¡and ¡Cycle ¡;me ¡

  • Determined ¡by ¡CPU ¡hardware ¡
  • We ¡will ¡examine ¡three ¡MIPS ¡datapaths ¡

– A ¡simplified ¡version ¡ – An ¡improved ¡split ¡design ¡ – A ¡more ¡realis;c ¡pipelined ¡version ¡

slide-6
SLIDE 6

Different ¡Subsets ¡ ¡

  • f ¡Instruc;ons ¡
  • Memory ¡reference: ¡lw, ¡sw
  • Arithme;c/logical: ¡add, ¡sub, ¡and, ¡or, ¡slt
  • Control ¡transfer: ¡beq, ¡j
  • Instruc;ons ¡executed ¡in ¡mul;ple ¡steps ¡

– Some ¡steps ¡are ¡common ¡to ¡all ¡instruc;ons ¡ – Some ¡steps ¡shared ¡between ¡subsets ¡ – Some ¡steps ¡unique ¡to ¡single ¡instruc;on ¡

slide-7
SLIDE 7

Five ¡Stages ¡of ¡ ¡ Instruc;on ¡Execu;on ¡

1. Instruc;on ¡fetch ¡ 2. Instruc;on ¡decode ¡ 3. Execute ¡ 4. Memory ¡access ¡ 5. Write ¡back ¡

We ¡will ¡formalize ¡hardware ¡for ¡these ¡stages ¡a[er ¡ Winter ¡break. ¡Un;l ¡then, ¡we’ll ¡build ¡parts ¡as ¡needed. ¡

slide-8
SLIDE 8

Instruc;on ¡Fetch ¡

  • Fetch ¡the ¡instruc;on ¡

– based ¡on ¡value ¡stored ¡in ¡PC ¡

  • Prepare ¡for ¡next ¡instruc;on ¡

– Increment ¡the ¡PC ¡

The image cannot be displayed. Your computer may not have enough memory to open the image, or the image may have been corrupted. Restart your computer, and then open the file
  • again. If the red x still appears, you may have to delete the
image and then insert it again.
slide-9
SLIDE 9

Instruc;on ¡Decode ¡

  • Read ¡registers ¡from ¡register ¡file ¡
  • Calculate ¡branch ¡address ¡
slide-10
SLIDE 10

Execute ¡

  • Depending ¡on ¡instruc;on ¡class ¡
  • Use ¡ALU ¡to ¡calculate ¡

– Arithme;c ¡result ¡(R-­‑type) ¡ – Memory ¡address ¡(lw,sw) ¡ – Branch ¡compare ¡(beq, ¡bne) ¡

  • PC ¡← ¡target ¡address ¡(faster ¡branches) ¡
slide-11
SLIDE 11

Memory ¡

  • Store ¡data ¡into ¡memory ¡(sw) ¡
  • Read ¡data ¡from ¡memory ¡(lw) ¡
  • Other ¡things ¡happen ¡here ¡too ¡

– Save ¡results ¡from ¡R-­‑type ¡instruc;ons ¡

slide-12
SLIDE 12

Write ¡Back ¡

  • Store ¡the ¡data ¡from ¡memory ¡into ¡registers ¡

(lw) ¡

– Similar ¡to ¡saving ¡R-­‑type ¡results ¡

slide-13
SLIDE 13

Datapath ¡Overview ¡

slide-14
SLIDE 14

Mul;plexers ¡

n Can’t ¡just ¡join ¡wires ¡

together ¡

n Use ¡mul;plexers ¡

slide-15
SLIDE 15

Mul;plexers ¡

slide-16
SLIDE 16

Control ¡

slide-17
SLIDE 17

Building ¡a ¡Datapath ¡

  • Datapath ¡

– Elements ¡that ¡process ¡data ¡and ¡addresses ¡ in ¡the ¡CPU ¡

  • Registers, ¡ALUs, ¡mux’s, ¡memories, ¡… ¡
  • We ¡will ¡build ¡a ¡MIPS ¡datapath ¡incrementally ¡

– Refining ¡the ¡overview ¡design ¡ – Consider ¡how ¡you ¡will ¡build ¡your ¡datapath! ¡

slide-18
SLIDE 18

Instruc;on ¡Fetch ¡

32-­‑bit ¡ register ¡ Increment ¡by ¡ 4 ¡for ¡next ¡ instruc;on ¡

slide-19
SLIDE 19

R-­‑Format ¡Instruc;ons ¡

  • Read ¡two ¡register ¡operands ¡
  • Perform ¡arithme;c/logical ¡opera;on ¡
  • Write ¡register ¡result ¡
slide-20
SLIDE 20

Load/Store ¡Instruc;ons ¡

  • Read ¡register ¡operands ¡
  • Calculate ¡address ¡using ¡

16-­‑bit ¡offset ¡

– Use ¡ALU, ¡but ¡sign-­‑extend ¡

  • ffset ¡
  • Load: ¡Read ¡memory ¡

and ¡update ¡register ¡

  • Store: ¡Write ¡register ¡

value ¡to ¡memory ¡

slide-21
SLIDE 21

Branch ¡Instruc;ons ¡

  • Read ¡register ¡operands ¡
  • Compare ¡operands ¡

– Use ¡ALU, ¡subtract ¡and ¡check ¡Zero ¡output ¡

  • Calculate ¡target ¡address ¡

– Sign-­‑extend ¡displacement ¡ – Shi[ ¡le[ ¡2 ¡places ¡(word ¡displacement) ¡ – Add ¡to ¡PC ¡+ ¡4 ¡

  • Already ¡calculated ¡by ¡instruc;on ¡fetch ¡
slide-22
SLIDE 22

Branch ¡Instruc;ons ¡

slide-23
SLIDE 23

Composing ¡the ¡Elements ¡

  • First ¡datapath ¡does ¡one ¡instruc;on ¡in ¡one ¡

clock ¡cycle ¡

– Each ¡datapath ¡element ¡can ¡only ¡do ¡one ¡func;on ¡ at ¡a ¡;me ¡ – Hence, ¡we ¡need ¡separate ¡instruc;on ¡and ¡data ¡ memories ¡

  • Use ¡mul;plexers ¡where ¡alternate ¡data ¡sources ¡

are ¡used ¡for ¡different ¡instruc;ons ¡

slide-24
SLIDE 24

R-­‑Type/Load/Store ¡Datapath ¡

slide-25
SLIDE 25

Full ¡Datapath ¡

slide-26
SLIDE 26

Performance ¡Issues ¡

  • Longest ¡delay ¡determines ¡clock ¡period ¡

– Cri;cal ¡path: ¡load ¡instruc;on ¡ – InstMem→ ¡RegFile→ ¡ALU→ ¡DataMem→ ¡RegFile ¡

  • Not ¡feasible ¡to ¡vary ¡period ¡for ¡different ¡

instruc;ons ¡

  • Violates ¡design ¡principle ¡

– Making ¡the ¡common ¡case ¡fast ¡

  • We ¡will ¡improve ¡performance ¡in ¡next ¡version ¡
slide-27
SLIDE 27

Review ¡and ¡Ques;ons ¡

  • Stages ¡of ¡execu;on ¡
  • CPU ¡overview ¡
  • Building ¡a ¡datapath ¡

¡

slide-28
SLIDE 28

Different ¡Subsets ¡ ¡

  • f ¡Instruc;ons ¡
  • Memory ¡reference: ¡lw, ¡sw
  • Arithme;c/logical: ¡add, ¡sub, ¡and, ¡or, ¡slt
  • Control ¡transfer: ¡beq
slide-29
SLIDE 29

Two ¡programs… ¡

  • Program ¡1 ¡
  • lw $t0 4($t1)
  • add $t0 $t0 $t2
  • beq $t0 $zero exit
  • Program ¡2 ¡
  • sub $s1 $s1 $s2
  • sw $s1 0($t0)
  • beq $s1 $t2 loop
slide-30
SLIDE 30

Blank ¡Datapath ¡

slide-31
SLIDE 31

Datapath ¡Exercise ¡

  • Trace ¡instruc;ons ¡through ¡datapath ¡

– Label ¡used ¡datapath ¡components ¡ – Trace ¡path ¡through ¡datapath ¡

  • Write ¡your ¡name ¡at ¡the ¡top ¡
  • And ¡the ¡program ¡you ¡used ¡