Midterm. Sticker winners: if you got >= 50 / 67

Size: px
Start display at page:

Download "Midterm. Sticker winners: if you got >= 50 / 67"

Transcription

1 CSC258 Week 8

2 Midterm Class average: 4.2 / 67 (6%) Highest mark: 64.5 / 67 Tests will be return in office hours. Make sure your midterm mark is correct on MarkUs Solution posted on the course website. Remarking request form ú ú the solution, fill in the form, attach it to the test and submit to Larry. ú A subset of the tests have been scanned. Sticker winners: if you got >= 5 / 67 2

3 Reflections Details matter. Being precise is important. ú Off by a couple bits not much better than off by many bits. ú Correct is much much better than almost correct. ú Pay enough attention to details, be precise, and get it all right. ú the questions carefully! The midterm is a great opportunity to realize any inefficiency in your learning method. If you didn t do well or are not sure how to improve, you are encouraged to arrange a meeting with Larry to talk about it how to do better in this course. 3

4 Drop date: March 7 4

5 The Blueprint of a microprocessor The Controller Thing PCCond PC IorD Mem Mem MemtoReg IR Contr ol Unit Opcode PCSource Op SrcB SrcA Reg RegDst Shift left 2 2 PC Address Memor y [3-26] [25-2] [2-6] [5-] Instructi on Register register Register s reg reg 2 reg Sign extend 2 A B Shift left A B Zero result AL U Out The Storage Thing The Arithmetic Thing 5

6 The Controller Thing aka: the Control Unit 6

7 The Control Unit controls how flows in the path. Different executions have different flows. 7

8 Processor Datapath The path of a processor is a description/ illustration of how the flows between processor components during the execution of an operation. 8

9 Datapath example Note: this is just an abstraction J The simplified path for most processor operations has stages as shown in the diagram: ú ú ú ú ú fetch decode & register fetch Address/ calculation access back. Address (PC) Sign ext. Mux Mux +4 Register File Data Mux Mux 9

10 What happens when you run an executable on your computer?./a.out, ls, fornite.exe,. The OS loads a bunch of instructions into the memory at certain location. 2. CPU finds that location and executes the instructions stored there one by one.

11 What does an instruction look like? It s a 32-bit (4-byte) binary string.

12 How do we remember the location of the current instruction? The program counter (PC) is a special register that stores the location of the current instruction. ú Each instruction is 4 bytes long, thus we do +4 to increments the current PC location. ú PC values can also be loaded from the result of an operation (e.g. jumps to a memory address). 2

13 So, here is the instruction. Do it! What does the instruction mean? What operations do I do? Where do I get the inputs and put the output? We need to decode the instruction. 3

14 decoding The instructions themselves can be broken down into sections that contain all the information needed to execute the operation. ú Also known as a control word. Example: unsigned subtraction ss sssttttt ddddd Register 7 = Register Register 4

15 registers The instruction register takes in the 32-bit instruction fetched from memory, and reads the first 6 bits (known as the opcode) to determine what operation to perform. register 5

16 Opcodes The first six digits of the instruction (the opcode) will determine the instruction type. ú Except for R-type instructions (marked in yellow) ú For these, opcode is, and last six digits denote the function. Op/Func add addu addi addiu div divu mult multu sub subu and andi nor or ori xor xori sll sllv sra Op/Func srav srl srlv beq bgtz blez bne j jal jalr jr lb lbu lh lhu lw sb sh sw mflo 6

17 MIPS instruction types R-type: opcode rs rt rd shamt funct I-type: opcode rs rt immediate J-type: 6 5 opcode 5 6 address 6 26 the first 6 bits first, then you know how to break it down. 7

18 R-type instructions opcode rs rt rd shamt funct Short for register-type instructions. ú Because they operate on the registers, naturally. These instructions have fields for specifying up to three registers and a shift amount. ú Three registers: two source registers (rs & rt) and one destination register (rd). ú A field is usually coded with all bits when not being used. The opcode for all R-type instructions is. The function field specifies the type of operation being performed (add, sub, and, etc). 8

19 Examples opcode rs rt rd shamt funct R-type! Reg 6! Reg 7! Reg 5! XOR! Reg_5 = Reg_6 XOR Reg_7 R-type! Reg 7! Reg 5! 2 bits! Shift left (SLL)! Left shift what s in Reg_7 by 2 bits and store result in Reg_5 9

20 R-type instruction path For the most part, the funct field tells the what operation to perform. rs and rt are sent to the register file, to specify the operands. rd is also sent to the register file, to specify the location of the result. Address (PC) Sign ext. Mux Mux Register File Data Mux +4 Mux 2

21 I-type instructions opcode rs rt immediate These instructions have a 6-bit immediate field. This field a constant value, which is used for: ú an immediate operand, ú a branch target offset (e.g., in branch if equal op), or ú an offset for a memory operand (e.g., in load op). 2

22 I-type instructions opcode rs rt immediate For branch target offset operations, the immediate field contains the signed difference between the current address stored in the PC and the address of the target instruction. ú This offset is stored with the two low order bits dropped. The dropped bits are always since instructions are word-aligned. 22

23 Word-aligned Every instruction is 4-byte ( word) long, so the starting address of each instruction is always a multiple of 4, like () 4 () 8 () 2 () 444 () Note that the two lowest bits are always. Since we know they are always, we don t need to use two bits to remember them. 23

24 Examples opcode rs rt immediate Branch on equal (BEQ) Reg 6! Reg 7! Offset = = 52 If Reg_6 == Reg_7: PC += 52 Else: PC += 4 24

25 Examples opcode rs rt immediate Load byte! (LB) Reg 6! Reg 7! Offset = = 38 Load one byte from MEM[Reg_6+38] to Reg_7 25

26 I-type instruction path Example #: Immediate arithmetic operations, with result stored in registers. Address (PC) Sign ext. Mux Register File Mux +4 Data Mux Mux 26

27 Interlude: Sign extension Sign ext. The immediately value we get from an I-type instruction is 6- bit long. But all operands of are supposed to be 32-bit long. So fill the upper 6 bits of the number with the sign-bit E.g., becomes 27

28 I-type instruction path Example #2: Immediate arithmetic operations, with result stored in memory. Address (PC) Sign ext. Mux Register File Mux +4 Data Mux Mux 28

29 I-type instruction path Example #3: Branch instructions. ú Output is written to PC, which looks to that location for the next instruction. Address (PC) Sign ext. Mux Register File Data Mux +4 Mux Mux 29

30 J-type instructions opcode address Only two J-type instructions: ú ú jump (j) jump and link (jal) These instructions use the 26-bit coded address field to specify the target of the jump. ú ú ú 6 26 The first four bits of the destination address are the same as the current bits in the program counter. The bits in positions 27 to 2 in the address are the 26 bits provided in the instruction. The bits at positions and are always since instructions are word-aligned. 3

31 Examples opcode address 6 26 Jump (J) destination address= {PC[3:28], whats-above, } PC jumps to address {PC[3:28] (4 bits), what s above (26 bits), (2 bits)} (32 bits total) 3

32 J-type instruction path Jump and branch use the path in similar but different ways: ú Branch calculates new PC value as old PC value + offset. (relative) ú Jump loads an immediate value over top of the old PC value. (absolute) Address (PC) Sign ext. Mux Mux Register File Data Mux +4 Mux 32

33 Takeaway Different instructions flow in different paths. In other words, if we can control the paths of flow, then we can control what instruction to execute. 33

34 Datapath control 34

35 Datapath control These instructions are executed by turning various parts of the path on and off, to direct the flow of from the correct source to the correct destination. What tells the processor to turn on these various components at the correct times? 35

36 Control unit The control unit takes in the opcode from the current instruction, and sends signals to the rest of the processor. PCCond PC Control Unit Opcode Within the control unit is a finite state machine that can occupy multiple clock cycles for a single instruction. ú The control unit send out different signals on each clock cycle, to make the overall operation happen. IorD Mem Mem MemtoReg IR PCSource Op SrcB SrcA Reg RegDst 36

37 The control unit sends signals (green lines) to various processor components to enact all possible operations. PCCond PC IorD Mem Mem MemtoReg IR Control Unit Opcode PCSource Op SrcB SrcA Reg RegDst Shift left 2 2 PC Address [3-26] [25-2] [2-6] [5-] Register Registers reg reg 2 reg 2 A B A B Zero result Out register Sign extend Shift left 2 37

38 Signals à instructions A certain combination of signals will make flow from some source to some destination. ú Just need to figure out what signals produce what behaviour. 38

39 Control unit signals PC: the output to the PC. PCCond: the output to the PC, only if the Zero condition has been met. IorD: For memory access; short for or Data. Signals whether the memory address is being provided by the PC (for instructions) or an operation (for ). Mem: The processor is reading from memory. Mem: The processor is writing to memory. MemToReg: The register file is receiving from memory, not from the output. IR: The instruction register is being filled with a new instruction from memory. 39

40 More control unit signals PCSource: Signals whether the value of the PC resulting from an jump, or an operation. Op (3 wires): Signals the execution of an operation. SrcA: Input A into the is coming from the PC (value=) or the register file (value=). SrcB (2 wires): Input B into the is coming from the register file (value=), a constant value of 4 (value=), the instruction register (value=2), or the shifted instruction register (value=3). Reg: The processor is writing to the register file. RegDst: Which part of the instruction is providing the destination address for a register write (rt versus rd). 4

41 Example instruction addi $t7, $t, 42 ú PC = ú PCCond = ú IorD = X ú Mem = ú Mem = ú MemToReg = ú IR = ú PCSource = X ú Op = (add) ú SrcA = ú SrcB = ú Reg = ú RegDst = Setting these signals will result in adding register $t by 42 and storing result in register $t7 4

42 addi $t7, $t, 42 This is a line of assembly language 42

43 Controlling the Datapath 43

44 MIPS Datapath PCCond PC IorD Mem Mem MemtoReg IR Control Unit Opcode PCSource Op SrcB SrcA Reg RegDst Shift left 2 2 PC Address [3-26] [25-2] [2-6] [5-] Register register Registers reg reg 2 reg Sign extend 2 A B Shift left A B Zero result Out So, how do we do the following? ú ú ú Increment the PC to the next instruction position. Store $t + 2 into the PC. Assuming that register $t3 is storing a valid memory address, fetch the from that location in memory and store it in $t5. 44

45 Controlling the signals Need to understand the role of each signal, and what value they need to have in order to perform the given operation. So, what s the best approach to make this happen? PCCond PC IorD Mem Mem MemtoReg IR Control Unit Opcode PCSource Op SrcB SrcA Reg RegDst 45

46 Basic approach to path. Figure out the source(s) and destination. 2. Determine the path of the. 3. Deduce the signal values that cause this path: a) Start with & signals (at most one can be high at a time). b) Then, mux signals along the path. c) Non-essential signals get an X value. 46

47 Example #: Incrementing PC PCCond PC IorD Mem Mem MemtoReg IR Control Unit Opcode PCSource Op SrcB SrcA Reg RegDst Shift left 2 2 PC Address [3-26] [25-2] [2-6] [5-] Register register Registers reg reg 2 reg Sign extend 2 A B Shift left A B Zero result Out Given the path above, what signals would the control unit turn on and off to increment the program counter by 4? 47

48 Example #: Incrementing PC PCCond PC IorD Mem Mem MemtoReg IR Control Unit Opcode PCSource Op SrcB SrcA Reg RegDst Shift left 2 2 PC Address [3-26] [25-2] [2-6] [5-] Register register Registers reg reg 2 reg Sign extend 2 A B Shift left A B Zero result Out Step #: Determine source and destination. ú Program counter provides source, ú Program counter is also destination. 48

49 Example #: Incrementing PC PCCond PC IorD Mem Mem MemtoReg IR Control Unit Opcode PCSource Op SrcB SrcA Reg RegDst Shift left 2 2 PC Address [3-26] [25-2] [2-6] [5-] Register register Registers reg reg 2 reg Sign extend 2 A B Shift left A B Zero result Out Step #2: Determine path for ú Operand A for : Program counter ú Operand B for : Literal value 4 ú Destination path: Through mux, back to PC 49

50 Example #: Incrementing PC PCCond PC IorD Mem Mem MemtoReg IR Control Unit Opcode PCSource Op SrcB SrcA Reg RegDst Shift left 2 2 PC Address [3-26] [25-2] [2-6] [5-] Register register Registers reg reg 2 reg Sign extend 2 A B Shift left A B Zero result Out Setting signals for this path:. & signals: PC is high, all others are low. 5

51 Example #: Incrementing PC PCCond PC IorD Mem Mem MemtoReg IR Control Unit Opcode PCSource Op SrcB SrcA Reg RegDst Shift left 2 2 PC Address [3-26] [25-2] [2-6] [5-] Register register Registers reg reg 2 reg Sign extend 2 A B Shift left A B Zero result Out Setting signals for this path: 2. Mux signals: PCSource is, AlUSrcA is, SrcB is all others are don t cares. 5

52 Example #: Incrementing PC PCCond PC IorD Mem Mem MemtoReg IR Control Unit Opcode PCSource Op SrcB SrcA Reg RegDst Shift left 2 2 PC Address [3-26] [25-2] [2-6] [5-] Register register Registers reg reg 2 reg Sign extend 2 A B Shift left A B Zero result Out Other signals for this path: ú Op is (Cin =, S =, S = : A+B) ú PCCond is X when PC is Otherwise it is except when branching. 52

53 Example # (final signals) PC = PCCond = X IorD = X Mem = Mem = MemToReg = X IR = PCSource = Op = SrcA = SrcB = Reg = RegDst = X 53

54 Another example add $r7, $r, $r2 PCCond PC IorD Mem Mem MemtoReg IR Control Unit Opcode PCSource Op SrcB SrcA Reg RegDst Shift left 2 2 PC Address [3-26] [25-2] [2-6] [5-] Register register Registers reg reg 2 reg Sign extend 2 A B Shift left A B Zero result Out Given the path above, what signals would the control unit turn on and off in order to add $r to $r2 and store the result in $r7? 54

55 add $r7, $r, $r2 PCCond PC IorD Mem Mem MemtoReg IR Control Unit Opcode PCSource Op SrcB SrcA Reg RegDst Shift left 2 2 PC Address [3-26] [25-2] [2-6] [5-] Register register Registers reg reg 2 reg Sign extend 2 A B Shift left A B Zero result Out Step #: Data source and destination ú Data starts in register block. ú Data goes to register block. 55

56 Question # (cont d) add $r7, $r, $r2 PCCond PC IorD Mem Mem MemtoReg IR Control Unit Opcode PCSource Op SrcB SrcA Reg RegDst Shift left 2 2 PC Address [3-26] [25-2] [2-6] [5-] Register register Registers reg reg 2 reg Sign extend 2 A B Shift left A B Zero result Out Step #2: Determine the path of the ú Data needs to go through the before heading back into the register file. 56

57 Question # (cont d) add $r7, $r, $r2 PCCond PC IorD Mem Mem MemtoReg IR Control Unit Opcode PCSource Op SrcB SrcA Reg RegDst Shift left 2 2 PC Address [3-26] [25-2] [2-6] [5-] Register register Registers reg reg 2 reg Sign extend 2 A B Shift left A B Zero result Out Step #3a: & signals ú Only Reg needs to be high. ú PC, PCCond, Mem, Mem, IR would be low. 57

58 Question # (cont d) add $r7, $r, $r2 PCCond PC IorD Mem Mem MemtoReg IR Control Unit Opcode PCSource Op SrcB SrcA Reg RegDst Shift left 2 2 PC Address [3-26] [25-2] [2-6] [5-] Register register Registers reg reg 2 reg Sign extend 2 A B Shift left A B Zero result Out Step #3b: Relevant mux signals ú Muxes before : SrcA à, SrcB à. ú Op à (Add) ú Mux before registers: MemToReg à 58

59 Question # (cont d) add $r7, $r, $r2 PCCond PC IorD Mem Mem MemtoReg IR Control Unit Opcode PCSource Op SrcB SrcA Reg RegDst Shift left 2 2 PC Address [3-26] [25-2] [2-6] [5-] Register Registers reg reg 2 reg 2 A B A B Zero result Out register Sign extend Shift left 2 Step #3c: Irrelevant mux signals ú No writing to PC: PCSource à X. ú No reading from memory: IorD à X. 59

60 Question # (cont d) PC = PCCond = IorD = X Mem = Mem = MemToReg = IR = PCSource = X Op = SrcA = SrcB = Reg = RegDst = Note: RegDst rule high for 3-register operations low for 2-register operations X if not using register file 6

61 The Tale of Hello world. You, the programmer, write a piece of code called hello.c/java/whatever 2. You compile the code, which translate the code into machine instructions and save the in an executable file (e.g., hello, hello.exe) 3. You run the executable, OS load the executable (the instructions) into memory, set PC. 4. CPU loads the instruction pointed by PC into instruction register. 5. Control Unit checks the opcode (first 6 bits), decode the rest of the instruction and send signals to setup the path (billions of MOSFETs switching ON/OFF). 6. Data flow through the path, electrons move around 7. And BOOM!, hello world shows up on your screen 6

62 The Tale of Hello world 62

EEM 486: Computer Architecture. Lecture 2. MIPS Instruction Set Architecture

EEM 486: Computer Architecture. Lecture 2. MIPS Instruction Set Architecture EEM 486: Computer Architecture Lecture 2 MIPS Instruction Set Architecture EEM 486 Overview Instruction Representation Big idea: stored program consequences of stored program Instructions as numbers Instruction

More information

The MIPS Instruction Set Architecture

The MIPS Instruction Set Architecture The MIPS Set Architecture CPS 14 Lecture 5 Today s Lecture Admin HW #1 is due HW #2 assigned Outline Review A specific ISA, we ll use it throughout semester, very similar to the NiosII ISA (we will use

More information

MIPS Reference Guide

MIPS Reference Guide MIPS Reference Guide Free at PushingButtons.net 2 Table of Contents I. Data Registers 3 II. Instruction Register Formats 4 III. MIPS Instruction Set 5 IV. MIPS Instruction Set (Extended) 6 V. SPIM Programming

More information

101 Assembly. ENGR 3410 Computer Architecture Mark L. Chang Fall 2009

101 Assembly. ENGR 3410 Computer Architecture Mark L. Chang Fall 2009 101 Assembly ENGR 3410 Computer Architecture Mark L. Chang Fall 2009 What is assembly? 79 Why are we learning assembly now? 80 Assembly Language Readings: Chapter 2 (2.1-2.6, 2.8, 2.9, 2.13, 2.15), Appendix

More information

Computer Architecture. The Language of the Machine

Computer Architecture. The Language of the Machine Computer Architecture The Language of the Machine Instruction Sets Basic ISA Classes, Addressing, Format Administrative Matters Operations, Branching, Calling conventions Break Organization All computers

More information

Week 10: Assembly Programming

Week 10: Assembly Programming Week 10: Assembly Programming Arithmetic instructions Instruction Opcode/Function Syntax Operation add 100000 $d, $s, $t $d = $s + $t addu 100001 $d, $s, $t $d = $s + $t addi 001000 $t, $s, i $t = $s +

More information

MIPS Instruction Set

MIPS Instruction Set MIPS Instruction Set Prof. James L. Frankel Harvard University Version of 7:12 PM 3-Apr-2018 Copyright 2018, 2017, 2016, 201 James L. Frankel. All rights reserved. CPU Overview CPU is an acronym for Central

More information

M2 Instruction Set Architecture

M2 Instruction Set Architecture M2 Instruction Set Architecture Module Outline Addressing modes. Instruction classes. MIPS-I ISA. High level languages, Assembly languages and object code. Translating and starting a program. Subroutine

More information

Question 0. Do not turn this page until you have received the signal to start. (Please fill out the identification section above) Good Luck!

Question 0. Do not turn this page until you have received the signal to start. (Please fill out the identification section above) Good Luck! CSC B58 Winter 2017 Final Examination Duration 2 hours and 50 minutes Aids allowed: none Last Name: Student Number: UTORid: First Name: Question 0. [1 mark] Read and follow all instructions on this page,

More information

ECE232: Hardware Organization and Design. Computer Organization - Previously covered

ECE232: Hardware Organization and Design. Computer Organization - Previously covered ECE232: Hardware Organization and Design Part 6: MIPS Instructions II http://www.ecs.umass.edu/ece/ece232/ Adapted from Computer Organization and Design, Patterson & Hennessy, UCB Computer Organization

More information

MIPS Instruction Reference

MIPS Instruction Reference Page 1 of 9 MIPS Instruction Reference This is a description of the MIPS instruction set, their meanings, syntax, semantics, and bit encodings. The syntax given for each instruction refers to the assembly

More information

ECE 2035 Programming HW/SW Systems Fall problems, 7 pages Exam Two 23 October 2013

ECE 2035 Programming HW/SW Systems Fall problems, 7 pages Exam Two 23 October 2013 Instructions: This is a closed book, closed note exam. Calculators are not permitted. If you have a question, raise your hand and I will come to you. Please work the exam in pencil and do not separate

More information

CSc 256 Midterm 2 Fall 2011

CSc 256 Midterm 2 Fall 2011 CSc 256 Midterm 2 Fall 2011 NAME: 1a) You are given a MIPS branch instruction: x: beq $12, $0, y The address of the label "y" is 0x400468. The memory location at "x" contains: address contents 0x40049c

More information

MIPS Instruction Format

MIPS Instruction Format MIPS Instruction Format MIPS uses a 32-bit fixed-length instruction format. only three different instruction word formats: There are Register format Op-code Rs Rt Rd Function code 000000 sssss ttttt ddddd

More information

Q1: /30 Q2: /25 Q3: /45. Total: /100

Q1: /30 Q2: /25 Q3: /45. Total: /100 ECE 2035(A) Programming for Hardware/Software Systems Fall 2013 Exam One September 19 th 2013 This is a closed book, closed note texam. Calculators are not permitted. Please work the exam in pencil and

More information

F. Appendix 6 MIPS Instruction Reference

F. Appendix 6 MIPS Instruction Reference F. Appendix 6 MIPS Instruction Reference Note: ALL immediate values should be sign extended. Exception: For logical operations immediate values should be zero extended. After extensions, you treat them

More information

Reduced Instruction Set Computer (RISC)

Reduced Instruction Set Computer (RISC) Reduced Instruction Set Computer (RISC) Reduced Instruction Set Computer (RISC) Focuses on reducing the number and complexity of instructions of the machine. Reduced number of cycles needed per instruction.

More information

ECE Exam I February 19 th, :00 pm 4:25pm

ECE Exam I February 19 th, :00 pm 4:25pm ECE 3056 Exam I February 19 th, 2015 3:00 pm 4:25pm 1. The exam is closed, notes, closed text, and no calculators. 2. The Georgia Tech Honor Code governs this examination. 3. There are 4 questions and

More information

Assembly Programming

Assembly Programming Designing Computer Systems Assembly Programming 08:34:48 PM 23 August 2016 AP-1 Scott & Linda Wills Designing Computer Systems Assembly Programming In the early days of computers, assembly programming

More information

A Processor. Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University. See: P&H Chapter , 4.1-3

A Processor. Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University. See: P&H Chapter , 4.1-3 A Processor Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University See: P&H Chapter 2.16-20, 4.1-3 Let s build a MIPS CPU but using Harvard architecture Basic Computer System Registers ALU

More information

TSK3000A - Generic Instructions

TSK3000A - Generic Instructions TSK3000A - Generic Instructions Frozen Content Modified by Admin on Sep 13, 2017 Using the core set of assembly language instructions for the TSK3000A as building blocks, a number of generic instructions

More information

ECE260: Fundamentals of Computer Engineering

ECE260: Fundamentals of Computer Engineering MIPS Instruction Set James Moscola Dept. of Engineering & Computer Science York College of Pennsylvania Based on Computer Organization and Design, 5th Edition by Patterson & Hennessy MIPS Registers MIPS

More information

CS 4200/5200 Computer Architecture I

CS 4200/5200 Computer Architecture I CS 4200/5200 Computer Architecture I MIPS Instruction Set Architecture Dr. Xiaobo Zhou Department of Computer Science CS420/520 Lec3.1 UC. Colorado Springs Adapted from UCB97 & UCB03 Review: Organizational

More information

Final Project: MIPS-like Microprocessor

Final Project: MIPS-like Microprocessor Final Project: MIPS-like Microprocessor Objective: The objective of this project is to design, simulate, and implement a simple 32-bit microprocessor with an instruction set that is similar to a MIPS.

More information

Processor. Han Wang CS3410, Spring 2012 Computer Science Cornell University. See P&H Chapter , 4.1 4

Processor. Han Wang CS3410, Spring 2012 Computer Science Cornell University. See P&H Chapter , 4.1 4 Processor Han Wang CS3410, Spring 2012 Computer Science Cornell University See P&H Chapter 2.16 20, 4.1 4 Announcements Project 1 Available Design Document due in one week. Final Design due in three weeks.

More information

CENG 3420 Lecture 06: Datapath

CENG 3420 Lecture 06: Datapath CENG 342 Lecture 6: Datapath Bei Yu byu@cse.cuhk.edu.hk CENG342 L6. Spring 27 The Processor: Datapath & Control q We're ready to look at an implementation of the MIPS q Simplified to contain only: memory-reference

More information

Reduced Instruction Set Computer (RISC)

Reduced Instruction Set Computer (RISC) Reduced Instruction Set Computer (RISC) Focuses on reducing the number and complexity of instructions of the ISA. RISC Goals RISC: Simplify ISA Simplify CPU Design Better CPU Performance Motivated by simplifying

More information

Computer Architecture. MIPS Instruction Set Architecture

Computer Architecture. MIPS Instruction Set Architecture Computer Architecture MIPS Instruction Set Architecture Instruction Set Architecture An Abstract Data Type Objects Registers & Memory Operations Instructions Goal of Instruction Set Architecture Design

More information

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA MIPS ISA. In a CPU. (vonneumann) Processor Organization

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA MIPS ISA. In a CPU. (vonneumann) Processor Organization CISC 662 Graduate Computer Architecture Lecture 4 - ISA MIPS ISA Michela Taufer http://www.cis.udel.edu/~taufer/courses Powerpoint Lecture Notes from John Hennessy and David Patterson s: Computer Architecture,

More information

ECE260: Fundamentals of Computer Engineering

ECE260: Fundamentals of Computer Engineering MIPS Instruction Set James Moscola Dept. of Engineering & Computer Science York College of Pennsylvania Based on Computer Organization and Design, 5th Edition by Patterson & Hennessy MIPS Registers MIPS

More information

CSc 256 Midterm 2 Spring 2012

CSc 256 Midterm 2 Spring 2012 CSc 256 Midterm 2 Spring 2012 NAME: 1a) You are given this MIPS assembly language instruction (i.e., pseudo- instruction): ble $12, 0x20004880, there Translate this MIPS instruction to an efficient sequence

More information

MIPS%Assembly% E155%

MIPS%Assembly% E155% MIPS%Assembly% E155% Outline MIPS Architecture ISA Instruction types Machine codes Procedure call Stack 2 The MIPS Register Set Name Register Number Usage $0 0 the constant value 0 $at 1 assembler temporary

More information

Anne Bracy CS 3410 Computer Science Cornell University. [K. Bala, A. Bracy, E. Sirer, and H. Weatherspoon]

Anne Bracy CS 3410 Computer Science Cornell University. [K. Bala, A. Bracy, E. Sirer, and H. Weatherspoon] Anne Bracy CS 3410 Computer Science Cornell University [K. Bala, A. Bracy, E. Sirer, and H. Weatherspoon] Understanding the basics of a processor We now have the technology to build a CPU! Putting it all

More information

Programming the processor

Programming the processor CSC258 Week 9 Logistics This week: Lab 7 is the last Logisim DE2 lab. Next week: Lab 8 will be assembly. For assembly labs you can work individually or in pairs. No matter how you do it, the important

More information

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA CISC 662 Graduate Computer Architecture Lecture 4 - ISA Michela Taufer http://www.cis.udel.edu/~taufer/courses Powerpoint Lecture Notes from John Hennessy and David Patterson s: Computer Architecture,

More information

ECE 2035 Programming HW/SW Systems Spring problems, 6 pages Exam One 4 February Your Name (please print clearly)

ECE 2035 Programming HW/SW Systems Spring problems, 6 pages Exam One 4 February Your Name (please print clearly) Your Name (please print clearly) This exam will be conducted according to the Georgia Tech Honor Code. I pledge to neither give nor receive unauthorized assistance on this exam and to abide by all provisions

More information

Instruction Set Architecture of. MIPS Processor. MIPS Processor. MIPS Registers (continued) MIPS Registers

Instruction Set Architecture of. MIPS Processor. MIPS Processor. MIPS Registers (continued) MIPS Registers CSE 675.02: Introduction to Computer Architecture MIPS Processor Memory Instruction Set Architecture of MIPS Processor CPU Arithmetic Logic unit Registers $0 $31 Multiply divide Coprocessor 1 (FPU) Registers

More information

Mips Code Examples Peter Rounce

Mips Code Examples Peter Rounce Mips Code Examples Peter Rounce P.Rounce@cs.ucl.ac.uk Some C Examples Assignment : int j = 10 ; // space must be allocated to variable j Possibility 1: j is stored in a register, i.e. register $2 then

More information

Overview. Introduction to the MIPS ISA. MIPS ISA Overview. Overview (2)

Overview. Introduction to the MIPS ISA. MIPS ISA Overview. Overview (2) Introduction to the MIPS ISA Overview Remember that the machine only understands very basic instructions (machine instructions) It is the compiler s job to translate your high-level (e.g. C program) into

More information

Project Part A: Single Cycle Processor

Project Part A: Single Cycle Processor Curtis Mayberry Andrew Kies Mark Monat Iowa State University CprE 381 Professor Joseph Zambreno Project Part A: Single Cycle Processor Introduction The second part in the three part MIPS Processor design

More information

CENG 3420 Computer Organization and Design. Lecture 06: MIPS Processor - I. Bei Yu

CENG 3420 Computer Organization and Design. Lecture 06: MIPS Processor - I. Bei Yu CENG 342 Computer Organization and Design Lecture 6: MIPS Processor - I Bei Yu CEG342 L6. Spring 26 The Processor: Datapath & Control q We're ready to look at an implementation of the MIPS q Simplified

More information

Multi-cycle Approach. Single cycle CPU. Multi-cycle CPU. Requires state elements to hold intermediate values. one clock cycle or instruction

Multi-cycle Approach. Single cycle CPU. Multi-cycle CPU. Requires state elements to hold intermediate values. one clock cycle or instruction Multi-cycle Approach Single cycle CPU State element Combinational logic State element clock one clock cycle or instruction Multi-cycle CPU Requires state elements to hold intermediate values State Element

More information

Processor (I) - datapath & control. Hwansoo Han

Processor (I) - datapath & control. Hwansoo Han Processor (I) - datapath & control Hwansoo Han Introduction CPU performance factors Instruction count - Determined by ISA and compiler CPI and Cycle time - Determined by CPU hardware We will examine two

More information

CO Computer Architecture and Programming Languages CAPL. Lecture 18 & 19

CO Computer Architecture and Programming Languages CAPL. Lecture 18 & 19 CO2-3224 Computer Architecture and Programming Languages CAPL Lecture 8 & 9 Dr. Kinga Lipskoch Fall 27 Single Cycle Disadvantages & Advantages Uses the clock cycle inefficiently the clock cycle must be

More information

A Processor! Hakim Weatherspoon CS 3410, Spring 2010 Computer Science Cornell University. See: P&H Chapter , 4.1-3

A Processor! Hakim Weatherspoon CS 3410, Spring 2010 Computer Science Cornell University. See: P&H Chapter , 4.1-3 A Processor! Hakim Weatherspoon CS 3410, Spring 2010 Computer Science Cornell University See: P&H Chapter 2.16-20, 4.1-3 Announcements! HW2 available later today HW2 due in one week and a half Work alone

More information

EE108B Lecture 3. MIPS Assembly Language II

EE108B Lecture 3. MIPS Assembly Language II EE108B Lecture 3 MIPS Assembly Language II Christos Kozyrakis Stanford University http://eeclass.stanford.edu/ee108b 1 Announcements Urgent: sign up at EEclass and say if you are taking 3 or 4 units Homework

More information

MIPS ISA. 1. Data and Address Size 8-, 16-, 32-, 64-bit 2. Which instructions does the processor support

MIPS ISA. 1. Data and Address Size 8-, 16-, 32-, 64-bit 2. Which instructions does the processor support Components of an ISA EE 357 Unit 11 MIPS ISA 1. Data and Address Size 8-, 16-, 32-, 64-bit 2. Which instructions does the processor support SUBtract instruc. vs. NEGate + ADD instrucs. 3. Registers accessible

More information

Anne Bracy CS 3410 Computer Science Cornell University. See P&H Chapter: , , Appendix B

Anne Bracy CS 3410 Computer Science Cornell University. See P&H Chapter: , , Appendix B Anne Bracy CS 3410 Computer Science Cornell University The slides are the product of many rounds of teaching CS 3410 by Professors Weatherspoon, Bala, Bracy, and Sirer. See P&H Chapter: 2.16-2.20, 4.1-4.4,

More information

ECE 2035 Programming HW/SW Systems Fall problems, 6 pages Exam One 22 September Your Name (please print clearly) Signed.

ECE 2035 Programming HW/SW Systems Fall problems, 6 pages Exam One 22 September Your Name (please print clearly) Signed. Your Name (please print clearly) This exam will be conducted according to the Georgia Tech Honor Code. I pledge to neither give nor receive unauthorized assistance on this exam and to abide by all provisions

More information

CS3350B Computer Architecture MIPS Instruction Representation

CS3350B Computer Architecture MIPS Instruction Representation CS3350B Computer Architecture MIPS Instruction Representation Marc Moreno Maza http://www.csd.uwo.ca/~moreno/cs3350_moreno/index.html Department of Computer Science University of Western Ontario, Canada

More information

CS3350B Computer Architecture Quiz 3 March 15, 2018

CS3350B Computer Architecture Quiz 3 March 15, 2018 CS3350B Computer Architecture Quiz 3 March 15, 2018 Student ID number: Student Last Name: Question 1.1 1.2 1.3 2.1 2.2 2.3 Total Marks The quiz consists of two exercises. The expected duration is 30 minutes.

More information

CS 351 Exam 2 Mon. 11/2/2015

CS 351 Exam 2 Mon. 11/2/2015 CS 351 Exam 2 Mon. 11/2/2015 Name: Rules and Hints The MIPS cheat sheet and datapath diagram are attached at the end of this exam for your reference. You may use one handwritten 8.5 11 cheat sheet (front

More information

Inf2C - Computer Systems Lecture Processor Design Single Cycle

Inf2C - Computer Systems Lecture Processor Design Single Cycle Inf2C - Computer Systems Lecture 10-11 Processor Design Single Cycle Boris Grot School of Informatics University of Edinburgh Previous lectures Combinational circuits Combinations of gates (INV, AND, OR,

More information

MIPS Assembly Language. Today s Lecture

MIPS Assembly Language. Today s Lecture MIPS Assembly Language Computer Science 104 Lecture 6 Homework #2 Midterm I Feb 22 (in class closed book) Outline Assembly Programming Reading Chapter 2, Appendix B Today s Lecture 2 Review: A Program

More information

ECE 2035 Programming HW/SW Systems Fall problems, 6 pages Exam One 19 September 2012

ECE 2035 Programming HW/SW Systems Fall problems, 6 pages Exam One 19 September 2012 Instructions: This is a closed book, closed note exam. Calculators are not permitted. If you have a question, raise your hand and I will come to you. Please work the exam in pencil and do not separate

More information

Today s Lecture. MIPS Assembly Language. Review: What Must be Specified? Review: A Program. Review: MIPS Instruction Formats

Today s Lecture. MIPS Assembly Language. Review: What Must be Specified? Review: A Program. Review: MIPS Instruction Formats Today s Lecture Homework #2 Midterm I Feb 22 (in class closed book) MIPS Assembly Language Computer Science 14 Lecture 6 Outline Assembly Programming Reading Chapter 2, Appendix B 2 Review: A Program Review:

More information

ECE 2035 Programming HW/SW Systems Spring problems, 6 pages Exam Two 11 March Your Name (please print) total

ECE 2035 Programming HW/SW Systems Spring problems, 6 pages Exam Two 11 March Your Name (please print) total Instructions: This is a closed book, closed note exam. Calculators are not permitted. If you have a question, raise your hand and I will come to you. Please work the exam in pencil and do not separate

More information

RISC Processor Design

RISC Processor Design RISC Processor Design Single Cycle Implementation - MIPS Virendra Singh Indian Institute of Science Bangalore virendra@computer.org Lecture 13 SE-273: Processor Design Feb 07, 2011 SE-273@SERC 1 Courtesy:

More information

LECTURE 5. Single-Cycle Datapath and Control

LECTURE 5. Single-Cycle Datapath and Control LECTURE 5 Single-Cycle Datapath and Control PROCESSORS In lecture 1, we reminded ourselves that the datapath and control are the two components that come together to be collectively known as the processor.

More information

ECE 15B Computer Organization Spring 2010

ECE 15B Computer Organization Spring 2010 ECE 15B Computer Organization Spring 2010 Dmitri Strukov Lecture 7: Procedures I Partially adapted from Computer Organization and Design, 4 th edition, Patterson and Hennessy, and classes taught by and

More information

Computer Science and Engineering 331. Midterm Examination #1. Fall Name: Solutions S.S.#:

Computer Science and Engineering 331. Midterm Examination #1. Fall Name: Solutions S.S.#: Computer Science and Engineering 331 Midterm Examination #1 Fall 2000 Name: Solutions S.S.#: 1 41 2 13 3 18 4 28 Total 100 Instructions: This exam contains 4 questions. It is closed book and notes. Calculators

More information

Concocting an Instruction Set

Concocting an Instruction Set Concocting an Instruction Set Nerd Chef at work. move flour,bowl add milk,bowl add egg,bowl move bowl,mixer rotate mixer... Read: Chapter 2.1-2.7 L03 Instruction Set 1 A General-Purpose Computer The von

More information

ECE 2035 Programming HW/SW Systems Fall problems, 6 pages Exam Two 23 October Your Name (please print clearly) Signed.

ECE 2035 Programming HW/SW Systems Fall problems, 6 pages Exam Two 23 October Your Name (please print clearly) Signed. Your Name (please print clearly) This exam will be conducted according to the Georgia Tech Honor Code. I pledge to neither give nor receive unauthorized assistance on this exam and to abide by all provisions

More information

Laboratory Exercise 6 Pipelined Processors 0.0

Laboratory Exercise 6 Pipelined Processors 0.0 Laboratory Exercise 6 Pipelined Processors 0.0 Goals After this laboratory exercise, you should understand the basic principles of how pipelining works, including the problems of data and branch hazards

More information

INSTRUCTION SET COMPARISONS

INSTRUCTION SET COMPARISONS INSTRUCTION SET COMPARISONS MIPS SPARC MOTOROLA REGISTERS: INTEGER 32 FIXED WINDOWS 32 FIXED FP SEPARATE SEPARATE SHARED BRANCHES: CONDITION CODES NO YES NO COMPARE & BR. YES NO YES A=B COMP. & BR. YES

More information

Unsigned Binary Integers

Unsigned Binary Integers Unsigned Binary Integers Given an n-bit number x x n 1 n 2 1 0 n 12 xn 22 x12 x02 Range: 0 to +2 n 1 Example 2.4 Signed and Unsigned Numbers 0000 0000 0000 0000 0000 0000 0000 1011 2 = 0 + + 1 2 3 + 0

More information

Unsigned Binary Integers

Unsigned Binary Integers Unsigned Binary Integers Given an n-bit number x x n 1 n 2 1 0 n 12 xn 22 x12 x02 Range: 0 to +2 n 1 Example 2.4 Signed and Unsigned Numbers 0000 0000 0000 0000 0000 0000 0000 1011 2 = 0 + + 1 2 3 + 0

More information

RISC Design: Multi-Cycle Implementation

RISC Design: Multi-Cycle Implementation RISC Design: Multi-Cycle Implementation Virendra Singh Associate Professor Computer Architecture and Dependable Systems Lab Department of Electrical Engineering Indian Institute of Technology Bombay http://www.ee.iitb.ac.in/~viren/

More information

5/17/2012. Recap from Last Time. CSE 2021: Computer Organization. The RISC Philosophy. Levels of Programming. Stored Program Computers

5/17/2012. Recap from Last Time. CSE 2021: Computer Organization. The RISC Philosophy. Levels of Programming. Stored Program Computers CSE 2021: Computer Organization Recap from Last Time load from disk High-Level Program Lecture-2 Code Translation-1 Registers, Arithmetic, logical, jump, and branch instructions MIPS to machine language

More information

Recap from Last Time. CSE 2021: Computer Organization. Levels of Programming. The RISC Philosophy 5/19/2011

Recap from Last Time. CSE 2021: Computer Organization. Levels of Programming. The RISC Philosophy 5/19/2011 CSE 2021: Computer Organization Recap from Last Time load from disk High-Level Program Lecture-3 Code Translation-1 Registers, Arithmetic, logical, jump, and branch instructions MIPS to machine language

More information

Computer Architecture

Computer Architecture CS3350B Computer Architecture Winter 2015 Lecture 4.2: MIPS ISA -- Instruction Representation Marc Moreno Maza www.csd.uwo.ca/courses/cs3350b [Adapted from lectures on Computer Organization and Design,

More information

Processor (multi-cycle)

Processor (multi-cycle) CS359: Computer Architecture Processor (multi-cycle) Yanyan Shen Department of Computer Science and Engineering Five Instruction Steps ) Instruction Fetch ) Instruction Decode and Register Fetch 3) R-type

More information

CS 61C: Great Ideas in Computer Architecture Datapath. Instructors: John Wawrzynek & Vladimir Stojanovic

CS 61C: Great Ideas in Computer Architecture Datapath. Instructors: John Wawrzynek & Vladimir Stojanovic CS 61C: Great Ideas in Computer Architecture Datapath Instructors: John Wawrzynek & Vladimir Stojanovic http://inst.eecs.berkeley.edu/~cs61c/fa15 1 Components of a Computer Processor Control Enable? Read/Write

More information

A General-Purpose Computer The von Neumann Model. Concocting an Instruction Set. Meaning of an Instruction. Anatomy of an Instruction

A General-Purpose Computer The von Neumann Model. Concocting an Instruction Set. Meaning of an Instruction. Anatomy of an Instruction page 1 Concocting an Instruction Set Nerd Chef at work. move flour,bowl add milk,bowl add egg,bowl move bowl,mixer rotate mixer... A General-Purpose Computer The von Neumann Model Many architectural approaches

More information

MACHINE LANGUAGE. To work with the machine, we need a translator.

MACHINE LANGUAGE. To work with the machine, we need a translator. LECTURE 2 Assembly MACHINE LANGUAGE As humans, communicating with a machine is a tedious task. We can t, for example, just say add this number and that number and store the result here. Computers have

More information

Introduction to the MIPS. Lecture for CPSC 5155 Edward Bosworth, Ph.D. Computer Science Department Columbus State University

Introduction to the MIPS. Lecture for CPSC 5155 Edward Bosworth, Ph.D. Computer Science Department Columbus State University Introduction to the MIPS Lecture for CPSC 5155 Edward Bosworth, Ph.D. Computer Science Department Columbus State University Introduction to the MIPS The Microprocessor without Interlocked Pipeline Stages

More information

COMPUTER ORGANIZATION AND DESIGN. The Hardware/Software Interface. Chapter 4. The Processor: A Based on P&H

COMPUTER ORGANIZATION AND DESIGN. The Hardware/Software Interface. Chapter 4. The Processor: A Based on P&H COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface Chapter 4 The Processor: A Based on P&H Introduction We will examine two MIPS implementations A simplified version A more realistic pipelined

More information

Midterm Questions Overview

Midterm Questions Overview Midterm Questions Overview Four questions from the following: Performance Evaluation: Given MIPS code, estimate performance on a given CPU. Compare performance of different CPU/compiler changes for a given

More information

Instruction Set Principles. (Appendix B)

Instruction Set Principles. (Appendix B) Instruction Set Principles (Appendix B) Outline Introduction Classification of Instruction Set Architectures Addressing Modes Instruction Set Operations Type & Size of Operands Instruction Set Encoding

More information

Multiple Cycle Data Path

Multiple Cycle Data Path Multiple Cycle Data Path CS 365 Lecture 7 Prof. Yih Huang CS365 1 Multicycle Approach Break up the instructions into steps, each step takes a cycle balance the amount of work to be done restrict each cycle

More information

Exam in Computer Engineering

Exam in Computer Engineering Exam in Computer Engineering Kurskod D0013E/SMD137/SMD082/SMD066 Tentamensdatum 2010-10-29 Skrivtid 14.00-18.00 Maximalt resultat 50 poäng Godkänt resultat 25 poäng Jourhavande lärare Andrey Kruglyak Tel

More information

Character Is a byte quantity (00~FF or 0~255) ASCII (American Standard Code for Information Interchange) Page 91, Fig. 2.21

Character Is a byte quantity (00~FF or 0~255) ASCII (American Standard Code for Information Interchange) Page 91, Fig. 2.21 2.9 Communication with People: Byte Data & Constants Character Is a byte quantity (00~FF or 0~255) ASCII (American Standard Code for Information Interchange) Page 91, Fig. 2.21 32: space 33:! 34: 35: #...

More information

CSc 256 Final Fall 2016

CSc 256 Final Fall 2016 CSc 256 Final Fall 2016 NAME: Problem 1 (25 points) Translate the C/C++ function func() into MIPS assembly language. The prototype is: void func(int arg0, int *arg1); arg0-arg1 are in $a0- $a1 respectively.

More information

Chapter 4. The Processor

Chapter 4. The Processor Chapter 4 The Processor Introduction CPU performance factors Instruction count Determined by ISA and compiler CPI and Cycle time Determined by CPU hardware We will examine two MIPS implementations A simplified

More information

Outline. EEL-4713 Computer Architecture Multipliers and shifters. Deriving requirements of ALU. MIPS arithmetic instructions

Outline. EEL-4713 Computer Architecture Multipliers and shifters. Deriving requirements of ALU. MIPS arithmetic instructions Outline EEL-4713 Computer Architecture Multipliers and shifters Multiplication and shift registers Chapter 3, section 3.4 Next lecture Division, floating-point 3.5 3.6 EEL-4713 Ann Gordon-Ross.1 EEL-4713

More information

I-Format Instructions (3/4) Define fields of the following number of bits each: = 32 bits

I-Format Instructions (3/4) Define fields of the following number of bits each: = 32 bits CS61C L10 MIPS Instruction Representation II (1) inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture #10 Instruction Representation II 2007-7-8 Review There are register calling conventions!

More information

University of California College of Engineering Computer Science Division -EECS. CS 152 Midterm I

University of California College of Engineering Computer Science Division -EECS. CS 152 Midterm I Name: University of California College of Engineering Computer Science Division -EECS Fall 996 D.E. Culler CS 52 Midterm I Your Name: ID Number: Discussion Section: You may bring one double-sided pages

More information

Design of Digital Circuits 2017 Srdjan Capkun Onur Mutlu (Guest starring: Frank K. Gürkaynak and Aanjhan Ranganathan)

Design of Digital Circuits 2017 Srdjan Capkun Onur Mutlu (Guest starring: Frank K. Gürkaynak and Aanjhan Ranganathan) Microarchitecture Design of Digital Circuits 27 Srdjan Capkun Onur Mutlu (Guest starring: Frank K. Gürkaynak and Aanjhan Ranganathan) http://www.syssec.ethz.ch/education/digitaltechnik_7 Adapted from Digital

More information

Instructions: Language of the Computer

Instructions: Language of the Computer Instructions: Language of the Computer Tuesday 22 September 15 Many slides adapted from: and Design, Patterson & Hennessy 5th Edition, 2014, MK and from Prof. Mary Jane Irwin, PSU Summary Previous Class

More information

CPU Design for Computer Integrated Experiment

CPU Design for Computer Integrated Experiment CPU Design for Computer Integrated Experiment Shan Lu, Guangyao Li, Yijianan Wang CEIE, Tongji University, Shanghai, China Abstract - Considering the necessity and difficulty of designing a CPU for students,

More information

Review. Lecture #9 MIPS Logical & Shift Ops, and Instruction Representation I Logical Operators (1/3) Bitwise Operations

Review. Lecture #9 MIPS Logical & Shift Ops, and Instruction Representation I Logical Operators (1/3) Bitwise Operations CS6C L9 MIPS Logical & Shift Ops, and Instruction Representation I () inst.eecs.berkeley.edu/~cs6c CS6C : Machine Structures Lecture #9 MIPS Logical & Shift Ops, and Instruction Representation I 25-9-28

More information

ENCM 369 Winter 2013: Reference Material for Midterm #2 page 1 of 5

ENCM 369 Winter 2013: Reference Material for Midterm #2 page 1 of 5 ENCM 369 Winter 2013: Reference Material for Midterm #2 page 1 of 5 MIPS/SPIM General Purpose Registers Powers of Two 0 $zero all bits are zero 16 $s0 local variable 1 $at assembler temporary 17 $s1 local

More information

CS61CL Machine Structures. Lec 5 Instruction Set Architecture

CS61CL Machine Structures. Lec 5 Instruction Set Architecture CS61CL Machine Structures Lec Instruction Set Architecture David Culler Electrical Engineering and Computer Sciences University of California, Berkeley What is Computer Architecture? Applications Compiler

More information

CSc 256 Midterm (green) Fall 2018

CSc 256 Midterm (green) Fall 2018 CSc 256 Midterm (green) Fall 2018 NAME: Problem 1 (5 points): Suppose we are tracing a C/C++ program using a debugger such as gdb. The code showing all function calls looks like this: main() { bat(5);

More information

Review: MIPS Organization

Review: MIPS Organization 1 MIPS Arithmetic Review: MIPS Organization Processor Memory src1 addr 5 src2 addr 5 dst addr 5 write data Register File registers ($zero - $ra) bits src1 data src2 data read/write addr 1 1100 2 30 words

More information

Instruction Set Architecture part 1 (Introduction) Mehran Rezaei

Instruction Set Architecture part 1 (Introduction) Mehran Rezaei Instruction Set Architecture part 1 (Introduction) Mehran Rezaei Overview Last Lecture s Review Execution Cycle Levels of Computer Languages Stored Program Computer/Instruction Execution Cycle SPIM, a

More information

ECE 2035 Programming HW/SW Systems Fall problems, 6 pages Exam Two 21 October 2016

ECE 2035 Programming HW/SW Systems Fall problems, 6 pages Exam Two 21 October 2016 Instructions: This is a closed book, closed note exam. Calculators are not permitted. If you have a question, raise your hand and I will come to you. Please work the exam in pencil and do not separate

More information

Midterm Questions Overview

Midterm Questions Overview Midterm Questions Overview Four questions from the following: Performance Evaluation: Given MIPS code, estimate performance on a given CPU. Compare performance of different CPU/compiler changes for a given

More information

Mark Redekopp, All rights reserved. EE 357 Unit 11 MIPS ISA

Mark Redekopp, All rights reserved. EE 357 Unit 11 MIPS ISA EE 357 Unit 11 MIPS ISA Components of an ISA 1. Data and Address Size 8-, 16-, 32-, 64-bit 2. Which instructions does the processor support SUBtract instruc. vs. NEGate + ADD instrucs. 3. Registers accessible

More information

ICS 233 COMPUTER ARCHITECTURE. MIPS Processor Design Multicycle Implementation

ICS 233 COMPUTER ARCHITECTURE. MIPS Processor Design Multicycle Implementation ICS 233 COMPUTER ARCHITECTURE MIPS Processor Design Multicycle Implementation Lecture 23 1 Add immediate unsigned Subtract unsigned And And immediate Or Or immediate Nor Shift left logical Shift right

More information