Machine Instructions - PowerPoint PPT Presentation

1 / 12
About This Presentation
Title:

Machine Instructions

Description:

Machine Instructions Instruction Formats Machine Instructions Internal Signals in computer have high and low voltages which represent values 0 and 1 (bits) Computer ... – PowerPoint PPT presentation

Number of Views:75
Avg rating:3.0/5.0
Slides: 13
Provided by: Chris1899
Category:

less

Transcript and Presenter's Notes

Title: Machine Instructions


1
Machine Instructions
  • Instruction Formats

2
Machine Instructions
  • Internal Signals in computer have high and low
    voltages which represent values 0 and 1 (bits)
  • Computer memory will store strings of bits in
    some standard length (word size)
  • Typically, a machine instruction is represented
    as one or more words -- e.g. a string of bits
  • Complex computers often have instructions with
    different lengths
  • RISC computers -- fixed instruction length

3
Assembly Instructions -- review
  • arithmetic and logical
  • use three registers
  • e.g. add s0, s1, s2
  • Memory access -- load/store
  • use two registers and a constant address
  • e.g. sw s0, 8(s5)

4
Assembly Instructions -- new
  • arithmetic and logical with constant
  • use two registers and constant
  • e.g. addi s0, t0, 16
  • jump instructions
  • use address, should be as long as possible
  • on MIPS address can be up to 26 bits
  • e.g. j 0x4f00024

5
Instruction Format -- MIPS
  • Instruction is 32 bits
  • Different fields (substrings) of bits represent
    different parts of instruction
  • What needs to be represented?
  • the operation opcode
  • registers used register field
  • constant values immediate field
  • addresses address field

6
Instruction Format -- Principles
  • Keep to as few different formats as possible
  • Keep patterns of formats the same -- regular
  • Keep corresponding parts of format in the same
    location in the bit string when possible
  • matches up to hardware more easily
  • keeps instructions and register/memory
    designations orthogonal -- that is,
    non-interfering

7
MIPS Instruction Formats
  • R-type (register)
  • instructions which designate three registers
  • includes most arithmetic/logical instructions
  • I-type (immediate)
  • instructions which use two registers and a
    constant
  • arithmetic/logical with immediate operand
  • load and store
  • J-type
  • jump instructions with a 26 bit address

8
Exercise -- A 16 bit instruction format
We have a 16 bit word. We have 16 general
purpose registers. We want to represent three
register arithmetic instructions. We want to
represent load/store functions with MIPS
format. We want to represent arith/log
instruction with two registers and
immediate operand. How can we do it? How many
bits for registers? How many bits can be used for
immediate operand? How many bits to indicate
operations?
9
MIPS R-type instruction
6 bits
6 bits
5 bits
5 bits
5 bits
5 bits
opcode
reg rs
reg rt
reg rd
shamt
funct
10
MIPS I-type instruction
6 bits
5 bits
5 bits
16 bits
opcode
reg rs
reg rt
immediate value/addr
11
MIPS J-type instruction
6 bits
26 bits
opcode
address
12
Instruction to hardware
The machine instruction is stored in a register
as high and low voltages, which can be switched
onto wires to control the operation of the CPU.
For example the values for the ADD instruction
are given below ADD 16, 12, 13
6 bits
6 bits
5 bits
5 bits
5 bits
5 bits
Write a Comment
User Comments (0)
About PowerShow.com