You are on page 1of 3

Computer Architecture and organization

Lecture: 3

4. Compromise

A problem occurs when an instruction needs longer fields. For example in the load word (lw)

If we use R type, the maximum number that can load from memory is 25

Compromise is to keep all instruction the same length, thereby requiring different kinds of instruction
formats

Instruction formats:

1- R Type

Op rs rt rd shamt funct

6 bits 5 bits 5 bits 5 bits 5 bits 6 bits


op
Operation code (denote the operation (add, sub) and format of instruction)
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

EX:

Add rd, rs, rt

0 rs rt rd 0 32

6 bits 5 bits 5 bits 5 bits 5 bits 6 bits


Register address ‫بمثل بيهم‬address ‫ دول‬Rs, rt , rd -

Name Register Address (Decimal)


$0 0
$v0 -$v1 2-3
$a0 -$a3 4-7
$t0-$t7 8-15
$s0-$s7 16-23
$t8-$t9 24-25
$sp 29
$ra 31

2- I Type

Op rs rt Constant or address

6 bits 5 bits 5 bits 16 bits


op
Operation code (denote the operation (addi,lw) )
rs
First source register operand
rt
Second source register operand
Address
For example lw can load any word within a region 215

EX:

Addi rt, rs, im

8 Rs rt Im

6 bits 5 bits 5 bits 16 bits


4- J Type

Op address

6 bits 26 bits
Op
Operation code

Address
Jump to a specific address
Max jump is 226

EX:

J address

2 address

6 bits 26 bits

You might also like