Lab 1. Warm-up : discovering the target machine, LEIA
|
|
- Terence Wade
- 5 years ago
- Views:
Transcription
1 Lab 1 Warm-up : discovering the target machine, LEIA Objective Be familiar with the LEIA 1 instruction set. Understand how it executes on the LEIA processor with the help of a simulator. Write simple programs, assemble, execute. EXERCISE #1 Lab preparation Clone the github repository for this year s labs: git clone Then: Follow the instructions of leia/readme.md to install the LEIA assembler and simulator. Some more documentation can be found in Appendix A. The files you need for this lab are in TP The LEIA processor and instruction set In the architecture course, you already saw a version of the target machine LEIA. The instruction set is depicted in Appendix A. EXERCISE #2 TD On paper, write (in LEIA assembly language) a program which initializes the r 0 register to 1 and increments it until it becomes equal to 8; using only one register. Then, write a similar program that increments it until it becomes equal to 4242, using only two registers. EXERCISE #3 TD : sum Write a program in LEIA assembly that computes the sum of the 10 first positive integers. 1.2 Assembling, disasembling EXERCISE #4 Hand assembling Assemble by hand the instructions : 1 begin: and r0 r0 0 snif r0 gt 2 jump begin You will need the set of instructions depicted in Appendix A and their associated opcode. EXERCISE #5 Hand disassembling In Figure 1.1 we depicted a toy example with its corresponding assembly code. Fill the first two rows of the table, read the rest of the solution, and answer the following questions: Which instruction is used to load data from memory? How is the pointer jumping done to create the loop? What happens to the labels in the disassembled program? In your own words describe what this program does. 1 LEIA stands for Literally Everything Is Awful Aurore Alcolei, Laure Gonnord, Valentin Lorentz. 1/8
2 ENS de Lyon, Département Informatique, M1 CAP Lab #1 Automne 2017 Address Content Binary Instructions pseudo-code c letl r2 9 R (label data) 0003 f rmem r3 [r2] R 3 mem[r 2 ] (content at label data) loop: add r1 r1 2 R 1 R b sub r3, r3 1 R 3 R f snif r3 le 0 if R 3 0 skip next statement 0007 bffd jump -3 jump to loop label 0008 b jump 0 HALT data: data - Figure 1.1: A binary/hexadecimal program (tp1-1.obj) 1.3 LEIA Simulator EXERCISE #6 Run the simulator with the hex code Run the simulation step-by-step on the file tp1-1.obj : $</path/to/simucode/>leia -s tp1-1.obj Carefully follow each step of the execution. Until now, we have written programs by putting the encoded instructions directly into the memory. From now on, we are going to write programs using an easier approach. We are going to write instructions using the LEIA assembly. EXERCISE #7 Execution and modification 1. First test assembling and terminal simulation step by step with on the file tp1-simple.s $python3 <path/to/assemblycode/>asm.py tp1-simple.s assembling tp1-simple.s $</path/to/simucode/>leia s tp1-simple.obj 1.set r2 data rmem r1 [r2] jump 0 data:.word 7 Listing 1.1: tp1-simple.s 2. Guess the purpose of the following files: tp1-3a.s et tp1-3b.s. Check with the simulator. What is the difference between the primitives putchar and printstr, that are provided by the operating system? call clearscr.let r4 1.let r0 0x0000 Listing 1.2: tp1-3a.s Aurore Alcolei, Laure Gonnord, Valentin Lorentz. 2/8
3 ENS de Lyon, Département Informatique, M1 CAP Lab #1 Automne 2017.let r let r2 95.set r3 HELLO call putstr refresh.let r let r2 85.set r3 COURSE call putstr refresh ; putstr code is in lib.s ; putstr code is in lib.s 15 jump 0 HELLO:.string "Hello" COURSE: 20.string "CAP ENSL !" #include lib.s Listing 1.3: tp1-3b.s ;; graphical "reserved" registers: r1,2,3,4 2 ;; r12 for the star call clearscr.let r4 1.let r0 0x0000.let r let r1 10.set r10 star ; takes - not affected.set r14 N rmem r6 [r14] ; loop counter init=n loopi: 12 rmem r3 [r10] copy r13 r6 copy r12 r2 copy r11 r1 call putchar 17 refresh copy r1 r11 copy r2 r12 copy r6 r13 add r1 r sub r6 r6 1 snif r6 eq 0 jump loopi jump 0 ; store the context before call 27 star:.word 42 N:.word 4 ; ascii for '*' 32 #include lib.s Aurore Alcolei, Laure Gonnord, Valentin Lorentz. 3/8
4 ENS de Lyon, Département Informatique, M1 CAP Lab # Automne print "Compiling is fun!".let r1 42 print r1.let r1 666 print r1 6 jump 0 Listing 1.4: tp1-3c.s 3. Write a program in LEIA assembly that computes the min and max of two integers, and stores the result in a precise location of the memory that has the label min. Try with different values. 1.4 More advanced assembly code! EXERCISE #8 Algo in LEIA assembly Write and execute the following programs in assembly : Draw squares and triangles of stars (character * ) of size n, n being given by the user. Count the number of non-nul bits of a given integer. Aurore Alcolei, Laure Gonnord, Valentin Lorentz. 4/8
5 Appendix A LEIA Assembly Documentation (ISA) Source: ISA: Florent de Dinechin, Nicolas Louvet, Antoine Plet, for ASR1, ENSL, Simulator: Pierre Oechsel and Guillaume Duboc, L3 students at ENSL, A.1 Installing the simulator and getting started To get the LEIA assembler and simulator, follow instructions of the first Lab (git pull on the course lab repository). A.2 The LEIA architecture Here is an example of LEIA assembly code for 2017: letl r0 17 ; initialisation of a register loop: wmem r13 [r0] ; write in memory 4 rmem r13 [r2] ; read in memory add r0 r10 r11 ; add snif r0 eq 3 ; test : if r0 = 3 skip next instruction jump loop ; equivalent to jump -3, and this is a comment xor r0 r0-1 Memory, Registers The memory is shared into words of 16 bits, with address of size 16 bits (from (0000) H to (FFFF) H ). The LEIA has 16 generalistic registers. Only R15 1 is reserved for the routine return address. They are also specific 16 bits registers: PC (Program Counter), IR (Instruction Register). Constants: leth and letl These expressions provide ways to initialize registers. The constant is encoded in the bits 0 to 7. For the letl instruction, bit 7 (sign bit) of the constant is replicated into the bits 8 to 15 of the destination register. Thus: letl r0 xx stores the constant xx in register r0, provided xx between -128 and 127. The leth instruction stores the 8 bit constant in the bits 8 to 15 of the destination register, the other bits being unchanged. Thus: letl r0 2 leth r0 3 stores in r0 the constant = 770. The LEIA assembler tool provides a macro:.let r0 770 to generate these two instructions automatically. 1 registers are indifferently in capital letters or in lower case. Aurore Alcolei, Laure Gonnord, Valentin Lorentz. 5/8
6 ENS de Lyon, Département Informatique, M1 CAP Lab #A Automne 2017 Table A.1: All LEIA instructions mnemonic class description ext(i ) wmem wmem write to memory add ALU addition z(i ) sub ALU subtraction z(i ) snif snif skip next if s(i ) and ALU logical bitwise and s(i ) or ALU logical bitwise or s(i ) xor ALU logical bitwise xor s(i ) lsl ALU logical shift left z(i ) lsr ALU logical shift right z(i ) asr ALU arithmetic shift right z(i ) call call sub-routine call jump jump relative jump if offset 1 return return from call if offset = letl letl 8-bit constant to Rd, sign-extended leth leth 8-bit constant to high half of Rd print print print or refresh rmem rmem read from memory if i=0 copy register-to-register copy if i=1 notation d i j meaning a 3 or 4 bit number that specifies the destination register a 4-bit number (bits 4 to 7 of the instruction word), the number of the first operand register a 4-bit number Table A.2: Notations Arithmetical and logical instructions add r1 r0 3 add r1 r2 r1 ; add immediate ; add registers Arithmetical and logical instructions have 3 operands: The first operand is the destination register, and the two remaining operands are sources: either two registers (if the bit 11 is 0) or a register and an immediate constant j of 4 bits (if the bit 11 is 1). Because of the restricted number of bits to describe the first operand, the destination register can only be one of the first eight registers (from r0 to r7). If a constant is used then it is extended into a 16 bit constant before the operation. This is documented in the last column of table A.1: z(j ) means that j is extended with zeros. In other words j is interpreted as a positive integer. s(j ) means that the bit 3 (sign bit) of j is replicated into bits 4 to 15: j is interpreted as a signed integer and is transformed into a 16 bits integer of the same value. Thus the result of the instruction: add r1 r0-1 is not really what is expected. The constant j = 1 is encoded as 1111, extended as z(j ) = , thus the sum should be done with the 31 constant. The assembler tool throws an error in that case: instruction add: Number, Not in bound: [0, 15] Branching Let a be the instruction s address, and c the integer encoded in the bits 0 to 11 of the instruction s word. The call instruction makes a copy of a + 1 into r 15 then executes pc c 16. Thus procedures should have addresses that are multiple of 16. The jump instruction considers the constant c as a signed integer (thus between and 2047) and executes pc a + c except if c = 1, in which case it executes pc r 15. In this case we can use the mnemonic return. Aurore Alcolei, Laure Gonnord, Valentin Lorentz. 6/8
7 ENS de Lyon, Département Informatique, M1 CAP Lab #A Automne 2017 Table A.3: Encoding per instruction class class action ALU reg r d r i op r j opcode 0 d i j ALU imm4 r d r i op ext(j ) opcode 1 d i j snif skip next if c/r condition i j letl r d s(b) d b leth r d [15..8] b d b call jump to the routine c jump jump c return return to calling routine wmem mem[r j ] r i i j rmem r d mem[r j ] d j copy r d r j d j print reg print (the numerical content of) r i i print char print c ascii(c) refresh wait Tests: snif skip next if The snif op1 <condition> op2 instruction deactivates the next instruction if the condition is true. Operands 1 and 2 are encoded like in the ALU instructions. In particular the second operand can be an immediate constant, which sign will be extended. The condition is encoded thanks to the following table: mnemonic description eq equal, op1 = op neq not equal, op1 op sgt signed greater than, op1 > op2, two s complement slt signed smaller than, op1 < op2, two s complement gt op1 > op2, unsigned ge op1 op2, unsigned lt op1 < op2, unsigned le op1 op2, unsigned Let us illustrate the difference between sgt et gt: if R 0 contains 0, then: snif r0 gt -1 is false, but snif r0 sgt -1 is true. In fact, the 1 constant is extended as ffff (hexa), which is interpreted as by gt, and -1 by sgt. Memory accesses The memory address is always specified in the r j register encoded in bits 0 to 3. The instruction rmem rd [rj] copies in the destination register (coded in bits 8 to 11) the content of the memory at address r j. The instruction wmem ri [rj] copies the content of the register r i (coded in bits 4 to 7) in the memory cell whose address is stored inside rj. Register management Some registers cannot be used with arithmetic and logical instructions, yet it is possible to use them to store a result thanks to the copy instruction. This instruction is also usefull before function calls to quickly save registers that are known to be used by the function. Print print r1 print 'z' Two examples of use of the native print instruction: ; prints the content of r1 (numerical value) ; prints the character 'z' Aurore Alcolei, Laure Gonnord, Valentin Lorentz. 7/8
8 ENS de Lyon, Département Informatique, M1 CAP Lab #A Automne 2017 Assembly directives A bit more of syntax: The assembly begins at address 0. Labels can be used for jumps. Warning, for the compiler to work properly, do not type anything else than the label on its line, followed by a colon :. The keyword.word xxxx reserves a memory cell initialized to the 16 bit constant xxxx. The keyword.reserve xxxx reserves n memory cells initialized to 0. The keyword.string Hello reserves 6 memory cells and store the ascii numbers corresponding to all the characters of the message (ending it with a Null character). The keyword.align16 pads memory cells in order for the next line to be at an address multiple of 16. The macro.let r3 585 stores the constant 585 in register 3 (see paragraph A.2) The macro.set r3 label loads the address corresponding to label onto r3. For instance, the following program:.set r0 foo foo: 3.word 42 is assembled into: c002 ; letl r0 2 (because 42 is stored at line 2) d000 ; leth r a ; the 42 constant From Lab 5 we will be using a stack. The address of its top will be stored in r 7 and we will use the following macros: The macro.push ri that pushes the content of the r i register into the memory. It is equivalent to: sub r7 r7 1 2 wmem ri [r7] ; The macro.pop ri that does the converse: rmem ri [r7] add r7 r7 1 A.3 Help to encode constants hex to binary a b c d e f s complement Let us code n = ( 3) 10 in 2 s complement on 6 bits, with the recipe: code -n in base 2, then negate bitwise, then add one. First, 3 is encoded as on 6 bits. Its negation is , thus ( 3) 10 = A.4 The graphical library Coordinates of the screen start on the bottom left corner of the screen ( (0,0) x y ) cleanscr: does what it is supposed to do. Uses register r 1. putstr: puts a string on the screen at coordinates (r 1, r 2 ) ; the string address is in register r3 ; if r 4 is not 1 then refresh between each letter. Uses registers 1, 2, 3, 6, 14, 15 and those of putchar. An example can be found in Lab 1. putchar: puts a char on the screen at coordinates (r 1, r 2 ). Uses registers r1 to r6. An example can be found in Lab 1. refresh: refreshes the screen. Aurore Alcolei, Laure Gonnord, Valentin Lorentz. 8/8
Lab 5. Syntax-Directed Code Generation
Lab 5 Syntax-Directed Code Generation Objective Generate 3-address code for the Mu language. Generate executable dummy LEIA from programs in Mu via 2 simple allocation algorithms. Student files are in
More informationLab 1. Warm-up : Python and the target machine : LEIA
Lab 1 Warm-up : Python and the target machine : LEIA Objective Start with Python. Be familiar with the LEIA 1 instruction set. Understand how it executes on the LEIA processor with the help of a simulator.
More informationLab 1. Warm-up : discovering the target machine, LC-3
Lab 1 Warm-up : discovering the target machine, LC-3 Credits This sequence of compilation labs has been inspired by those designed by C. Alias and G. Iooss in 2013/14. In 2016/17 we changed the support
More information2.2 THE MARIE Instruction Set Architecture
2.2 THE MARIE Instruction Set Architecture MARIE has a very simple, yet powerful, instruction set. The instruction set architecture (ISA) of a machine specifies the instructions that the computer can perform
More informationCompilation: a bit about the target architecture
Compilation: a bit about the target architecture MIF08 Laure Gonnord Laure.Gonnord@univ-lyon1.fr Plan 1 The LEIA architecture in a nutshell 2 One example Laure Gonnord (Lyon1/FST) Compilation: a bit about
More informationChapter 13. The ISA of a simplified DLX Why use abstractions?
Chapter 13 The ISA of a simplified DLX In this chapter we describe a specification of a simple microprocessor called the simplified DLX. The specification is called an instruction set architecture (ISA).
More information11. A Computing Machine
COMPUTER SCIENCE S E D G E W I C K / W A Y N E Computer Science Including Programming in Java 11. A Computing Machine Section 5.1 http://introcs.cs.princeton.edu COMPUTER SCIENCE S E D G E W I C K / W
More informationARM Shift Operations. Shift Type 00 - logical left 01 - logical right 10 - arithmetic right 11 - rotate right. Shift Amount 0-31 bits
ARM Shift Operations A novel feature of ARM is that all data-processing instructions can include an optional shift, whereas most other architectures have separate shift instructions. This is actually very
More informationComparison InstruCtions
Status Flags Now it is time to discuss what status flags are available. These five status flags are kept in a special register called the Program Status Register (PSR). The PSR also contains other important
More informationThe PAW Architecture Reference Manual
The PAW Architecture Reference Manual by Hansen Zhang For COS375/ELE375 Princeton University Last Update: 20 September 2015! 1. Introduction The PAW architecture is a simple architecture designed to be
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 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 informationPart 1 (70% of grade for homework 2): MIPS Programming: Simulating a simple computer
CS 465 - Homework 2 Fall 2016 Profs. Daniel A. Menasce and Yutao Zhong Team Allowed: maximum of two per team. State clearly team member names and GMU IDs as comments in source code and each page of submitted
More informationARM Assembly Language. Programming
Outline: ARM Assembly Language the ARM instruction set writing simple programs examples Programming hands-on: writing simple ARM assembly programs 2005 PEVE IT Unit ARM System Design ARM assembly language
More informationThe CPU and Memory. How does a computer work? How does a computer interact with data? How are instructions performed? Recall schematic diagram:
The CPU and Memory How does a computer work? How does a computer interact with data? How are instructions performed? Recall schematic diagram: 1 Registers A register is a permanent storage location within
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 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 informationDigital Logic Design: a rigorous approach c
Digital Logic Design: a rigorous approach c Chapter 21: The ISA of a Simplified DLX Guy Even Moti Medina School of Electrical Engineering Tel-Aviv Univ. June 13, 2016 Book Homepage: http://www.eng.tau.ac.il/~guy/even-medina
More informationSTEVEN R. BAGLEY ARM: PROCESSING DATA
STEVEN R. BAGLEY ARM: PROCESSING DATA INTRODUCTION CPU gets instructions from the computer s memory Each instruction is encoded as a binary pattern (an opcode) Assembly language developed as a human readable
More informationComputer Organization CS 206 T Lec# 2: Instruction Sets
Computer Organization CS 206 T Lec# 2: Instruction Sets Topics What is an instruction set Elements of instruction Instruction Format Instruction types Types of operations Types of operand Addressing mode
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 informationTopic Notes: MIPS Instruction Set Architecture
Computer Science 220 Assembly Language & Comp. Architecture Siena College Fall 2011 Topic Notes: MIPS Instruction Set Architecture vonneumann Architecture Modern computers use the vonneumann architecture.
More informationRaspberry Pi / ARM Assembly. OrgArch / Fall 2018
Raspberry Pi / ARM Assembly OrgArch / Fall 2018 The Raspberry Pi uses a Broadcom System on a Chip (SoC), which is based on an ARM CPU. https://en.wikipedia.org/wiki/arm_architecture The 64-bit ARM processor
More informationArithmetic and Bitwise Operations on Binary Data
Arithmetic and Bitwise Operations on Binary Data CSCI 2400: Computer Architecture ECE 3217: Computer Architecture and Organization Instructor: David Ferry Slides adapted from Bryant & O Hallaron s slides
More informationComputer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: MIPS Instruction Set Architecture
Computer Science 324 Computer Architecture Mount Holyoke College Fall 2009 Topic Notes: MIPS Instruction Set Architecture vonneumann Architecture Modern computers use the vonneumann architecture. Idea:
More informationProcessor Status Register(PSR)
ARM Registers Register internal CPU hardware device that stores binary data; can be accessed much more rapidly than a location in RAM ARM has 13 general-purpose registers R0-R12 1 Stack Pointer (SP) R13
More informationWe will study the MIPS assembly language as an exemplar of the concept.
MIPS Assembly Language 1 We will study the MIPS assembly language as an exemplar of the concept. MIPS assembly instructions each consist of a single token specifying the command to be carried out, and
More informationAnnouncements HW1 is due on this Friday (Sept 12th) Appendix A is very helpful to HW1. Check out system calls
Announcements HW1 is due on this Friday (Sept 12 th ) Appendix A is very helpful to HW1. Check out system calls on Page A-48. Ask TA (Liquan chen: liquan@ece.rutgers.edu) about homework related questions.
More informationChapter 2A Instructions: Language of the Computer
Chapter 2A Instructions: Language of the Computer Copyright 2009 Elsevier, Inc. All rights reserved. Instruction Set The repertoire of instructions of a computer Different computers have different instruction
More informationComputer Architecture /
Computer Architecture 02-201 / 02-601 The Conceptual Architecture of a Computer PC CPU register 0 register 1 register 2 registers hold small amounts of data for processing by the CPU Reading / writing
More informationMath 230 Assembly Programming (AKA Computer Organization) Spring 2008
Math 230 Assembly Programming (AKA Computer Organization) Spring 2008 MIPS Intro II Lect 10 Feb 15, 2008 Adapted from slides developed for: Mary J. Irwin PSU CSE331 Dave Patterson s UCB CS152 M230 L10.1
More informationInstruction Set Architecture
C Fortran Ada etc. Basic Java Instruction Set Architecture Compiler Assembly Language Compiler Byte Code Nizamettin AYDIN naydin@yildiz.edu.tr http://www.yildiz.edu.tr/~naydin http://akademik.bahcesehir.edu.tr/~naydin
More informationChapter 2. Instruction Set. RISC vs. CISC Instruction set. The University of Adelaide, School of Computer Science 18 September 2017
COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface RISC-V Edition Chapter 2 Instructions: Language of the Computer These slides are based on the slides by the authors. The slides doesn t
More information3 Assembly Programming (Part 2) Date: 07/09/2016 Name: ID:
3 Assembly Programming (Part 2) 43 Date: 07/09/2016 Name: ID: Name: ID: 3 Assembly Programming (Part 2) This laboratory session discusses about Secure Shell Setup and Assembly Programming. The students
More informationChapter 1. Computer Abstractions and Technology. Lesson 3: Understanding Performance
Chapter 1 Computer Abstractions and Technology Lesson 3: Understanding Performance Manufacturing ICs 1.7 Real Stuff: The AMD Opteron X4 Yield: proportion of working dies per wafer Chapter 1 Computer Abstractions
More informationTrap Vector Table. Interrupt Vector Table. Operating System and Supervisor Stack. Available for User Programs. Device Register Addresses
Chapter 1 The LC-3b ISA 1.1 Overview The Instruction Set Architecture (ISA) of the LC-3b is defined as follows: Memory address space 16 bits, corresponding to 2 16 locations, each containing one byte (8
More informationDepartment of Computer and Mathematical Sciences. Lab 4: Introduction to MARIE
Department of Computer and Mathematical Sciences CS 3401 Assembly Language 4 Lab 4: Introduction to MARIE Objectives: The main objective of this lab is to get you familiarized with MARIE a simple computer
More informationSparse Notes on an MIPS Processor s Architecture and its Assembly Language
Sparse Notes on an MIPS Processor s Architecture and its Assembly Language February 6, 2004 1 Introduction In this notes we are not going in details with the architecture of an MIPS processor, but only
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 informationProgramming refresher and intro to C programming
Applied mechatronics Programming refresher and intro to C programming Sven Gestegård Robertz sven.robertz@cs.lth.se Department of Computer Science, Lund University 2018 Outline 1 C programming intro 2
More informationEE251: Tuesday September 5
EE251: Tuesday September 5 Shift/Rotate Instructions Bitwise logic and Saturating Instructions A Few Math Programming Examples ARM Assembly Language and Assembler Assembly Process Assembly Structure Assembler
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 informationNotes: The Marie Simulator
The Accumulator (AC) is the register where calculations are performed. To add two numbers together, a) load the first number into the accumulator with a Load instruction b) Add the second number to the
More informationComputer Systems and -architecture
Computer Systems and -architecture Project 5: Datapath 1 Ba INF 2018-2019 Brent van Bladel brent.vanbladel@uantwerpen.be Don t hesitate to contact the teaching assistant of this course. M.G.305 or by e-mail.
More informationChapter 2. Instructions: Language of the Computer. Adapted by Paulo Lopes
Chapter 2 Instructions: Language of the Computer Adapted by Paulo Lopes Instruction Set The repertoire of instructions of a computer Different computers have different instruction sets But with many aspects
More informationComputer Organization and Structure. Bing-Yu Chen National Taiwan University
Computer Organization and Structure Bing-Yu Chen National Taiwan University Instructions: Language of the Computer Operations and Operands of the Computer Hardware Signed and Unsigned Numbers Representing
More informationInstruction Sets: Characteristics and Functions Addressing Modes
Instruction Sets: Characteristics and Functions Addressing Modes Chapters 10 and 11, William Stallings Computer Organization and Architecture 7 th Edition What is an Instruction Set? The complete collection
More informationChapter 3 Machine Instructions & Programs. Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan
Chapter 3 Machine Instructions & Programs Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan Outline Numbers, Arithmetic Operations, and Characters Memory Locations
More informationCS401 - Computer Architecture and Assembly Language Programming Glossary By
CS401 - Computer Architecture and Assembly Language Programming Glossary By absolute address : A virtual (not physical) address within the process address space that is computed as an absolute number.
More informationMIPS (SPIM) Assembler Syntax
MIPS (SPIM) Assembler Syntax Comments begin with # Everything from # to the end of the line is ignored Identifiers are a sequence of alphanumeric characters, underbars (_), and dots () that do not begin
More informationLab8: SAM Assembler and Simulator
Lab8: SAM Assembler and Simulator Due Date: Wednesday April 29th 2009 by midnight Background: The Instruction Set Architecture (ISA) provides a view of a processor's features as seen from the perspective
More informationThe MARIE Architecture
The MARIE Machine Architecture that is Really Intuitive and Easy. We now define the ISA (Instruction Set Architecture) of the MARIE. This forms the functional specifications for the CPU. Basic specifications
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 informationappendix a The LC-3 ISA A.1 Overview
A.1 Overview The Instruction Set Architecture (ISA) of the LC-3 is defined as follows: Memory address space 16 bits, corresponding to 2 16 locations, each containing one word (16 bits). Addresses are numbered
More informationArithmetic and Bitwise Operations on Binary Data
Arithmetic and Bitwise Operations on Binary Data CSCI 224 / ECE 317: Computer Architecture Instructor: Prof. Jason Fritts Slides adapted from Bryant & O Hallaron s slides 1 Boolean Algebra Developed by
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 2016 1 ISA is the HW/SW
More informationReview 1/2 MIPS assembly language instructions mapped to numbers in 3 formats. CS61C Negative Numbers and Logical Operations R I J.
CS61C Negative Numbers and Logical Operations cs 61C L7 Number.1 Lecture 7 February 10, 1999 Dave Patterson (http.cs.berkeley.edu/~patterson) www-inst.eecs.berkeley.edu/~cs61c/schedule.html Review 1/2
More informationOverview of the MIPS Architecture: Part I. CS 161: Lecture 0 1/24/17
Overview of the MIPS Architecture: Part I CS 161: Lecture 0 1/24/17 Looking Behind the Curtain of Software The OS sits between hardware and user-level software, providing: Isolation (e.g., to give each
More informationNumber Systems for Computers. Outline of Introduction. Binary, Octal and Hexadecimal numbers. Issues for Binary Representation of Numbers
Outline of Introduction Administrivia What is computer architecture? What do computers do? Representing high level things in binary Data objects: integers, decimals, characters, etc. Memory locations (We
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 informationTopic 10: Instruction Representation
Topic 10: Instruction Representation CSE 30: Computer Organization and Systems Programming Summer Session II Dr. Ali Irturk Dept. of Computer Science and Engineering University of California, San Diego
More informationComputer Organization II CMSC 3833 Lecture 33
Term MARIE Definition Machine Architecture that is Really Intuitive and Easy 4.8.1 The Architecture Figure s Architecture Characteristics: Binary, two s complement Stored program, fixed word length Word
More informationArchitecture. Digital Computer Design
Architecture Digital Computer Design Architecture The architecture is the programmer s view of a computer. It is defined by the instruction set (language) and operand locations (registers and memory).
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 informationThe LC-3 Instruction Set Architecture. ISA Overview Operate instructions Data Movement instructions Control Instructions LC-3 data path
Chapter 5 The LC-3 Instruction Set Architecture ISA Overview Operate instructions Data Movement instructions Control Instructions LC-3 data path A specific ISA: The LC-3 We have: Reviewed data encoding
More informationCS311 Lecture: The Architecture of a Simple Computer
CS311 Lecture: The Architecture of a Simple Computer Objectives: July 30, 2003 1. To introduce the MARIE architecture developed in Null ch. 4 2. To introduce writing programs in assembly language Materials:
More informationECE 30 Introduction to Computer Engineering
ECE 30 Introduction to Computer Engineering Study Problems, Set #3 Spring 2015 Use the MIPS assembly instructions listed below to solve the following problems. arithmetic add add sub subtract addi add
More informationLevels of Programming. Registers
Levels of Programming COSC 2021: Computer Organization Instructor: Dr. Amir Asif Department of Computer Science York University Handout # 3: MIPS Instruction Set I Topics: 1. Arithmetic Instructions 2.
More informationThe Assembly Language of the Boz 5
The Assembly Language of the Boz 5 The Boz 5 uses bits 31 27 of the IR as a five bit opcode. Of the possible 32 opcodes, only 26 are implemented. Op-Code Mnemonic Description 00000 HLT Halt the Computer
More informationCOSC 6385 Computer Architecture. Instruction Set Architectures
COSC 6385 Computer Architecture Instruction Set Architectures Spring 2012 Instruction Set Architecture (ISA) Definition on Wikipedia: Part of the Computer Architecture related to programming Defines set
More information3. Instruction Set Architecture The MIPS architecture
3. Instruction Set Architecture The MIPS architecture EECS 370 Introduction to Computer Organization Winter 2007 Prof. Valeria Bertacco & Prof. Scott Mahlke EECS Department University of Michigan in Ann
More informationTopics Power tends to corrupt; absolute power corrupts absolutely. Computer Organization CS Data Representation
Computer Organization CS 231-01 Data Representation Dr. William H. Robinson November 12, 2004 Topics Power tends to corrupt; absolute power corrupts absolutely. Lord Acton British historian, late 19 th
More informationCSCE 5610: Computer Architecture
HW #1 1.3, 1.5, 1.9, 1.12 Due: Sept 12, 2018 Review: Execution time of a program Arithmetic Average, Weighted Arithmetic Average Geometric Mean Benchmarks, kernels and synthetic benchmarks Computing CPI
More informationMore about Binary 9/6/2016
More about Binary 9/6/2016 Unsigned vs. Two s Complement 8-bit example: 1 1 0 0 0 0 1 1 2 7 +2 6 + 2 1 +2 0 = 128+64+2+1 = 195-2 7 +2 6 + 2 1 +2 0 = -128+64+2+1 = -61 Why does two s complement work this
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 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 informationSOME ASSEMBLY REQUIRED
SOME ASSEMBLY REQUIRED Assembly Language Programming with the AVR Microcontroller TIMOTHY S. MARGUSH CRC Press Taylor & Francis Group CRC Press is an imprint of the Taylor & Francis Croup an Informa business
More informationCOMPUTER ORGANIZATION & ARCHITECTURE
COMPUTER ORGANIZATION & ARCHITECTURE Instructions Sets Architecture Lesson 5a 1 What are Instruction Sets The complete collection of instructions that are understood by a CPU Can be considered as a functional
More informationInstructions: Assembly Language
Chapter 2 Instructions: Assembly Language Reading: The corresponding chapter in the 2nd edition is Chapter 3, in the 3rd edition it is Chapter 2 and Appendix A and in the 4th edition it is Chapter 2 and
More informationBinary Logic (review)
Binary Logic (review) Basic logical operators: (Chapter 7 expanded) NOT AND outputs 1 only if both inputs are 1 OR outputs 1 if at lest one input is 1 XOR outputs 1 if exactly one input is 1 a not 0 1
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 informationRun time environment of a MIPS program
Run time environment of a MIPS program Stack pointer Frame pointer Temporary local variables Return address Saved argument registers beyond a0-a3 Low address Growth of stack High address A translation
More informationCSE 378 Midterm 2/12/10 Sample Solution
Question 1. (6 points) (a) Rewrite the instruction sub $v0,$t8,$a2 using absolute register numbers instead of symbolic names (i.e., if the instruction contained $at, you would rewrite that as $1.) sub
More informationBasic Processor Design
Basic Processor Design Design Instruction Set Design Datapath Design Control Unit This lecture deals with Instruction Set Design. 1001 Instruction Set Terminology Mnemonic (Instruction Name) SUBI Syntax
More informationCS 61C: Great Ideas in Computer Architecture Introduction to Assembly Language and RISC-V Instruction Set Architecture
CS 61C: Great Ideas in Computer Architecture Introduction to Assembly Language and RISC-V Instruction Set Architecture Instructors: Krste Asanović & Randy H. Katz http://inst.eecs.berkeley.edu/~cs61c 9/7/17
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 informationAssembly language Simple, regular instructions building blocks of C, Java & other languages Typically one-to-one mapping to machine language
Assembly Language Readings: 2.1-2.7, 2.9-2.10, 2.14 Green reference card Assembly language Simple, regular instructions building blocks of C, Java & other languages Typically one-to-one mapping to machine
More informationMIPS 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 informationLC-3 Instruction Set Architecture
CMPE12 Notes LC-3 Instruction Set Architecture (Textbookʼs Chapter 5 and 6)# Instruction Set Architecture# ISA is all of the programmer-visible components and operations of the computer.# memory organization#
More informationCharacter Is a byte quantity (00~FF or 0~255) ASCII (American Standard Code for Information Interchange) Page 91, Fig. 2.21
2.9 Communication with People: Byte Data & Constants Character Is a byte quantity (00~FF or 0~255) ASCII (American Standard Code for Information Interchange) Page 91, Fig. 2.21 32: space 33:! 34: 35: #...
More 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 informationComputer Organisation CS303
Computer Organisation CS303 Module Period Assignments 1 Day 1 to Day 6 1. Write a program to evaluate the arithmetic statement: X=(A-B + C * (D * E-F))/G + H*K a. Using a general register computer with
More informationThe Bluff Machine (Single Module Version)
Purdue University Purdue e-pubs Department of Computer Science Technical Reports Department of Computer Science 1984 The Bluff Machine (Single Module Version) John T. Korb Purdue University, jtk@cs.purdue.edu
More informationCHAPTER 5 A Closer Look at Instruction Set Architectures
CHAPTER 5 A Closer Look at Instruction Set Architectures 5.1 Introduction 199 5.2 Instruction Formats 199 5.2.1 Design Decisions for Instruction Sets 200 5.2.2 Little versus Big Endian 201 5.2.3 Internal
More informationLEO-1 Homebrew Computer
LEO-1 Homebrew Computer Architecture Rev 1.10, 5th January 2017, John Croudy The LEO-1 is a complete 16-bit computer system featuring the LEO-1 CPU, a custom-designed CPU. This CPU s architecture was inspired
More information2010 Summer Answers [OS I]
CS2503 A-Z Accumulator o Register where CPU stores intermediate arithmetic results. o Speeds up process by not having to store these results in main memory. Addition o Carried out by the ALU. o ADD AX,
More informationEE 361 University of Hawaii Fall
C functions Road Map Computation flow Implementation using MIPS instructions Useful new instructions Addressing modes Stack data structure 1 EE 361 University of Hawaii Implementation of C functions and
More informationCSCI 2212: Intermediate Programming / C Chapter 15
... /34 CSCI 222: Intermediate Programming / C Chapter 5 Alice E. Fischer October 9 and 2, 25 ... 2/34 Outline Integer Representations Binary Integers Integer Types Bit Operations Applying Bit Operations
More informationThomas Polzer Institut für Technische Informatik
Thomas Polzer tpolzer@ecs.tuwien.ac.at Institut für Technische Informatik Branch to a labeled instruction if a condition is true Otherwise, continue sequentially beq rs, rt, L1 if (rs == rt) branch to
More information