CS231Fall 2005 - PowerPoint PPT Presentation

1 / 31
About This Presentation
Title:

CS231Fall 2005

Description:

... Architecture is the science and art of selecting and interconnecting hardware ... (1) instruction set architecture (ISA), (2) pipelining, (3) memory hierarchy, (4) ... – PowerPoint PPT presentation

Number of Views:21
Avg rating:3.0/5.0
Slides: 32
Provided by: Xia91
Category:
Tags: cs231fall

less

Transcript and Presenter's Notes

Title: CS231Fall 2005


1
(No Transcript)
2
CS231(Fall 2005)
Review Session Nov. 18 2005
Xiao Ma (xiaoma2_at_cs.uiuc.edu)
3
CS231 (Fall 2005)
Outline
1. What Is Computer Architecture?
2. Datapath
3. A Programs Life
4. Instruction Set - Compiling
5. Instruction Set - Encoding
CS231(Fall 05) Review Session (11/18/2005) Xiao
Ma (xiaoma2_at_cs.uiuc.edu)
4
CS231 (Fall 2005)
What is Computer Architecture?
Computer Architecture is the science and art of
selecting and interconnecting hardware components
to create computers that meet functional,
performance and cost goals. Computer architecture
is not about using computers to design
buildings. -- http//www.cs.wisc.edu/arch/www/
CS231(Fall 05) Review Session (11/18/2005) Xiao
Ma (xiaoma2_at_cs.uiuc.edu)
5
CS231 (Fall 2005)
Two Parts (1) Microarchitecture
  • Microarchitecture
  • Consist of a set of microprocessor design
    techniques, including instruction set, microcode,
    pipelining, cache systems, etc.

CS231(Fall 05) Review Session (11/18/2005) Xiao
Ma (xiaoma2_at_cs.uiuc.edu)
6
CS231 (Fall 2005)
Two Parts (2) System architecture
  • System architecture
  • How to organize a chuck of hardware resources
  • Spread from mobile computing, PC to mainframe
  • Include microprocessor, memory, I/O, operating
    system, networking, distributed system, security,
    dependability and so forth.

CS231(Fall 05) Review Session (11/18/2005) Xiao
Ma (xiaoma2_at_cs.uiuc.edu)
7
CS231 (Fall 2005)
What is after CS231?
  • CS231 Computer Architecture I
  • Basic course on computer architecture
  • CS232 Computer Architecture II
  • Second-level course on Computer architecture
  • (1) instruction set architecture (ISA), (2)
    pipelining, (3) memory hierarchy, (4)
    input/output hardware and software
  • CS433 Computer System Organization (UG/G)
  • A must take course on computer architecture
  • cover ISA design, pipeline design, memory
    hierarchy and so forth
  • CS533 Parallel Computer Architecture
  • Theoretical aspects of parallel and pipeline
    computation

CS231(Fall 05) Review Session (11/18/2005) Xiao
Ma (xiaoma2_at_cs.uiuc.edu)
8
CS231 (Fall 2005)
Outline
1. What Is Computer Architecture?
2. Datapath
3. A Programs Life
4. Instruction Set - Compiling
5. Instruction Set - Encoding
CS231(Fall 05) Review Session (11/18/2005) Xiao
Ma (xiaoma2_at_cs.uiuc.edu)
9
CS231 (Fall 2005)
CPU Design
  • CPU design is extremely complex, fortunately
    however, this course will only introduce some
    basic concepts.
  • Datapath how does the data flow in a CPU
  • Instruction set programmers language to a CPU
  • Control unit how does CPUs control the
    operations.

CS231(Fall 05) Review Session (11/18/2005) Xiao
Ma (xiaoma2_at_cs.uiuc.edu)
10
CS231 (Fall 2005)
Datapath - Overview
  • Fundamentally, the processor is just moving data
    between registers, possibly with some ALU
    computations.
  • Actually, within a CPU, the data may also flow
    through cache, which is a part of the memory.
  • Temporarily forget about what you learned before
    in CS231 .
  • How do these components work ? What are they
    doing?

Memory
CPU
CS231(Fall 05) Review Session (11/18/2005) Xiao
Ma (xiaoma2_at_cs.uiuc.edu)
11
CS231 (Fall 2005)
Datapath - Registers
  • Register is the fastest and smallest storage
    component in a computer.
  • Register file contains several registers.
  • Only one control bit - WR.
  • Remember the notation of size 2k x n
  • We can read two (why?) value from the
    register file at once and write one value to
    it at once
  • Any operation happens only on the positive
    edge of the clock.
  • If possible, try to know the inside of the
    register file.
  • How to combine of split a register file?

CS231(Fall 05) Review Session (11/18/2005) Xiao
Ma (xiaoma2_at_cs.uiuc.edu)
12
CS231 (Fall 2005)
Datapath - ALU
  • ALU is a key component in a CPU.
  • No address line for ALUs.
  • Output some status bits.
  • The function select FS has more than one bit.

CS231(Fall 05) Review Session (11/18/2005) Xiao
Ma (xiaoma2_at_cs.uiuc.edu)
13
CS231 (Fall 2005)
Datapath Register ?? ALU
D data
  • R0 ? R1 R3
  • This instruction needs two cycles
  • Calculate R1R3 in ALU
  • Put the result back to R0
  • Be familiar with this kind of diagram.

WR
Write
1
D address
DA
00
Register File
AA
BA
A address
B address
01
11
A data
B data
A
B
FS
FS
00010
ALU
V
C
N
Z
F
CS231(Fall 05) Review Session (11/18/2005) Xiao
Ma (xiaoma2_at_cs.uiuc.edu)
14
CS231 (Fall 2005)
Datapath Put them all together
  • Blue Add constant operator
  • Red Add memory access

CS231(Fall 05) Review Session (11/18/2005) Xiao
Ma (xiaoma2_at_cs.uiuc.edu)
15
CS231 (Fall 2005)
Outline
1. What Is Computer Architecture?
2. Datapath
3. A Programs Life
4. Instruction Set - Compiling
5. Instruction Set - Encoding
CS231(Fall 05) Review Session (11/18/2005) Xiao
Ma (xiaoma2_at_cs.uiuc.edu)
16
CS231 (Fall 2005)
A Programs Life (1) High-level language
int A10 int i0 int j1
int k0 while (Ai k) i i j
  • In todays world, usually programs are written
    by high-level programming languages
  • They provide easy-use loop statements,
    conditional branch statements, plenty of data
    types, sub-routine mechanism and so forth.
  • Also, modern programming languages
    provideOO-Programming, memory safe scheme,
    luxuriouslibraries.
  • They are easy to use. They can let programmers
    pay more attention to the programs design.
  • A lots of languages are there.
  • They are very low machine-specific.

Machines cannot understand!
CS231(Fall 05) Review Session (11/18/2005) Xiao
Ma (xiaoma2_at_cs.uiuc.edu)
17
CS231 (Fall 2005)
A Programs Life (2) Assembly language
0 lw 1, 0, i 1 lw 2, 0, j 2
lw 3, 0, k 3 loop lw 4, 1, A 4
beq 4, 3, 1 5 beq 0, 0, exit 6
add 1, 1, 2 7 beq 0, 0, loop 8
exit halt 9 i .fill 0 10
j .fill 1 11 k .fill 0 12 A
.fill 0 13 .fill 0 14 .fill 0 15
.fill 0 16 .fill 0 17 .fill 0 18
.fill 0 19 .fill 0 20 .fill 0
21 .fill 0
  • Then, the program becomes assembly codes
  • These instructions are a sub-set of the
    instruction set of a specific machine.
  • Highly machine-specific.
  • Hard to understand.
  • Only a few programmers who involve hardware
    programming need to use it directly.

How can we transfer the high-level language into
assembly codes? Compiling
CS231(Fall 05) Review Session (11/18/2005) Xiao
Ma (xiaoma2_at_cs.uiuc.edu)
18
CS231 (Fall 2005)
A Programs Life (3) Machine language
0 100 001 000 0001001 1 100 010 000
0001010 2 100 011 000 0001011 3 100 100 001
0001100 4 110 100 011 0000001 5 110 000 000
0000010 6 000 001 001 0000 010 7 110 000 000
1111011 8 011 0000000000000 9
0000000000000000 10 0000000000000001 11
0000000000000000 12 0000000000000000 13
0000000000000000 14 0000000000000000 15
0000000000000000 16 0000000000000000 17
0000000000000000 18 0000000000000000 19
0000000000000000 20 0000000000000000 21
0000000000000000
  • Finally, the machine language code is generated
  • Computers become happy ?
  • Human beings become sad ?
  • Almost onbody can read it smoothly
  • Each assembly instruction has one corresponding
    instruction in machine language.

How can we transfer assembly codes into the ugly
01-strings? Instruction encoding
CS231(Fall 05) Review Session (11/18/2005) Xiao
Ma (xiaoma2_at_cs.uiuc.edu)
19
CS231 (Fall 2005)
Outline
1. What Is Computer Architecture?
2. Datapath
3. A Programs Life
4. Instruction Set - Compiling
5. Instruction Set - Encoding
CS231(Fall 05) Review Session (11/18/2005) Xiao
Ma (xiaoma2_at_cs.uiuc.edu)
20
CS231 (Fall 2005)
Instruction Set - Overview
  • Instruction set is specific to the processor
  • Instruction set is closely related to the
    processor design.
  • A high-level language program must be
    translatedinto low-level instruction.
  • Instruction set is hard to design, a lot of
    trade-offsand complex considerations.

CS231(Fall 05) Review Session (11/18/2005) Xiao
Ma (xiaoma2_at_cs.uiuc.edu)
21
CS231 (Fall 2005)
Compiling
  • High-level language ? Assembly language
  • Compilers are highly machine-specific, because
    ISA is machine-specific.
  • Compliers can do optimization, which would be
    very powerful sometime, but is too complex for
    human beings to do it.
  • Compliers can do static check.
  • Modern compilers are very efficient.
  • Compiler theory and technology is a direction
    of computer science research.

int A10 int i0 int j1 int
k0 while (Ai k) i i j

0 lw 1, 0, i 1 lw 2, 0, j 2
lw 3, 0, k 3 loop lw 4, 1, A 4
beq 4, 3, 1 5 beq 0, 0, exit 6
add 1, 1, 2 7 beq 0, 0, loop 8
exit halt 9 i .fill 0 10
j .fill 1 11 k .fill 0 12 A
.fill 0 13 .fill 0 14 .fill 0 15
.fill 0 16 .fill 0 17 .fill 0 18
.fill 0 19 .fill 0 20 .fill 0
21 .fill 0
CS231(Fall 05) Review Session (11/18/2005) Xiao
Ma (xiaoma2_at_cs.uiuc.edu)
22
CS231 (Fall 2005)
Assembly Instructions
  • In CS231, you should be familiar with a small
    set of assembly instructions.
  • Data manipulation instructions (ADD, R0, R1, R2)
  • Load instruction (LD R1, (R3))
  • Save instruction (ST (R3), R1)
  • Jump instruction (JMP label1)
  • Branch instructions (8 instructions)
  • Addressing mode
  • R0 ? Reg0 The value in Register 0
  • (R0) ? MemReg0 The value in of the memory
    byte with address Reg0
  • 1000 ? 1,000 A simple integer.
  • 1000 ? Mem1,000 The value of the memory
    byte with address as 1,000
  • Know how to compile simple c-code

CS231(Fall 05) Review Session (11/18/2005) Xiao
Ma (xiaoma2_at_cs.uiuc.edu)
23
CS231 (Fall 2005)
Compiling Example
  • Here is a translation of the for loop

CS231(Fall 05) Review Session (11/18/2005) Xiao
Ma (xiaoma2_at_cs.uiuc.edu)
24
CS231 (Fall 2005)
Outline
1. What Is Computer Architecture?
2. Datapath
3. A Programs Life
4. Instruction Set - Compiling
5. Instruction Set - Encoding
CS231(Fall 05) Review Session (11/18/2005) Xiao
Ma (xiaoma2_at_cs.uiuc.edu)
25
CS231 (Fall 2005)
Encoding
  • Assembly language ? Machine language
  • One-to-one corresponding
  • Much much simpler than compiling. What we need
    to do is translate instructions one by one
    according to given corresponding rules.
  • Fixed-length encoding v.s. Variable-length
    encoding
  • Fixed-length easy to implement
  • Variable-length (1) more efficient,
    (2) small code size

0 100 001 000 0001001 1 100 010 000
0001010 2 100 011 000 0001011 3 100 100 001
0001100 4 110 100 011 0000001 5 110 000 000
0000010 6 000 001 001 0000 010 7 110 000 000
1111011 8 011 0000000000000 9
0000000000000000 10 0000000000000001 11
0000000000000000 12 0000000000000000 13
0000000000000000 14 0000000000000000 15
0000000000000000 16 0000000000000000 17
0000000000000000 18 0000000000000000 19
0000000000000000 20 0000000000000000 21
0000000000000000
0 lw 1, 0, i 1 lw 2, 0, j 2
lw 3, 0, k 3 loop lw 4, 1, A 4
beq 4, 3, 1 5 beq 0, 0, exit 6
add 1, 1, 2 7 beq 0, 0, loop 8
exit halt 9 i .fill 0 10
j .fill 1 11 k .fill 0 12 A
.fill 0 13 .fill 0 14 .fill 0 15
.fill 0 16 .fill 0 17 .fill 0 18
.fill 0 19 .fill 0 20 .fill 0
21 .fill 0
CS231(Fall 05) Review Session (11/18/2005) Xiao
Ma (xiaoma2_at_cs.uiuc.edu)
26
CS231 (Fall 2005)
Machine Instructions
  • In CS231, the CPU only has three types of
    instruction format.
  • Register format instructions require two source
    registers.
  • Immediate format instructions have one source
    register and one constant operand.
  • Jump and branch format instructions need one
    source register and one constant address
  • Also, we will use fix-length instruction
    encoding.
  • All of the machine instructions have 16 bits.

CS231(Fall 05) Review Session (11/18/2005) Xiao
Ma (xiaoma2_at_cs.uiuc.edu)
27
CS231 (Fall 2005)
Instruction format
15-13
12-9
Register Format
12-9
15-13
Immediate Format
12-9
15-13
J/B Format
Instruction Type Code
Type-specific Code
CS231(Fall 05) Review Session (11/18/2005) Xiao
Ma (xiaoma2_at_cs.uiuc.edu)
28
CS231 (Fall 2005)
Instruction format
15-13
12-9
Register Format
12-9
15-13
Immediate Format
12-9
15-13
J/B Format
8 types of instructions 3 bits are needed
Instruction Type Code
Type-specific Code
CS231(Fall 05) Review Session (11/18/2005) Xiao
Ma (xiaoma2_at_cs.uiuc.edu)
29
CS231 (Fall 2005)
Instruction format
15-13
12-9
Register Format
12-9
15-13
Immediate Format
12-9
15-13
J/B Format
ALU Shift Instruction (4 bits)
Branch Instruction (3 bits, 1bit used)
Instruction Type Code
Type-specific Code
CS231(Fall 05) Review Session (11/18/2005) Xiao
Ma (xiaoma2_at_cs.uiuc.edu)
30
CS231 (Fall 2005)
Instruction Example
CS231(Fall 05) Review Session (11/18/2005) Xiao
Ma (xiaoma2_at_cs.uiuc.edu)
31
CS231 (Fall 2005)
THE END
Thank you! Wish you guys a GREAT Thanksgiving
Break!
CS231(Fall 05) Review Session (11/18/2005) Xiao
Ma (xiaoma2_at_cs.uiuc.edu)
Write a Comment
User Comments (0)
About PowerShow.com