CSCI 50.01 LT#3

studied byStudied by 9 people
5.0(1)
Get a hint
Hint

Datapath

1 / 249

encourage image

There's no tags or description

Looks like no one added any tags here yet for you.

250 Terms

1

Datapath

Hardware components that execute instructions

New cards
2

What does Main Memory contain?

instructions to execute any data (ex. variables)

New cards
3

Give an address to either: ______ or _______

1. Retrieve a line of code/data
- Address specifies location containing instructions & parameters, or contents of variable

2. Overwrite a line of data
- Contents of variable

New cards
4

Address in Program Counter (PC)

  • Passed to instruction memory to fetch next instruction to be executed

<ul><li><p>Passed to instruction <strong><mark data-color="#ffe600" style="background-color: #ffe600; color: inherit">memory </mark></strong>to <strong><mark data-color="#00ff13" style="background-color: #00ff13; color: inherit">fetch next instruction to be executed</mark></strong></p></li></ul><p></p>
New cards
5

Main memory should have at least ____ read port/s and ______ write port/s

2 read ports
1 write port

New cards
6

Program Counter

  • 1 instance of main memory

  • Knowing where you are requires a register (esp for branching or jumping)

New cards
7

Opcode

  • Binary code

  • Represents specific instruction

New cards
8

What is the purpose of assigning opcodes to instructions?

  • to identify instructions for processor to differentiate operations

  • assigned based on functional groups or specific criteria

New cards
9

What pattern is used for arithmetic instructions in the Beta instruction set?

- Using constants have opcode[4] == 1
- Using 2nd register have opcode[4] == 0

New cards
10

What is the opcode significance of branching instructions like BEQ or BNE?

use constant to specify branch target address, so opcode[4] == 1

New cards
11

Control Unit

- Given instruction's opcode
- Sends signals to rest of CPU for instruction execution

<p>- Given <strong><mark data-color="#cdffa4" style="background-color: #cdffa4; color: inherit">instruction's opcode</mark></strong><br>- <strong><mark data-color="#92e8ff" style="background-color: #92e8ff; color: inherit">Sends signals to rest of CPU</mark></strong> for instruction execution</p>
New cards
12

Registers

  • Storage in CPU for temporary variables passed to ALU

  • Includes PC to remember address of next instruction

New cards
13

Register File

- Collection of registers for instruction arguments
- Used for Ra/Rb/Rc arguments in BSim implementation

<p>- <strong><mark data-color="#fff577" style="background-color: #fff577; color: inherit">Collection of registers</mark> </strong>for<strong> <mark data-color="#77edff" style="background-color: #77edff; color: inherit">instruction arguments</mark></strong><br>- Used for <strong><mark data-color="#77ff9f" style="background-color: #77ff9f; color: inherit">Ra/Rb/Rc arguments</mark></strong> in BSim implementation</p>
New cards
14

RFLE

Register File Load Enable (allow write)

New cards
15

OPCODE Fields

Operate: ADD, ADDC

Main memory: LD, ST

Program control: JMP, BEQ

New cards
16

How are Incremental Design datapaths implemented?

  • Implement datapaths for each class individually

  • Merge datapaths (old functionality maintained while adding new functionality)

New cards
17

Instruction Fetch

Process of retrieving next instruction

<p>Process of<strong><mark data-color="#b3ffdc" style="background-color: #b3ffdc; color: inherit"> retrieving next instruction</mark></strong></p>
New cards
18

Instruction Fetch Steps

  1. PC passes address of current instruction to main memory

  2. Default next instruction is in next line (address + 4)

  3. Instruction's opcode passed to control logic

  4. Control logic send signals to execute current instruction

New cards
19

Is it necessary to "save" PC's value?

Yes

New cards
20

Can the system function without a PC register?

No assuming PC is not saved anywhere

New cards
21

Is there another way to remember where we are in the program and to send the appropriate address to main memory for instruction fetch?

Yes only if PC is saved somewhere (doesn't have to be a register) in a device connected to main memory's instruction port's address

New cards
22

What is the role of control logic in a processor?

  • determines what ALU should do

  • controls if overwriting is allowed in register file for current instruction

New cards
23

What input does the register file receive from an instruction?

register addresses specified in instruction

New cards
24

What does the ALU base its operations on?

Instructions from control logic

New cards
25

WERF

  • Write Enable Register File

  • Controls if current instruction can overwrite a register in register file

    1 - can overwrite
    0 - can’t overwrite

New cards
26

Why can't WERF be don't care (1)?

Setting it to 1 (DC) will cause an unspecified overwrite to occur because of how registers function

New cards
27

ALUFN

Arithmetic and Logic Unit FunctioN

New cards
28

ALUFN

Arithmetic and Logic Unit FunctioN

Specifies operation that ALU should perform

New cards
29

How to send A and B inputs to the ALU without using a register file?

A and B inputs sent to ALU directly via connections to main memory instead of register file

New cards
30

What issues arise when sending ALU inputs directly from main memory?

More bits needed to specify memory addresses:
- Register file uses 5 bits (for 32 registers)
- Main memory with 2^20 lines would require 20 bits for address specification

New cards
31

What does BSEL do in ALU operations?

selects either:
- Rb (register file input)
- Constant embedded in the instruction

New cards
32

What must be done to a 16-bit constant before it can be used in ALU operations?

SEXT

sign-extended to 32 bits to match the ALU's input size

New cards
33

How does the current setup support both ALU register-register and register-constant operations?

Can choose between:
- Rb (register input) for register-register
- Constant (from instruction) for register-constant

New cards
34

What role does the multiplexer controlled by BSEL play in ALU operations?

Switches ALU's B input between
- Value from register file (Rb)
- Sign-extended constant from instruction

New cards
35

BSEL

B Selector

New cards
36

WDSEL

  • Write Data SELector

  • Controls source of data written to register file's Rc port

    "What am I supposed to write to register file?

New cards
37

Possible Values of BSEL

0 - need Rb's data to be passed, ignore constant (c[15:0])

1 - need their attached 16-bit constant, ignore Rb

New cards
38

How do you sign-extend a 16-bit value to a 32-bit value?

- Copy most significant bit into rest of the bits
- This preserves the sign

New cards
39

Why do memory and branching instructions have opcode[4] = 1?

They require a constant

EX. for addresses or offsets

New cards
40

What are examples of arithmetic instructions using a second register in the Beta instruction set?

ADD, SUB, and MUL

New cards
41

How are opcodes grouped in Beta instruction set?

Based on functionality, with specific opcode bits (like opcode[4]) indicating if constant or second register

New cards
42

How does BSEL allow Rb[15:11] and c[15:0] to occupy the same space in an instruction?

  • Uses mux to enable either rb[15:11] or c[15:0] as active input

  • Ensure only 1 path is used despite sharing instruction space

New cards
43

What is BSEL for?

Controls what gets passed as ALU's B input

New cards
44

WDSEL Possible Values

0: For BEQ/BNE

1: ALU output

2: Main memory's data read port's data

New cards
45

Wr

Write to memory

New cards
46

What is Wr used for?

- to know if reading or writing to main memory
- Similar to WERF, but specifically for memory writes

New cards
47

Possible Values of Wr

0: No data written to memory

1: Data written to memory.

New cards
48

For LD instructions, what should ALUFN be?

ADD

LD calculates address by adding <Ra> and C using ADDC

New cards
49

For LD instructions, what should BSEL be?

1

LD uses constant as second 2nd operand

New cards
50

For LD instructions, what should WDSEL be?

2

Data is read from main memory and written to register file's Rc

New cards
51

For LD instructions, what should Wr be?

0

LD doesn't write to main memory

New cards
52

RA2SEL

  • Read Address #2 SELector

  • determines which address is used for 2nd register

New cards
53

RA2SEL possible values

0 - Use Rb[15:11]
1 - Use Rc[25:21]

New cards
54

For ST instructions, what should ALUFN be?

ADD

ST calculates memory address by <Ra> + C using ADDC

New cards
55

For ST instructions, what should BSEL be?

1

ST uses constant (C) as second operand for ALU

New cards
56

For ST instructions, what should WERF be?

0

ST doesn't write to register file

New cards
57

For ST instructions, what should WDSEL be?

DC

WDSEL is not used for ST bc WERF = 0

0 default value for WDSEL

New cards
58

For ST instructions, what should Wr be?

1

ST writes data from Rc to main memory[<Ra> + C]

New cards
59

For ST instructions, what should RA2SEL be?

1

ST reads data from Rc[25:21] for writing to memory

New cards
60

What should RA2SEL be for non-ST instructions?

0 - read from Rb[15:11]

DC - don't read from Rb or Rc

New cards
61

Why does ST use Rc[25:21] instead of Rb[15:11]?

Because it needs a constant C[15:0] and can’t use Rb[15:11] simultaneously

New cards
62

PCSEL

Program Counter SELector

New cards
63

What is PCSEL used for?

determines the next instruction address

New cards
64

Possible Values of PCSEL

0 - Use default PC + 4
1 - Use branch address
2 - Use <Ra> for JMP instructions

  • can have 3 or 4 as well (but idk for what)

New cards
65

For JMP instructions, what should WDSEL be?

0

Passes PC + 4 to be written to Rc as return point

New cards
66

For JMP instructions, what should ALUFN be?

Dont care

New cards
67

For JMP instructions, what should BSEL be?

Don’t care

New cards
68

For JMP instructions, what should WERF be?

1

JMP writes PC + 4 to register file (Rc) as return point

New cards
69

What is Z for?

Zero check

1 if <Ra> is 0

0 otherwise

Requires additional circuitry to check if <Ra> is zero

New cards
70

For BEQ instructions, what should PCSEL be?

PCSEL = Z

0 if Z = 0

1 if Z = 1 (branch)

New cards
71

For BNE instructions, what should PCSEL be?

PCSEL = !Z

1 if Z = 0 (branch if <Ra> ≠ 0)
0 if Z = 1 (don't branch).

New cards
72

For both BEQ/BNE instructions:
What should ALUFN be?
What should WDSEL be?
What should WERF be?

ALUFN = DC

WDSEL = 0 (passes <PC>+4 to be written to Rc)

WERF = 1

New cards
73

What is XP (R30) used for?

register for handling Interrupts or Exceptions

New cards
74

Examples of CPU or system-generated faults (synchronous)

- Illegal instruction
- System calls, like "read-a-character"

New cards
75

Examples of externally generated I/O events (asynchronous)

Interrupt Request (IRQ) events like a key being pressed

New cards
76

How Interrupts Work:

1. Interrupt running program
2. Invoke exception handler (Similar to a procedure call)
3. Return to continue execution

New cards
77

What does ILLOP (PCSEL = 3) handle?

Handles illegal operations, like:
- Divide by 0
- Unimplemented instructions

New cards
78

What happens during an illegal instruction?

1. Procedure call is forced
2. CPU branches to illegal operation handler instead of executing illegal instruction
3. <PC+4> is saved to XP (R30)
4. Program resumes at instruction after illegal one

New cards
79

What does XAdr (PCSEL = 4) handle?

Interrupt Requests (IRQs)

New cards
80

What happens during an interrupt request?

1. Procedure call is forced
2. CPU branches to IRQ handler
3. <PC> is saved to XP (R30)
4. Program resumes at instruction that was supposed to execute when interrupt occurred

New cards
81

What is the difference between ILLOP and XAdr in handling events?

ILLOP handles illegal operations, saving <PC+4> to XP (R30)

XAdr handles interrupts, saving <PC> to XP (R30)

New cards
82

What is the primary purpose of a cache in a memory system?

combines high-speed memory access of expensive memory with large size of cheaper, slower main memory

New cards
83

How does a cache improve memory access efficiency?

  • Storing copy of frequently accessed portions of main memory for future use

  • Take advantage of locality of reference

New cards
84

Cache Read Operation

<p></p>
New cards
85

What happens when the processor attempts to read a word of memory?

Check if word is in cache

New cards
86

Cache Hit

- requested word is in cache
- it's delivered to processor

New cards
87

What happens during a cache hit?

- Address & data buffers disabled
- Communication only between processor and cache
- No system bus traffic

New cards
88

Cache Miss

  • Requested word not in cache

  • Desired address loaded onto system bus

  • Data is returned via data buffer to cache & processor

New cards
89

Why does cache load a block of memory instead of requesting the word during a miss?

To take advantage of locality of reference, which predicts that nearby words might be accessed soon

New cards
90

How many addressable words are in main memory?

2n addressable words

each word having a unique n-bit address

New cards
91

What are blocks in main memory?

Main memory is divided into fixed-length blocks, each containing K words

New cards
92

How many blocks (M) are in main memory? (formula)

M blocks in main mem = (2n) / K words

New cards
93

Cache consists of C blocks called ___?

Lines

New cards
94

Each line contains ______ words and additional information like ______ and ______

K words

Tags and Control bits

New cards
95

Tag identifies …?

- Identifies which block is currently being stored
- Equivalent to part of the block's memory address

New cards
96

What additional information is stored in a cache line besides words and tags?

Control bits to indicate if line was modified since being loaded into cache

New cards
97

What is the line size in a cache?

length of a line in cache, excluding tag and control bits

New cards
98

How does number of cache lines C compare to number of main memory blocks M?

lines C < main memory blocks M

New cards
99

A single cache line can hold data from multiple main memory blocks simultaneously

False

New cards
100

True or False: Every block in main memory has a dedicated cache line in the cache.

False

New cards

Explore top notes

note Note
studied byStudied by 6 people
... ago
5.0(1)
note Note
studied byStudied by 64 people
... ago
5.0(1)
note Note
studied byStudied by 11 people
... ago
5.0(2)
note Note
studied byStudied by 18 people
... ago
5.0(1)
note Note
studied byStudied by 6 people
... ago
5.0(1)
note Note
studied byStudied by 11 people
... ago
5.0(1)
note Note
studied byStudied by 145 people
... ago
5.0(2)
note Note
studied byStudied by 34 people
... ago
5.0(1)

Explore top flashcards

flashcards Flashcard (37)
studied byStudied by 9 people
... ago
5.0(1)
flashcards Flashcard (63)
studied byStudied by 45 people
... ago
5.0(3)
flashcards Flashcard (109)
studied byStudied by 90 people
... ago
4.5(2)
flashcards Flashcard (67)
studied byStudied by 6 people
... ago
5.0(1)
flashcards Flashcard (31)
studied byStudied by 10 people
... ago
5.0(2)
flashcards Flashcard (59)
studied byStudied by 24 people
... ago
5.0(1)
flashcards Flashcard (364)
studied byStudied by 4 people
... ago
5.0(1)
flashcards Flashcard (34)
studied byStudied by 27 people
... ago
5.0(2)
robot