L1
L1
L1
https://www.cse.iitb.ac.in/~biswa/
Instructions
Programmers’ order/command to the processor
Computer Architecture 2
World of 18 instructions
A n Add the number in storage location n into the accumulator.
E n If the number in the accumulator is greater than or equal to
zero execute next the order which stands in storage location n;
otherwise proceed serially.
Z Stop the machine and ring the warning bell.
Computer Architecture 4
Why Instructions?
Programmer knows what it can/cannot
Processor knows what it should
Power of abstraction:
World with no instructions:
Programmers – communicate a sequence of 0s and 1s
Computer Architecture 5
World with no instructions
000000 00000 00000 00010 00000 100101
000000 00000 00101 01000 00000 101010
000100 01000 00000 00000 00000 000011
000000 00010 00100 00010 00000 100000
001000 00101 00101 11111 11111 111111
000010 00000 10000 00000 00000 000001
Computer Architecture 6
Last Lecture
Registers
Core
32-bit Address
Data Costly: 100 times
Costly DRAM
Registers are limited accesses
GBs DRAM
South pole
Computer Architecture 7
Let’s Open the Processor Core
Register 0
Register 1
Register 2
Register 3
Computer Architecture 8
Let’s Open the Processor Core
Register 0 Arithmetic
/ Logic
Register 1
Unit
Register 2
Register 3
Computer Architecture 9
Let’s put the Memory (not inside the core)
Register 0 Arithmetic
/ Logic
Register 1 Bus
Unit
Register 2
Register 3
Computer Architecture 10
Let’s put the Memory (not inside the core)
Register 0 Arithmetic
/ Logic Address Bus
Register 1
Unit Data Bus
Register 2
Register 3
Computer Architecture 11
MIPS Instructions: 101
add $0, $1, $2
Computer Architecture 12
What to do for “a=b+c-d”?
Computer Architecture 13
What to do for “a=b+c-d”?
add $t0, $s1, $s2 #$t = b+c
sub $s0, $t0, $s3 #$s = $t-d
Temporary register
Try out:
f=(g+h) – (i+j)
Computer Architecture 14
Constants and Immediate
x=x+10
No need of a register
No need of a register
addi $s0, $s0, 10
Do we need a subi ? ☺
No need of a register
Computer Architecture 17
Special treatment for zero
$0 or $zero is a special register that contains ZERO
Computer Architecture 18
Pseudo Instruction 101
a=b
Computer Architecture 19
Logical Operations
Bitwise operations and shifts (Refer Section 2.6 P&H)
Computer Architecture 20
Trivia? How to store a 32-bit constant into a
32-bit register?
For example, 10101010 10101010 11110000 11110000
Computer Architecture 21
Trivia? How to store a 32-bit constant into a
32-bit register?
For example, 10101010 10101010 11110000 11110000
Computer Architecture 22
Thanks
Computer Architecture 23