Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 9

Chapter 7

Language Of Computer

INSTRUCTION REPRESENTATION
R format
I format
J format
This chapter we will learn about:

instruction as numbers in computer

instruction in encoding

MIPS instruction format for (Add instruction, Immediate instruction, Data Transfer
instruction)

FORMAT INSTRUCTION

ADDRESSED

All instruction and data are stored in memory, everything has a memory
address
Pointer are just a memory address, they can point anything in memory.
One register keeps address of instruction that had been executed.
Why program in binary form?
- to suited a different version for computer (Operating System)
Words in Machine language is a set of bits data (32-bits block)
Currently all data we work is in word:
- each register is a word
- Lw and sw both access memory one word at a time

INSTRUCTION AS NUMBER
One word is 32 bits, so divide instruction into fields
Each field tells processor something about instruction
- We could define different field for each instruction, but MIPS is based on
simplicity, so define 3 basic types of instruction formats:
I format = used for instruction with immediate lw and sw
- arithmetic/logical
- shift
- jump register

J format = used for j and jal


- unconditional jump
- jump and link

R format = used all other insturction


- arithmetic/logical
- load and store
- conditional branch

R type instruction
6 bits

5 bits

op

rs

5 bits

5 bits

5 bits

6 bits

rt

rd

shamt

funct

00111

00101

00000

100000

add $5, $6, $7

000000

0110

I type instruction
6 bits

op

addi $1, $2, -3

001000

5 bits

rs

00010

5 bits

rt

16 bits

immediate

00001

1111 1111 1111 1101

J type instruction
6 bits

26 bits

op

address

{00400024} Loop: add $t1 $s3, $s3


{0040003c}

0000 10

j loop

00 0001 0000 0000 0000 0000 1001

You might also like