Home Assignment 5 Assigned. Deadline 2016 March 2, Wednesday.

Slides:



Advertisements
Similar presentations
Chapter 2.
Advertisements

Microprocessors General Features To be Examined For Each Chip Jan 24 th, 2002.
Computer Structure - Computer Arithmetic Goal: Representing Numbers in Binary  Base 10 (decimal) - Numbers are represented using 10 numerals: 0, 1, 2,
TK 2633 Microprocessor & Interfacing Lecture 3: Introduction to 8085 Assembly Language Programming (2) 1 Prepared By: Associate Prof. Dr Masri Ayob.
Instruction Representation II (1) Fall 2007 Lecture 10: Instruction Representation II.
Assembly Language for Intel-Based Computers, 4th Edition
Room: E-3-31 Phone: Dr Masri Ayob TK 2633 Microprocessor & Interfacing Lecture 1: Introduction to 8085 Assembly Language.
Lecture 5 Sept 14 Goals: Chapter 2 continued MIPS assembly language instruction formats translating c into MIPS - examples.
Arithmetic I CPSC 321 Andreas Klappenecker. Administrative Issues Office hours of TA Praveen Bhojwani: M 1:00pm-3:00pm.
EET 2261 Unit 2 HCS12 Architecture
Binary Arithmetic Math For Computers.
Learning Target We are learning to use scientific notation to express large and small numbers.
CMPT 120 How computers run programs Summer 2012 Instructor: Hassan Khosravi.
CMPE 325 Computer Architecture II Cem Ergün Eastern Mediterranean University Integer Representation and the ALU.
Lecture 11: Machine Processing Intro to IT COSC1078 Introduction to Information Technology Lecture 11 Machine Processing James Harland
MIPS coding. SPIM Some links can be found such as:
IT253: Computer Organization
ZONG Wen Department of Computer Science and Engineering The Chinese University of Hong Kong
1 Introduction Chapter 1 n What is Assembly Language? n Data Representation.
Eng.Samra Essalaimeh Philadelphia University 2013/ nd Semester PIC Microcontrollers.
Lec 3: Data Representation Computer Organization & Assembly Language Programming.
Lecture Objectives: 1)Define the terms least significant bit and most significant bit. 2)Explain how unsigned integer numbers are represented in memory.
Information Representation. Reading and References Reading - Computer Organization and Design, Patterson and Hennessy Chapter 2, sec. 2.4, 2.9 (first.
CSE378 Instr. encoding.1 Instruction encoding The ISA defines –The format of an instruction (syntax) –The meaning of the instruction (semantics) Format.
Registers and MAL Lecture 12. The MAL Architecture MAL is a load/store architecture. MAL supports only those addressing modes supported by the MIPS RISC.
Working With Main Memory. Why Main Memory Register space limited Used for communication.
CSCI 136 Lab 1: 135 Review.
Chapter 19 Number Systems. Irvine, Kip R. Assembly Language for Intel-Based Computers, Translating Languages English: Display the sum of A times.
Chapter 10 The Assembly Process. What Assemblers Do Translates assembly language into machine code. Assigns addresses to all symbolic labels (variables.
Informationsteknologi Friday, September 28, 2007Computer Architecture I - Class 21 Today’s class More assembly language programming.
Copyright 2006 by Timothy J. McGuire, Ph.D. 1 MIPS Assembly Language CS 333 Sam Houston State University Dr. Tim McGuire.
ACOE2511 Assembly Language for the 80X86/Pentium Intel Microprocessors Lecturer: Dr. Konstantinos Tatas.
More on Assembly 1 CSE 2312 Computer Organization and Assembly Language Programming Vassilis Athitsos University of Texas at Arlington.
Chapter 2 CSF 2009 The MIPS Assembly Language: Introduction to Binary System.
Irvine, Kip R. Assembly Language for Intel-Based Computers 6/e, Signed Integers The highest bit indicates the sign. 1 = negative, 0 = positive.
Control Structures Computer Organization I 1 October 2009 © McQuain, Feng & Ribbens Conditional Control Structure if ( i == j ) h = i + j;
Copyright 2006 by Timothy J. McGuire, Ph.D. 1 MIPS Assembly Language CS 333 Sam Houston State University Dr. Tim McGuire.
What is a program? A sequence of steps
DR. SIMING LIU SPRING 2016 COMPUTER SCIENCE AND ENGINEERING UNIVERSITY OF NEVADA, RENO Session 9 Binary Representation and Logical Operations.
MIPS assembly syntax Home Assignment 3 Assigned. Deadline 2016 February 14, Sunday.
1 Signed Arithmetic Logical Operations Ellen Spertus MCS 111 October 1, 2002.
More on Assembly 1 CSE 2312 Computer Organization and Assembly Language Programming Vassilis Athitsos University of Texas at Arlington.
 Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in memory. 
Control Structures Computer Organization I 1 October 2009 © McQuain, Feng & Ribbens Conditional Control Structure if ( i < j ) goto A; else.
COMPUTER ARCHITECTURE & OPERATIONS I Instructor: Yaohang Li.
Software Design and Development Storing Data Computing Science.
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
Memory Access Instructions Load and Store Addressing Modes Memory Addressing. Base addressing mode. Load byte and store byte: lb, lbu, sb Address alignment.
Based on slides from D. Patterson and www-inst.eecs.berkeley.edu/~cs152/ COM 249 – Computer Organization and Assembly Language Chapter 3 Arithmetic For.
CS2100 Computer Organisation
MIPS Arithmetic is 32 bits
Loading a Single Byte There are two instructions that load a byte from a memory address. The instructions differ in how the 8-bit byte is put into the.
Microprocessor Systems Design I
Morgan Kaufmann Publishers
Microprocessor Systems Design I
Conditional Branches What distinguishes a computer from a simple calculator is its ability to make decisions Decisions are made using the if statement,
Conditional Control Structure
Lecture 4: MIPS Instruction Set
MPIS Instructions Functionalities of instructions Instruction format
MISP Assembly.
Computer Architecture & Operations I
MIPS Assembly.
Computer Instructions
Computer Architecture
3.
MIPS Assembly.
Generalities for Assembly Language
MIPS Arithmetic and Logic Instructions
Conditional Control Structure
MIPS instructions.
Presentation transcript:

Home Assignment 5 Assigned. Deadline 2016 March 2, Wednesday

Loading a Single Byte There are two instructions that load a byte from a memory address. The instructions differ in how the 8-bit byte is put into the 32-bit register. lb – load two’s complement byte lbu – load unsigned byte

 Use this instruction when the byte is regarded as an 8-bit two’s complement integer in the range and you want a 32-bit version of it.  Of course, the value of the integer does not change. lb

 The lbu instruction fills bits 8-31 of the register with zeros.  Use this instruction when the byte is regarded as an ascii character or 8-bit unsigned integer. lbu What will be in register $8 after loading the byte 0x7F By lb ? What will be in register $8 after loading the byte 0x7F By lbu ? What will be in register $8 after loading the byte 0x8F By lb ? What will be in register $8 after loading the byte 0x8F By lbu ? What will be in register $8 after loading the byte 0x7F By lb ? What will be in register $8 after loading the byte 0x7F By lbu ? What will be in register $8 after loading the byte 0x8F By lb ? What will be in register $8 after loading the byte 0x8F By lbu ?

lb example Which type of instruction is this ?

lb examples (decimal vs hex) lb $8, 0x60($10) lb $8, 96($10) lb $8, 0xFFF8($10) lb $8, -8($10) The assembler translates below assembly instruction pairs into exactly the same machine instructions. The second instruction in pairs uses signed decimal notation to specify numbers. That is much easier to use by human.

 There is a one instruction delay before the data from memory is available after load instructions.  Reaching outside of the processor chip into main memory takes time. But the processor does not wait and executes one more instruction while the load is going on. This is the load delay slot. Load delay slot lb $11, 3($8)# after lb byte comes to Reg. # after one instruction...# The data is not yet available # This is “delay slot” or $13,$0,$11 # in Reg. $11 the byte is now # available

Filling Load delay slot  Sometimes the instruction after the lb is a no-operation instruction. lb $11, 3($8)# after lb byte comes to Reg. # after one instruction sll $0,$0,0 # The data is not yet available # This is “delay slot” or $13,$0,$11 # in Register $11 the byte is # now available

lb $11, 3($8)# after lb byte comes # after one instruction ori $11, $0, 1# wrong usage of the # register in delay slot or $13,$0,$11 # What is the problem here ?  Sometimes the instruction after the lb is a useful instruction.  Sometimes it’s a dangerous one  $11 is damaged by the byte came from the memory  Always try to use simple NOP instead of complex useful instruction in delay slots. Filling Load delay slot

lb $11, 3($8)# after lb byte comes # after one instruction or $12,$0,$11# wrong usage of the # register in delay slot or $13,$0,$12 # What is the problem here ?  Sometimes the instruction after the lb is a useful instruction.  Sometimes it’s a dangerous one  $11 doesn’t contain yet the byte came from the memory Filling Load delay slot

Storing a Single Byte

ori $9,$0, 0x1234 # Prepare data sll $9,$9,16 ori $9,$9, 0xabcd ori $8,$0, 0x1000 # Prepare the address sll $8,$8,16 # in base register sb $9,0($8) # Save 0xcd at 0x srl $9,$9,8 sb $9,1($8) # Save 0xab at 0x srl $9,$9,8 sb $9,2($8) # Save 0x34 at 0x srl $9,$9,8 sb $9,3($8) # Save 0x12 at 0x lb, lbu, sb examples a bc d 1 00 $9 $8 c da b x

Example continues. Delay Slots ? lb $11, 3($8) # Positive values lb $12, 2($8) lb $16, 1($8) # Negative Values lb $17, 0($8) lbu $18, 1($8) # Unsigned load lbu $19, 0($8)  Where are NOPs in delay slots ?  Does this work properly without NOPs ? What is the difference between upper and lower pairs of instructions’ results ?