CMPEN 331 Exam 2 Lecture 8

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/18

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

19 Terms

1
New cards

fetch

get the bits representing the current instruction from MEM[PC]

2
New cards

decode

figure out which instruction has been fetched:
• What type? (R, I, J) What resources are needed (Mem, Imm, Reg)?
• Get local register operands; sign extend immediates; concat J-type IMM, PC

3
New cards

execute

perform arithmetic/ logical operation specified by the instruction
• express necessary control to employ arithmetic logic unit (e.g. +, -, &) if necessary
• may need different functionality, additional HW, for each instruction class

4
New cards

memory

perform read/write
• only relevant for load/store variants

5
New cards

writeback

update any state with modified values
• update registers, if any

6
New cards

instruction and data memories

• two types of memory
• the separation is only conceptual (von neumann, they are the same), physical (harvard, they are two different memories), or in between (same memory but separate cache, harvard)
• most modern computers are harvard architecture

7
New cards

components: instruction memory

• input: address
• output: instruction in that address

8
New cards

components: register files

when reading:
• input: two register numbers
• output: values in the register

when writing (controlled by RegWrite signal):
• input: register number, value
• writes the value to the register

9
New cards

components: ALU

• input: two values
• output: computation output using the two values
• type of computation controlled by ALU operation signal

10
New cards

components: data memory

when reading (controlled by MemRead signal):
• input: address
• output: value in the address

when writing (controlled by the MemWrite signal):
• input: address, value
• writes the value to the address

11
New cards

components: others

• mux: chooses one of the inputs and connect it to the output
• sign-extend: do sign-extension

12
New cards

PC (program counter)

a specialized register that holds the address of the instruction to execute

13
New cards

instruction fetch

instructions involve:
• reading the instruction from the instruction memory that PC points to
• updating PC to point to the next instruction
• if not branch/jump, next PC = current PC + 4
• automatically updated on every clock cycle

14
New cards

decoding instructions: getting register operands

instructions involve:
• understanding what instruction must be executed and getting signals to control relevant components (e.g. registers, ALU, memory) --- op/func code
• reading two registers --- rs/rt
• who reads the two register? R-type, some I-types (beq/bne, lw)
• Who reads one register? Other I-types (sw, addi)
• Who reads zero register? J-type
• What if the instruction does not use rs/rt? Still read something and don't use. It won't hurt

15
New cards

executing R-Format instructions
• (add, sub, alt, and, or)

how to execute a certain type of instruction:
• perform operation (op and funct) on values rs and rt
• store the result back into the register file (into location rd)
• note that the register file is not written every cycle (e.g. instruction that are not this type), so we need an explicit write control signal for the register file

16
New cards

executing load and store operations

how to execute two specific operations:
• for both: compute the effective memory address by adding the contents of the base register (read from the Register File during decode) to the 16-bit-sign-extended immediate field (byte offset) in the instruction

for one of them only:
• value, (read from the Register File during decode) written to the Data Memory

for the other only:
• value, read from the Data Memory, written to the Register File

17
New cards

branch instructions

specific type of instructions:
• read register operands
• compare operands; use ALU (can subtract and check "zero" output)
• calculate target address
• sign-extend displacement
• shift left 2 places (word displacement -> byte displacement)
• add to PC + 4
• already calculated by fetch
• MIPS was always designed with pipelining in mind

18
New cards

implementing J-Type Jumps
• blank = jump

implementing a specific instruction:
• uses word address
• update PC with concatenation of
• top 4 bits of old PC
• 26-bit [blank] address
• lower bits word-aligned: 2'b00
• need an extra control signal decoded from opcode

19
New cards

ALU control

used for:
• load/store: F = add
• branch: F = subtract
• R-Type: F depends on funct field

Explore top flashcards