Basics Instruction Set Architecture - PowerPoint PPT Presentation

1 / 21
About This Presentation
Title:

Basics Instruction Set Architecture

Description:

Basics Instruction Set Architecture – PowerPoint PPT presentation

Number of Views:42
Avg rating:3.0/5.0
Slides: 22
Provided by: pani4
Category:

less

Transcript and Presenter's Notes

Title: Basics Instruction Set Architecture


1
BasicsInstruction Set Architecture
  • Panickos Neophytou
  • Recitation 1 09/07/2005
  • 09/12/2005

CS0447 Computer Organization and Assembly Link
for this presentation www.cs.pitt.edu/panickos/c
lasses/cs0447/Basics.ppt
2
Contact info
  • Panickos Neophytou
  • Office
  • 6514 Sennott Square
  • Office Hours Monday 230-530 Tuesday
    345-645
  • Email
  • panickos_at_cs.pitt.edu (use cs0447 anywhere in
    the subject to get my attention)
  • TAs course web page
  • www.cs.pitt.edu/panickos/classes/cs0447 (under
    construction BUT available)

3
Outline
  • Decimal to Binary conversions
  • Binary to Hexadecimal conversions
  • Instruction Set Architecture
  • SPIM

4
Decimal to Binary conversions
           
  • Example 1 - (Convert Decimal 44 to Binary)

5
Decimal to Binary conversions
  • Example 2 - (Convert Decimal 15 to Binary)

6
Decimal to Binary conversions
                           
  • Example 3 - (Convert Decimal 62 to Binary)

7
Binary to Hexadecimal conversions
  • In the Hexadecimal system you have 16 symbols to
    represent natural numbers.

8
Binary to Hexadecimal conversions
  • Convert the following Hex number to Binary
  • 286F A3E1
  • Convert the following Binary number to
    Hexadecimal
  • 0101 0011 1111 0110 1011 1010 0001 1100

9
Instruction Set Architecture
  • op Operation code  
  • rs First source register operand  
  • rt Second source register operand  
  • rd Destination register operand  
  • shamt Shift amount - used in shift instructions  
  • funct Select the variant of the operation in the
    op code field


10
Instruction Set Architecture
  • Specific Instruction Formats


11
Instruction Set Architecture
  • Arithmetic Instructions

12
Instruction Set Architecture
  • Logical


13
Instruction Set Architecture
  • Data Transfer


14
Instruction Set Architecture
  • Conditional Branch


15
Instruction Set Architecture
  • Unconditional Jump


16
SPIM
  • Spim is a self-contained simulator that will run
    MIPS32 assembly language programs.
  • Freeware
  • Can be downloaded and installed onto Windows or
    Unix based machines from
  • http//www.cs.wisc.edu/larus/spim.html
  • Will be used for assignments

17
SPIM
  • Registers
  • Instructions
  • Loaded Data
  • Output

18
SPIM - Assembler Syntax
  • Program includes .data and .text
  • Comments begin with .  Rest of line is ignored.
  • Identifier names are sequence of letters,
    numbers, underbars (_) and dots (.).
  • Labels are declared by putting them at beginning
    of line followed by colon.  Use labels for
    variables and code locations.
  • Instruction format op field followed by one or
    more operands addi t0, t0, 1
  • Operands may be literal values or registers.
  • Register is hardware primitive, can stored 32-bit
    value s0
  • Numbers are base 10 by default.  0x prefix
    indicates hexadecimal.
  • Strings are enclosed in quotes.  May include
    \nnewline or \ttab.  Used for prompts.

19
SPIM
  • Simple Example

SPIM Code to print hello world a comment
starts with a till the end of the line 
.data start putting stuff in the data
segment greet .asciiz Hello world\n declare
greet to be the string .text start
putting stuff in the text segment main main
is a label here. Names a function li v0, 4
system call code for print_str la a0, greet
address of string to print syscall print the
string jr ra return from main  here li
is load immediate into an integer register la
is load computed address into an integer
register jr is standard return from function
call...ra contains return address
20
SPIM
  • Modify the program by adding these instructions
  • addi 10, 10, 4
  • addi 11, 11, 28
  • add 12, 10, 11
  • Use the step option (from the Simulator menu)
    of SPIM to watch your programs execution
    step-by-step.

21
MIPS Basics
  • Implementing Conditional Statements

if ( i j ) i j--
bne r1, r2, L1 branch if ! ( i j )
addi r1, r1, 1 i L1 addi r2, r2,
-1 j--
if ( i j ) i else j-- j i
bne r1, r2, ELSE branch if !( i j )
addi r1, r1, 1 i j L1 jump
over else ELSE addi r2, r2, -1 j
L1 add r2, r2, r1 j i
Write a Comment
User Comments (0)
About PowerShow.com