• Tidak ada hasil yang ditemukan

Computer Architecture

N/A
N/A
Protected

Academic year: 2024

Membagikan "Computer Architecture"

Copied!
14
0
0

Teks penuh

(1)

Computer Architecture

Single-Cycle Implementation

(2)

Computer Architecture & Network Lab 2

Single-Cycle Datapath

PC Read

address

Shift left 2

Instruction [31-0]

Instruction memory

Instruction [25-21]

Instruction [20-16]

Instruction [15-11]

Instruction [15-0]

4

Add

Add ALU result

Read register 1 Read register 2

Read data 1

Read data 2 Registers

Sign

extend ALU

control Instruction [5-0]

ALU Zero

resultALU Address

Write data

Read data

Data memory 0

M U X 1

0 M U X 1

1 M U X 0 0

M U X 1

16 32

RegWrite

MemWrite

MemtoReg

MemRead

ALUOp RegDst

ALUSrc

PCSrc

Write data Write register

This datapath supports the following instructions:

add, sub, and, or, slt, lw, sw, beq

(3)

Single-Cycle Control

RegDst Select destination register

RegWrite Specify if the destination register is written

ALUSrc Select whether source is register or immediate ALUOp Specify operation for ALU

MemWrite Specify whether memory is to be written MemRead Specify whether memory is to be read

MemtoReg Select whether memory or ALU output is used

PCSrc Select whether next PC or computed address is used

(4)

Computer Architecture & Network Lab 4

R-format Instruction Dataflow

For add, sub, and, or, slt instructions

PC Read

address

Shift left 2

Instruction [31-0]

Instruction memory

Instruction [25-21]

Instruction [20-16]

Instruction [15-11]

Instruction [15-0]

4

Add

Add ALU result

Read register 1 Read register 2

Read data 1

Read data 2 Registers

Sign

extend ALU

control Instruction [5-0]

ALU Zero

resultALU Address

Write data

Read data

Data memory 0

M U X 1

0 M U X 1

1 M U X 0 0

M U X 1

16 32

MemtoReg MemWrite

MemRead

ALUOp RegDst

ALUSrc

PCSrc

Write data Write register

RegWrite

(5)

R-format Instruction Control

Control signal summary

RegDst 1 to select Rd

RegWrite 1 to enable writing Rd

ALUSrc 0 to select Rt value from register file ALUOp Dependent on operation (see below) MemWrite 0 to disable writing memory

MemRead 0 to disable reading memory

MemtoReg 0 to select ALU output to register

PCSrc 0 to select next PC

ALUOp

add OP (add) and OP (and)

sub OP (sub) or OP (or)

slt OP (slt)

(6)

Computer Architecture & Network Lab 6

I-format Load Instruction Dataflow

For lw instruction

PC Read

address

Shift left 2

Instruction [31-0]

Instruction memory

Instruction [25-21]

Instruction [20-16]

Instruction [15-11]

Instruction [15-0]

4

Add

Add ALU result

Read register 1 Read register 2

Read data 1

Read data 2 Registers

Sign

extend ALU

control Instruction [5-0]

ALU Zero

resultALU Address

Write data

Read data

Data memory 0

M U X 1

0 M U X 1

1 M U X 0 0

M U X 1

16 32

MemtoReg MemWrite

MemRead

ALUOp RegDst

ALUSrc

PCSrc

Write data Write register

RegWrite

(7)

I-format Load Instruction Control

Control signal summary

RegDst 0 to select Rt

RegWrite 1 to enable writing Rt

ALUSrc 1 to select immediate field value from instruction

ALUOp add

MemWrite 0 to disable writing memory MemRead 1 to enable reading memory

MemtoReg 1 to select memory output to register

PCSrc 0 to select next PC

(8)

Computer Architecture & Network Lab 8

I-format Store Instruction Dataflow

For sw instruction

PC Read

address

Shift left 2

Instruction [31-0]

Instruction memory

Instruction [25-21]

Instruction [20-16]

Instruction [15-11]

Instruction [15-0]

4

Add

Add ALU result

Read register 1 Read register 2

Read data 1

Read data 2 Registers

Sign

extend ALU

control Instruction [5-0]

ALU Zero

resultALU Address

Write data

Read data

Data memory 0

M U X 1

0 M U X 1

1 M U X 0 0

M U X 1

16 32

MemtoReg MemWrite

MemRead

ALUOp RegDst

ALUSrc

PCSrc

Write data Write register

RegWrite

(9)

I-format Store Instruction Control

Control signal summary

RegDst x (don’t care)

RegWrite 0 to disable writing a register

ALUSrc 1 to select Rt value from register file

ALUOp add

MemWrite 1 to enable writing memory MemRead 0 to disable reading memory MemtoReg x (don’t care)

PCSrc 0 to select next PC

(10)

Computer Architecture & Network Lab 10

I-format Branch Instruction Dataflow

For beq instruction

PC Read

address

Shift left 2

Instruction [31-0]

Instruction memory

Instruction [25-21]

Instruction [20-16]

Instruction [15-11]

Instruction [15-0]

4

Add

Add ALU result

Read register 1 Read register 2

Read data 1

Read data 2 Registers

Sign

extend ALU

control Instruction [5-0]

ALU Zero

resultALU Address

Write data

Read data

Data memory 0

M U X 1

0 M U X 1

1 M U X 0 0

M U X 1

16 32

MemtoReg MemWrite

MemRead

ALUOp RegDst

ALUSrc

PCSrc

Write data Write register

RegWrite

(11)

I-format Branch Instruction Control

Control signal summary

RegDst x (don’t care)

RegWrite 0 to disable writing a register

ALUSrc 0 to select Rt value from register file

ALUOp sub

MemWrite 0 to disable writing memory MemRead 0 to disable reading memory MemtoReg x (don’t care)

PCSrc zero

(12)

Computer Architecture & Network Lab 12

Single-Cycle Control Signals Summary

Signal R-fmt I-fmt (lw) I-fmt (sw) I-fmt (beq)

RegDst 1 0 x x

RegWrite 1 1 0 0

ALUSrc 0 1 1 0

ALUOp OP add add sub

MemWrite 0 0 1 0

MemRead 0 1 0 0

MemtoReg 0 1 x x

PCSrc 0 0 0 zero

(13)

More Details on Control Signal Generation

(14)

Computer Architecture & Network Lab 14

Review and Projection

Single-Cycle implementation is easy

Control is based solely on the operation

(and results!)

dictates ALU operation

controls multiplexor selection

enables/disables storage elements

Processor signals (control and data) stabilize and then any state (register and/or memory) change takes place when the clock cycle ends

Multi-Cycle implementation explained in the next class

Instruction processing takes multiple steps, one step per cycle

Within a given clock cycle, signals stabilize and their local state

change takes place when the clock cycle ends

Referensi

Dokumen terkait

° However, in order to design good instruction sets, it is important to understand the how the architecture might be implemented... Key considerations in

Contention occurs when both the Instruction Prefetcher and the Execution Unit simultaneously require access to the cache.. In that case, the Prefetcher is stalled while the E ti

—  In parallel fetch address used to access branch prediction arrays. •  F3 Instruction data are placed in

A general format of an instruction register to register operations is: op r1 r2 r3 means R[r1] = R[r2] op R[r3] To pass values between memory and registers, load/store instructions

Instruction Set Design Fixed versus Variable-Length Instruction Formats – Fixed-length instruction format • use same number of bits to represent all instructions • leads to simpler

How to Stall the Pipeline 1 Force control values in ID/EX register to 0 • EX, MEM and WB do nop no-operation 2 Prevent update of PC and IF/ID register • instruction in ID stage is

Pin Simbol Fungsi 1 Vss Ground 2 Vdd +3V Atau +5V 3 Vo Pengatur Kontras 4 Rs H/L Register Select Signal 5 R/W Read/Write Signal 6 EN Enable Signal 7-14 Data I/O Pins 15