Computer Hardware Engineering
|
|
- Barnaby Alexander
- 5 years ago
- Views:
Transcription
1 2 Course Structure Computer Hardware ngineering IS1200, spring 2015 Lecture 3: Languages Module 4: I/O Systems Module 1: Logic Design L DCÖ1 L DCÖ2 Lab:dicom L7 Module 2: C and Assembly Programming Associate Professor, KTH Royal Institute of Technology L1 L2 1 Assistant Research ngineer, University of California, Berkeley L3 2 3 L4 4 Slides version 10 L6 7 Lab: nios2io 9 Lab: nios2int Module 5: Memory Hierarchy L8 Home Lab: cache 8 Lab: nios2time Home lab: C Module 6: Parallel Processors and Programs Module 3: Processor Design L5 6 5 L9 L10 10 I II 3 4 Abstractions in Computer Systems Computer System Agenda Networked Systems and Systems of Systems Application Software Software I Negative Numbers Operating System Instruction Set Architecture Hardware/Software Interface Microarchitecture Logic and Building Blocks II Digital Hardware Design Digital Circuits Analog Circuits Devices and Physics Analog Design and Physics I II I II
2 5 6 Sign/Magnitude Numbers Negative Numbers How can we represent negative numbers? Idea: Let msb represent the sign (1 = negative, 0 = positive) and the remaining bits the magnitude This representation is called signed/magnitude numbers signed/magnitude numbers 6 7 = = = = Can we add two numbers using binary addition? Should be = 1 10 = but = = Problem 1: Binary addition does not work = and = Problem 2: Strange effect; we have two numbers for zero I II I II 7 8 Two s Complement Numbers (1/3) Solution: Two s complement numbers Which patterns can we find in the following 3-bit two s complement numbers Only one number represent 0 (Solution to problem 1) All negative numbers have msb set This is called the sign bit = = = = = = = = I Positive numbers are represented as usual Can represent one more negative number than positive numbers Negative numbers are listed in reverse order II Two s Complement Numbers (2/3) Why is it called two s complement? Because the negation of an N-bit value X is 2 N X Is binary addition working with two s complement numbers? two s complement numbers (check yourself) xample: N = 3 and X = 3 Then = 8 3 = 5 = Should be I = = = = = = = = = 1 10 = = = = = Yes, it works (general proof left as = an exercise) Note that the carry out is 1, but ignored here II
3 9 10 Two s Complement Numbers (3/3) Sign xtension But, in this case we need a subtract erator to get negative numbers Another way to take the two s complement of a number X with N bits: Invert all bit of number X and add 1 xample: N = 3 and X = 3 X = 3 = 0112 inv(x) = 1002, = 1012 (general proof omitted) I Sign extension Assume you have a binary number A with n bits We can sign extend A to have the length m+n bits, by cing A s most significant bit into the m most significant bits 0002 = = = = 310 xample Assume we have value -3 encoded as a two s complement 4-bit value Sign extend the 4-bit value into a 8-bit value 1002 = = = = -110 xercise Assume we have value -10 encoded as a two s complement 8-bit value Sign extend the 8-bit value into a 12-bit value Solution: The 12-bit value is II 11 Instruction ncoding I Word address C II II 12 Stored Programs with Formats 0f a0 93 fa a0 b0 4e 01 1b 12 aa MIPS programs are typically stored from address Physical xercise Sign extend the 4-bit value 2 into 8 bits Stand for , hands on the table for Solution: The 8-bit value is I Stored program concept Code is data Code is stored in memory as any other data, enabling general purpose computing I Solution The 8-bit value is Word 3 Word 2 Word 1 Word 0 For MIPS and NIOS2, there are 3 instruction formats: R-Type (register-type) I-Type (immediate-type) J-Type (jump-type) Although both MIPS and NIOS2 have R, I, and J formats, the exact bit encodings are different See the NIOS2 manual In MIPS and NIOS2, each instruction requires exactly one word (32 bits) of space MIPS code must be word-aligned (start at addresses 0,4, 8, C etc) X86 does not require word alignment I II
4 R-Type Instructions 13 I-Type Instructions 14 R-Type (register-type) instructions have three register erands: two sources and one destination rs 6 bits rt rd shamt stands for shift amount It is only used for shift instructions It has value 0 for other instructions shamt funct 6 bits I-Type (immediate-type) instructions have two register erands and one immediate erand rs 6 bits rt imm 16 bits 0 For R-Type, is always 0 source 1 xercise: Create the machine code for add $t2, $s1, $s2 Answer with a C code expression source 2 destination funct determines the specific R-type instruction Answer: Check the MIPS reference card for codes (10 << 11) (17 << 21) (18 << 16) 32 Opcode source 1 destination xercise: a) Create the machine code for lb $t0,-7($s1) Answer with a binary number b) b) Same as above, but answer with a C code expression for some inst (lw, addi), source 2 for others (sw) Immediate value (can also be negative using two s complement) Answer: a) b) (32 << 26) (17<<21) (8<<16) (-7 & 0xffff) I II I II J-Type Instructions J-Type (jump-type) instructions has one 26- bit address erand II 6 bits addr 26 bits 0 Opcode Address erand I II I II
5 Registers 17 Function Calls and Returns 18 MIPS (and NIOS2) have 32 registers Name Number Use $0 0 constant value of 0 $at 1 assembler temporary $v0-$v1 2-3 function return value $a0-$a3 4-7 function arguments $t0-$t temporary (caller-saved) $s0-$s saved variables (callee-saved) $t8-$t temporary (caller-saved) $k0-$k reserved for OS kernal $gp 28 global pointer 29 stack pointer $fp 30 frame pointer $ra 31 function return address I II int main(){ dummy(); void dummy(){ 0x main: jal dummy 0x x dummy: jr $ra What is the value of $ra when entering the function dummy? Answer: 0x The calling function is called the caller Function main() in this case The called function is called the callee Function dummy() in this case This simple example shows a function call without arguments or return values that returns immediately The jump and link instruction (jal) performs two tasks: 1 It stores the address of the next instruction in the return address register $ra 2 It jumps to the target address (updates the program counter, PC) The jump registers (jr) returns by jumping to the address stored in $ra I II Arguments and Return Values 19 The Stack (1/3) The Basic Idea 20 int main(){ int y; y = sum(3,8); int sum(int x, int y){ return x + y; Assume y is mapped to $s0 main: addi $a0, $0, 3 addi $a1, $0, 8 jal sum add $s0, $v0, $0 sum: add $v0, $a0, $a1 jr $ra Save arguments in $a0 and $a1 Save return value in $v0 Problem: We are limited to four arguments $a0, $a1, $a2, and $a3 Move the result to $s0 (mapped from y) Solution: A stack is used to store local variables and additional arguments A stack is a last-in-first-out (LIFO) queue 0x7FFF FF0C 0x7FFF FF08 0x7FFF FF04 0x7FFF FF00 0x B2 The stack grows traditionally down in memory 0x7FFF FF0C 0x7FFF FF08 0x7FFF FF04 0x7FFF FF00 The stack pointer points to the t of the stack 0x B2 0x x Before adding two words to the stack After adding two words to the stack I II I II
6 The Stack (2/3) Preserving Registers 21 The Stack (3/3) Preserving Registers, Continued 22 One usage of the stack is to save registers that are modified in the callee function xercise: Assume that a callee function foo modifies registers $s0 and $s1 Write the foo function in ASM, so that $s0 and $s1 are preserved when the function returns 0xAC 0xA8 0xA4 0xA0? 0xAC 0xA8 0xA4 0xA0? $s0 $s1 Before and after that the registers have been saved foo: addi,, -8 sw $s0, 4() sw $s1, 0() modifies $s0 and $s1 lw $s1, 0() lw $s0, 4() addi,, 8 jr $ra If the callee saves registers that are not used by the caller, this saving of registers is a waste The caller can use the save registers $s0 to $s7 before the function call, knowing that they are preserved when the function returns Name Number Use $t0-$t temporary (caller-saved) $s0-$s saved variables (callee-saved) $t8-$t temporary (caller-saved) The callee only saves the registers $s0 to $s7 If the caller use the $t registers and they are live before and after a function call, it must save these registers on the stack The callee can freely use the temporary registers $t0 to $t9, without saving them I II I II PC-Relative Addressing Pseudo-Direct Addressing Conditional branches compute their addresses relative to the program counter (PC) because the instructions have not enough address bits 0x40 lo: add $t1, $a0, $s0 0x44 lb $t1,0($t1) 0x48 add $t2, $a1, $s0 0x4c sb $t1, 0($t2) 0x50 addi $s0, $s0, 1 0x54 bne $t1, $0, lo 0x58 lw $s0,0() xercise: Compute the machine code for the bne instruction BTA for the bne instruction is 0x40 Calculate branch target address (BTA): BTA = PC imm * 4 rs rt 6 bits 16 bits I imm II The J and JAL instructions are encoded using the J-type But, the address is not 32 bits, only 26 bits 6 bits addr 26 bits A 32-bit Pseudo-Direct Address is computed as follows: Bits 1 to 0 (least significant) are always zero because word alignment of code Bits 27 to 2 is taken directly from the addr field of the machine code instruction Bits 31 to 28 are obtained from the four most significant bits from PC + 4 Note: JR instructions are not using Pseudo-Direct Addresses (it is in R- format) Compilers must make sure not to jump between segments of code I 0 II
7 25 26 Summary You are soon released from the lecture room Some key take away points: Two s complement is the standard way of representing negative and positive integer numbers (please do not fumble with the bags) MIPS and NIOS II main instruction formats are R-Type, I-Type, and J-Type Arguments and return values are passed in registers when calling functions If there are too many arguments, the stack is used Thanks for listening! I II I II
Computer Organization and Components
2 Course Structure Computer Organization and Components Module 4: Memory Hierarchy Module 1: Logic Design IS1500, fall 2014 Lecture 4: and F1 DC Ö1 F2 DC Ö2 F7b Lab: dicom F8 Module 2: C and Associate
More informationMIPS%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 informationENGN1640: Design of Computing Systems Topic 03: Instruction Set Architecture Design
ENGN1640: Design of Computing Systems Topic 03: Instruction Set Architecture Design Professor Sherief Reda http://scale.engin.brown.edu School of Engineering Brown University Spring 2014 Sources: Computer
More informationComputer Hardware Engineering
Computer Hardware Engineering IS2, spring 2 Lecture : LU and s ssociate Professor, KTH Royal itute of Technology ssistant Research Engineer, University of California, Berkeley Revision v., June 7, 2: Minor
More informationComputer Organization and Components
Computer Organization and Components IS1500, fall 2016 Lecture 2: Assembly Languages Associate Professor, KTH Royal Institute of Technology Slides version 1.0 2 Course Structure Module 1: C and Assembly
More informationMath 230 Assembly Programming (AKA Computer Organization) Spring 2008
Math 230 Assembly Programming (AKA Computer Organization) Spring 2008 MIPS Intro II Lect 10 Feb 15, 2008 Adapted from slides developed for: Mary J. Irwin PSU CSE331 Dave Patterson s UCB CS152 M230 L10.1
More informationComputer Organization MIPS ISA
CPE 335 Computer Organization MIPS ISA Dr. Iyad Jafar Adapted from Dr. Gheith Abandah Slides http://www.abandah.com/gheith/courses/cpe335_s08/index.html CPE 232 MIPS ISA 1 (vonneumann) Processor Organization
More informationECE 30 Introduction to Computer Engineering
ECE 30 Introduction to Computer Engineering Study Problems, Set #3 Spring 2015 Use the MIPS assembly instructions listed below to solve the following problems. arithmetic add add sub subtract addi add
More informationRui Wang, Assistant professor Dept. of Information and Communication Tongji University.
Instructions: ti Language of the Computer Rui Wang, Assistant professor Dept. of Information and Communication Tongji University it Email: ruiwang@tongji.edu.cn Computer Hierarchy Levels Language understood
More informationComputer Hardware Engineering
2 Coue Structure Computer Hardware Engineering IS2, spring 2 Lecture : LU and s Module : I/O Systems Module : Logic Design L DCÖ L DCÖ2 Lab:dicom L7 Module 2: C and ssembly Programming ssociate Professor,
More informationComputer 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 informationCourse Administration
Fall 2018 EE 3613: Computer Organization Chapter 2: Instruction Set Architecture Introduction 4/4 Avinash Karanth Department of Electrical Engineering & Computer Science Ohio University, Athens, Ohio 45701
More informationMachine Language Instructions Introduction. Instructions Words of a language understood by machine. Instruction set Vocabulary of the machine
Machine Language Instructions Introduction Instructions Words of a language understood by machine Instruction set Vocabulary of the machine Current goal: to relate a high level language to instruction
More informationCourse Administration
Fall 2017 EE 3613: Computer Organization Chapter 2: Instruction Set Architecture 2/4 Avinash Kodi Department of Electrical Engineering & Computer Science Ohio University, Athens, Ohio 45701 E-mail: kodi@ohio.edu
More informationcomp 180 Lecture 10 Outline of Lecture Procedure calls Saving and restoring registers Summary of MIPS instructions
Outline of Lecture Procedure calls Saving and restoring registers Summary of MIPS instructions Procedure Calls A procedure of a subroutine is like an agent which needs certain information to perform a
More informationCENG3420 Lecture 03 Review
CENG3420 Lecture 03 Review Bei Yu byu@cse.cuhk.edu.hk 2017 Spring 1 / 38 CISC vs. RISC Complex Instruction Set Computer (CISC) Lots of instructions of variable size, very memory optimal, typically less
More informationCS 61C: Great Ideas in Computer Architecture. MIPS Instruction Formats
CS 61C: Great Ideas in Computer Architecture MIPS Instruction Formats Instructor: Justin Hsia 6/27/2012 Summer 2012 Lecture #7 1 Review of Last Lecture New registers: $a0-$a3, $v0-$v1, $ra, $sp Also: $at,
More informationAnnouncements HW1 is due on this Friday (Sept 12th) Appendix A is very helpful to HW1. Check out system calls
Announcements HW1 is due on this Friday (Sept 12 th ) Appendix A is very helpful to HW1. Check out system calls on Page A-48. Ask TA (Liquan chen: liquan@ece.rutgers.edu) about homework related questions.
More informationChapter 2A Instructions: Language of the Computer
Chapter 2A Instructions: Language of the Computer Copyright 2009 Elsevier, Inc. All rights reserved. Instruction Set The repertoire of instructions of a computer Different computers have different instruction
More informationMIPS Datapath. MIPS Registers (and the conventions associated with them) MIPS Instruction Types
1 Lecture 08 Introduction to the MIPS ISA + Procedure Calls in MIPS Longer instructions = more bits to address registers MIPS Datapath 6 bit opcodes... 2 MIPS Instructions are 32 bits More ways to address
More informationCISC 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 informationMIPS Functions and Instruction Formats
MIPS Functions and Instruction Formats 1 The Contract: The MIPS Calling Convention You write functions, your compiler writes functions, other compilers write functions And all your functions call other
More informationEN164: Design of Computing Systems Topic 03: Instruction Set Architecture Design
EN164: Design of Computing Systems Topic 03: Instruction Set Architecture Design Professor Sherief Reda http://scale.engin.brown.edu Electrical Sciences and Computer Engineering School of Engineering Brown
More informationCISC 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 informationCS3350B Computer Architecture
CS3350B Computer Architecture Winter 2015 Lecture 4.1: MIPS ISA: Introduction Marc Moreno Maza www.csd.uwo.ca/courses/cs3350b [Adapted d from lectures on Computer Organization and Design, Patterson & Hennessy,
More informationIntroduction 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 informationCS3350B Computer Architecture MIPS Introduction
CS3350B Computer Architecture MIPS Introduction Marc Moreno Maza http://www.csd.uwo.ca/~moreno/cs3350_moreno/index.html Department of Computer Science University of Western Ontario, Canada Thursday January
More informationLecture 2. Instructions: Language of the Computer (Chapter 2 of the textbook)
Lecture 2 Instructions: Language of the Computer (Chapter 2 of the textbook) Instructions: tell computers what to do Chapter 2 Instructions: Language of the Computer 2 Introduction Chapter 2.1 Chapter
More informationEN164: Design of Computing Systems Lecture 11: Processor / ISA 4
EN164: Design of Computing Systems Lecture 11: Processor / ISA 4 Professor Sherief Reda http://scale.engin.brown.edu Electrical Sciences and Computer Engineering School of Engineering Brown University
More informationCOMPSCI 313 S Computer Organization. 7 MIPS Instruction Set
COMPSCI 313 S2 2018 Computer Organization 7 MIPS Instruction Set Agenda & Reading MIPS instruction set MIPS I-format instructions MIPS R-format instructions 2 7.1 MIPS Instruction Set MIPS Instruction
More informationEN164: Design of Computing Systems Lecture 09: Processor / ISA 2
EN164: Design of Computing Systems Lecture 09: Processor / ISA 2 Professor Sherief Reda http://scale.engin.brown.edu Electrical Sciences and Computer Engineering School of Engineering Brown University
More informationComputer Architecture
Computer Architecture Chapter 2 Instructions: Language of the Computer Fall 2005 Department of Computer Science Kent State University Assembly Language Encodes machine instructions using symbols and numbers
More informationComputer Hardware Engineering
2 Course Structure Computer Hardware ngineering IS1200, spring 2015 Lecture 4: The C Programming Language Continued Module 4: I/O Systems Module 1: Logic Design L DCÖ1 L DCÖ2 Lab:dicom L7 Module 2: C and
More informationComputer Hardware Engineering
Computer Hardware ngineering IS1200, spring 2015 Lecture 4: The C Programming Language Continued Associate Professor, KTH Royal Institute of Technology Assistant Research ngineer, University of California,
More informationLecture 5: Procedure Calls
Lecture 5: Procedure Calls Today s topics: Memory layout, numbers, control instructions Procedure calls 1 Memory Organization The space allocated on stack by a procedure is termed the activation record
More informationInstructions: Language of the Computer
CS359: Computer Architecture Instructions: Language of the Computer Yanyan Shen Department of Computer Science and Engineering 1 The Language a Computer Understands Word a computer understands: instruction
More informationECE331: Hardware Organization and Design
ECE331: Hardware Organization and Design Lecture 8: Procedures (cont d), Binary Numbers and Adders Adapted from Computer Organization and Design, Patterson & Hennessy, UCB Review: Procedure Calling Steps
More informationInstructions: MIPS ISA. Chapter 2 Instructions: Language of the Computer 1
Instructions: MIPS ISA Chapter 2 Instructions: Language of the Computer 1 PH Chapter 2 Pt A Instructions: MIPS ISA Based on Text: Patterson Henessey Publisher: Morgan Kaufmann Edited by Y.K. Malaiya for
More informationChapter 2. Instructions: Language of the Computer. Adapted by Paulo Lopes
Chapter 2 Instructions: Language of the Computer Adapted by Paulo Lopes Instruction Set The repertoire of instructions of a computer Different computers have different instruction sets But with many aspects
More informationChapter 2. Computer Abstractions and Technology. Lesson 4: MIPS (cont )
Chapter 2 Computer Abstractions and Technology Lesson 4: MIPS (cont ) Logical Operations Instructions for bitwise manipulation Operation C Java MIPS Shift left >>> srl Bitwise
More informationInstructions: 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 information2) Using the same instruction set for the TinyProc2, convert the following hex values to assembly language: x0f
CS2 Fall 28 Exam 2 Name: ) The Logisim TinyProc2 has four instructions, each using 8 bits. The instruction format is DR SR SR2 OpCode with OpCodes of for add, for subtract, and for multiply. Load Immediate
More informationMIPS Functions and the Runtime Stack
MIPS Functions and the Runtime Stack COE 301 Computer Organization Prof. Muhamed Mudawar College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals Presentation Outline
More informationChapter 1. Computer Abstractions and Technology. Lesson 3: Understanding Performance
Chapter 1 Computer Abstractions and Technology Lesson 3: Understanding Performance Manufacturing ICs 1.7 Real Stuff: The AMD Opteron X4 Yield: proportion of working dies per wafer Chapter 1 Computer Abstractions
More informationComputer Hardware Engineering
Computer Hardware Engineering IS2, spring 27 Lecture 9: LU and s ssociate Professor, KTH Royal Institute of Technology Slides version. 2 Course Structure Module : C and ssembly Programming LE LE2 LE EX
More informationELEC / Computer Architecture and Design Fall 2013 Instruction Set Architecture (Chapter 2)
ELEC 5200-001/6200-001 Computer Architecture and Design Fall 2013 Instruction Set Architecture (Chapter 2) Victor P. Nelson, Professor & Asst. Chair Vishwani D. Agrawal, James J. Danaher Professor Department
More informationChapter 2: Instructions:
Chapter 2: Instructions: Language of the Computer Computer Architecture CS-3511-2 1 Instructions: To command a computer s hardware you must speak it s language The computer s language is called instruction
More informationBranch Addressing. Jump Addressing. Target Addressing Example. The University of Adelaide, School of Computer Science 28 September 2015
Branch Addressing Branch instructions specify Opcode, two registers, target address Most branch targets are near branch Forward or backward op rs rt constant or address 6 bits 5 bits 5 bits 16 bits PC-relative
More informationCOMP 303 Computer Architecture Lecture 3. Comp 303 Computer Architecture
COMP 303 Computer Architecture Lecture 3 Comp 303 Computer Architecture 1 Supporting procedures in computer hardware The execution of a procedure Place parameters in a place where the procedure can access
More informationComputer Hardware Engineering
Computer Hardware ngineering IS2, spring 25 Lecture 6: Pipelined Processors ssociate Professor, KTH Royal Institute of Technology ssistant Research ngineer, University of California, Berkeley Slides version.
More informationCS/COE1541: Introduction to Computer Architecture
CS/COE1541: Introduction to Computer Architecture Dept. of Computer Science University of Pittsburgh http://www.cs.pitt.edu/~melhem/courses/1541p/index.html 1 Computer Architecture? Application pull Operating
More informationComputer Organization MIPS Architecture. Department of Computer Science Missouri University of Science & Technology
Computer Organization MIPS Architecture Department of Computer Science Missouri University of Science & Technology hurson@mst.edu Computer Organization Note, this unit will be covered in three lectures.
More informationCharacter 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 informationToday s topics. MIPS operations and operands. MIPS arithmetic. CS/COE1541: Introduction to Computer Architecture. A Review of MIPS ISA.
Today s topics CS/COE1541: Introduction to Computer Architecture MIPS operations and operands MIPS registers Memory view Instruction encoding A Review of MIPS ISA Sangyeun Cho Arithmetic operations Logic
More informationReview of Last Lecture. CS 61C: Great Ideas in Computer Architecture. MIPS Instruction Representation II. Agenda. Dealing With Large Immediates
CS 61C: Great Ideas in Computer Architecture MIPS Instruction Representation II Guest Lecturer: Justin Hsia 2/11/2013 Spring 2013 Lecture #9 1 Review of Last Lecture Simplifying MIPS: Define instructions
More informationStored Program Concept. Instructions: Characteristics of Instruction Set. Architecture Specification. Example of multiple operands
Stored Program Concept Instructions: Instructions are bits Programs are stored in memory to be read or written just like data Processor Memory memory for data, programs, compilers, editors, etc. Fetch
More informationCSE Lecture In Class Example Handout
CSE 30321 Lecture 07-08 In Class Example Handout Part A: J-Type Example: If you look in your book at the syntax for j (an unconditional jump instruction), you see something like: e.g. j addr would seemingly
More informationLectures 3-4: MIPS instructions
Lectures 3-4: MIPS instructions Motivation Learn how a processor s native language looks like Discover the most important software-hardware interface MIPS Microprocessor without Interlocked Pipeline Stages
More information5/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 informationChapter 2. Instructions: Language of the Computer. HW#1: 1.3 all, 1.4 all, 1.6.1, , , , , and Due date: one week.
Chapter 2 Instructions: Language of the Computer HW#1: 1.3 all, 1.4 all, 1.6.1, 1.14.4, 1.14.5, 1.14.6, 1.15.1, and 1.15.4 Due date: one week. Practice: 1.5 all, 1.6 all, 1.10 all, 1.11 all, 1.14 all,
More informationRecap 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 informationComputer Organization and Structure. Bing-Yu Chen National Taiwan University
Computer Organization and Structure Bing-Yu Chen National Taiwan University Instructions: Language of the Computer Operations and Operands of the Computer Hardware Signed and Unsigned Numbers Representing
More informationCSE Lecture In Class Example Handout
CSE 30321 Lecture 07-09 In Class Example Handout Part A: A Simple, MIPS-based Procedure: Swap Procedure Example: Let s write the MIPS code for the following statement (and function call): if (A[i] > A
More informationAssembler. Lecture 8 CS301
Assembler Lecture 8 CS301 Discussion Given the following function header, int foo(int a, int b); what will be on the stack before any of the calculations in foo are performed? Assume foo() calls some other
More informationInstructions: Assembly Language
Chapter 2 Instructions: Assembly Language Reading: The corresponding chapter in the 2nd edition is Chapter 3, in the 3rd edition it is Chapter 2 and Appendix A and in the 4th edition it is Chapter 2 and
More informationCS 61c: Great Ideas in Computer Architecture
MIPS Instruction Formats July 2, 2014 Review New registers: $a0-$a3, $v0-$v1, $ra, $sp New instructions: slt, la, li, jal, jr Saved registers: $s0-$s7, $sp, $ra Volatile registers: $t0-$t9, $v0-$v1, $a0-$a3
More informationControl Instructions. Computer Organization Architectures for Embedded Computing. Thursday, 26 September Summary
Control Instructions Computer Organization Architectures for Embedded Computing Thursday, 26 September 2013 Many slides adapted from: Computer Organization and Design, Patterson & Hennessy 4th Edition,
More informationControl Instructions
Control Instructions 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 Instruction Set
More informationECE232: Hardware Organization and Design
ECE232: Hardware Organization and Design Lecture 6: Procedures Adapted from Computer Organization and Design, Patterson & Hennessy, UCB Overview Procedures have different names in different languages Java:
More informationCS61C - Machine Structures. Lecture 6 - Instruction Representation. September 15, 2000 David Patterson.
CS61C - Machine Structures Lecture 6 - Instruction Representation September 15, 2000 David Patterson http://www-inst.eecs.berkeley.edu/~cs61c/ 1 Review Instructions: add, addi, sub, lw, sw beq, bne, j
More informationECE 154A Introduction to. Fall 2012
ECE 154A Introduction to Computer Architecture Fall 2012 Dmitri Strukov Lecture 4: Arithmetic and Data Transfer Instructions Agenda Review of last lecture Logic and shift instructions Load/store instructionsi
More informationCSCI 402: Computer Architectures. Instructions: Language of the Computer (3) Fengguang Song Department of Computer & Information Science IUPUI.
CSCI 402: Computer Architectures Instructions: Language of the Computer (3) Fengguang Song Department of Computer & Information Science IUPUI Recall Big endian, little endian Memory alignment Unsigned
More informationLecture 4: MIPS Instruction Set
Lecture 4: MIPS Instruction Set No class on Tuesday Today s topic: MIPS instructions Code examples 1 Instruction Set Understanding the language of the hardware is key to understanding the hardware/software
More informationECE 331 Hardware Organization and Design. Professor Jay Taneja UMass ECE - Discussion 3 2/8/2018
ECE 331 Hardware Organization and Design Professor Jay Taneja UMass ECE - jtaneja@umass.edu Discussion 3 2/8/2018 Study Jams Leader: Chris Bartoli Tuesday 5:30-6:45pm Elab 325 Wednesday 8:30-9:45pm Elab
More informationComputer Hardware Engineering
2 Course Structure Computer Hardware ngineering IS1200, spring 2016 Lecture 4: The C Programming Language Continued Module 1: C and Assembly Programming L1 L2 L3 L4 Module 4: Processor Design X1 LAB1 S1
More informationComputer Organization and Components
2 Computer Organization and Components Coue Structure Module : C and ssembly Programming IS, fall 2 Lecture 9: LU and s LE LE2 LE LE Module : Processor Design EX LB S LB2 LE9 LE ssistant Research Engineer,
More informationI-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 informationInstruction Set Architectures Part I: From C to MIPS. Readings:
Instruction Set Architectures Part I: From C to MIPS Readings: 2.1-2.14 1 Goals for this Class Understand how CPUs run programs How do we express the computation the CPU? How does the CPU execute it? How
More informationThomas Polzer Institut für Technische Informatik
Thomas Polzer tpolzer@ecs.tuwien.ac.at Institut für Technische Informatik Branch to a labeled instruction if a condition is true Otherwise, continue sequentially beq rs, rt, L1 if (rs == rt) branch to
More informationLevels of Programming. Registers
Levels of Programming COSC 2021: Computer Organization Instructor: Dr. Amir Asif Department of Computer Science York University Handout # 3: MIPS Instruction Set I Topics: 1. Arithmetic Instructions 2.
More informationMIPS R-format Instructions. Representing Instructions. Hexadecimal. R-format Example. MIPS I-format Example. MIPS I-format Instructions
Representing Instructions Instructions are encoded in binary Called machine code MIPS instructions Encoded as 32-bit instruction words Small number of formats encoding operation code (opcode), register
More informationStored Program Concept. Instructions: Characteristics of Instruction Set. Architecture Specification. Example of multiple operands
Stored Program Concept nstructions: nstructions are bits Programs are stored in memory to be read or written just like data Processor Memory memory for data, programs, compilers, editors, etc. Fetch &
More informationCompiling Techniques
Lecture 10: An Introduction to MIPS assembly 18 October 2016 Table of contents 1 Overview 2 3 Assembly program template.data Data segment: constant and variable definitions go here (including statically
More informationArchitecture I. Computer Systems Laboratory Sungkyunkwan University
MIPS Instruction ti Set Architecture I Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Architecture (1) the attributes of a system as seen by the
More informationReduced 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 informationReview. 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 informationEE 361 University of Hawaii Fall
C functions Road Map Computation flow Implementation using MIPS instructions Useful new instructions Addressing modes Stack data structure 1 EE 361 University of Hawaii Implementation of C functions and
More informationECE 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 informationSubroutines. int main() { int i, j; i = 5; j = celtokel(i); i = j; return 0;}
Subroutines Also called procedures or functions Example C code: int main() { int i, j; i = 5; j = celtokel(i); i = j; return 0;} // subroutine converts Celsius to kelvin int celtokel(int i) { return (i
More informationInstructions: Language of the Computer
CS359: Computer Architecture Instructions: Language of the Computer Yanyan Shen Department of Computer Science and Engineering 1 The Language a Computer Understands Word a computer understands: instruction
More informationShift and Rotate Instructions
Shift and Rotate Instructions Shift and rotate instructions facilitate manipulations of data (that is, modifying part of a 32-bit data word). Such operations might include: Re-arrangement of bytes in a
More informationECE331: Hardware Organization and Design
ECE331: Hardware Organization and Design Lecture 15: Midterm 1 Review Adapted from Computer Organization and Design, Patterson & Hennessy, UCB Basics Midterm to cover Book Sections (inclusive) 1.1 1.5
More informationMIPS (SPIM) Assembler Syntax
MIPS (SPIM) Assembler Syntax Comments begin with # Everything from # to the end of the line is ignored Identifiers are a sequence of alphanumeric characters, underbars (_), and dots () that do not begin
More informationDo-While Example. In C++ In assembly language. do { z--; while (a == b); z = b; loop: addi $s2, $s2, -1 beq $s0, $s1, loop or $s2, $s1, $zero
Do-While Example In C++ do { z--; while (a == b); z = b; In assembly language loop: addi $s2, $s2, -1 beq $s0, $s1, loop or $s2, $s1, $zero 25 Comparisons Set on less than (slt) compares its source registers
More informationChapter 4. The Processor. Computer Architecture and IC Design Lab
Chapter 4 The Processor Introduction CPU performance factors CPI Clock Cycle Time Instruction count Determined by ISA and compiler CPI and Cycle time Determined by CPU hardware We will examine two MIPS
More informationReduced 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 informationComputer 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 informationCOMPUTER ORGANIZATION AND DESIGN
COMPUTER ORGANIZATION AND DESIGN 5 th The Hardware/Software Interface Edition Chapter 2 Instructions: Language of the Computer 2.1 Introduction Instruction Set The repertoire of instructions of a computer
More informationCS222: MIPS Instruction Set
CS222: MIPS Instruction Set Dr. A. Sahu Dept of Comp. Sc. & Engg. Indian Institute of Technology Guwahati 1 Outline Previous Introduction to MIPS Instruction Set MIPS Arithmetic's Register Vs Memory, Registers
More informationECE232: 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