Administrivia Joes lab hours Monday 6-8, Tuesday 6-9, Thursday 6-9 - - PowerPoint PPT Presentation

administrivia
SMART_READER_LITE
LIVE PREVIEW

Administrivia Joes lab hours Monday 6-8, Tuesday 6-9, Thursday 6-9 - - PowerPoint PPT Presentation

Administrivia Joes lab hours Monday 6-8, Tuesday 6-9, Thursday 6-9 Any problems with lab 1? Fetch Unit CSE141L Lab 1b The Instruction Execution Cycle Obtain instruction from program storage Instruction Fetch Determine required


slide-1
SLIDE 1

Administrivia

  • Joe’s lab hours

– Monday 6-8, Tuesday 6-9, Thursday 6-9

  • Any problems with lab 1?
slide-2
SLIDE 2

Fetch Unit

CSE141L Lab 1b

slide-3
SLIDE 3

3

The Instruction Execution Cycle

Obtain instruction from program storage Determine required actions and instruction size Locate and obtain operand data Compute result value or status Deposit results in storage for later use Determine successor instruction Instruction Fetch Instruction Decode Operand Fetch Execute Result Store Next Instruction

slide-4
SLIDE 4

Fetch Unit?

  • Fetch instructions from I-mem
  • Supply instructions to the Exec Unit
  • Why use a FIFO?

Fetch Unit FIFO fetch instruction addr deque FIFO FIFO FIFO FIFO FIFO FIFO FIFO FIFO FIFO FIFO Exec Unit (“BackEnd”)

slide-5
SLIDE 5

Fetch Unit Roles

  • Supply instructions to the exec unit
  • Service I-Mem operations

– load an instruction – store an instruction

  • Branch Prediction

– if (cond) do A, else do B

  • fetch A or B?

– Instead of waiting the result of condition evaluation, predict where to go – For a misprediction, a recovery mechanism required

slide-6
SLIDE 6

Simple Static Branch Prediction

  • P(1bit) - prediction bit

– 0: not a branch, or a branch predicted untaken – 1: a branch, and predicted taken

  • Branch target address

– PC(10bits) + Offset(5bits)

P Opcode Offset

Sign Extend

ADD

PC [9:0] Offset [4:0] Offset [9:0]

slide-7
SLIDE 7

Fetch Unit Interface

Fetch Unit

Instruction(data, addr, valid) deque restart restart_addr memory req (load, store, addr, store_data) load_data, load_valid

Exec Unit

slide-8
SLIDE 8

module fetch #(parameter I_WIDTH = 17, A_WIDTH = 10, O_WIDTH= 5) ( input clk, reset, // normal operation, signals from the backend end input deque, input restart, input [A_WIDTH-1:0] restart_addr, // normal operation, signals from the front end to backend

  • utput [I_WIDTH-1:0] instruction_data,
  • utput [A_WIDTH-1:0] instruction_addr,
  • utput instruction_valid,

input [A_WIDTH-1:0] load_store_addr, input [I_WIDTH-1:0] store_data,

  • utput [I_WIDTH-1:0] load_data,
  • utput load_valid,

input load_store_1_0; input do_load_store; )

slide-9
SLIDE 9

Fetch Unit Operations

  • deque

– simple

  • fetch
  • restart
  • memory

– load – store

slide-10
SLIDE 10

Operation - Fetch

  • If reset

– Fetch the instruction at 0x0

  • Else If (branch | branch_predicted)

– Fetch the instruction at the branch target address

  • Else

– Fetch the instruction at {PC + 1}

slide-11
SLIDE 11

Operation - Restart

  • Why Restart?
  • Operations

– discard all the instructions in FIFO – Fetch the instruction at restart_addr

  • Priority?

– Reset > Restart > Normal Fetch

slide-12
SLIDE 12

Operation - Memory

  • Memory Operations

– Load: read a data from the specified addr of the I-Mem – Store: write a data to the specified addr of the I-Mem – At most only one operation can be performed in a cycle

  • Priority: why?

– 1. load = store – 2. reset – 3. restart – 4. normal fetch

slide-13
SLIDE 13

SRAM FIFO

+1 +Offset

0x0

pc [9:0] pc_prev_r[9:0] restart_addr_r [9:0] loadstore_addr_r [9:0] store_data_r [16:0] din[26:17] din[16:0] load_data[16:0] instruction_addr[9:0] instruction_data[16:0] pc[9:0] deque ram_addr[9:0]

ram_we sel_addr sel_pc fifo_enque

restart_addr [9:0] loadstore_addr [9:0] store_data [16:0]

Control Datapath

ram_data [4:0]

slide-14
SLIDE 14

Lab 2

  • Due next Friday
  • Goal

– Make the datapath Work

  • Understand the given datapath
  • Use given 2 module

– RAM – FIFO

  • Implement 2 modules

– Adder – Sign extender

  • Connect all things together
  • Synthesize, Implement, and analyze
  • ……
  • Detailed instructions will be available tonight!