1 Introduction
1 Introduction
• Course covers:
Processor design and implementation
Memory Design and implementation
Text Book: Computer Organization and Design,
The Hardware/Software Interface by Hennessy and
Patterson.
• Course grading:
Midterm Exam : 30%
Homework Assignments: 20%
Final Exam : 50%,
1
Computer Components
5
Evolution of ISA’s
6
The Different ISA’s
Over the years many ISA’s have been proposed
• Accumulator Based:
One operand is specified in the instruction (memory address
or constant). The other operand is implicit in the accumulator.
• Stack Based: Zero operands are specified in the instruction. All
operands are implicit on top of the stack.
• Registers: All specified operands can be registers or constants.
No memory address specified in the instruction. (MIPS)
• Register –Memory: At most on operand Can be a memory address.
other operands can be register or constant.
• All Memory: operands can any combination of registers or memory
Even all three operands can be in memory (VAX)
7
Accumulator Architecture
A = B/5 + C;
Load B
Div 5
Add C
Store A
8
Stack Architecture
All operands must be on the stack
•A = B + C;
push B
push C
add
pop A
A = B/5 + C
push B
push 5
div
push C
add
pop A
* 9
Using Register Only (MIPS)
A =B+5
LOAD R1,B
ADD R2,R1,5
STORE R2,A
10
Register-Memory and Memory-Memory
• X86 one operand in memory
A = B+C
Mov AX, B
ADD AX,C
MOV A,AX
You Do A = B/5 - C
* 11
ISA’s classifications
13
Reduced Instruction Set Computer (RISC)
• John L. Hennessy
• Dave Patterson
• MIPS, 1981
• RISC Project, 1982
• Stanford
• UC Berkeley
• Simple pipelining, keep full
• RISC-I: ½ transistors & 3x
• Influences: MIPS computer
faster
system, PlayStation, Nintendo
• Influences: Sun SPARC,
namesake of industry
Reduced Instruction Set Computer (RISC)
• MIPS Design Principles
• Smaller is faster
– Small register file
17
Addresses per instruction
• RISC machines
– Load-store and branches: 1 memory address + 1 or 2 registers
– All other 3 registers or 2 registers + immediate
• CISC machines
– Most of them: Two addresses
( destination ← source op.
destination)
– One operand is a register; other is either register, immediate,
or given by memory address
– Some special instructions (string manipulation) can have two
memory addresses
18
Regularity of instruction formats
19
Number of instruction formats
• RISC: three or four (instructions have same length)
To Keep design simple and decoding fast.
• CISC
– Several formats, each of fixed (but maybe different)
lengths. Decoding Slow.
– Variable length instructions (depends on opcode,
addressing of operands etc. Intel x86 instructions from
(1 to 17 bytes) To keep program size small.
– One instruction in CISC may requires executing many
instructions in RISC.
– Therefore same high level language program compiles to
more machine instructions in RISC Compared to CISC.
20
Addressing modes
21
A sample of VAX addressing modes
22
Examples
• CLRL register (clears a whole register)
• CLRB register (clears the low byte of the register)
• CLRL (register) clears memory add whose add. is in reg.
• CLRL (register)+ as above but then register is incr. by 4
• CLRL @(register)+ as above with 1 more level of indirection
(register points to address of address)
• CLRL offset(register) Register + offset mult .by 4 for L, by 1
for B etc
• CLRL offset[register] similar but use offset + 4 * register
• CLRL 12(R4)+[R1] clear word at add. R4 + 12*4 + R1*4
then add 4 to R4
23
RISC Processor
24
RISC vs. CISC
Complex instruction set computer (CISC):
– Philosophy : Memory available is small optimize memory usage by reducing
memory needed to store program.
– Characteristics:
• Large instruction set; Complex operations; Complex addressing modes;
• Complex hardware, long execution time of a single instruction.
• Minimum number of instructions needed for a given task;
The x86 architectures were based on the Intel 8086 microprocessor chip, initially
released in 1978. Intel Core 2 Duo – an example of an x86-compatible, 64-bit
multicore processor. AMD Athlon (early version) – a technically different but fully
compatible x86 implementation. Am386, released by AMD in 1991.The x86 architecture
Many millions of this processor architectures are produces each year for PCs
26
ARMDroid vs WinTel
28
Computer structure: Von Neumann model
Data +
CPU path
Control
Memory
I/O bus
bus
29
Some Computer families
30
More computer families
• Intel
– Early micros 40xx in early 70’s
– x86 (086,…,486, Pentium, Pentium Pro, Pentium 3, Pentium 4) from 1980
on
– IA-64 (Itanium) in 2001
• SUN
– Sparc, Ultra Sparc 1985 on
• MIPS-SGI
– Mips 2000, 3000, 4400, 10000 from 1985 on
32
Information units
33
Memory addressing
• Memory is an array of information units
– Each unit has the same size
– Each unit has its own address
– Address of an unit and contents of the unit at that address are
different
0 -123
1 17
2 0
contents
address
34
Big Endian and Little Endian
To load word or store word instruction uses only one memory address.
The lowest address of the four bytes is used for the address of a block of four
contiguous bytes. (we address x we access x, x+1, x+2 and x+3)
How is a 32-bit pattern held in the four bytes of memory? There are 32 bits in
the four bytes and 32 bits in the pattern, but a choice has to be made about
which byte of memory gets what part of the pattern. There are two ways that
computers commonly do this:
Big Endian Byte Order: The most significant byte (the "big end") of the data
is placed at the byte with the lowest address. The rest of the data is placed in
order in the next three bytes in memory.
Little Endian Byte Order: The least significant byte (the "little end") of the
data is placed at the byte with the lowest address. The rest of the data is
placed in order in the next three bytes in memory.
In these definitions, the data, a 32-bit pattern, is regarded as a 32-bit unsigned
integer.* The "most significant" byte is the one for the largest 35 powers of two:
231, ..., 224. The "least significant" byte is the one for the smallest powers of two:
Big-endian vs. little endian
3 2 1 0 Little-endian
(we’ll use this)
0 1 2 3 Big-endian
36
For example, say that the 32-bit
pattern 0x12345678 is stored at
address 0x00400000.
37
Memory alignment
means when storing data in memory place the data at a memory address divisible
by its size without remainder.
Example:
if data size in 4 bytes (int) it must be stored at addresses: 0,4,8,12
if data size in 2 bytes (short) it must be stored at addresses: 0,2,4,6
if data size in 8 bytes (double) it must be stored at addresses: 0,8,16,24
if data size is 1 byte (char) if can be stored at any memory address.
38
Reason For memory Alignment
40