Spr 2015, Mar Spr 2015, Mar 13 . . . 13 . . . ELEC 5200-001/6200-001 ELEC 5200-001/6200-001 Lecture 8 Lecture 8 1 ELEC 5200-001/6200-001 ELEC 5200-001/6200-001 Computer Architecture and Computer Architecture and Design Design Spring 2015 Spring 2015 Microprogramming Microprogramming (Appendix D) (Appendix D) Vishwani D. Agrawal Vishwani D. Agrawal James J. Danaher Professor James J. Danaher Professor Department of Electrical and Computer Department of Electrical and Computer Engineering Engineering Auburn University, Auburn, AL 36849 Auburn University, Auburn, AL 36849 http://www.eng.auburn.edu/~vagrawal [email protected]
35
Embed
Spr 2015, Mar 13... ELEC 5200-001/6200-001 Lecture 8 1 ELEC 5200-001/6200-001 Computer Architecture and Design Spring 2015 Microprogramming (Appendix D)
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Vishwani D. AgrawalVishwani D. AgrawalJames J. Danaher ProfessorJames J. Danaher Professor
Department of Electrical and Computer EngineeringDepartment of Electrical and Computer EngineeringAuburn University, Auburn, AL 36849Auburn University, Auburn, AL 36849
Alternatives for Control Unit (CU)Alternatives for Control Unit (CU)Hard-wired (hardware)Hard-wired (hardware)– Random logic, programmable logic array (PLA), or ROMRandom logic, programmable logic array (PLA), or ROM– FastFast– InflexibleInflexible
FirmwareFirmware– Microprogrammed or microcoded CUMicroprogrammed or microcoded CU– Control implemented like a computer (microcomputer)Control implemented like a computer (microcomputer)
– FlexibleFlexibleSoftware-like changes to instruction set possibleSoftware-like changes to instruction set possibleCompletely different instruction sets can be emulatedCompletely different instruction sets can be emulated
– Speed limited by microcomputer memorySpeed limited by microcomputer memory
States and OutputsStates and OutputsSuppose 10 states are encoded 0000 through 1001.Suppose 10 states are encoded 0000 through 1001.State code completely determines 16 control signals State code completely determines 16 control signals (Moore machine).(Moore machine).States 0 (0000), 3 (0011) and 6 (0110)States 0 (0000), 3 (0011) and 6 (0110)
Next state ← present state + 1Next state ← present state + 1
State 1 (0001) – opcode determines next stateState 1 (0001) – opcode determines next stateState 2 (0010) for lw or swState 2 (0010) for lw or swState 6 (0110) for R-type of instructionState 6 (0110) for R-type of instructionState 8 (1000) for branch instructionState 8 (1000) for branch instructionState 9 (1001) for jump instructionState 9 (1001) for jump instruction
State 2 (0010) – opcode determines next stateState 2 (0010) – opcode determines next stateState 3 (0011) for lwState 3 (0011) for lwState 5 (0101) for swState 5 (0101) for sw
States 4 (0100), 5 (0101), 7 (0111), 8 (1000) and 9 States 4 (0100), 5 (0101), 7 (0111), 8 (1000) and 9 (1001) – next state is unconditionally 0 (0000)(1001) – next state is unconditionally 0 (0000)
Control ROM ContentsControl ROM ContentsControl ROM has sixteen Control ROM has sixteen 18-bit words:18-bit words:– bits 0-1, AddrCtl to bits 0-1, AddrCtl to
control muxcontrol mux– bits 2-17, sixteen bits 2-17, sixteen
control signals for control signals for datapathdatapath
Address is 4-bit state of Address is 4-bit state of control machinecontrol machine
Microprogram: Basic IdeaMicroprogram: Basic IdeaThe control unit in a computer generates an output The control unit in a computer generates an output (sequence of control signals) for each instruction.(sequence of control signals) for each instruction.Suppose we break down each instruction into a series of Suppose we break down each instruction into a series of smaller operations (microinstructions), such as, smaller operations (microinstructions), such as, fetchfetch, , decodedecode, etc., etc.Then, implement the control unit as a smallThen, implement the control unit as a small computer computer (within the computer) that executes a sequence of (within the computer) that executes a sequence of microinstructions (microprogram) for each instruction.microinstructions (microprogram) for each instruction.M. V. Wilkes, “The Best Way to Design an Automatic M. V. Wilkes, “The Best Way to Design an Automatic Calculating Machine,” Calculating Machine,” Report of Manchester University Report of Manchester University Computer Inaugural ConferenceComputer Inaugural Conference, pp. 16-18, 1951., pp. 16-18, 1951.Reprinted in E. E. Swartzlander (editor), Reprinted in E. E. Swartzlander (editor), Computer Design Computer Design Development: Principal PapersDevelopment: Principal Papers, pp. 266-270, Rochelle , pp. 266-270, Rochelle Park, NJ: Hayden, 1976.Park, NJ: Hayden, 1976.
Maurice V. WilkesMaurice V. WilkesBorn June 26, 1913, Staffordshire, UK, died November 29, 2010
1967 Turing Award citation:
Professor Wilkes Is best known as the builder and designer of the EDSAC, the first computer with an internally stored program. Built in 1949, the EDSAC used a mercury delay line memory. He is also known as the author, with Wheeler and Gill, of a volume on “Preparation of Programs for Electronic Digital Computers” in 1951, in which program libraries were effectively introduced.
Implementing the IdeaImplementing the IdeaUse a memory type implementation for control Use a memory type implementation for control unit.unit.Create a software infrastructure to automatically Create a software infrastructure to automatically translate instructions into memory data translate instructions into memory data (microcode):(microcode):
Microinstructions – define a machine language in which Microinstructions – define a machine language in which instructions can be describedinstructions can be describedMicroprogram – an instruction described as a sequence of Microprogram – an instruction described as a sequence of microinstructionsmicroinstructionsMicroassembler – converts microprogram to (binary) Microassembler – converts microprogram to (binary) microcodemicrocode
Is there a micro-compiler?Is there a micro-compiler?
A microinstruction set is defined.A microinstruction set is defined.
To program the control of a computer for an To program the control of a computer for an instruction set, a programmer writes a instruction set, a programmer writes a microprogram for each machine instruction.microprogram for each machine instruction.
Each micrprogram is converted into Each micrprogram is converted into microcode, specific to the datapath microcode, specific to the datapath hardware, by a microassembler and the hardware, by a microassembler and the entire microcode is loaded in the microcode entire microcode is loaded in the microcode memory of the control unit (CU).memory of the control unit (CU).
Breaking Up MIPS InstructionsBreaking Up MIPS Instructions
Microinstruction FormatMicroinstruction FormatJust one instruction with seven argumentsJust one instruction with seven argumentsA label or name for control state(s), e.g., Fetch, MEM1, etc. A label or name for control state(s), e.g., Fetch, MEM1, etc. Seven arguments and their possible values:Seven arguments and their possible values:– ALU controlALU control add, subtract or funct. codeadd, subtract or funct. code # result to ALUOut# result to ALUOut– SRC1SRC1 PC or APC or A– SRC2SRC2 B, 4, extend or extend-shiftB, 4, extend or extend-shift– Reg. controlReg. control ReadRead # read two reg. specified by IR into A # read two reg. specified by IR into A
and Band BWrite ALUWrite ALU # write ALUOut to register file# write ALUOut to register fileWrite MDRWrite MDR # register file ← MDR# register file ← MDR
– MemoryMemory Read PCRead PC # IR # IR ← ← M[ PC ]M[ PC ]Read ALURead ALU # MDR ← M[ ALUOut ]# MDR ← M[ ALUOut ]Write ALUWrite ALU # M[ ALUOut ] ← B# M[ ALUOut ] ← B
– PCWritePCWrite ALUALU # write PC from ALU# write PC from ALUALU cond.ALU cond. # If zero = 1, PC ← ALUOut# If zero = 1, PC ← ALUOutJump addr.Jump addr. # # PC ← jump addressPC ← jump address
– Sequencing Seq # choose next μInst. Sequentiallyfetch # go to first μInst. to begin new
Microinstruction Arguments (Cont.)Microinstruction Arguments (Cont.)FieldField μμInstr. valueInstr. value μμCode valueCode value ActionAction
PC Write PC Write CtrlCtrl
ALUALU PCSource = 00PCSource = 00
PCWrite = 1PCWrite = 1Register file loads A and BRegister file loads A and B
ALUOut-ALUOut-condcond
PCSource = 01PCSource = 01
PCWriteCond = 1PCWriteCond = 1An IR-specified register in An IR-specified register in Register file is written from Register file is written from ALUOutALUOut
Jump Jump addressaddress
PCSource = 10PCSource = 10
PCWrite = 1PCWrite = 1An IR-specified register in An IR-specified register in Register file is written from MDRRegister file is written from MDR
SequencSequencinging
SeqSeq AddrCtl = 11AddrCtl = 11 Choose next Choose next μμInstr. sequentiallyInstr. sequentially
FetchFetch AddrCtl = 00AddrCtl = 00 Go to first Go to first μμInstr.Instr. to begin new to begin new instructioninstruction
Dispatch 1Dispatch 1 AddrCtl = 01AddrCtl = 01 Use Dispatch ROM 1Use Dispatch ROM 1
Dispatch 2Dispatch 2 AddrCtl = 10AddrCtl = 10 Use Dispatch ROM 2Use Dispatch ROM 2
SummarySummaryHard-wired control:Hard-wired control: A finite state machine A finite state machine implemented typically using programmable logic implemented typically using programmable logic array (PLA) or random logic.array (PLA) or random logic.Microinstruction:Microinstruction: A one-clock instruction that A one-clock instruction that asserts a set of control signals to the datapath and asserts a set of control signals to the datapath and specifies what microinstruction to execute next.specifies what microinstruction to execute next.Microprogram:Microprogram: A sequence of microinstructions A sequence of microinstructions that implements a multicycle (or single cycle) that implements a multicycle (or single cycle) instruction.instruction.Microcode:Microcode: Machine code of a microprogram, Machine code of a microprogram, generally produced by a generally produced by a microassemblermicroassembler..Microprogrammed or microcoded control:Microprogrammed or microcoded control: A A method of specifying control that uses microcode method of specifying control that uses microcode rather than a finite state machine.rather than a finite state machine.
Further on MicroprogrammingFurther on MicroprogrammingPreceding discussion is based on:Preceding discussion is based on:
D. A. Patterson and J. L. Hennessey, D. A. Patterson and J. L. Hennessey, Computer Organization and Computer Organization and Design, Second EditionDesign, Second Edition, San Francisco: Morgan-Kaufman, 1998, , San Francisco: Morgan-Kaufman, 1998, Chapter 5, pp. 399-410.Chapter 5, pp. 399-410.
Terms “microcomputer”, “microarchitecture” and Terms “microcomputer”, “microarchitecture” and “micropipeline” are not related to microprogramming.“micropipeline” are not related to microprogramming.Nanoprogramming: Two levels of microprogramming Nanoprogramming: Two levels of microprogramming – a “recursive” control:– a “recursive” control:
Nanodata Corp., Nanodata Corp., QM-1 Hardware Level Users ManualQM-1 Hardware Level Users Manual, 2, 2ndnd Ed., Ed., Williamsville, NY, 1972.Williamsville, NY, 1972.J. P. Hayes, J. P. Hayes, Computer Architecture and OrganizationComputer Architecture and Organization, Section , Section 4.4.3, NY: McGraw-Hill, 1978.4.4.3, NY: McGraw-Hill, 1978.
Virtual machines: Any program can be run on any Virtual machines: Any program can be run on any instruction set using an interpreter. Example, Java.instruction set using an interpreter. Example, Java.