Assembly Language Programming

Size: px
Start display at page:

Download "Assembly Language Programming"

Transcription

1 Assembly Language Programming Assemblers were the first programs to assist in programming. The idea of the assembler is simple: represent each computer instruction with an acronym (group of letters). Eg: add for the computer add instruction. The programmer writes programs using the acronyms. The assembler converts acronyms binary codes that the computer recognizes as instructions. Since most computer instructions are complex combinations of bits (as we will see in the next lecture), assembler programming is easier. Assemblers were succeeded by compilers, which are much more sophisticated programming tools. A compiler instruction can represent many computer instructions. 1

2 Why Learn Assembly Language? Compilers ease the program development load. However, compilers remove the visibility of computer operation. Assembly language programs gives a better feel for computer operation. Learning assembly language helps understand basics of computer design. Some programs need assembly language precision. 2 Compile Assemble Link or link edit Load Write program in compiler language Resulting assembly language program (or write program in assembly language) Object code, or machine language module, with relative memory references We will not do this step in EE 2310 Object code or machine language with library functions or macros Machine instructions loaded in computer; absolute memory references We will do these steps in EE 2310

3 The MIPS Computer and SPIM We will study SPIM, the assembly language of the MIPS computer. The MIPS computer was developed by Patterson and Hennessey, who wrote our textbook. The design dates from the 1980 s. There were several MIPS models. The architecture was very influential many electronic game systems today employ a descendant of the original MIPS. We will study the first MIPS model, the 32-bit MIPS R The assembler/simulator for the MIPS R-2000 is called SPIM. We will program using the SPIM assembler/emulator, which can run on your laptop or home computer (the R-2000 no longer exists). Class instructions will primarily refer to QtSPIM, the PC SPIM assembler/simulator. SPIM is also available for Mac and Unix. 3

4 4 How Does an Assembler Work? An assembler is a program that aids programming. It is much simpler than a compiler. In an assembler, 1 acronym = 1 instruction. Example: Add = Take the contents of 2 registers, add them together, and put the result (sum) in another register. The program is written in assembly language, a sequence of acronyms which represent instructions: The assembler converts assembly language instructions into patterns of binary numbers that make up the 32-bit instruction. Registers ID s are converted to binary numbers that are also inserted into appropriate fields in the 32-bit instruction. The final 32-bit instruction consists of fields of binary numbers, each of which represents part of the instruction.

5 Assembler Process Diagram Instruction: add $t5,$t0,$t1 Begin add instruction process. Insert in bits 26-31, since all arithmetic instructions have a 0 op code. Op Code ID the arithmetic/ logic function and insert 6-bit binary # into function code field. ID destination reg. and input 5-bit # into Rd field. ID first source reg. and input 5-bit # into Rs field. Rs Rt Rd Sh Amt ID second source reg. and input 5-bit # into Rd field. Fn Code Bit 0 Bit 31 The function code is the arithmetic/ logical function to be performed. Example: Function code [0x20] means add. 5

6 SPIM Register-Register Instructions Today, we will study a few instructions that allow us to write a simple program. We will also check the SPIM set up on your computer. Register-to-register instructions are the MIPS instructions that do all the calculations and data manipulations. Register-to-register instructions are usually of the form: Operation_Dest. Reg.,Source Reg.,2nd Source Reg. For example: add $t2,$t0,$t1 Real computer instruction:

7 Register-Register Instruction Process Register Block ALU processes instruction ALU 7

8 Registers There are 32 registers in the MIPS computer. Remember that registers are just collections of D flip-flops. The number of register bits (width) depends on the computer. The MIPS R-2000 computer has 32-bit data words, so each register has 32 flip-flops. The MIPS computer has 32 fixed-point (whole number) registers. There are rules (actually suggestions or policies) for register use. The rules may be violated; the assembler has no Register Police. However, to do so is very bad practice. In EE 2310, you must use registers as recommended in the rules. 8

9 9 The University of Texas at Dallas MIPS Special-Purpose Registers These registers are generally used only for the purposes noted: Registers Name or Value Purpose $0 Always = 0 Comparisons; clearing registers $1 $at Assembler temporary register1 $2 $v0 Value to be passed to function2 $3 $v1 Value to be passed to function $4 $a0 Argument passing to procedures3 $5 $a1 Argument passing to procedures4,5 $6 $a2 Argument passing to procedures4 $7 $a3 Argument passing to procedures4 In MIPS, the dollar sign ( $ ) signifies register. 1 Don t ever use this register! 2 Used in all system calls to load the syscall number; also specifically used in syscalls 5 & 12 for input data. 3 Specifically used in syscalls 1, 4, 8, and Argument passing past a total of four uses the stack. 5 Also used in syscall 8.

10 Special-Purpose Registers (2) These registers are also generally used only for the purposes noted. Register Name Purpose $26 $k0 Reserved for use by operating system. 1 $27 $k1 Reserved for use by operating system. 1 $28 $gp Pointer to global area2 $29 $sp Points to current top of stack $30 $fp Points to current top of frame $31 $ra Return address to exit procedure 1 Don t ever use these registers! 2 We will not use this register. 10

11 MIPS Temporary Registers The t-registers hold data in programs. Use as you wish. Register Name Purpose $8 $t0 Holds a local (temp) variable $9 $t1 Holds a local (temp) variable $10 $t2 Holds a local (temp) variable $11 $t3 Holds a local (temp) variable $12 $t4 Holds a local (temp) variable $13 $t5 Holds a local (temp) variable $14 $t6 Holds a local (temp) variable $15 $t7 Holds a local (temp) variable $24 $t8 Holds a local (temp) variable $25 $t9 Holds a local (temp) variable NOTE: Think of t-registers as scratchpad registers. 11

12 MIPS Saved Temporary Registers S-registers also hold data in programs. In general, use as you wish. Some restrictions on s registers will be discussed later. Register Name Purpose $16 $s0 Holds a saved temporary variable $17 $s1 Holds a saved temporary variable $18 $s2 Holds a saved temporary variable $19 $s3 Holds a saved temporary variable $20 $s4 Holds a saved temporary variable $21 $s5 Holds a saved temporary variable $22 $s6 Holds a saved temporary variable $23 $s7 Holds a saved temporary variable 12

13 Register-Register Instructions: Add The format of add is: add_rd,rs,rt. The contents of registers rs and rt (the source registers ) are added, and the result is put in rd. Examples: add $s1, $t2, $t6: [$t2] + [$t6] [$s1]. add $t7, $t3, $s4: [$t3] + [$s4] [$t7]. [ ] = Contents of $ = Register In addi, the second source is an immediate, i.e., a number coded in the instruction.* Examples: addi $s1, $t2, 27: [$t2] + 27 [$s1]. addi $t7, $t3, 0x15: [$t3] + 0x15 [$t7]. Adding the u at the end (i.e., addu or addiu) simply instructs the computer to ignore overflow indication. 13 * Immediates may be any size up to 32-bits (that is ~ ± 2,000,000,000).

14 Subtract Subtract has exactly the same form as add: sub rd, rs, rt. Examples: sub $t3, $t4, $t5: [$t4] [$t5] [$t3]. sub $s3, $s6, $t0: [$s6] [$t0] [$s3]. Although there is not a formal subi, a coded number in the instruction can be substituted for rt. Thus: sub $t3, $t4, 67: [$t4] 67 [$t3]. sub $s3, $s6, 0xdf8: [$s6] 0xdf8 [$s3]. Like addu, subu prevents an overflow indication from being given when the instruction is executed, if overflow occurs. 14

15 Multiply/Divide Multiply and divide are real MIPS instructions, but SPIM makes them into pseudo instructions in the way that it handles the product and quotient results. We will discuss the details of this later. Multiply is written as mul $rd,$rs,$rt. An example: mul $t2, $t0, $t1 Similarly, divide is written as: div $t4,$t2,$t3 Note that the form of multiply and divide is identical to that for add and subtract. 15

16 Logical Instructions Logical instructions perform logic functions on the arguments on which they operate. For example: and $t0, $t1, $t2: [$t1] [$t2] [$t0]. Logical operations include AND, OR, NOT, NOR, and XOR. Logical instructions are performed on the arguments on a bitwise basis, as shown below (and $t0,$t1,$t2). [$t1] [$t2] [$t0] Thus in the above example, bit 0 of register t1 is ANDed with bit 0 of register t2 and the result stored in bit 0 of $t0; bit 1 of $t1 is ANDed with bit 1 of $t2, and the result stored in bit 1 of $t0, etc. 16

17 Logical Instructions (2) AND function: and $s0, $t3, $t4: [$t3] [$t4] [$s0], on a bitwise basis. OR is performed likewise: or $s0, $t3, $t4: [$t3]+[$t4] [$s0], on a bitwise basis. andi/ori These instructions are similar to addi, thus: ori $t4, $t5, 0x0ff1: [$t5] + 0xff1 [$t4], on a bitwise basis. andi $t4, $t5, 587: [$t5 ] 587 [$t4], on a bitwise basis. NOR and XOR are functionally identical to AND and OR. nor $t1, $t2, $t6: [$t2] + [$t6] [$t1], on a bitwise basis. xor $s1, $s2, $s3: [$s2] [$s3] [$s1], on a bitwise basis. NOT is a simpler instruction, with only one operand: not $t7, $s5: [$s5] [$t7], on a bitwise basis. 17

18 18 The University of Texas at Dallas Other Register-Register Instructions Load immediate: li $rd, #: load immediate. Load immediate allows a constant whole number to be loaded into a register. Note: li is a pseudo instruction in some cases. This will be covered later. li $t0, 2405 the number 2405 is loaded into register $t0. li $s4,16523 the number 16,523 is loaded into register $s4. move: move transfers the contents of one register to another. Example: move $s5, $t3: [$t3] [$s5] ($t3 contents are not changed). move is also a pseudo instruction. The ONLY way to transfer data from one register to another is via move! NOT load, NOT load immediate!

19 Putting SPIM on Your Computer The most up-to-date version of the SPIM simulator is maintained by James Larus, formerly of the University of Wisconsin at Madison. It is freeware, and is maintained by a web site called SourceForge. Go to the SourceForge website: You will see the choice of a number of SPIM downloads. Select: QtSpim_9.1.16_Windows.exe and click on that link. There are Linux and Mac versions as well. Follow instructions to load onto your computer (next page). Note that this used to be a zip file, but as far as I can tell, it no longer is it is simply a binary file. 19

20 James Larus Version of SPIM (2) 20 The download software will ask if you want to open or save. Click save, and save it as a download file. Note that the file is an exe file. At 34 Mbytes, the download takes a bit even on 3G or broadband. Open the download file and it will begin to install. The program will ask to create a folder: C:/Program Files/QtSpim. Click OK and the file folder will be created. Note: All of the programs you create will be saved to this file. The setup program will also install a QtSpim.exe icon on your desktop. Once QtSpim is created, you may open it to see if you get the register, text, and data windows. If you do, it is correctly installed.

21 Two Other Things You Need to Know 21 Directives are special instructions that tell the assembler important information. We will study most of them later. All programs are started with the.text directive. When programming, put only one SPIM instruction per line. The first line of a program must be labeled main:. That is, the first instruction in the program has the label main: to its left, e.g.: main:.text li $t3,356 li $t7,44 add $t2,$t7,$t3 etc., The last instruction in a program is system call 10 ( stop! ). li $v0,10 syscall

22 How to Construct and Run a Program in SPIM Write the program in NotePad. Save it in the SPIM file folder. To execute the program: Open QtSPIM. In QtSPIM, open your NotePad program as a file ( Load file ). You may not see the program in the open file list, until you select All Files in the program file type select window. After selecting the program, it will assemble automatically, link, and load. Mouse click on Simulator tab. Select Run/Continue. The program should immediately run. Instead of running the program, you can single step using F10. Debug is simple; for program errors (lines that will not properly assemble), SPIM merely stops with a note indicating the line that failed (more on next slide). 22

23 Fixing Program Bugs 1. Launch QtSpim or PCSPIM and open your program. 2. It will assemble until encountering an error, then stop. The assembler will indicate a line where the error exists. 2. Open the text editor, edit the offending instruction, and re-save. 3. Restart SPIM and reopen the program. The program will assemble until another error is encountered. 4. If another error is encountered, repeat above procedure. 5. If the program assembles, it will show up in the text window, and no error message will appear. 6. Click Go (under Simulator tab) and click OK to run, per previous slide. 7. If your program writes to the console, check it for desired result. 8. Next, you can single step the program to watch instructions execute if you wish. 23

24 Program 1 Write a program on your computer to do the following: Enter 47 into $t0 ( x ) Put 253 into $t1 ( y ) Load 23 in $t2 ( z ) Compute x 2 + 3y + 10z Store the result in $t3 Stop the program by using system call 10. What is the number in $t3? 24 Remember: $ = register.

25 Program 2 Write a program to do the following: Load 25 in $t4 and 126 into $t7. Add the contents of registers $t4 and $t7, storing in $t3. AND this result with $t4, storing in $s2. Multiply $s2 by the contents of $t7, storing in $t9. Also store the result in $t9 in $s5 and $s7. Use syscall 10 to end the program. What is the value of the number in $s7 (state in hex)? 26

26 Program 3 Write a program to solve the equation: w = 4x 2 +8y+z. Variable x is 0x123, y is 0x12b7, and z is 0x34af7. Use $t0 for x, $t1 for y, and $t2 for z. Remember to start your program with.text and label the first instruction as main:. Store w in $s0 and end your program with syscall 10. What is the value of w in hex? 28

Installing QtSPIM on Your Laptop

Installing QtSPIM on Your Laptop Installing QtSPIM on Your Laptop Our assembly language programming classes will be interactive, using the QtSPIM assembler and emulator, which students can install on their laptops. The most up-to-date

More information

Introduction to MIPS Assembly Programming

Introduction to MIPS Assembly Programming 1 / 26 Introduction to MIPS Assembly Programming January 23 25, 2013 2 / 26 Outline Overview of assembly programming MARS tutorial MIPS assembly syntax Role of pseudocode Some simple instructions Integer

More information

MIPS Assembly Code Layout

MIPS Assembly Code Layout Learning MIPS & SPIM MIPS assembly is a low-level programming language The best way to learn any programming language is to write code We will get you started by going through a few example programs and

More information

Syscall 5. Erik Jonsson School of Engineering and Computer Science. The University of Texas at Dallas

Syscall 5. Erik Jonsson School of Engineering and Computer Science. The University of Texas at Dallas Syscall 5 System call 5 allows input of numerical data from the keyboard while a program is running. Syscall 5 is a bit unusual, in that it requires the use of register $v0 twice. In syscall 5 (as for

More information

Figure 1: Graphical example of a mergesort 1.

Figure 1: Graphical example of a mergesort 1. CSE 30321 Computer Architecture I Fall 2011 Lab 02: Procedure Calls in MIPS Assembly Programming and Performance Total Points: 100 points due to its complexity, this lab will weight more heavily in your

More information

PCSpim Tutorial. Nathan Goulding-Hotta 2012-01-13 v0.1

PCSpim Tutorial. Nathan Goulding-Hotta 2012-01-13 v0.1 PCSpim Tutorial Nathan Goulding-Hotta 2012-01-13 v0.1 Download and install 1. Download PCSpim (file PCSpim_9.1.4.zip ) from http://sourceforge.net/projects/spimsimulator/files/ This tutorial assumes you

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

COMP 303 MIPS Processor Design Project 4: MIPS Processor Due Date: 11 December 2009 23:59

COMP 303 MIPS Processor Design Project 4: MIPS Processor Due Date: 11 December 2009 23:59 COMP 303 MIPS Processor Design Project 4: MIPS Processor Due Date: 11 December 2009 23:59 Overview: In the first projects for COMP 303, you will design and implement a subset of the MIPS32 architecture

More information

Instruction Set Architecture

Instruction Set Architecture Instruction Set Architecture Consider x := y+z. (x, y, z are memory variables) 1-address instructions 2-address instructions LOAD y (r :=y) ADD y,z (y := y+z) ADD z (r:=r+z) MOVE x,y (x := y) STORE x (x:=r)

More information

Typy danych. Data types: Literals:

Typy danych. Data types: Literals: Lab 10 MIPS32 Typy danych Data types: Instructions are all 32 bits byte(8 bits), halfword (2 bytes), word (4 bytes) a character requires 1 byte of storage an integer requires 1 word (4 bytes) of storage

More information

Stack machines The MIPS assembly language A simple source language Stack-machine implementation of the simple language Readings: 9.1-9.

Stack machines The MIPS assembly language A simple source language Stack-machine implementation of the simple language Readings: 9.1-9. Code Generation I Stack machines The MIPS assembly language A simple source language Stack-machine implementation of the simple language Readings: 9.1-9.7 Stack Machines A simple evaluation model No variables

More information

Winter 2002 MID-SESSION TEST Friday, March 1 6:30 to 8:00pm

Winter 2002 MID-SESSION TEST Friday, March 1 6:30 to 8:00pm University of Calgary Department of Electrical and Computer Engineering ENCM 369: Computer Organization Instructors: Dr. S. A. Norman (L01) and Dr. S. Yanushkevich (L02) Winter 2002 MID-SESSION TEST Friday,

More information

Review: MIPS Addressing Modes/Instruction Formats

Review: MIPS Addressing Modes/Instruction Formats Review: Addressing Modes Addressing mode Example Meaning Register Add R4,R3 R4 R4+R3 Immediate Add R4,#3 R4 R4+3 Displacement Add R4,1(R1) R4 R4+Mem[1+R1] Register indirect Add R4,(R1) R4 R4+Mem[R1] Indexed

More information

M A S S A C H U S E T T S I N S T I T U T E O F T E C H N O L O G Y DEPARTMENT OF ELECTRICAL ENGINEERING AND COMPUTER SCIENCE

M A S S A C H U S E T T S I N S T I T U T E O F T E C H N O L O G Y DEPARTMENT OF ELECTRICAL ENGINEERING AND COMPUTER SCIENCE M A S S A C H U S E T T S I N S T I T U T E O F T E C H N O L O G Y DEPARTMENT OF ELECTRICAL ENGINEERING AND COMPUTER SCIENCE 1. Introduction 6.004 Computation Structures β Documentation This handout is

More information

Lecture Outline. Stack machines The MIPS assembly language. Code Generation (I)

Lecture Outline. Stack machines The MIPS assembly language. Code Generation (I) Lecture Outline Code Generation (I) Stack machines The MIPS assembl language Adapted from Lectures b Profs. Ale Aiken and George Necula (UCB) A simple source language Stack- machine implementation of the

More information

Introduction to MIPS Programming with Mars

Introduction to MIPS Programming with Mars Introduction to MIPS Programming with Mars This week s lab will parallel last week s lab. During the lab period, we want you to follow the instructions in this handout that lead you through the process

More information

Central Processing Unit Simulation Version v2.5 (July 2005) Charles André University Nice-Sophia Antipolis

Central Processing Unit Simulation Version v2.5 (July 2005) Charles André University Nice-Sophia Antipolis Central Processing Unit Simulation Version v2.5 (July 2005) Charles André University Nice-Sophia Antipolis 1 1 Table of Contents 1 Table of Contents... 3 2 Overview... 5 3 Installation... 7 4 The CPU

More information

Lab Work 2. MIPS assembly and introduction to PCSpim

Lab Work 2. MIPS assembly and introduction to PCSpim Lab Work 2. MIPS assembly and introduction to PCSpim The goal of this work is for the student to become familiar with the data types and the programming in assembly (MIPS32). To realize this lab work you

More information

Outline. hardware components programming environments. installing Python executing Python code. decimal and binary notations running Sage

Outline. hardware components programming environments. installing Python executing Python code. decimal and binary notations running Sage Outline 1 Computer Architecture hardware components programming environments 2 Getting Started with Python installing Python executing Python code 3 Number Systems decimal and binary notations running

More information

1 Classical Universal Computer 3

1 Classical Universal Computer 3 Chapter 6: Machine Language and Assembler Christian Jacob 1 Classical Universal Computer 3 1.1 Von Neumann Architecture 3 1.2 CPU and RAM 5 1.3 Arithmetic Logical Unit (ALU) 6 1.4 Arithmetic Logical Unit

More information

QUICK START GUIDE. SG2 Client - Programming Software SG2 Series Programmable Logic Relay

QUICK START GUIDE. SG2 Client - Programming Software SG2 Series Programmable Logic Relay QUICK START GUIDE SG2 Client - Programming Software SG2 Series Programmable Logic Relay SG2 Client Programming Software T he SG2 Client software is the program editor for the SG2 Series Programmable Logic

More information

Instructions for Importing (migrating) Data

Instructions for Importing (migrating) Data Instructions for Importing (migrating) Data from CTAS Version 7 to CTAS Version 8 For Windows 8 and 8.1 CTAS Version 8 is designed to work with your Version 7 data if you choose to. These instructions

More information

A single register, called the accumulator, stores the. operand before the operation, and stores the result. Add y # add y from memory to the acc

A single register, called the accumulator, stores the. operand before the operation, and stores the result. Add y # add y from memory to the acc Other architectures Example. Accumulator-based machines A single register, called the accumulator, stores the operand before the operation, and stores the result after the operation. Load x # into acc

More information

Instruction Set Architecture. or How to talk to computers if you aren t in Star Trek

Instruction Set Architecture. or How to talk to computers if you aren t in Star Trek Instruction Set Architecture or How to talk to computers if you aren t in Star Trek The Instruction Set Architecture Application Compiler Instr. Set Proc. Operating System I/O system Instruction Set Architecture

More information

More MIPS: Recursion. Computer Science 104 Lecture 9

More MIPS: Recursion. Computer Science 104 Lecture 9 More MIPS: Recursion Computer Science 104 Lecture 9 Admin Homework Homework 1: graded. 50% As, 27% Bs Homework 2: Due Wed Midterm 1 This Wed 1 page of notes 2 Last time What did we do last time? 3 Last

More information

Solution: start more than one instruction in the same clock cycle CPI < 1 (or IPC > 1, Instructions per Cycle) Two approaches:

Solution: start more than one instruction in the same clock cycle CPI < 1 (or IPC > 1, Instructions per Cycle) Two approaches: Multiple-Issue Processors Pipelining can achieve CPI close to 1 Mechanisms for handling hazards Static or dynamic scheduling Static or dynamic branch handling Increase in transistor counts (Moore s Law):

More information

1. Convert the following base 10 numbers into 8-bit 2 s complement notation 0, -1, -12

1. Convert the following base 10 numbers into 8-bit 2 s complement notation 0, -1, -12 C5 Solutions 1. Convert the following base 10 numbers into 8-bit 2 s complement notation 0, -1, -12 To Compute 0 0 = 00000000 To Compute 1 Step 1. Convert 1 to binary 00000001 Step 2. Flip the bits 11111110

More information

Lecture 8: Binary Multiplication & Division

Lecture 8: Binary Multiplication & Division Lecture 8: Binary Multiplication & Division Today s topics: Addition/Subtraction Multiplication Division Reminder: get started early on assignment 3 1 2 s Complement Signed Numbers two = 0 ten 0001 two

More information

Let s put together a Manual Processor

Let s put together a Manual Processor Lecture 14 Let s put together a Manual Processor Hardware Lecture 14 Slide 1 The processor Inside every computer there is at least one processor which can take an instruction, some operands and produce

More information

Advanced Computer Architecture-CS501. Computer Systems Design and Architecture 2.1, 2.2, 3.2

Advanced Computer Architecture-CS501. Computer Systems Design and Architecture 2.1, 2.2, 3.2 Lecture Handout Computer Architecture Lecture No. 2 Reading Material Vincent P. Heuring&Harry F. Jordan Chapter 2,Chapter3 Computer Systems Design and Architecture 2.1, 2.2, 3.2 Summary 1) A taxonomy of

More information

Computer Science 281 Binary and Hexadecimal Review

Computer Science 281 Binary and Hexadecimal Review Computer Science 281 Binary and Hexadecimal Review 1 The Binary Number System Computers store everything, both instructions and data, by using many, many transistors, each of which can be in one of two

More information

Fall 2006 CS/ECE 333 Lab 1 Programming in SRC Assembly

Fall 2006 CS/ECE 333 Lab 1 Programming in SRC Assembly Lab Objectives: Fall 2006 CS/ECE 333 Lab 1 Programming in SRC Assembly 1. How to assemble an assembly language program for the SRC using the SRC assembler. 2. How to simulate and debug programs using the

More information

Exceptions in MIPS. know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine

Exceptions in MIPS. know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine 7 Objectives After completing this lab you will: know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine Introduction Branches and jumps provide ways to change

More information

Computer Architecture Lecture 2: Instruction Set Principles (Appendix A) Chih Wei Liu 劉 志 尉 National Chiao Tung University [email protected].

Computer Architecture Lecture 2: Instruction Set Principles (Appendix A) Chih Wei Liu 劉 志 尉 National Chiao Tung University cwliu@twins.ee.nctu.edu. Computer Architecture Lecture 2: Instruction Set Principles (Appendix A) Chih Wei Liu 劉 志 尉 National Chiao Tung University [email protected] Review Computers in mid 50 s Hardware was expensive

More information

Compilers I - Chapter 4: Generating Better Code

Compilers I - Chapter 4: Generating Better Code Compilers I - Chapter 4: Generating Better Code Lecturers: Paul Kelly ([email protected]) Office: room 304, William Penney Building Naranker Dulay ([email protected]) Materials: Office: room 562 Textbook

More information

Two's Complement Adder/Subtractor Lab L03

Two's Complement Adder/Subtractor Lab L03 Two's Complement Adder/Subtractor Lab L03 Introduction Computers are usually designed to perform indirect subtraction instead of direct subtraction. Adding -B to A is equivalent to subtracting B from A,

More information

VirtualXP Users Guide

VirtualXP Users Guide VirtualXP Users Guide Contents Chapter 1: Introduction... 2 Chapter 2: Install and Uninstall VirtualXP... 3 2.1 System Requirement... 3 2.2 Installing VirtualXP... 3 2.3 Uninstalling VirtualXP... 3 Chapter

More information

SIM-PL: Software for teaching computer hardware at secondary schools in the Netherlands

SIM-PL: Software for teaching computer hardware at secondary schools in the Netherlands SIM-PL: Software for teaching computer hardware at secondary schools in the Netherlands Ben Bruidegom, [email protected] AMSTEL Instituut Universiteit van Amsterdam Kruislaan 404 NL-1098 SM Amsterdam

More information

Introducción. Diseño de sistemas digitales.1

Introducción. Diseño de sistemas digitales.1 Introducción Adapted from: Mary Jane Irwin ( www.cse.psu.edu/~mji ) www.cse.psu.edu/~cg431 [Original from Computer Organization and Design, Patterson & Hennessy, 2005, UCB] Diseño de sistemas digitales.1

More information

Computer Systems Architecture

Computer Systems Architecture Computer Systems Architecture http://cs.nott.ac.uk/ txa/g51csa/ Thorsten Altenkirch and Liyang Hu School of Computer Science University of Nottingham Lecture 10: MIPS Procedure Calling Convention and Recursion

More information

CPU Organization and Assembly Language

CPU Organization and Assembly Language COS 140 Foundations of Computer Science School of Computing and Information Science University of Maine October 2, 2015 Outline 1 2 3 4 5 6 7 8 Homework and announcements Reading: Chapter 12 Homework:

More information

CPU Organisation and Operation

CPU Organisation and Operation CPU Organisation and Operation The Fetch-Execute Cycle The operation of the CPU 1 is usually described in terms of the Fetch-Execute cycle. 2 Fetch-Execute Cycle Fetch the Instruction Increment the Program

More information

Code::Blocks Student Manual

Code::Blocks Student Manual Code::Blocks Student Manual Lawrence Goetz, Network Administrator Yedidyah Langsam, Professor and Theodore Raphan, Distinguished Professor Dept. of Computer and Information Science Brooklyn College of

More information

Xilinx ISE. <Release Version: 10.1i> Tutorial. Department of Electrical and Computer Engineering State University of New York New Paltz

Xilinx ISE. <Release Version: 10.1i> Tutorial. Department of Electrical and Computer Engineering State University of New York New Paltz Xilinx ISE Tutorial Department of Electrical and Computer Engineering State University of New York New Paltz Fall 2010 Baback Izadi Starting the ISE Software Start ISE from the

More information

Translating C code to MIPS

Translating C code to MIPS Translating C code to MIPS why do it C is relatively simple, close to the machine C can act as pseudocode for assembler program gives some insight into what compiler needs to do what's under the hood do

More information

Athena Knowledge Base

Athena Knowledge Base Athena Knowledge Base The Athena Visual Studio Knowledge Base contains a number of tips, suggestions and how to s that have been recommended by the users of the software. We will continue to enhance this

More information

EC 362 Problem Set #2

EC 362 Problem Set #2 EC 362 Problem Set #2 1) Using Single Precision IEEE 754, what is FF28 0000? 2) Suppose the fraction enhanced of a processor is 40% and the speedup of the enhancement was tenfold. What is the overall speedup?

More information

MICROPROCESSOR AND MICROCOMPUTER BASICS

MICROPROCESSOR AND MICROCOMPUTER BASICS Introduction MICROPROCESSOR AND MICROCOMPUTER BASICS At present there are many types and sizes of computers available. These computers are designed and constructed based on digital and Integrated Circuit

More information

File Management Where did it go? Teachers College Summer Workshop

File Management Where did it go? Teachers College Summer Workshop File Management Where did it go? Teachers College Summer Workshop Barbara Wills University Computing Services Summer 2003 To Think About The Beginning of Wisdom is to Call Things by the Right Names --

More information

Chapter 4 Register Transfer and Microoperations. Section 4.1 Register Transfer Language

Chapter 4 Register Transfer and Microoperations. Section 4.1 Register Transfer Language Chapter 4 Register Transfer and Microoperations Section 4.1 Register Transfer Language Digital systems are composed of modules that are constructed from digital components, such as registers, decoders,

More information

Divide: Paper & Pencil. Computer Architecture ALU Design : Division and Floating Point. Divide algorithm. DIVIDE HARDWARE Version 1

Divide: Paper & Pencil. Computer Architecture ALU Design : Division and Floating Point. Divide algorithm. DIVIDE HARDWARE Version 1 Divide: Paper & Pencil Computer Architecture ALU Design : Division and Floating Point 1001 Quotient Divisor 1000 1001010 Dividend 1000 10 101 1010 1000 10 (or Modulo result) See how big a number can be

More information

Computer organization

Computer organization Computer organization Computer design an application of digital logic design procedures Computer = processing unit + memory system Processing unit = control + datapath Control = finite state machine inputs

More information

Guide to RISC Processors

Guide to RISC Processors Guide to RISC Processors Sivarama P. Dandamudi Guide to RISC Processors for Programmers and Engineers Sivarama P. Dandamudi School of Computer Science Carleton University Ottawa, ON K1S 5B6 Canada [email protected]

More information

An Introduction to MPLAB Integrated Development Environment

An Introduction to MPLAB Integrated Development Environment An Introduction to MPLAB Integrated Development Environment 2004 Microchip Technology Incorporated An introduction to MPLAB Integrated Development Environment Slide 1 This seminar is an introduction to

More information

Graded ARM assembly language Examples

Graded ARM assembly language Examples Graded ARM assembly language Examples These examples have been created to help students with the basics of Keil s ARM development system. I am providing a series of examples that demonstrate the ARM s

More information

EE361: Digital Computer Organization Course Syllabus

EE361: Digital Computer Organization Course Syllabus EE361: Digital Computer Organization Course Syllabus Dr. Mohammad H. Awedh Spring 2014 Course Objectives Simply, a computer is a set of components (Processor, Memory and Storage, Input/Output Devices)

More information

Hosting Users Guide 2011

Hosting Users Guide 2011 Hosting Users Guide 2011 eofficemgr technology support for small business Celebrating a decade of providing innovative cloud computing services to small business. Table of Contents Overview... 3 Configure

More information

USER AND INSTALLATION MANUAL

USER AND INSTALLATION MANUAL Revision 1 - October 2013 User and installation manual O-link The manufacturer OWANDY reserves the right to make modifications to its products or to their specifications in order to improve the performance,

More information

THUMB Instruction Set

THUMB Instruction Set 5 THUMB Instruction Set This chapter describes the THUMB instruction set. Format Summary 5-2 Opcode Summary 5-3 5. Format : move shifted register 5-5 5.2 Format 2: add/subtract 5-7 5.3 Format 3: move/compare/add/subtract

More information

High level code and machine code

High level code and machine code High level code and machine code Teacher s Notes Lesson Plan x Length 60 mins Specification Link 2.1.7/cde Programming languages Learning objective Students should be able to (a) explain the difference

More information

MIPS Assembler and Simulator

MIPS Assembler and Simulator MIPS Assembler and Simulator Reference Manual Last Updated, December 1, 2005 Xavier Perséguers (ing. info. dipl. EPF) Swiss Federal Institude of Technology [email protected] Preface MIPS Assembler

More information

EECS 427 RISC PROCESSOR

EECS 427 RISC PROCESSOR RISC PROCESSOR ISA FOR EECS 427 PROCESSOR ImmHi/ ImmLo/ OP Code Rdest OP Code Ext Rsrc Mnemonic Operands 15-12 11-8 7-4 3-0 Notes (* is Baseline) ADD Rsrc, Rdest 0000 Rdest 0101 Rsrc * ADDI Imm, Rdest

More information

10 STEPS TO YOUR FIRST QNX PROGRAM. QUICKSTART GUIDE Second Edition

10 STEPS TO YOUR FIRST QNX PROGRAM. QUICKSTART GUIDE Second Edition 10 STEPS TO YOUR FIRST QNX PROGRAM QUICKSTART GUIDE Second Edition QNX QUICKSTART GUIDE A guide to help you install and configure the QNX Momentics tools and the QNX Neutrino operating system, so you can

More information

Moving Your WorkCenter CRM Software

Moving Your WorkCenter CRM Software Moving Your WorkCenter CRM Software When you decide that you need to move your WorkCenter CRM software to another computer, please follow the steps outlined in the user manual. 1. Always back up your database

More information

Chapter 5 Instructor's Manual

Chapter 5 Instructor's Manual The Essentials of Computer Organization and Architecture Linda Null and Julia Lobur Jones and Bartlett Publishers, 2003 Chapter 5 Instructor's Manual Chapter Objectives Chapter 5, A Closer Look at Instruction

More information

Introduction to UNIX and SFTP

Introduction to UNIX and SFTP Introduction to UNIX and SFTP Introduction to UNIX 1. What is it? 2. Philosophy and issues 3. Using UNIX 4. Files & folder structure 1. What is UNIX? UNIX is an Operating System (OS) All computers require

More information

LC-3 Assembly Language

LC-3 Assembly Language LC-3 Assembly Language Programming and tips Textbook Chapter 7 CMPE12 Summer 2008 Assembly and Assembler Machine language - binary Assembly language - symbolic 0001110010000110 An assembler is a program

More information

Administrative Issues

Administrative Issues CSC 3210 Computer Organization and Programming Introduction and Overview Dr. Anu Bourgeois (modified by Yuan Long) Administrative Issues Required Prerequisites CSc 2010 Intro to CSc CSc 2310 Java Programming

More information

PROBLEMS (Cap. 4 - Istruzioni macchina)

PROBLEMS (Cap. 4 - Istruzioni macchina) 98 CHAPTER 2 MACHINE INSTRUCTIONS AND PROGRAMS PROBLEMS (Cap. 4 - Istruzioni macchina) 2.1 Represent the decimal values 5, 2, 14, 10, 26, 19, 51, and 43, as signed, 7-bit numbers in the following binary

More information

Magaya Software Installation Guide

Magaya Software Installation Guide Magaya Software Installation Guide MAGAYA SOFTWARE INSTALLATION GUIDE INTRODUCTION Introduction This installation guide explains the system requirements for installing any Magaya software, the steps to

More information

TEL2821/IS2150: INTRODUCTION TO SECURITY Lab: Operating Systems and Access Control

TEL2821/IS2150: INTRODUCTION TO SECURITY Lab: Operating Systems and Access Control TEL2821/IS2150: INTRODUCTION TO SECURITY Lab: Operating Systems and Access Control Version 3.4, Last Edited 9/10/2011 Students Name: Date of Experiment: Read the following guidelines before working in

More information

Kids College Computer Game Programming Exploring Small Basic and Procedural Programming

Kids College Computer Game Programming Exploring Small Basic and Procedural Programming Kids College Computer Game Programming Exploring Small Basic and Procedural Programming According to Microsoft, Small Basic is a programming language developed by Microsoft, focused at making programming

More information

Instruction Set Design

Instruction Set Design Instruction Set Design Instruction Set Architecture: to what purpose? ISA provides the level of abstraction between the software and the hardware One of the most important abstraction in CS It s narrow,

More information

EXPERIMENT 4. Parallel Adders, Subtractors, and Complementors

EXPERIMENT 4. Parallel Adders, Subtractors, and Complementors EXPERIMENT 4. Parallel Adders, Subtractors, and Complementors I. Introduction I.a. Objectives In this experiment, parallel adders, subtractors and complementors will be designed and investigated. In the

More information

what operations can it perform? how does it perform them? on what kind of data? where are instructions and data stored?

what operations can it perform? how does it perform them? on what kind of data? where are instructions and data stored? Inside the CPU how does the CPU work? what operations can it perform? how does it perform them? on what kind of data? where are instructions and data stored? some short, boring programs to illustrate the

More information

Virtual Machines as an Aid in Teaching Computer Concepts

Virtual Machines as an Aid in Teaching Computer Concepts Virtual Machines as an Aid in Teaching Computer Concepts Ola Ågren Department of Computing Science Umeå University SE-901 87 Umeå, SWEDEN E-mail: [email protected] Abstract A debugger containing a set

More information

CS101 Lecture 26: Low Level Programming. John Magee 30 July 2013 Some material copyright Jones and Bartlett. Overview/Questions

CS101 Lecture 26: Low Level Programming. John Magee 30 July 2013 Some material copyright Jones and Bartlett. Overview/Questions CS101 Lecture 26: Low Level Programming John Magee 30 July 2013 Some material copyright Jones and Bartlett 1 Overview/Questions What did we do last time? How can we control the computer s circuits? How

More information

Installation Assistance... 3. Windows/Microsoft Updates... 3. Updating from Spectra 7.0.1 or 7.1... 4. Upgrading from Spectra 6.x...

Installation Assistance... 3. Windows/Microsoft Updates... 3. Updating from Spectra 7.0.1 or 7.1... 4. Upgrading from Spectra 6.x... Spectra 7.1.1/Access 2010 Windows Upgrade Installation Instructions Installation Assistance... 3 Windows/Microsoft Updates... 3 Updating from Spectra 7.0.1 or 7.1... 4 Important Notices... 4 Downloading

More information

OPERATING SYSTEM SERVICES

OPERATING SYSTEM SERVICES OPERATING SYSTEM SERVICES USER INTERFACE Command line interface(cli):uses text commands and a method for entering them Batch interface(bi):commands and directives to control those commands are entered

More information

PCRecruiter Resume Inhaler

PCRecruiter Resume Inhaler PCRecruiter Resume Inhaler The PCRecruiter Resume Inhaler is a stand-alone application that can be pointed to a folder and/or to an email inbox containing resumes, and will automatically extract contact

More information

Programming LEGO NXT Robots using NXC

Programming LEGO NXT Robots using NXC Programming LEGO NXT Robots using NXC This text programming language derived from C language is bended together with IDE BricxCC on standard firmware LEGO Mindstorms. This can be very convenient for those,

More information

Excel Reports and Macros

Excel Reports and Macros Excel Reports and Macros Within Microsoft Excel it is possible to create a macro. This is a set of commands that Excel follows to automatically make certain changes to data in a spreadsheet. By adding

More information

2) Write in detail the issues in the design of code generator.

2) Write in detail the issues in the design of code generator. COMPUTER SCIENCE AND ENGINEERING VI SEM CSE Principles of Compiler Design Unit-IV Question and answers UNIT IV CODE GENERATION 9 Issues in the design of code generator The target machine Runtime Storage

More information

Chapter 7D The Java Virtual Machine

Chapter 7D The Java Virtual Machine This sub chapter discusses another architecture, that of the JVM (Java Virtual Machine). In general, a VM (Virtual Machine) is a hypothetical machine (implemented in either hardware or software) that directly

More information

Central Processing Unit (CPU)

Central Processing Unit (CPU) Central Processing Unit (CPU) CPU is the heart and brain It interprets and executes machine level instructions Controls data transfer from/to Main Memory (MM) and CPU Detects any errors In the following

More information

WinTask x64 Scheduler for Windows 7 64 bit, Windows 8/8.1 64 bit and Windows 2008 R2 64 bit. Scheduler Quick Start Guide

WinTask x64 Scheduler for Windows 7 64 bit, Windows 8/8.1 64 bit and Windows 2008 R2 64 bit. Scheduler Quick Start Guide WinTask x64 Scheduler for Windows 7 64 bit, Windows 8/8.1 64 bit and Windows 2008 R2 64 bit Scheduler Quick Start Guide 2 INTRODUCTION 5 CHAPTER I : INSTALLATION 7 CHAPTER II : SET UP YOUR FIRST SCHEDULED

More information

BioWin Network Installation

BioWin Network Installation BioWin Network Installation Introduction This document outlines procedures and options for installing the network version of BioWin. There are two parts to the network version installation: 1. The installation

More information

Eclipse installation, configuration and operation

Eclipse installation, configuration and operation Eclipse installation, configuration and operation This document aims to walk through the procedures to setup eclipse on different platforms for java programming and to load in the course libraries for

More information

Creating the program. TIA Portal. SIMATIC Creating the program. Loading the block library. Deleting program block Main [OB1] Copying program blocks

Creating the program. TIA Portal. SIMATIC Creating the program. Loading the block library. Deleting program block Main [OB1] Copying program blocks Loading the block library 1 Deleting program block Main [OB1] 2 TIA Portal SIMATIC Getting Started Copying program blocks 3 Cyclic interrupt OB 4 Copying tag tables 5 Compiling a project 6 Load project

More information

Traditional IBM Mainframe Operating Principles

Traditional IBM Mainframe Operating Principles C H A P T E R 1 7 Traditional IBM Mainframe Operating Principles WHEN YOU FINISH READING THIS CHAPTER YOU SHOULD BE ABLE TO: Distinguish between an absolute address and a relative address. Briefly explain

More information

Using Karel with Eclipse

Using Karel with Eclipse Mehran Sahami Handout #6 CS 106A September 23, 2015 Using Karel with Eclipse Based on a handout by Eric Roberts Once you have downloaded a copy of Eclipse as described in Handout #5, your next task is

More information

Operating System Structures

Operating System Structures COP 4610: Introduction to Operating Systems (Spring 2015) Operating System Structures Zhi Wang Florida State University Content Operating system services User interface System calls System programs Operating

More information

Platform-independent static binary code analysis using a metaassembly

Platform-independent static binary code analysis using a metaassembly Platform-independent static binary code analysis using a metaassembly language Thomas Dullien, Sebastian Porst zynamics GmbH CanSecWest 2009 Overview The REIL Language Abstract Interpretation MonoREIL

More information

MAS 500 Intelligence Tips and Tricks Booklet Vol. 1

MAS 500 Intelligence Tips and Tricks Booklet Vol. 1 MAS 500 Intelligence Tips and Tricks Booklet Vol. 1 1 Contents Accessing the Sage MAS Intelligence Reports... 3 Copying, Pasting and Renaming Reports... 4 To create a new report from an existing report...

More information

Connecticut Hazardous Waste Manifests Database

Connecticut Hazardous Waste Manifests Database Connecticut Hazardous Waste Manifests Database Due to limitations inherent to Microsoft Access, the Department has migrated this database to Microsoft SQL Server. The user interface will remain the same.

More information

Upgrading Client Security and Policy Manager in 4 easy steps

Upgrading Client Security and Policy Manager in 4 easy steps Page 1 of 13 F-Secure White Paper Upgrading Client Security and Policy Manager in 4 easy steps Purpose This white paper describes how to easily upgrade your existing environment running Client Security

More information

Tips and Tricks SAGE ACCPAC INTELLIGENCE

Tips and Tricks SAGE ACCPAC INTELLIGENCE Tips and Tricks SAGE ACCPAC INTELLIGENCE 1 Table of Contents Auto e-mailing reports... 4 Automatically Running Macros... 7 Creating new Macros from Excel... 8 Compact Metadata Functionality... 9 Copying,

More information

C Programming. for Embedded Microcontrollers. Warwick A. Smith. Postbus 11. Elektor International Media BV. 6114ZG Susteren The Netherlands

C Programming. for Embedded Microcontrollers. Warwick A. Smith. Postbus 11. Elektor International Media BV. 6114ZG Susteren The Netherlands C Programming for Embedded Microcontrollers Warwick A. Smith Elektor International Media BV Postbus 11 6114ZG Susteren The Netherlands 3 the Table of Contents Introduction 11 Target Audience 11 What is

More information