5.1.4 · D3Instruction Set Architecture (ISA)

Worked examples — Register file organization

2,654 words12 min readBack to topic

Before anything else, let us re-earn the four symbols we will use over and over, in plain words:

The single cost fact we lean on everywhere:


The scenario matrix

Every register-file numeric question falls into one of these boxes. The job of this page is to hit every row.

# Case class What makes it tricky Example that hits it
A is an exact power of 2 clean Ex 1
B is not a power of 2 must round up (ceiling) Ex 2
C Degenerate: address bits Ex 3
D Total stored state , ports don't count Ex 4
E Superscalar port scaling area ratio Ex 5
F Limiting case: many ports how fast cost blows up Ex 6
G Read-during-write timing old vs new value, no arithmetic trap Ex 7
H Real-world word problem translate English → Ex 8
I Exam twist: instruction encoding budget mixing with opcode bits Ex 9
J R0 degenerate storage one register stores nothing Ex 10

Prerequisite building blocks live in Multiplexers and Decoders and Datapath and ALU; the timing row leans on Pipeline Hazards.


Worked Examples

Cell A — clean power of two

Cell B — not a power of two (the ceiling trap)

Cell C — the degenerate single register

Cell D — total stored state (ports don't count)

Cell E — superscalar port scaling

Figure — Register file organization

Cell F — the limiting case (how fast does it blow up?)

Figure — Register file organization

Cell G — read-during-write timing

Cell H — real-world word problem

Cell I — exam twist: instruction encoding budget

Cell J — R0 degenerate storage


Active Recall

Recall Which matrix cell is each trap?
  1. 40 registers → address bits? ::: Cell B (ceiling): .
  2. Does a 3rd read port change total stored bits? ::: No — Cell D: state is only.
  3. 4-issue vs 1-issue area factor? ::: Cell F: , from .
  4. Same-cycle read of a register being written? ::: Cell G: policy-dependent; forwarding gives new value.
  5. Why does 64 registers hurt opcode space? ::: Cell I: rises to 6, three fields cost 18 bits, leaving fewer opcode bits.

Connections


Address bits to select 1 of 40 registers?
bits.
Do read/write ports change the total stored bits of a register file?
No; stored bits only. Ports affect area and speed.
Area factor going from a 1-issue () to a 4-issue () file?
larger.
How many storage flip-flops in a 32×32-bit RISC-V file, given R0 is hardwired?
(R0 stores nothing).
Opcode bits left in a 32-bit word after three 5-bit register fields?
bits.