Some Samples of MIPS Assembly Language. Lecture for CPSC 5155 Edward Bosworth, Ph.D. Computer Science Department Columbus State University
|
|
- Charles Adams
- 7 years ago
- Views:
Transcription
1 Some Samples of MIPS Assembly Language Lecture for CPSC 5155 Edward Bosworth, Ph.D. Computer Science Department Columbus State University
2 Structure of This Lecture This lecture will be built around a number of sample programs, written in assembly language and run under both SPIM and MARS. We begin with some of the syntax for writing the programs and then illustrate.
3 System Calls Almost all programs, user and system, are written to be run on a machine with a fully functional operating system. The operating system provides a number of services to other programs. We shall use a number of SPIM system calls to facilitate input and output.
4 Example of System Calls.data str: asciiz The answer is.text li $v0, 4 Code for print string la $a0, str Address of string syscall Print the string li $v0, 1 Code for print integer li $a0, 5 Value to print syscall li $v0, 10 Code for exit syscall
5 The SPIM System Services
6 SPIM Data Directives Here are a number of directives used to set aside memory and initialize it..asciiz str stores the string in memory and null terminates it in the style of C or C++..space N allocates N bytes of storage for structures such as arrays, etc..word w1 wn allocates and initializes n 32-bit words.
7 Sample of Space Allocation S1:.asciiz A null-terminated string This associates label S1 with the string. C1:.space 80 This allocates 80 bytes, possibly for an array to hold 80 characters or bit integers. W1:.word 1, 2, 3 This initializes three integer values. Same as W1:.word 1.word 2 At address W1 + 4.word 3 At address W1 + 8
8 Conventions for Strings Strings should be null terminated, as in the style of C and C++. String constants are enclosed in double quotes This is a string Special characters follow the C/C++ style newline \n tab \t quote \
9 Data Alignment The assembler will normally align data as required by the data type. The.align N directive aligns the next entry on an address that is a multiple of 2 N. Character data can be stored anywhere. Byte data must be stored at an address that is a multiple of 2. Use.align 1 Word data must be stored at an address that is a multiple of 4. Use.align 2
10 Kernel and User Mode All modern computer systems restrict certain operations to the operating system, when it is operating in what is called kernel mode. Example restricted operations: direct access to I/O devices, memory management, etc. SPIM allows programs to be run in either user mode or kernel mode, as both modes are emulated on the host machine.
11 SPIM Text & Data.data <address> This stores subsequent items in the user data segment..kdata <address> This stores subsequent items in the kernel data segment..ktext <address> This stores subsequent items in the kernel text area, which holds instructions for kernel code..text <address> This stores subsequent items in the user text area, also for program instructions.
12 The Optional Address Each of these directives has an optional address, commonly not used. One exception will be for an interrupt handler, which must be in the kernel at a fixed address..ktext 0x sw $a0, savea0 sw $a1, savea1 More code goes here..kdata savea0.word 0 savea1.word 0
13 Compute Fibonacci Numbers The Fibonacci sequence was introduced in 1202 by the Italian mathematician Leonardo of Pisa, known as Fibonacci. The sequence is defined for N 0 as follows: F 0 = 1, F 1 = 1, and F N = F N-1 + F N-2 for N 2. This is often used as an example of recursion. We shall implement a non-recursive solution in the MIPS assembly language.
14 The Basic Algorithm The basic non-recursive algorithm for computing Fibonacci numbers uses a loop. To compute F(N), do the following F1 = 1 F2 = 1 For (J = 2; J <= N; J++) F0 = F1 F1 = F2 F2 = F1 + F0 End For
15 The Program (Page 1) Here is the standard program header. Fibonacci This is a non-recursive program to calculate Fibonacci numbers, defined as follows: F(0) = 1, F(1) = 1, and F(N) = F(N - 1) + F(N - 2), for N >= 2. This runs under both MARS and SPIM. Written by Edward Bosworth, Ph.D. Associate Professor of Computer Science Columbus State University Columbus, GA bosworth_edward@columbusstate.edu Date first written: July 4, 2012 Date last revised: July 4, 2012.
16 The Program (Page 2) Here is the start of the code. Note that the program must have a globally visible label main at its start..text.globl main main: li $v0, 4 Make this global Print string la $a0, str0 Address of title string syscall Print the title getn: li $v0, 4 Print string la $a0, str1 Address of input prompt syscall Print the prompt. li $v0, 5 Read an integer syscall Return the value in $v0
17 The Program (Page 3) The program is designed to loop: read user input and then to produce the result. The user input is found in $v0. Non-positive input is a signal to terminate the program. A value of 1 disrupts the loop logic, so treat as special. blez $v0, done Do we stop? li $v1, 1 F(1) is trivial. bgt $v0, $v1, doit Is N > 1? li $v0, 4 F(1) will disrupt la $a0, str2 the loop logic; syscall just print answer j getn Get more input.
18 The Program (Page 4) Here is the main computational loop. doit: li $t1, 1 Initialization li $t2, 1 code for loop. loop: addi $v1, $v1, 1 Bump $v1 move $t0, $t1 New F(N - 2) move $t1, $t2 New F(N - 1) addu $t2, $t0, $t1 New F(N), where $v1 contains N blt $v1, $v0, loop Are we done?
19 The Program (Page 5) Print out the result and get more input. move $a1, $v0 Set aside the value of N li $v0, 4 la $a0, str3 Print part of output string syscall li $v0, 1 move $a0, $a1 Get the value of N back syscall Print N li $v0, 4 la $a0, str4 Print more of the string syscall li $v0, 1 F(N) is found in $t2 move $a0, $t2 Print the result syscall j getn Get more input.
20 The Program (Page 6) Here is the closing code and data section. Set up for a proper exit done: li $v0, 4 Print closing remark la $a0, finis Address of closing remark syscall li $v0, 10 Call exit syscall.data str0:.asciiz "Program to calculate a Fibonacci number str1:.asciiz "\ninput an integer: str2:.asciiz "\nf(1) is equal to 1. str3:.asciiz "\nthe Fibonacci number F( str4:.asciiz ") is equal to finis:.asciiz "\nall done. \n" \n is New line
21 Comments on the Text Figure B.1.4 on page B-7 contains the following. It has a problem..text.align 2.globl main main: The MARS emulator does not allow the.align directive within the text area.
22 When to Use Assembly Language When should one prefer assembly language for writing programs? Your instructor s opinion is almost never. Compiler technology has advanced to a point that it is almost impossible to write code better or faster than that emitted by a modern compiler. The only real use for assembly language is as a part of teaching computer science.
23 Ancient History (PDP-9 FORTRAN) The PDP-9 computer was fairly advanced for the early 1970 s. Your instructor programmed such a machine from 1971 to The PDP-9 supported programs written in the FORTRAN programming language. The code produced was very slow. The preferable method was to have the FORTRAN compiler emit assembly language code, edit that code, and assembly it.
24 Labels: Local and Global A label is called global or external if it can be referenced from another module. The label may refer to a memory storage location or to a function or procedure. The linker will resolve global references as a part of creating the executable image. If module A references a global in module B, the linker will make the correct connection. Any label not declared as global is local, not available for reference by other modules.
25 Rdata & Sdata The sample code on page B-28 includes a data directive.rdata. There is another directive,.sdata. The MARS emulator does not recognize either directive. Use.data for user data and.kdata for kernel data.
26 Various Jump Commands The code near the bottom of page B-28 contains an error: 2 commands are confused. j jump to the instruction at the target address jr jump to the instruction at the address stored in the register. The instruction should be j L1. Also, the label should be L1, not $L1.
27 The Assembly Temporary ($at) Register Register $1 (called $at ) is reserved for use by the assembler. The SPIM emulator will raise an error if the code references the $at register. To avoid this problem, when it is necessary to save the $at register, use the following..set noat Allow use of $at move $k1, $at Save it.set at Assembler can now use $at again.
28 Exception Handler Code The sample code on page B-36 contains the following code, which should be corrected.ktext 0x mov $k1, $at Save the register $at It should read as follows.ktext 0x set noat move $k1, $at.set at
29 Exceptions & Interrupts Exceptions are events that disrupt the normal flow of program control and cause exception code to be executed. Almost always, this is kernel code managed by the operating system. Interrupts are exceptions from outside sources such as I/O devices. The terminology is not uniformly applied.
30 Examples of Exceptions External interrupts include: Input the device has data ready to transfer Output the device is ready to receive data Timer the CPU timer raises an interrupt, used to run the CPU clock. Exceptions include Arithmetic overflow an arithmetic error Page fault a reference has been made to an invalid virtual memory address.
31 Exceptions: Control Unit Implications For most external interrupts, the implications for the control unit are rather simple. As the control unit begins the execution of each instruction, it tests a signal (often called INT ) that indicates that there is an interrupt pending. If there is a pending interrupt, the control unit branches unconditionally to kernel code.
32 Handling Exceptions Depending on the exception type, the control unit will begin execution of kernel code at one of two locations. 0x for undefined instructions 0x for other exceptions For that reason, the standard exception handler begins as follows:.ktext 0x set noat move $k1, $at This at 0x set at
33 More Control Unit Implications The handling of page fault exceptions shows one of the strengths of a load/store RISC. Only register load and register store instructions can reference memory. Neither load nor store change the computer state prior to referencing memory, so that any instruction can be restarted after a page fault.
34 The Coprocessors CP0 for exceptions; CP1 for floating point
35 Coprocessor Registers Coprocessor 0 has a number of registers to control exceptions and manage memory. Here are some of the registers used by SPIM $12 the interrupt mask and enable bits $13 the exception type and pending interrupt bits $14 EPC: address of the instruction that caused the exception.
36 Accessing CP0 Registers There are two instructions for accessing the registers in coprocessor 0: mfc0 and mtc0. mfc0 $k0, $13 Copy CP0 cause register ($13) into CPU register $k0 ($26). mtc0 $k1, $12 Load CP0 status register ($12) from CPU register $k1 ($27).
37 Structure of Two Registers
38 Sample Exception Handler Code.ktext 0x sw $a0, savea0 Use static storage sw $a1, savea1 It uses $a0 and $a1, so save sw $v0, savev0 It also uses $v0 Now determine the cause of the exception or interrupt mfc0 $t0, $13 Move cause into $t0 srl $t0, $t0, 2 Shift to get exception code andi $t0, $t0, 0xF Put the code into $t0 More code here to handle exception
39 Returning from Exception la $a0, L4 L4 is the return address, defined elsewhere in code mtc0 $a0, $14 Put it into the EPC mtc0 $0, $13 Clear the cause register mfc0 $a1, $12 Get the status register andi $a1, 0xFFFD Clear the EXL bit ori $a1, 0x1 Enable the interrupt and mtc0 $a1, $12 reset the status register lw $v0, savev0 lw lw $a1, savea1 $a0, savea0 eret Return to new spot Not a subroutine return.
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 informationMIPS 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 informationA 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 informationIntroduction 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 informationFigure 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 informationTypy 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 information5 MIPS Assembly Language
103 5 MIPS Assembly Language Today, digital computers are almost exclusively programmed using high-level programming languages (PLs), eg, C, C++, Java The CPU fetch execute cycle, however, is not prepared
More informationCOMP 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 informationLab 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 informationTranslating 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 informationInstruction Set Architecture (ISA)
Instruction Set Architecture (ISA) * Instruction set architecture of a machine fills the semantic gap between the user and the machine. * ISA serves as the starting point for the design of a new machine
More informationStack 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 informationAdvanced 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 informationInstruction 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 informationASSEMBLY PROGRAMMING ON A VIRTUAL COMPUTER
ASSEMBLY PROGRAMMING ON A VIRTUAL COMPUTER Pierre A. von Kaenel Mathematics and Computer Science Department Skidmore College Saratoga Springs, NY 12866 (518) 580-5292 pvonk@skidmore.edu ABSTRACT This paper
More informationWinter 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 informationIntroduction. What is an Operating System?
Introduction What is an Operating System? 1 What is an Operating System? 2 Why is an Operating System Needed? 3 How Did They Develop? Historical Approach Affect of Architecture 4 Efficient Utilization
More informationInstruction 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 informationAssembly Language Programming
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:
More informationLC-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 informationCPU 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 informationComputer Organization and Components
Computer Organization and Components IS1500, fall 2015 Lecture 5: I/O Systems, part I Associate Professor, KTH Royal Institute of Technology Assistant Research Engineer, University of California, Berkeley
More informationInstruction 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 informationASSEMBLY LANGUAGE PROGRAMMING (6800) (R. Horvath, Introduction to Microprocessors, Chapter 6)
ASSEMBLY LANGUAGE PROGRAMMING (6800) (R. Horvath, Introduction to Microprocessors, Chapter 6) 1 COMPUTER LANGUAGES In order for a computer to be able to execute a program, the program must first be present
More informationComputer 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 informationException and Interrupt Handling in ARM
Exception and Interrupt Handling in ARM Architectures and Design Methods for Embedded Systems Summer Semester 2006 Author: Ahmed Fathy Mohammed Abdelrazek Advisor: Dominik Lücke Abstract We discuss exceptions
More informationQ. Consider a dynamic instruction execution (an execution trace, in other words) that consists of repeats of code in this pattern:
Pipelining HW Q. Can a MIPS SW instruction executing in a simple 5-stage pipelined implementation have a data dependency hazard of any type resulting in a nop bubble? If so, show an example; if not, prove
More information8051 MICROCONTROLLER COURSE
8051 MICROCONTROLLER COURSE Objective: 1. Familiarization with different types of Microcontroller 2. To know 8051 microcontroller in detail 3. Programming and Interfacing 8051 microcontroller Prerequisites:
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 informationSyscall 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İSTANBUL AYDIN UNIVERSITY
İSTANBUL AYDIN UNIVERSITY FACULTY OF ENGİNEERİNG SOFTWARE ENGINEERING THE PROJECT OF THE INSTRUCTION SET COMPUTER ORGANIZATION GÖZDE ARAS B1205.090015 Instructor: Prof. Dr. HASAN HÜSEYİN BALIK DECEMBER
More informationPART B QUESTIONS AND ANSWERS UNIT I
PART B QUESTIONS AND ANSWERS UNIT I 1. Explain the architecture of 8085 microprocessor? Logic pin out of 8085 microprocessor Address bus: unidirectional bus, used as high order bus Data bus: bi-directional
More informationChapter 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 informationCHAPTER 4 MARIE: An Introduction to a Simple Computer
CHAPTER 4 MARIE: An Introduction to a Simple Computer 4.1 Introduction 195 4.2 CPU Basics and Organization 195 4.2.1 The Registers 196 4.2.2 The ALU 197 4.2.3 The Control Unit 197 4.3 The Bus 197 4.4 Clocks
More informationEmbedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C
Embedded Systems A Review of ANSI C and Considerations for Embedded C Programming Dr. Jeff Jackson Lecture 2-1 Review of ANSI C Topics Basic features of C C fundamentals Basic data types Expressions Selection
More informationAn Introduction to Assembly Programming with the ARM 32-bit Processor Family
An Introduction to Assembly Programming with the ARM 32-bit Processor Family G. Agosta Politecnico di Milano December 3, 2011 Contents 1 Introduction 1 1.1 Prerequisites............................. 2
More informationName: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.
Name: Class: Date: Exam #1 - Prep True/False Indicate whether the statement is true or false. 1. Programming is the process of writing a computer program in a language that the computer can respond to
More informationProgramming Languages
Programming Languages Programming languages bridge the gap between people and machines; for that matter, they also bridge the gap among people who would like to share algorithms in a way that immediately
More informationOutline Basic concepts of Python language
Data structures: lists, tuples, sets, dictionaries Basic data types Examples: int: 12, 0, -2 float: 1.02, -2.4e2, 1.5e-3 complex: 3+4j bool: True, False string: "Test string" Conversion between types int(-2.8)
More informationKeil C51 Cross Compiler
Keil C51 Cross Compiler ANSI C Compiler Generates fast compact code for the 8051 and it s derivatives Advantages of C over Assembler Do not need to know the microcontroller instruction set Register allocation
More informationMemory Systems. Static Random Access Memory (SRAM) Cell
Memory Systems This chapter begins the discussion of memory systems from the implementation of a single bit. The architecture of memory chips is then constructed using arrays of bit implementations coupled
More informationChapter One Introduction to Programming
Chapter One Introduction to Programming 1-1 Algorithm and Flowchart Algorithm is a step-by-step procedure for calculation. More precisely, algorithm is an effective method expressed as a finite list of
More informationLSN 2 Computer Processors
LSN 2 Computer Processors Department of Engineering Technology LSN 2 Computer Processors Microprocessors Design Instruction set Processor organization Processor performance Bandwidth Clock speed LSN 2
More informationSources: On the Web: Slides will be available on:
C programming Introduction The basics of algorithms Structure of a C code, compilation step Constant, variable type, variable scope Expression and operators: assignment, arithmetic operators, comparison,
More informationInstruction Set Architecture (ISA) Design. Classification Categories
Instruction Set Architecture (ISA) Design Overview» Classify Instruction set architectures» Look at how applications use ISAs» Examine a modern RISC ISA (DLX)» Measurement of ISA usage in real computers
More informationCS352H: Computer Systems Architecture
CS352H: Computer Systems Architecture Topic 9: MIPS Pipeline - Hazards October 1, 2009 University of Texas at Austin CS352H - Computer Systems Architecture Fall 2009 Don Fussell Data Hazards in ALU Instructions
More informationIntroducció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 information1 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 informationMACHINE ARCHITECTURE & LANGUAGE
in the name of God the compassionate, the merciful notes on MACHINE ARCHITECTURE & LANGUAGE compiled by Jumong Chap. 9 Microprocessor Fundamentals A system designer should consider a microprocessor-based
More informationChapter 2: Elements of Java
Chapter 2: Elements of Java Basic components of a Java program Primitive data types Arithmetic expressions Type casting. The String type (introduction) Basic I/O statements Importing packages. 1 Introduction
More informationLecture 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 informationCOS 318: Operating Systems
COS 318: Operating Systems OS Structures and System Calls Andy Bavier Computer Science Department Princeton University http://www.cs.princeton.edu/courses/archive/fall10/cos318/ Outline Protection mechanisms
More informationHow To Write An Array In A Microsoft Zil
Array Declaration and Storage Allocation The first step is to reserve sufficient space for the array: 1.data list:.space 1000 # reserves a block of 1000 bytes This yields a contiguous block of bytes of
More informationInformatica e Sistemi in Tempo Reale
Informatica e Sistemi in Tempo Reale Introduction to C programming Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 25, 2010 G. Lipari (Scuola Superiore Sant Anna)
More informationPCSpim 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 informationEE282 Computer Architecture and Organization Midterm Exam February 13, 2001. (Total Time = 120 minutes, Total Points = 100)
EE282 Computer Architecture and Organization Midterm Exam February 13, 2001 (Total Time = 120 minutes, Total Points = 100) Name: (please print) Wolfe - Solution In recognition of and in the spirit of the
More informationAn Implementation Of Multiprocessor Linux
An Implementation Of Multiprocessor Linux This document describes the implementation of a simple SMP Linux kernel extension and how to use this to develop SMP Linux kernels for architectures other than
More informationCSC 2405: Computer Systems II
CSC 2405: Computer Systems II Spring 2013 (TR 8:30-9:45 in G86) Mirela Damian http://www.csc.villanova.edu/~mdamian/csc2405/ Introductions Mirela Damian Room 167A in the Mendel Science Building mirela.damian@villanova.edu
More informationComputer 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 cwliu@twins.ee.nctu.edu.tw Review Computers in mid 50 s Hardware was expensive
More informationQEMU, a Fast and Portable Dynamic Translator
QEMU, a Fast and Portable Dynamic Translator Fabrice Bellard Abstract We present the internals of QEMU, a fast machine emulator using an original portable dynamic translator. It emulates several CPUs (x86,
More informationChapter 2 Basic Structure of Computers. Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan
Chapter 2 Basic Structure of Computers Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan Outline Functional Units Basic Operational Concepts Bus Structures Software
More informationFloating Point C Compiler: Tips and Tricks Part I
TMS320 DSP DESIGNER S NOTEBOOK Floating Point C Compiler: Tips and Tricks Part I APPLICATION BRIEF: SPRA229 Karen Baldwin Digital Signal Processing Products Semiconductor Group Texas Instruments June 1993
More informationAn Introduction to Computer Science and Computer Organization Comp 150 Fall 2008
An Introduction to Computer Science and Computer Organization Comp 150 Fall 2008 Computer Science the study of algorithms, including Their formal and mathematical properties Their hardware realizations
More informationFaculty of Engineering Student Number:
Philadelphia University Student Name: Faculty of Engineering Student Number: Dept. of Computer Engineering Final Exam, First Semester: 2012/2013 Course Title: Microprocessors Date: 17/01//2013 Course No:
More informationMICROPROCESSOR. Exclusive for IACE Students www.iace.co.in iacehyd.blogspot.in Ph: 9700077455/422 Page 1
MICROPROCESSOR A microprocessor incorporates the functions of a computer s central processing unit (CPU) on a single Integrated (IC), or at most a few integrated circuit. It is a multipurpose, programmable
More informationDesign of Pipelined MIPS Processor. Sept. 24 & 26, 1997
Design of Pipelined MIPS Processor Sept. 24 & 26, 1997 Topics Instruction processing Principles of pipelining Inserting pipe registers Data Hazards Control Hazards Exceptions MIPS architecture subset R-type
More informationThe Operating System and the Kernel
The Kernel and System Calls 1 The Operating System and the Kernel We will use the following terminology: kernel: The operating system kernel is the part of the operating system that responds to system
More informationIntroduction to Java
Introduction to Java The HelloWorld program Primitive data types Assignment and arithmetic operations User input Conditional statements Looping Arrays CSA0011 Matthew Xuereb 2008 1 Java Overview A high
More informationSoftware based Finite State Machine (FSM) with general purpose processors
Software based Finite State Machine (FSM) with general purpose processors White paper Joseph Yiu January 2013 Overview Finite state machines (FSM) are commonly used in electronic designs. FSM can be used
More informationMIPS Assembly Language Programming CS50 Discussion and Project Book. Daniel J. Ellard
MIPS Assembly Language Programming CS50 Discussion and Project Book Daniel J. Ellard September, 1994 Contents 1 Data Representation 1 1.1 Representing Integers........................... 1 1.1.1 Unsigned
More informationCS 106 Introduction to Computer Science I
CS 106 Introduction to Computer Science I 01 / 21 / 2014 Instructor: Michael Eckmann Today s Topics Introduction Homework assignment Review the syllabus Review the policies on academic dishonesty and improper
More informationMore 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 informationDATA ITEM DESCRIPTION
DD Form 1664, APR 89 Previous editions are obsolete Page 1 of 4 Pages 135/123 DATA ITEM DESCRIPTION Form Approved OMB NO.0704-0188 Public reporting burden for collection of this information is estimated
More informationStorage Classes CS 110B - Rule Storage Classes Page 18-1 \handouts\storclas
CS 110B - Rule Storage Classes Page 18-1 Attributes are distinctive features of a variable. Data type, int or double for example, is an attribute. Storage class is another attribute. There are four storage
More informationLecture 22: C Programming 4 Embedded Systems
Lecture 22: C Programming 4 Embedded Systems Today s Goals Basic C programming process Variables and constants in C Pointers to access addresses Using a High Level Language High-level languages More human
More informationHow To Write Portable Programs In C
Writing Portable Programs COS 217 1 Goals of Today s Class Writing portable programs in C Sources of heterogeneity Data types, evaluation order, byte order, char set, Reading period and final exam Important
More informationArithmetic in MIPS. Objectives. Instruction. Integer arithmetic. After completing this lab you will:
6 Objectives After completing this lab you will: know how to do integer arithmetic in MIPS know how to do floating point arithmetic in MIPS know about conversion from integer to floating point and from
More informationOperating Systems. Lecture 03. February 11, 2013
Operating Systems Lecture 03 February 11, 2013 Goals for Today Interrupts, traps and signals Hardware Protection System Calls Interrupts, Traps, and Signals The occurrence of an event is usually signaled
More information2) 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 informationAn Overview of Stack Architecture and the PSC 1000 Microprocessor
An Overview of Stack Architecture and the PSC 1000 Microprocessor Introduction A stack is an important data handling structure used in computing. Specifically, a stack is a dynamic set of elements in which
More informationCS 3530 Operating Systems. L02 OS Intro Part 1 Dr. Ken Hoganson
CS 3530 Operating Systems L02 OS Intro Part 1 Dr. Ken Hoganson Chapter 1 Basic Concepts of Operating Systems Computer Systems A computer system consists of two basic types of components: Hardware components,
More informationBoolean Expressions, Conditions, Loops, and Enumerations. Precedence Rules (from highest to lowest priority)
Boolean Expressions, Conditions, Loops, and Enumerations Relational Operators == // true if two values are equivalent!= // true if two values are not equivalent < // true if left value is less than the
More informationFreescale Semiconductor, I
nc. Application Note 6/2002 8-Bit Software Development Kit By Jiri Ryba Introduction 8-Bit SDK Overview This application note describes the features and advantages of the 8-bit SDK (software development
More informationUniversity of Hull Department of Computer Science. Wrestling with Python Week 01 Playing with Python
Introduction Welcome to our Python sessions. University of Hull Department of Computer Science Wrestling with Python Week 01 Playing with Python Vsn. 1.0 Rob Miles 2013 Please follow the instructions carefully.
More informationHands-on Exercise 1: VBA Coding Basics
Hands-on Exercise 1: VBA Coding Basics This exercise introduces the basics of coding in Access VBA. The concepts you will practise in this exercise are essential for successfully completing subsequent
More information10CS35: Data Structures Using C
CS35: Data Structures Using C QUESTION BANK REVIEW OF STRUCTURES AND POINTERS, INTRODUCTION TO SPECIAL FEATURES OF C OBJECTIVE: Learn : Usage of structures, unions - a conventional tool for handling a
More informationThe AVR Microcontroller and C Compiler Co-Design Dr. Gaute Myklebust ATMEL Corporation ATMEL Development Center, Trondheim, Norway
The AVR Microcontroller and C Compiler Co-Design Dr. Gaute Myklebust ATMEL Corporation ATMEL Development Center, Trondheim, Norway Abstract High Level Languages (HLLs) are rapidly becoming the standard
More informationComputer Organization. and Instruction Execution. August 22
Computer Organization and Instruction Execution August 22 CSC201 Section 002 Fall, 2000 The Main Parts of a Computer CSC201 Section Copyright 2000, Douglas Reeves 2 I/O and Storage Devices (lots of devices,
More information2.2: Bitwise Logical Operations
2.2: Bitwise Logical Operations Topics: Introduction: logical operations in C/C++ logical operations in MIPS In 256 lecture, we looked at bitwise operations in C/C++ and MIPS. We ll look at some simple
More information1. 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 informationIntel 8086 architecture
Intel 8086 architecture Today we ll take a look at Intel s 8086, which is one of the oldest and yet most prevalent processor architectures around. We ll make many comparisons between the MIPS and 8086
More informationChapter 2 Topics. 2.1 Classification of Computers & Instructions 2.2 Classes of Instruction Sets 2.3 Informal Description of Simple RISC Computer, SRC
Chapter 2 Topics 2.1 Classification of Computers & Instructions 2.2 Classes of Instruction Sets 2.3 Informal Description of Simple RISC Computer, SRC See Appendix C for Assembly language information. 2.4
More informationDEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Question Bank Subject Name: EC6504 - Microprocessor & Microcontroller Year/Sem : II/IV
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Question Bank Subject Name: EC6504 - Microprocessor & Microcontroller Year/Sem : II/IV UNIT I THE 8086 MICROPROCESSOR 1. What is the purpose of segment registers
More informationEMC Publishing. Ontario Curriculum Computer and Information Science Grade 11
EMC Publishing Ontario Curriculum Computer and Information Science Grade 11 Correlations for: An Introduction to Programming Using Microsoft Visual Basic 2005 Theory and Foundation Overall Expectations
More information2011, The McGraw-Hill Companies, Inc. Chapter 9
Chapter 9 9.1 Master Control Reset Instruction Program control instructions are used to enable or disable a block of logic program or to move execution of a program from one place to another place. Program
More informationC++ INTERVIEW QUESTIONS
C++ INTERVIEW QUESTIONS http://www.tutorialspoint.com/cplusplus/cpp_interview_questions.htm Copyright tutorialspoint.com Dear readers, these C++ Interview Questions have been designed specially to get
More informationProgramming A PLC. Standard Instructions
Programming A PLC STEP 7-Micro/WIN32 is the program software used with the S7-2 PLC to create the PLC operating program. STEP 7 consists of a number of instructions that must be arranged in a logical order
More informationBefore entering the lab, make sure that you have your own UNIX and PC accounts and that you can log into them.
1 Objective Texas A&M University College of Engineering Computer Science Department CPSC 321:501 506 Computer Architecture Fall Semester 2004 Lab1 Introduction to SPIM Simulator for the MIPS Assembly Language
More informationApplication Note 195. ARM11 performance monitor unit. Document number: ARM DAI 195B Issued: 15th February, 2008 Copyright ARM Limited 2007
Application Note 195 ARM11 performance monitor unit Document number: ARM DAI 195B Issued: 15th February, 2008 Copyright ARM Limited 2007 Copyright 2007 ARM Limited. All rights reserved. Application Note
More informationX86-64 Architecture Guide
X86-64 Architecture Guide For the code-generation project, we shall expose you to a simplified version of the x86-64 platform. Example Consider the following Decaf program: class Program { int foo(int
More information