Docsity

Understanding Instruction Set Architecture: A Deep Dive into MIPS and RISC, Slides of Computer Architecture and Organization

Partial preview of the text

Download Understanding Instruction Set Architecture: A Deep Dive into MIPS and RISC and more Slides Computer Architecture and Organization in PDF only on Docsity!

Lecture 02- Instruction Set

Architecture

EE Computer Architecture

Course Overview MIPS Instruction Set Architecture  Computer Arithmetic  Performance Processor Datapath Single Cycle Control Multiple Cycle Control Pipelining Memory and Caches I/O Modern Architectures

4 EE204 L02-ISA Inside the Pentium 4 Processor Chip

The Instruction Set:a Critical

Interface

instruction set software hardware To Command a computer’s hardware , you must speak its language The words of computer’s language are called instructions Its vocabulary is called an instruction set.

Benefits of HLL

Closer to Natural Languages C++ FORTRAN scientific computation COBOL business data processing Increased Programmer productivity Small and concise code Easy and Quick Programming Independent of Hardware Platform Compiler converts HLL code to target m/c code

Assembly Language  Basic job of a CPU: execute lots of instructions. Instructions are the primitive operations that the CPU may execute. Different CPUs implement different sets of instructions. The set of instructions a particular CPU implements is an Instruction Set Architecture ( ISA ). Examples: Intel 80x86 (Pentium 4), IBM/Motorola PowerPC (Macintosh), MIPS, Intel IA64, ...

10 EE204 L02-ISA MIPS Architecture MIPS – semiconductor company that built one of the first commercial RISC architectures We will study the MIPS architecture in detail in this class Why MIPS instead of Intel 80x86? MIPS is simple, elegant. Don’t want to get bogged down in gritty details. MIPS widely used in embedded apps, x86 little used in embedded, and more embedded computers than PCs NEC, Silicon Graphics, Nintendo, Sony etc.

RISC - Reduced Instruction Set Computer RISC philosophy fixed instruction lengths load-store instruction sets limited addressing modes limited operations MIPS, Sun SPARC, HP PA-RISC, IBM PowerPC, Intel (Compaq) Alpha, … Instruction sets are measured by how well compilers use them as opposed to how well assembly language programmers use them

Assembly Variables: Registers Unlike HLL like C or Java, assembly cannot use variables Why not? Keep Hardware Simple Assembly Operands are registers limited number of special locations built directly into the hardware operations can only be performed on these! Benefit: Since registers are directly in hardware, they are very fast (faster than 1 billionth of a second)

Assembly Variables: Registers Drawback: Since registers are in hardware, there are a predetermined number of them Solution: MIPS code must be very carefully put together to efficiently use registers 32 registers in MIPS Why 32? Smaller is faster Each MIPS register is 32 bits wide Groups of 32 bits called a word in MIPS

Assembly Variables: Registers By convention, each register also has a name to make it easier to code For now: $16 - $23  $s0 - $s (correspond to C variables) $8 - $15  $t0 - $t (correspond to temporary variables) Later will explain other 16 register names In general, use names to make your code more readable

C, Java variables vs. registers In C (and most High Level Languages) variables declared first and given a type Example:

int fahr, celsius;

char a, b, c, d, e;

Each variable can ONLY represent a value of the type it was declared as (cannot mix and match int and char variables).  In Assembly Language, the registers have no type; operation determines how register contents are treated

Comments in Assembly Another way to make your code more readable: comments! Hash (#) is used for MIPS comments anything from hash mark to end of line is a comment and will be ignored This is just like the C //  Note: Different from C. C comments have format /* comment */ so they can span many lines

Assembly Instructions In assembly language, each statement (called an Instruction), executes exactly one of a short list of simple commands Unlike in C (and most other High Level Languages), each line of assembly code contains at most 1 instruction Instructions are related to operations (=, +, -, *, /) in C or Java