Single Clock Datapath
Single Clock Datapath
Organisasi Komputer
Masalah kinerja
Introduction
CPU performance factors
Jumlah instruksi
Tergantung arsitektur dan compiler
Contoh penggunaan
Memory reference: lw, sw
Arithmetic/logical: add, sub, and, or, slt
Control transfer: beq, j
Hanif Rasyidi - POK 2014
Eksekusi Instruksi
PC memory instruksi, fetch instruksi
Register register file, read registers
Eksekusi Instruksi
PC memory instruksi, fetch instruksi
Register register file, read registers
Tergantung instruksi
Penggunaan ALU untuk mendapatkan
Hasil operasi arithmetic
Alamat memory untuk load/store
Alamat percabangan (branch)
CPU Overview
CPU Overview
Bukan hanya
sambung kabel
Gunakan multiplexers
Combinational element
Beroperasi pada data
Output adalah fungsi terhadap input
Combinational Elements
AND-gate
Y=A&B
A
B
Multiplexer
A
+
Y=A+B
Adder
Arithmetic/Logic Unit
Y = F(A, B)
Y = S ? I1 : I0
I0
I1
M
u
x
A
ALU
B
F
Hanif Rasyidi - POK 2014
Sequential Elements
Register: stores data in a circuit
Menggunakan sinyal dari clock untuk menentukan kapan
mengupdate nilai yang tersimpan
Edge-triggered: update ketika Clk berubah dari 0 ke 1
Clk
D
Q
D
Clk
Sequential Elements
Register with write control
Hanya melakukan update ketika write control input bernilai 1
Digunakan saat sebuah nilai butuh disimpan dan digunakan di
kemudian waktu
Clk
D
Write
Clk
Write
D
Q
Hanif Rasyidi - POK 2014
Clocking Methodology
Combinational logic mengubah data pada tiap clock
cycles
Di antara tepi tiap clock
Masukan dari sebuah elemen dan keluaran menuju sebuah
elemen
Delay/waktu eksekusi instruksi terpanjang menentukan
periode clock
Membangun Datapath
Datapath
Bagian yang memproses data dan alamat yang ada di
dalam CPU
Registers, ALUs, muxs, memories,
Membangun Datapath
Datapath
Bagian yang memproses data dan alamat yang ada di
dalam CPU
Registers, ALUs, muxs, memories,
Instruction Fetch
Program Counter
Instruction Fetch
Program Counter
Instruction Memory
Instruction Fetch
Program Counter
Instruction Memory
ALU / Adder
Instruction Fetch
Instruction Fetch
32-bit
register
Increment 4
untuk
instruksi
berikutnya
R-Format Instructions
Baca 2 register operand
Lakukan operasi arithmetic/logical
R-Format Instructions
Baca 2 register operand
Lakukan operasi arithmetic/logical
Load/Store Instructions
Baca register operand
Hitung alamat dengan 16-bit offset
Gunakan ALU, tapi gunakan sign-extend offset
Load/Store Instructions
Baca register operand
Hitung alamat dengan 16-bit offset
Gunakan ALU, tapi gunakan sign-extend offset
Branch Instructions
Baca register operands
Bandingkan operands
Gunakan ALU, kurangi dan cek Zero output
Branch Instructions
Just
re-routes
wires
Sign-bit wire
replicated
R-Type/Load/Store Datapath
Full Datapath
ALU Control
ALU used for
Load/Store: F = add
Branch: F = subtract
R-type: F tergantung dari fungsi yang dibutuhkan
ALU control
Function
0000
AND
0001
OR
0010
add
0110
subtract
0111
set-on-less-than
1100
NOR
Hanif Rasyidi - POK 2014
ALU Control
Asumsikan 2-bit ALUOp dihasilkan dari opcode
Combinational logic menghasilkan ALU control
opcode
ALUOp
Operation
funct
ALU function
ALU control
lw
00
load word
XXXXXX
add
0010
sw
00
store word
XXXXXX
add
0010
beq
01
branch equal
XXXXXX
subtract
0110
R-type
10
add
100000
add
0010
subtract
100010
subtract
0110
AND
100100
AND
0000
OR
100101
OR
0001
set-on-less-than
101010
set-on-less-than
0111
rs
31:26
Load/
Store
35 or 43
25:21
rs
31:26
Branch
rt
opcode
20:16
rt
25:21
rs
31:26
rd
always
read
15:11
10:6
funct
5:0
address
20:16
rt
25:21
shamt
15:0
address
20:16
read,
except
for load
15:0
write for
R-type and
load
sign-extend
and add
Hanif Rasyidi - POK 2014
R-Type Instruction
Load Instruction
Branch-on-Equal Instruction
Mengimplementasi Jumps
Jump
address
31:26
25:0
dari opcode
Hanif Rasyidi - POK 2014
Performance Issues
Delay terbesar menentukan periode clock
Critical path: load instruction
Instruction memory register file ALU data memory
register file