Lab 1 Overview and Microcode Reviewcs152/sp16/sections/...• Examples – Found 20% of VAX...

19
Lab 1 Overview and Microcode Review Sec3on 2 2/1/2016

Transcript of Lab 1 Overview and Microcode Reviewcs152/sp16/sections/...• Examples – Found 20% of VAX...

Page 1: Lab 1 Overview and Microcode Reviewcs152/sp16/sections/...• Examples – Found 20% of VAX instruc3ons responsible for 60% of microcode, but only account for 0.2% of execu3on me!

Lab1OverviewandMicrocodeReview

Sec3on22/1/2016

Page 2: Lab 1 Overview and Microcode Reviewcs152/sp16/sections/...• Examples – Found 20% of VAX instruc3ons responsible for 60% of microcode, but only account for 0.2% of execu3on me!

Agenda

•  Lab1– Whywe’reaskingyou?– Whatwe’vegivenyou?– Whatyou’reaskedtodo?

•  MicrocodeReview•  Miscellaneous(RISC-V,Chisel,etc.)Ques3ons

Page 3: Lab 1 Overview and Microcode Reviewcs152/sp16/sections/...• Examples – Found 20% of VAX instruc3ons responsible for 60% of microcode, but only account for 0.2% of execu3on me!

ComputerArchitect’sJob•  Findthecommoncase(s),andmakesureyoucansupportthemefficiently–  Some3mesatthecostofsupporttheuncommoncaseinefficiently

•  Examples–  Found20%ofVAXinstruc3onsresponsiblefor60%ofmicrocode,butonlyaccountfor0.2%ofexecu3on3me!

–  Registerimmediateinstruc3ons•  Howdoweknowwhattodo?–  Intui3on,Simula3on,Building,Experiments,…

Page 4: Lab 1 Overview and Microcode Reviewcs152/sp16/sections/...• Examples – Found 20% of VAX instruc3ons responsible for 60% of microcode, but only account for 0.2% of execu3on me!

Experimentsaren’teasy

•  Althoughthereareproper3esthatyoucanprovemathema3cally,computerarchitectureiso[enbasedonempiricalstudies

•  Thismeansthatyourdatawillbeapplica3onspecific– Pickyourapplica3onscarefully!(benchmarks)

•  “Itdepends”:Alwaysthinkaboutbothsidesoftheargument– Keepaskingques3onstoyourselftounderstand

Page 5: Lab 1 Overview and Microcode Reviewcs152/sp16/sections/...• Examples – Found 20% of VAX instruc3ons responsible for 60% of microcode, but only account for 0.2% of execu3on me!

Lab1

•  Understandhowin-orderpipelinedmicroarchitectureaffectsprocessor

•  Guided–  CPI–  Instruc3onMix

•  Open-ended–  Bypassing–  CISCmicrocode– GeneralDesign–  Yourfunidea!

Page 6: Lab 1 Overview and Microcode Reviewcs152/sp16/sections/...• Examples – Found 20% of VAX instruc3ons responsible for 60% of microcode, but only account for 0.2% of execu3on me!

Lab1Given•  ProvidedRISC-V32Iprocessors–  1-stage–  2-stage–  3-stage–  5-stage

•  Fullybypassed•  Interlocked(stalltoresolveallhazards)

– Micro-coded•  Only1-stageand5-stageareusedinthedirectedpor3on–  2-stage3-stageandmicro-codearethereforyoutoinves3gateoruseintheopen-endedpor3on

Page 7: Lab 1 Overview and Microcode Reviewcs152/sp16/sections/...• Examples – Found 20% of VAX instruc3ons responsible for 60% of microcode, but only account for 0.2% of execu3on me!

Lab1GivenotherMisc.

•  Chisel->C++simulator(emulator)•  Benchmarksandtestprograms•  Instruc3onTracertogatherstats– CPI,instruc3onmix

•  Ques3onsandanalysis– Makerecommenda3ons– Proposenewdesigns

Page 8: Lab 1 Overview and Microcode Reviewcs152/sp16/sections/...• Examples – Found 20% of VAX instruc3ons responsible for 60% of microcode, but only account for 0.2% of execu3on me!

Lab1ChiselProcessor

TileCore

CPath DPath

RAM

Page 9: Lab 1 Overview and Microcode Reviewcs152/sp16/sections/...• Examples – Found 20% of VAX instruc3ons responsible for 60% of microcode, but only account for 0.2% of execu3on me!

Lab1ProcessorEmulator

Emulator.cpp

Target System: Top-0.h Top-0.cc

TileCore

CPath DPath

RAMFESVR

Page 10: Lab 1 Overview and Microcode Reviewcs152/sp16/sections/...• Examples – Found 20% of VAX instruc3ons responsible for 60% of microcode, but only account for 0.2% of execu3on me!

DEMO!

•  Addtoolstoyourpath$ source ~cs152/sp13/cs152.bashrc

•  CopyLabFiles$ cp –R ~cs152/sp13/lab1 .

•  BuildaChiselprocessor,Compilesimulator,runalltests&benchmarks$ make run-emulator

Page 11: Lab 1 Overview and Microcode Reviewcs152/sp16/sections/...• Examples – Found 20% of VAX instruc3ons responsible for 60% of microcode, but only account for 0.2% of execu3on me!

HowisChiselusedinLabChisel(

Page 12: Lab 1 Overview and Microcode Reviewcs152/sp16/sections/...• Examples – Found 20% of VAX instruc3ons responsible for 60% of microcode, but only account for 0.2% of execu3on me!

Lab1Ques3ons

Page 13: Lab 1 Overview and Microcode Reviewcs152/sp16/sections/...• Examples – Found 20% of VAX instruc3ons responsible for 60% of microcode, but only account for 0.2% of execu3on me!

Microcode/Lecture2Review

•  Endianness•  Combina3onalPath•  Cri3calPath•  BenefitsofMicrocode•  HorizontalvsVeritcal•  Nanocoding

Page 14: Lab 1 Overview and Microcode Reviewcs152/sp16/sections/...• Examples – Found 20% of VAX instruc3ons responsible for 60% of microcode, but only account for 0.2% of execu3on me!

DataFormatsandMemoryAddresses

14

Dataformats:8-bBytes,16-bHalfwords,32-bwordsand64-bdoublewords

Someissues• Byteaddressing

• WordalignmentSupposethememoryisorganizedin32-bitwords.Canawordaddressbeginonlyat0,4,8,....?

0 1 2 3 4 5 6 7

MostSignificantByte

LeastSignificantByte

ByteAddresses

3 2 1 0

0 1 2 3BigEndian

Li8leEndian(RISC-V)

Page 15: Lab 1 Overview and Microcode Reviewcs152/sp16/sections/...• Examples – Found 20% of VAX instruc3ons responsible for 60% of microcode, but only account for 0.2% of execu3on me!

PerformanceIssues

15

Microprogrammedcontrol=>mul3plecyclesperinstruc3on

Cycle3me?tC>max(treg-reg,tALU,tμROM)

Suppose10*tμROM<tRAM

Goodperformance,relaDvetoasingle-cyclehardwiredimplementaDon,canbeachievedevenwithaCPIof10

Page 16: Lab 1 Overview and Microcode Reviewcs152/sp16/sections/...• Examples – Found 20% of VAX instruc3ons responsible for 60% of microcode, but only account for 0.2% of execu3on me!

CycleTime,Combina3onalPath,Cri3calPath

1

IR A B

RegWr enReg

MemWr enMem

MA

addr addr

data data

rs rs11 rd 32(PC)

RegSel

busy? zero?

ALUOp

Opcode

ldIR ldA ldB ldMA

IntRq

Memory 32 GPRs +

PC + IRA + ...

(32-bit regs) ALU

enALU

Immed Select

enImm

ImmSel

Bus

Page 17: Lab 1 Overview and Microcode Reviewcs152/sp16/sections/...• Examples – Found 20% of VAX instruc3ons responsible for 60% of microcode, but only account for 0.2% of execu3on me!

HorizontalvsVer3calµCode

•  Horizontalµcodehaswiderµinstruc3ons–  Mul3pleparallelopera3onsperµinstruc3on–  Fewermicrocodestepspermacroinstruc3on–  Sparserencoding⇒morebits

•  Ver3calµcodehasnarrowerµinstruc3ons–  Typicallyasingledatapathopera3onperµinstruc3on

–  separateµinstruc3onforbranches–  Moremicrocodestepspermacroinstruc3on–  Morecompact⇒lessbits

•  Nanocoding–  Triestocombinebestofhorizontalandver3calµcode

17

#µInstruc3ons

BitsperµInstruc3on

Page 18: Lab 1 Overview and Microcode Reviewcs152/sp16/sections/...• Examples – Found 20% of VAX instruc3ons responsible for 60% of microcode, but only account for 0.2% of execu3on me!

Nanocoding

18

•  MC68000had17-bitµcodecontainingeither10-bitµjumpor9-bitnanoinstruc3onpointer–  Nanoinstruc3onswere68bitswide,decodedtogive196controlsignals

µcodeROM

nanoaddress

µcodenext-state

µaddress

μPC(state)

nanoinstruc3onROMdata

Exploitsrecurringcontrolsignalpa}ernsinµcode,e.g.,ALU0 A<=Reg[rs1]...ALUi0 A<=Reg[rs1]...

Page 19: Lab 1 Overview and Microcode Reviewcs152/sp16/sections/...• Examples – Found 20% of VAX instruc3ons responsible for 60% of microcode, but only account for 0.2% of execu3on me!

Ques3ons