Lecture - 3 - Computer Science 230H Instructions: Language...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
Computer Science 230H Instructions: Language of the Computer (Using MIPS) Prepared by Michael Jack - Fall 2007 Slides set 3
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
MIPS 2 References The information and figures for the following slides were prepared from the following source: – Patterson, D., and Hennessy J., Computer Organization and Design, 3rd edition, 2005
Background image of page 2
MIPS 3 Instruction Categories The 6 Instruction Categories: – Computational – Load/Store – Jump and Branch – Floating Point – Memory Management – Special R0 - R31 PC HI LO Registers
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
MIPS 4 Hardware Software Interface MIPS registers take less time to access and have higher throughput than memory – Throughput - the amount of data transmitted between two points in a given amount of time. Data is more useful when stored in registers – Arithmetic instructions operate on registers. – Data transfer instructions only read/write one operand without operating. Since most programs have more variables than computers have registers, the compiler: • Keeps the most frequently used variables in registers. • Places the less frequently used in memory. • Uses load and store ops to move variables between registers and memory.
Background image of page 4
MIPS 5 Hardware Software Interface (cont) The process of putting less commonly used variables into memory is called spilling registers. – Register spilling occurs whenever the register “allocator” runs out of registers, and therefore must “spill” values by saving and restoring them from memory. – Register spilling can result in significant increase of the instruction count within a loop body, resulting in large overheads. One way to alleviate the problem is to use constants.
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
MIPS 6 Immediate (Constant) Operands Many of the MIPS arithmetic instructions use constants in operations – E.g. incrementing an index to point to the next element of an array. To use a constant we have to load it from memory first. Example: Add constant 4 to register $s3: lw $t0, AddrConstant4($s1) # $t0 = constant 4 add $s3, $s3, $t0 # $s3 = $s3 + $t0 – We want to avoid using the load instruction. – Use arithmetic instructions in which one operand is a constant. addi $s3, $s3, 4 # $s3 = $s3 + 4 Design Principle 3: Make the common case fast.
Background image of page 6
MIPS 7 Accessed only by data transfer instructions. MIPS uses byte addresses, so sequential word addresses differ by 4. Memory holds data structures, arrays, and spilled registers. Fast locations of data. Data must be in registers to perform arithmetic operations. Comments
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/14/2010 for the course COMPUTER S COIS-3030 taught by Professor Hircock during the Spring '10 term at Trent University.

Page1 / 23

Lecture - 3 - Computer Science 230H Instructions: Language...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online