KI Ế NTR Ú CM Á YT Í NH CE2010
KI Ế NTR Ú CM Á YT Í NH CE2010
KI Ế NTR Ú CM Á YT Í NH CE2010
2010
dce
2010
dce
2010
Computer Architecture Is
the attributes of a [computing] system as seen by the programmer, i.e., the conceptual structure and functional behavior, as distinct from the organization of the data flows and controls the logic design, and the physical implementation. Amdahl, Blaaw, and Brooks, 1964
dce
2010
dce
2010
hardware
dce
2010
General Purpose Register Machines Complex Instruction Sets (Vax, Intel 432 1977-80) Load/Store Architecture (CDC 6600, Cray 1 1963-76) RISC (Mips,Sparc,HP-PA,IBM RS6000,PowerPC . . .1987) LIW/EPIC?
Computer Architecture, Chapter 2
(IA-64. . .1999)
6
dce
2010
dce
2010
Accumulator
load A add B store C #accum = M[A]; #accum += M[B]; #M[C] = accum; #M[C] = M[A] + M[B]; #R1 = M[A]; #R1 = R1 + M[B]; #M[C] = R1; #R1 = M[A]; #R2 = M[B]; #R3 = R1 + R2; #M[C] = R3;
Memory Memory
add C,A, B
Memory Register
load R1, A add R1,B store C,R1
Register Register
load R1,A load R2,B add R3,R1,R2 store C,R3
dce
2010
dce
2010
MIPS, Sun SPARC, HP PA-RISC, IBM PowerPC Instruction sets are measured by how well compilers use them as opposed to how well assembly language programmers use them CISC (C for complex), e.g., Intel x86
Design goals: speed, cost (design, fabrication, test, packaging), size, power consumption, reliability, memory space (embedded systems)
Computer Architecture, Chapter 2 2010, Dr. Dinh Duc Anh Vu 10
dce
2010
Instruction Set
The repertoire of instructions of a computer Different computers have different instruction sets
But with many aspects in common
11
dce
2010
12
dce
2010
PC HI LO
rd
shamt immediate
funct
dce
2010
Smaller is faster
limited instruction set limited number of registers in register file limited number of addressing modes
dce
2010
15
dce
2010
16
dce
2010
Registers are
Faster than main memory
But register files with more locations are slower (e.g., a 64 word file could be as much as 50% slower than a 32 word file) Read/write port increase impacts speed quadratically
dce
2010
dce
2010
Memory
Compiler associates variables with registers What about programs with lots of variables?
Computer Architecture, Chapter 2 2010, Dr. Dinh Duc Anh Vu 19
dce
2010
? locations
32 bits
Computer Architecture, Chapter 2 2010, Dr. Dinh Duc Anh Vu 20
dce
2010
Accessing Memory
MIPS has two basic data transfer instructions for accessing memory (assume $s3 holds 2410)
lw sw $t0, 4($s3) $t0, 8($s3) #load word from memory #store word to memory
The memory address is formed by summing the constant portion of the instruction and the contents of the second register
Computer Architecture, Chapter 2 2010, Dr. Dinh Duc Anh Vu 21
dce
2010
dce
2010
23
dce
2010
Assuming that the base address of array A is in register $s4, and variables b, c, and i are in $s1, $s2, and $s3, respectively, what is the MIPS assembly code for the C statement ... ... c = A[i] - b
A[3] A[2] A[1] A[0] add add $s4+12 $s4+8 $s4+4 $s4 $t1, $s3, $s3 $t1, $t1, $t1 #array index i is in $s3 #temp reg $t1 holds 4*i
24
dce
2010
dce
2010
dce
2010
add Arithmetic subtract add immediate Data transfer load word store word
add sub
$s1 = $s2 + $s3 $s1 = $s2 - $s3 $s1 = $s2 + 4 $s1 = Memory($s2+32) Memory($s2+32) = $s1
27