Assembly Language. Prof. Dr. Antônio Augusto Fröhlich. Sep 2006
|
|
- Samson Russell
- 5 years ago
- Views:
Transcription
1 Sep 2006 Prof. Antônio Augusto Fröhlich ( 33 Assembly Language Prof. Dr. Antônio Augusto Fröhlich Sep 2006
2 Sep 2006 Prof. Antônio Augusto Fröhlich ( 34 Assembly Language Assembly language, commonly called assembly, asm or symbolic machine code, is a humanreadable notation for the machine language that a specific computer architecture uses. Machine language, a pattern of bits encoding machine operations, is made readable by replacing the raw values with symbols called mnemonics. (Wikipedia)
3 Sep 2006 Prof. Antônio Augusto Fröhlich ( 35 Assembler An assembler creates object code by translating assembly instruction mnemonics into opcodes, and by resolving symbolic names for memory locations and other entities. (David Salomon)
4 Sep 2006 Prof. Antônio Augusto Fröhlich ( 36 Memory Access Program instructions and data are stored in memory Must be brought into the CPU during execution Program instructions are automatically fetched by the CPU Control flow instructions guide the execution flow Data operands for ALU instructions are fetched by explicit instructions in the program Data access instructions
5 Sep 2006 Prof. Antônio Augusto Fröhlich ( 37 CPU Registers General Purpose Registers (GPR) Scratch storage Data Addresses Constants (0/1/ 1) Indexes for data structures Base/segment to segment memory Floating Point Registers (FPR) Floating point data
6 Sep 2006 Prof. Antônio Augusto Fröhlich ( 38 CPU Registers Control registers Program Counter (PC) / Instruction Pointer (IP) Points to the next instruction to be executed Flags ALU flags: carry, overflow, zero, etc Machine control flags: MMU, I/O, etc Stack pointer Top of the stack Frame pointer Return value/pointer
7 Sep 2006 Prof. Antônio Augusto Fröhlich ( 39 Data Addressing Modes Legend 16 bit architecture big endian byte addressed memory involved altered Memory Registers r1 10 r2 2 r3
8 Sep 2006 Prof. Antônio Augusto Fröhlich ( 40 Data Addressing Modes Register Operand stored in a CPU register ALU operations Most used variables Automated by compilers add r1, r2 (r1 < r1 + r2) Memory Registers 10 r r r3
9 Sep 2006 Prof. Antônio Augusto Fröhlich ( 41 Data Addressing Modes Register Operand stored in a CPU register ALU operations Most used variables Automated by compilers add r1, r2 (r1 < r1 + r2) Memory Registers 10 r r r3
10 Sep 2006 Prof. Antônio Augusto Fröhlich ( 42 Data Addressing Modes Immediate Operand encoded along with operation Constants add r1, #10 (r1 < r1 + 10) Memory Registers 10 r r r3
11 Sep 2006 Prof. Antônio Augusto Fröhlich ( 43 Data Addressing Modes Immediate Operand encoded along with operation Constants add r1, #10 (r1 < r1 + 10) Memory Registers 10 r r r3
12 Sep 2006 Prof. Antônio Augusto Fröhlich ( 44 Data Addressing Modes Absolute Operand stored in memory at address Static data (static variables, class attributes) add r1, (r1 < r1 + M[]) Memory Registers 10 r r r3
13 Sep 2006 Prof. Antônio Augusto Fröhlich ( 45 Data Addressing Modes Absolute Operand stored in memory at address Static data (static variables, class attributes) add r1, (r1 < r1 + M[]) Memory Registers 10 r r r3
14 Sep 2006 Prof. Antônio Augusto Fröhlich ( 46 Data Addressing Modes Register Indirect Operand stored in a memory location pointed by a register Pointer deferring add r1, (r3) (r1 < r1 + M[r3]) Memory Registers 10 r r r3
15 Sep 2006 Prof. Antônio Augusto Fröhlich ( 47 Data Addressing Modes Register Indirect Operand stored in a memory location pointed by a register Pointer deferring add r1, (r3) (r1 < r1 + M[r3]) Memory Registers 10 r r r3
16 Sep 2006 Prof. Antônio Augusto Fröhlich ( 48 Data Addressing Modes Register Indirect with Displacement Operand stored in a memory location pointed by a register plus an offset Local variables (reg = frame pointer) add r1, 4(r3) (r1 < r1 + M[r3 + 4]) Memory Registers 10 r r r3
17 Sep 2006 Prof. Antônio Augusto Fröhlich ( 49 Data Addressing Modes Register Indirect with Displacement Operand stored in a memory location pointed by a register plus an offset Local variables (reg = frame pointer) add r1, 4(r3) (r1 < r1 + M[r3 + 4]) Memory Registers 10 r r r3
18 Sep 2006 Prof. Antônio Augusto Fröhlich ( 50 Data Addressing Modes Register Indirect Indexed Operand stored in a memory location pointed by an indexed register Array (reg1 = array, reg2 = index) add r1, (r3, r2) (r1 < r1 + M[r3 + r2]) Memory Registers 10 r r r3
19 Sep 2006 Prof. Antônio Augusto Fröhlich ( 51 Data Addressing Modes Register Indirect Indexed Operand stored in a memory location pointed by an indexed register Array (reg1 = array, reg2 = index) add r1, (r3, r2) (r1 < r1 + M[r3 + r2]) Memory Registers 10 r r r3
20 Sep 2006 Prof. Antônio Augusto Fröhlich ( 52 Data Addressing Modes Register Indirect with Post [Inc Dec]rement Operand stored in a memory location pointed by a register that is post [inc dec]remented Iteration (reg = array, inc = size of element ) add r1, (r3)+ (r1 < r1 + M[r3]; r3 < r3 + s) Memory Registers 10 r r r3
21 Sep 2006 Prof. Antônio Augusto Fröhlich ( 53 Data Addressing Modes Register Indirect with Post [Inc Dec]rement Operand stored in a memory location pointed by a register that is post [inc dec]remented Iteration (reg = array, inc = size of element ) add r1, (r3)+ (r1 < r1 + M[r3]; r3 < r3 + s) Memory Registers 10 r r r3 102
22 Sep 2006 Prof. Antônio Augusto Fröhlich ( 54 Data Addressing Modes Register Indirect with Pre [Inc Dec]rement Operand stored in a memory location pointed by a register that is pre [inc dec]remented Iteration Stack (reg = stack ptr) add r1, (r3) (r3 < r3 s; r1 < r1 + M[r3]) Memory Registers 10 r r r3 102
23 Sep 2006 Prof. Antônio Augusto Fröhlich ( 55 Data Addressing Modes Register Indirect with Pre [Inc Dec]rement Operand stored in a memory location pointed by a register that is pre [inc dec]remented Iteration Stack (reg = stack ptr) add r1, (r3) (r3 < r3 s; r1 < r1 + M[r3]) Memory Registers 10 r r r3
24 Sep 2006 Prof. Antônio Augusto Fröhlich ( 56 Data Addressing Modes Register Indirect Indexed and Scaled Operand stored in a memory location pointed by an indexed and scaled register Array (reg1 = array, reg2 = index, scale = size of element) add r1, (r3, r2, 2) (r1 < r1 + M[r3 + r2 * 2) Memory Registers 10 r r r3
25 Sep 2006 Prof. Antônio Augusto Fröhlich ( 57 Data Addressing Modes Register Indirect Indexed and Scaled Operand stored in a memory location pointed by an indexed and scaled register Array (reg1 = array, reg2 = index, scale = size of element) add r1, (r3, r2, 2) (r1 < r1 + M[r3 + r2 * 2) Memory Registers 10 r r r3
26 Sep 2006 Prof. Antônio Augusto Fröhlich ( 58 Data Addressing Modes Register Indirect with Displacement, Indexed and Scaled Array (dis = offeset, reg1 = array, reg2 = index, scale = size of element) add r1, 2(r3, r2, 2) (r1 < r1 + M[r r2 * 2]) Memory Registers 10 r r r3
27 Sep 2006 Prof. Antônio Augusto Fröhlich ( 59 Data Addressing Modes Register Indirect with Displacement, Indexed and Scaled Array (dis = offeset, reg1 = array, reg2 = index, scale = size of element) add r1, 2(r3, r2, 2) (r1 < r1 + M[r r2 * 2]) Memory Registers 10 r r r3
28 Sep 2006 Prof. Antônio Augusto Fröhlich ( 60 Data Addressing Modes Memory Indirect Operand stored in a memory location pointed by another memory localion Pointer to pointer deferring Call tables add (r1 < r1 + M[M[r3]]) Memory Registers 106 r r r3
29 Sep 2006 Prof. Antônio Augusto Fröhlich ( 61 Data Addressing Modes Memory Indirect Operand stored in a memory location pointed by another memory localion Pointer to pointer deferring Call tables add (r1 < r1 + M[M[r3]]) Memory Registers 106 r r r3
30 Sep 2006 Prof. Antônio Augusto Fröhlich ( 62 Data Addressing Modes Mode Example Meaning Register add r1, r2 r1 < r1 + r2 Immediate add r1, #10 r1 < r Absolute add r1, r1 < r1 + M[] Reg. Ind. Disp. add r1, (r3) r1 < r1 + M[r3] Reg. Ind. Disp. add r1, 4(r3) r1 < r1 + M[r3 + 4] Reg. Ind. Ind. add r1, (r3, r2) r1 < r1 + M[r3 + r2] Reg. Ind. Post add r1, (r3)+ r1 < r1 +M[r3]; r3 < r3 + s Reg. Ind. Pre add r1, (r3) r3 < r3 s; r1 < r1 +M[r3] Reg. Ind. Scal. add r1, (r3, r2, 2) r1 < r1 + M[r3 + r2 * 2] Reg. Ind. Disp. Scal. add r1, 2(r3, r2, 2) r1 < r1 + M[r r2 * 2] Memory Ind. add r1 < r1 + M[M[r3]]
31 Arithmetic and Logical Operations Hugo Marcondes Sep 2006 Sep 2006 Hugo Marcondes ( 1
32 Introduction Logical Operations Boolean Algebra AND, OR, NOR, XOR Shift Operations Shifts Right/Left Rotates Right/Left Arithmetic Operations Sum and Subtraction Multiplication and Division Sep 2006 Hugo Marcondes ( 2
33 Logical Operations Essential for low level programming Device Drivers Data Transmission (Serial/Parallel) Data Codification Cryptography Algorithms Bits are manipulated with bit masks Sep 2006 Hugo Marcondes ( 3
34 Logical Operations AND Function and rd, rs, rt Verify if a bit is set Unset a bit RD RS RT Alternate form andi rd, rs, imm Sep 2006 Hugo Marcondes ( 4
35 Logical Operations OR Function or rd, rs, rt Set a bit Load constants RD RS RT Alternate form ori rd, rs, imm Sep 2006 Hugo Marcondes ( 5
36 Logical Operations Negate OR Function nor rd, rs, rt Detect both zero bits Invert bits (all) RD RS RT Sep 2006 Hugo Marcondes ( 6
37 Logical Operations Exclusive OR Function xor rd, rs, rt Detect positions with different bits Invert bits (mask) RD RS RT Sep 2006 Hugo Marcondes ( 7
38 Logical Operations Left Shift Operations sll rd, rt, shamt Bit level Operations Multiplication and division Serialization / Parallelization [Kjell, 2004] Variable shift sllv rd, rt, rs Sep 2006 Hugo Marcondes ( 8
39 Logical Operations Right Shift Operations srl rd, rt, shamt Bit level Operations Multiplication and division Serialization / Parallelization Variable shift srlv rd, rt, rs Arithmetic shift sra rd, rt, shamt / srav rd, rt, rs [Kjell, 2004] Sep 2006 Hugo Marcondes ( 9
40 Logical Operations Right/Left Rotation Bits aren't discarded Right Rotation High bit moves to low Left Rotation Low bit moves high [Kjell, 2004] Sep 2006 Hugo Marcondes ( 10
41 Arithmetic Operations Sum With or without overflow signaling Can have a immediate operand Subtraction Sum of a negative number Overflow signalization Operation A B RES A + B >= 0 >= 0 < 0 A + B < 0 < 0 >= 0 A B >= 0 < 0 < 0 A B < 0 >= 0 >= 0 Sep 2006 Hugo Marcondes ( 11
42 Arithmetic Operations Comparison Instructions Arithmetical comparison between number Less than, Greater Than, Equal, Not Equal The result of comparison can be in a general purpose register, or specific ones Intel: Flags register MIPS Set on Less Than slt rd, rs, rt / sltu rd, rs, rt slti rd, rs, imm / sltiu rd, rs, imm Pseudo instructions for other modes Sep 2006 Hugo Marcondes ( 12
43 Arithmetic Operation Multiplication Product of two N bits number is 2N bits 10 x x Sep 2006 Hugo Marcondes ( 13
44 Arithmetic Operation Result are stored on a double word register MIPS has HI and LO register Accessed mflo rd and mfhi rd instructions mult rs, rt and multu rs, rt HI 32 LO 32 < rs * rt Unsigned Multiplication Overflow don't occur Signed Multiplication Equal signs: positive result Can produce overflow MIPS need overflow detection on software Sep 2006 Hugo Marcondes ( 14
45 Arithmetic Operation Division div rs, rt and divu rs, rt LO < Quotient (rs/rt), HI < Remainder Mathematical Properties Don't generate overflow Raises a Zero Division exception Result is always unsigned Sep 2006 Hugo Marcondes ( 15
46 System Programming Flow Control Hugo Marcondes Sep 2006 Sep 2006 Hugo Marcondes ( 1
47 Introduction The power of computers is their ability to repeat actions and their ability to alter their operation depending on data Bradley Kjell Instruction Addressing Modes Branchs Conditional Unconditional Long Branch Jump Call Sep 2006 Hugo Marcondes ( 2
48 Instruction Addressing Modes Branch to an absolute address Concatenates imm with high bits of PC to complete address Calling near functions Absolute jump imm [n] PC < PC [w,n] : imm [n] w > word High Bit n > imm High Bit Memory Registers 0x PC 0x x x IMM 0x rs 9 0x Sep 2006 Hugo Marcondes ( 3
49 Instruction Addressing Modes Branch to an absolute address Concatenates imm with high bits of PC to complete address Calling near functions Absolute jump imm [n] PC < PC [w,n] : imm [n] w > word High Bit n > imm High Bit Memory Registers 0x PC 0x x x IMM 0x rs 9 0x Sep 2006 Hugo Marcondes ( 4
50 Instruction Addressing Modes Branch to a relative address Sum imm with the PC Usually imm is signed Code can be easily relocated Local Branch Relative Address branch imm PC < PC + imm Memory Registers 0x PC 0x x x x IMM 0x rs 9 Sep 2006 Hugo Marcondes ( 5
51 Instruction Addressing Modes Branch to a relative address Sum imm with the PC Usually imm is signed Code can be easily relocated Local Branch Relative Address branch imm PC < PC + imm Memory Registers 0x PC 0x x x x IMM 0x rs 9 Sep 2006 Hugo Marcondes ( 6
52 Instruction Addressing Modes Branch to an absolute address Contents of rs are transferred to PC Long Branch Register Indirect jump rs PC < rs Memory Registers 0x PC 0x x xC000000C IMM 0x rs 0xC xC Sep 2006 Hugo Marcondes ( 7
53 Instruction Addressing Modes Branch to an absolute address Contents of rs are transferred to PC Long Branch Register Indirect jump rs PC < rs Memory Registers 0x PC 0xC x xC000000C IMM 0x rs 0xC xC Sep 2006 Hugo Marcondes ( 8
54 Branch Instructions Instructions used with address modes to change the execution flow of a program Conditional Branchs usually associated with Relative Addressing Mode Have a condition associated with the branch Comparison instructions/registers to express the condition Unconditional Branch Usually have all addressing mode forms Always change the execution flow Used in local context or for function call Sep 2006 Hugo Marcondes ( 9
55 Conditional Branch Condition expressed in the instruction beq rs, rt, LABEL (Branch Equal) PC < PC + LABEL, if rs == rt bne rs, rt, LABEL (Branch Not Equal) PC < PC + LABEL, if rs!= rt Condition resolved before the branch instruction slt rd, rs, rt (Set On Less Than) rd < 1, if rs < rt rd < 0, otherwise Used in conjunction with beq / bne Sep 2006 Hugo Marcondes ( 10
56 Unconditional Branch Are not associated with a condition b LABEL (Branch to LABEL Relative Address) PC < PC + LABEL j ADDR (Jump to ADDR Absolute Address) PC < PC : ADDR jr rs (Jump Register Register Indirect) PC < rs Sep 2006 Hugo Marcondes ( 11
57 Calls Branch the execution flow, but saves the return address The return address could be saved in stack or in a specific purpose register jal LABEL (Jump and Link Relative Address) RA < PC + 4 ; PC < PC : LABEL jalr rs (Jump and Link Register Register Indirect) RA < PC + 4 ; PC < RS Sep 2006 Hugo Marcondes ( 12
58 Programming Structures Exercise Write the assembler code that maps the following programming structure if ( a == 0 ) { // Block 1 } else { // Block 2 } while (a > 0) { //Block 3 a = a - 1; } Sep 2006 Hugo Marcondes ( 13
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 informationMark 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 informationComputer 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 informationMIPS 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 informationThe 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 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 informationEEM 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 informationComputer 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 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 informationExamples of branch instructions
Examples of branch instructions Beq rs,rt,target #go to target if rs = rt Beqz rs, target #go to target if rs = 0 Bne rs,rt,target #go to target if rs!= rt Bltz rs, target #go to target if rs < 0 etc.
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 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 informationMIPS 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 informationFlow of Control -- Conditional branch instructions
Flow of Control -- Conditional branch instructions You can compare directly Equality or inequality of two registers One register with 0 (>,
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 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 information101 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 informationMIPS 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 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 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 informationM2 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 informationArithmetic for Computers
MIPS Arithmetic Instructions Cptr280 Dr Curtis Nelson Arithmetic for Computers Operations on integers Addition and subtraction; Multiplication and division; Dealing with overflow; Signed vs. unsigned numbers.
More informationOverview. 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 informationTSK3000A - 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 informationF. 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 informationECE 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 informationCS3350B 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 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 informationAssembly 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 informationWeek 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 informationMips 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 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 informationCPS311 - COMPUTER ORGANIZATION. A bit of history
CPS311 - COMPUTER ORGANIZATION A Brief Introduction to the MIPS Architecture A bit of history The MIPS architecture grows out of an early 1980's research project at Stanford University. In 1984, MIPS computer
More informationMIPS 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 informationEE 109 Unit 13 MIPS Instruction Set. Instruction Set Architecture (ISA) Components of an ISA INSTRUCTION SET OVERVIEW
1 2 EE 109 Unit 13 MIPS Instruction Set Architecting a vocabulary for the HW INSTRUCTION SET OVERVIEW 3 4 Instruction Set Architecture (ISA) Defines the of the processor and memory system Instruction set
More informationMark Redekopp, All rights reserved. EE 352 Unit 3 MIPS ISA
EE 352 Unit 3 MIPS ISA Instruction Set Architecture (ISA) Defines the software interface of the processor and memory system Instruction set is the vocabulary the HW can understand and the SW is composed
More informationReview: 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 informationECE260: 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 informationUnsigned 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 informationUnsigned 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 informationMACHINE 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 informationEE 109 Unit 8 MIPS Instruction Set
1 EE 109 Unit 8 MIPS Instruction Set 2 Architecting a vocabulary for the HW INSTRUCTION SET OVERVIEW 3 Instruction Set Architecture (ISA) Defines the software interface of the processor and memory system
More informationCS2214 COMPUTER ARCHITECTURE & ORGANIZATION SPRING 2014
B CS2214 COMPUTER ARCHITECTURE & ORGANIZATION SPRING 2014 DUE : March 3, 2014 READ : - Related sections of Chapter 2 - Related sections of Chapter 3 - Related sections of Appendix A - Related sections
More informationSPIM Instruction Set
SPIM Instruction Set This document gives an overview of the more common instructions used in the SPIM simulator. Overview The SPIM simulator implements the full MIPS instruction set, as well as a large
More informationECE260: 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 informationECE468 Computer Organization & Architecture. MIPS Instruction Set Architecture
ECE468 Computer Organization & Architecture MIPS Instruction Set Architecture ECE468 Lec4.1 MIPS R2000 / R3000 Registers 32-bit machine --> Programmable storage 2^32 x bytes 31 x 32-bit GPRs (R0 = 0) 32
More informationOutline. 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 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 informationNumber Systems and Their Representations
Number Representations Cptr280 Dr Curtis Nelson Number Systems and Their Representations In this presentation you will learn about: Representation of numbers in computers; Signed vs. unsigned numbers;
More informationECE232: Hardware Organization and Design
ECE232: Hardware Organization and Design Lecture 4: Logic Operations and Introduction to Conditionals Adapted from Computer Organization and Design, Patterson & Hennessy, UCB Overview Previously examined
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 informationConcocting 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 informationInstruction 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 informationA 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 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 informationQ1: /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 informationProgramming 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 informationECE 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 informationINSTRUCTION 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 informationConcocting 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.6 L04 Instruction Set 1 A General-Purpose Computer The von
More informationECE 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 informationECE 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 informationECE 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 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 informationMIPS 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 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 informationToday 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 informationA 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 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 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 informationECE 2035 Programming HW/SW Systems Spring problems, 6 pages Exam Three 10 April 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 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 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 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 informationInstruction 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 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 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 informationece4750-parc-isa.txt
========================================================================== PARC Instruction Set Architecture ========================================================================== # Author : Christopher
More informationAnne 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 informationECE 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 informationECE 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 informationECE 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 informationTailoring the 32-Bit ALU to MIPS
Tailoring the 32-Bit ALU to MIPS MIPS ALU extensions Overflow detection: Carry into MSB XOR Carry out of MSB Branch instructions Shift instructions Slt instruction Immediate instructions ALU performance
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 informationISA and RISCV. CASS 2018 Lavanya Ramapantulu
ISA and RISCV CASS 2018 Lavanya Ramapantulu Program Program =?? Algorithm + Data Structures Niklaus Wirth Program (Abstraction) of processor/hardware that executes 3-Jul-18 CASS18 - ISA and RISCV 2 Program
More informationCMPE324 Computer Architecture Lecture 2
CMPE324 Computer Architecture Lecture 2.1 What is Computer Architecture? Software Hardware Application (Netscape) Operating System Compiler (Unix; Assembler Windows 9x) Processor Memory Datapath & Control
More informationLAB B Translating Code to Assembly
LAB B Translating Code to Assembly Perform the following groups of tasks: LabB1.s 1. Create a directory to hold the files for this lab. 2. Create and run the Java app below. We seek to translate it to
More informationCS 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 informationCS 61c: Great Ideas in Computer Architecture
MIPS Functions July 1, 2014 Review I RISC Design Principles Smaller is faster: 32 registers, fewer instructions Keep it simple: rigid syntax, fixed instruction length MIPS Registers: $s0-$s7,$t0-$t9, $0
More informationCO Computer Architecture and Programming Languages CAPL. Lecture 13 & 14
CO20-320241 Computer Architecture and Programming Languages CAPL Lecture 13 & 14 Dr. Kinga Lipskoch Fall 2017 Frame Pointer (1) The stack is also used to store variables that are local to function, but
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 informationQuestion 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 informationProcessor. 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 informationece4750-tinyrv-isa.txt
========================================================================== Tiny RISC-V Instruction Set Architecture ========================================================================== # Author :
More informationMidterm. Sticker winners: if you got >= 50 / 67
CSC258 Week 8 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.
More informationMIPS Assembly Language
MIPS Assembly Language Chapter 15 S. Dandamudi Outline MIPS architecture Registers Addressing modes MIPS instruction set Instruction format Data transfer instructions Arithmetic instructions Logical/shift/rotate/compare
More informationAnne 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 informationMIPS Integer ALU Requirements
MIPS Integer ALU Requirements Add, AddU, Sub, SubU, AddI, AddIU: 2 s complement adder/sub with overflow detection. And, Or, Andi, Ori, Xor, Xori, Nor: Logical AND, logical OR, XOR, nor. SLTI, SLTIU (set
More informationEE108B 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 informationMidterm. CS64 Spring Midterm Exam
Midterm LAST NAME FIRST NAME PERM Number Instructions Please turn off all pagers, cell phones and beepers. Remove all hats & headphones. Place your backpacks, laptops and jackets at the front. Sit in every
More information