Computer Organization CS345 David Monismith Based upon notes by Dr. Bill Siever and notes from the Patternson and Hennessy Text.

Slides:



Advertisements
Similar presentations
Catch up on previous topics Summary and putting together first four classes.
Advertisements

Integer Arithmetic: Multiply, Divide, and Bitwise Operations
MIPS Assembly Language CPSC 321 Computer Architecture Andreas Klappenecker.
Computer Organization CS345 David Monismith Based upon notes by Dr. Bill Siever and notes from the Patternson and Hennessy Text.
I/O: SPARC Assembly Department of Computer Science Georgia State University Georgia State University Updated Spring 2014.
SPIM and MIPS programming
Fall EE 333 Lillevik 333f06-l4 University of Portland School of Engineering Computer Organization Lecture 4 Assembly language programming ALU and.
MIPS Function Continued
MIPS Assembly Language Programming
IT253: Computer Organization Lecture 6: Assembly Language and MIPS: Programming Tonga Institute of Higher Education.
Assembly Language Working with the CPU.
1 COMS 361 Computer Organization Title: Instructions Date: 9/28/2004 Lecture Number: 10.
Computer Organization CS345 David Monismith Based upon notes by Dr. Bill Siever and notes from the Patternson and Hennessy Text.
Data Representation Computer Organization &
Data Representation COE 205
CS 300 – Lecture 6 Intro to Computer Architecture / Assembly Language Instructions.
Computer Organization CS345 David Monismith Based upon notes by Dr. Bill Siever and notes from the Patterson and Hennessy Text.
Binary Numbers.
Computer Organization - Syscalls David Monismith Jan. 28, 2015 Based on notes from Patterson and Hennessy Text and from Dr. Bill Siever.
Computer Organization CS345 David Monismith Based upon notes by Dr. Bill Siever and notes from the Patternson and Hennessy Text.
Computers Organization & Assembly Language
Numbering Systems CS208.
Number Systems Part 2 Numerical Overflow Right and Left Shifts Storage Methods Subtraction Ranges.
Computer Organization CS345 David Monismith Based upon notes by Dr. Bill Siever and notes from the Patterson and Hennessy Text.
EX_01.1/46 Numeric Systems. EX_01.2/46 Overview Numeric systems – general, Binary numbers, Octal numbers, Hexadecimal system, Data units, ASCII code,
Lec 3: Data Representation Computer Organization & Assembly Language Programming.
CSCI 136 Lab 1: 135 Review.
Computer Organization CS345 David Monismith Based upon notes by Dr. Bill Siever and notes from the Patternson and Hennessy Text.
Computer Organization – Memory Access David Monismith Jan. 30, 2015 Based upon notes by Dr. Bill Siever and the Patterson and Hennessy Text.
Ch2b- 2 EE/CS/CPE Computer Organization  Seattle Pacific University Thanks for all the Memory! When 32 registers just won’t do. Many times (almost.
MIPS coding. Review Shifting – Shift Left Logical (sll) – Shift Right Logical (srl) – Moves all of the bits to the left/right and fills in gap with 0’s.
Computer Organization CS345 David Monismith Based upon notes by Dr. Bill Siever and notes from the Patternson and Hennessy Text.
Lecture 161 Lets examine a SPIM program in detail. io.asm This program is a simple routine which demonstrates input/output using assembly code. SPIM.
Computer Architecture CSE 3322 Lecture 3 Assignment: 2.4.1, 2.4.4, 2.6.1, , Due 2/3/09 Read 2.8.
9/29: Lecture Topics Conditional branch instructions
Irvine, Kip R. Assembly Language for Intel-Based Computers 6/e, Signed Integers The highest bit indicates the sign. 1 = negative, 0 = positive.
Computer Organization CS345 David Monismith Based upon notes by Dr. Bill Siever and notes from the Patternson and Hennessy Text.
1 Lecture 7: MARS, Computer Arithmetic Today’s topics:  MARS intro  Numerical representations  Addition and subtraction.
Computer Organization CS345 David Monismith Based upon notes by Dr. Bill Siever and notes from the Patternson and Hennessy Text.
Number Representation Lecture Topics How are numeric data items actually stored in computer memory? How much space (memory locations) is.
Computer Organization CS345 David Monismith Based upon notes by Dr. Bill Siever and notes from the Patterson and Hennessy Text.
Arrays in MIPS Assembly Computer Organization and Assembly Language: Module 6.
Numerical formats What’s the main idea? Want to represent numbers (eg: 45, -12, ) using only bits. We’ve already seen (or you can read in the book)
Computer Organization CS345 David Monismith Based upon notes by Dr. Bill Siever and notes from the Patterson and Hennessy Text.
CS 125 Lecture 3 Martin van Bommel. Overflow In 16-bit two’s complement, what happens if we add =
The Hexadecimal System is base 16. It is a shorthand method for representing the 8-bit bytes that are stored in the computer system. This system was chosen.
Computer Organization CS345 David Monismith Based upon notes by Dr. Bill Siever and notes from the Patterson and Hennessy Text.
Computer Organization CS345 David Monismith Based upon notes by Dr. Bill Siever and notes from the Patternson and Hennessy Text.
Arrays and Pointers Variables are just names of memory locations An array is a variable (just with many memory locations – all contiguous) Address = pointer.
Computer Organization CS345 David Monismith Based upon notes by Dr. Bill Siever and notes from the Patterson and Hennessy Text.
Computer Organization CS345 David Monismith Based upon notes by Dr. Bill Siever and notes from the Patternson and Hennessy Text.
Computer Organization CS345 David Monismith Based upon notes by Dr. Bill Siever and notes from the Patternson and Hennessy Text.
CS 312 Computer Architecture & Organization
Computer Organization CS345 David Monismith Based upon notes by Dr. Bill Siever and notes from the Patternson and Hennessy Text.
Lec 3: Data Representation
Introduction to Lab #1 José Nelson Amaral.
Integer Real Numbers Character Boolean Memory Address CPU Data Types
Morgan Kaufmann Publishers
MIPS assembly syntax Comments
Week 5 Computers are like Old Testament gods; lots of rules and no mercy. Joseph Campbell.
Ken D. Nguyen Department of Computer Science Georgia State University
Digital Electronics and Microprocessors
CS334: Memory _ Mars simulator Lab 4(part2-2)
Hexadecimal.
Ken D. Nguyen Department of Computer Science Georgia State University
MIPS Assembly Language Programming Computer Architecture
CS 286 Computer Architecture & Organization
Week 5 Computers are like Old Testament gods; lots of rules and no mercy. Joseph Campbell.
MIPS Assembly.
Section 6 Primitive Data Types
Presentation transcript:

Computer Organization CS345 David Monismith Based upon notes by Dr. Bill Siever and notes from the Patternson and Hennessy Text

Last Time Reviewed arrays Discussed the lw (load word) and sw (store word) instructions Discussed the li (load immediate) instruction We saw that there are different ways to store arrays

Recall: Array names are defined by a label. The name is followed by a colon. Array type is provided after the name using a directive. Some examples of directives arelisted below. –.asciiz - string (an array of characters or bytes) that is null terminated –.word - array of standard size data units (32-bit units for MIPS) –.space - array of bytes Arrays are declared in the.data section of an assembly program and follow the format: label:.directive initValues/size

Array Examples myString:.asciiz "This is my string\n" myIntArray:.word 1, 2, 3, 4, 5 myBytes:.space 200 We can load a word (integer) into a register if we have the address of an array. la $t1, myIntArray #here we load the address of myIntArray into $t1 lw $t2, 0($t1) #here we load the first data value from myIntArray into $t2 Notice that $t2 contains the value 1 decimal.

Arrays We can store a value at a position in the integer array. li $t3, 432 sw $t3, 8($t1) Here we store the value 432 in place of the value 3 in location 2 of the myIntegerArray.

Conversions This time we will continue with decimal to binary conversions. We've seen how to convert from binary to decimal (multiply by 2) = 2^0 + 2^3 + 2^6 = = 73 We've seen how to convert from binary to hex But how do we convert from decimal to binary?

Decimal to binary 0 = 0 1 = 1 2 = 10 3 = 11 4 = Notice how the division by 2 method works 4 % 2 = 0 2 % 2 = 0 1 -> 100 binary = 4 decimal By repeatedly taking our value modulo 2, dividing by 2 and repeating, we can find the binary value of a decimal number.

Example Take % 2 = % 2 = % 2 = 0 58 % 2 = 0 29 % 2 = 1 14 % 2 = 0 7 % 2 = 1 3 % 2 = 1 1

Result Result: Let's check our result. 1 D 3 hex * = = = 467 Recall that every four binary digits represent a hex digit.

Questions for next time: What is the issue with plain binary numbers? – Signs must be represented – We need an extra bit to do that How do we account for overflow? That is, what if we add two very large binary numbers? – We need to be careful about adding very large numbers and consider different numberrepresentations. How do we represent instructions? – There are three formats that MIPS uses to represent instructions. – R format - all registers – I format - using registers and a 16 bit integer – J format - using one instruction and a 26 bit address