DOC PREVIEW
UCLA COMSCI M151B - Lecture7

This preview shows page 1 out of 2 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Week 4 - WednesdayChapter 4 - The Processor4_1Introduction CPU performance factors Instruction count CPI and cycle time Examin two data path implementations of MIPS A single-cycle implementation A pipelined version Simple subset, shows most aspects Memory reference: lw, sw Arithmetic/logical: add, sub, and, or, slt Control transfer, beq, jInstruction Execution PC -> instruction memory, fetch instruction Register numbers -> register file, read registers Depending on instruction class Use ALU to calculate Arithmetic result Memory address for load/store Branch target address PC+4+offset Access data memory for load/store PC <- target address or PC+4CPU Overview PC -> Instruction memory -> registers -> ALU -> Data memoryLogic Design Basics Information encoded in binary Low voltage = 0, High voltage = 1 One wire per bit Multi-bit data encoded on multi-wire buses Combinational element Operate on data Output is a function of input State (sequential) elements Store informationCombinational Elements AND-gate Y = A & B Adder Y = A + B Multiplexer Y = S ? I1 : I0 ALU Y = F(A, B)Sequential Elements Register: stores data in a circuit Uses a clock signal to determine when to update the stored value Edge-triggered: update when clk changes from 0 to 1 Register with write control Only updates on clock edge when write control input is 1 Used when stored value is required laterClocking Methodology Combinational logic transforms data during clock cycles Between clock edgesInput from state elements, output to state element Longest delay determines state period4_2Building a Datapath Datapath Elements that process data and addresses in the CPU Registers, ALUs, mux's, memories, ... We will build a MIPS datapath incrementally Refine the overview designInstruction fetch 32-bit register PC Provides address to the instruction memory There's an adder to increment by 4 for the next instuction goes back to point to the program counterR-Format Instructions Read two register operands as inputs Perform arithmetic/logical operation Write register resultLoad/Store Instructions We need to be able to read register operands rs (for both store and load), rt (for store) Calculate address using 16-bit offset Use ALU, but sign-extend offset to get 32-bits Data memory unit Address port to specify where in the memory we are doing reading/writing Read data to pull data out of memory Write data to put values into memory MemWrite control line - write data into memory MemRead control line - read data from memory Load: Read memory and update register Store: Write register value to memoryBranch Instructions Read register operands rs, rt Compare operands Use ALU, subtract and check the zero output If they are equal Calculate target address Sign-extend displacement Shift left 2 placements Add to PC+4Composing the Elements First-cut data path does an instruction in one clock cycle Each datapath element can only do one function at a time Hence, we need separate instruction and data memories Use multiplexers where alternate data sources are used for different instructionsR-Type/Load/Store Datapath Registers Instructions coming from the left Instruction fetch is done (PC+4 stuff) rs, rt, rd inputs4_3Full


View Full Document

UCLA COMSCI M151B - Lecture7

Download Lecture7
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture7 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture7 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?