07-cpu-perf-i - cornell...

55
1

Upload: others

Post on 16-Mar-2021

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC

1  

Page 2: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC

2  

Page 3: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC

3  

Page 4: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC

4  

Page 5: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC

5  

Page 6: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC

6  

Page 7: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC

7  

Page 8: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC

8  

Page 9: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC

9  

Page 10: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC

10  

Page 11: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC

11  

Page 12: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC
Page 13: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC
Page 14: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC
Page 15: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC

For  addi,  sign  extension  and  can  do  posi;ve  and  nega;ve.  Will  signal  overflow.  For  addiu,  s;ll  use  sign  extension,  but  no  overflow    Add  vs.  addu:  no  overflow  for  addu    

Page 16: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC
Page 17: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC
Page 18: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC
Page 19: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC

or,  extra  input  to  alu  B  mux  from  before/aJer  extend  (or,  extra  mux  aJer  alu)  

Page 20: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC

20  

Page 21: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC
Page 22: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC
Page 23: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC
Page 24: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC

sw  r1  4(r5)  sb    r1,  3(r5)    If  you  don’t  make  sure  half  word  accesses  are  half  word  aligned,  or  word  accesses  are  word  aligned,  there  will  be  an  error  signaled.  We  will  talk  about  traps  and  excep;ons  later.    

Page 25: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC

Comes  from  Gulliver  travels  

25  

Page 26: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC

Big  Endian  means  store  MSB  (most  significant  byte)  first  

26  

Page 27: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC
Page 28: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC

Where  �  is  used  to  concatenate      Why  should  the  offset  be  leJ  shiJed  by  2.  To  keep  the  jump  address  word  aligned.      AND  to  not  waste  two  bits  that  we  *know*  are  going  to  be  0.  

Page 29: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC

Where  �  is  used  to  concatenate    

Page 30: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC
Page 31: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC
Page 32: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC
Page 33: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC
Page 34: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC

Why  should  the  offset  be  leJ  shiJed  by  2.  To  keep  the  jump  address  word  aligned.      AND  to  not  waste  two  bits  that  we  *know*  are  going  to  be  0.    

Page 35: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC

In  the  book,  the  ALU  is  used  to  determine  the  branch  comparison.  We  are  choosing  to  do  it  separately.      Anyway,  can’t  use  ALU  for  both  branc  comparison  and  PC  determina;on.  At  most,  we  can  use  it  once.  The  book  uses  it  for  branch    

Page 36: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC
Page 37: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC
Page 38: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC

0x0121808  ==  1185800  

Page 39: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC
Page 40: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC

40  

Page 41: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC

41  

Page 42: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC

42  

Page 43: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC
Page 44: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC

44  

Page 45: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC
Page 46: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC
Page 47: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC

47  

Page 48: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC
Page 49: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC
Page 50: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC
Page 51: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC
Page 52: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC
Page 53: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC
Page 54: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC
Page 55: 07-cpu-perf-i - Cornell UniversityIn"the"book,"the"ALU"is"used"to"determine"the"branch"comparison."We"are"choosing"to" do"itseparately."" " Anyway,"can’tuse"ALU"for"both" branc"comparison"and"PC

55