Complete the 4×2 register bank so the write port updates the selected register on the rising edge, while the read port independently selects the register shown at Data_Out1:Data_Out0.
Complete the missing write-decoder and read-MUX connections.
Constraints:
Write_Address1, Write_Address0, Read_Address1, Read_Address0, Data_In1, Data_In0, Write_Enable, Clock.Data_Out1, Data_Out0.Write_Address1:Write_Address0 selects the register that captures Data_In1:Data_In0 on the rising edge when Write_Enable = 1.Read_Address1:Read_Address0 independently selects the register shown at Data_Out1:Data_Out0; the read is combinational.Write_Enable = 0, all registers hold. No reset is used, so unwritten registers are undefined.| Operation | Write_Address1 | Write_Address0 | Read_Address1 | Read_Address0 | Data_In1 | Data_In0 | Write_Enable | Clock | Data_Out1:Data_Out0 |
|---|---|---|---|---|---|---|---|---|---|
| Read Register 0 | X | X | 0 | 0 | X | X | 0 | X | Stored value of Register 0 |
| Read Register 1 | X | X | 0 | 1 | X | X | 0 | X | Stored value of Register 1 |
| Read Register 2 | X | X | 1 | 0 | X | X | 0 | X | Stored value of Register 2 |
| Read Register 3 | X | X | 1 | 1 | X | X | 0 | X | Stored value of Register 3 |
| Write setup | W1 | W0 | R1 | R0 | D1 | D0 | 1 | 0 | Stored value at R1R0 |
| Write | W1 | W0 | R1 | R0 | D1 | D0 | 1 | 0 → 1 | D1:D0 is stored at W1W0; output follows R1R0 |
| Hold | X | X | R1 | R0 | X | X | 0 | 0 → 1 | Stored value at R1R0 remains visible |
W1:W0 is the selected write address, R1:R0 is the selected read address, D1:D0 is the data being written, and X means the input does not affect that operation.
If the read and write addresses are the same, Data_Out1:Data_Out0 shows the old value before the rising edge and the newly written value after the edge settles. If the selected register has not yet been written, its output is undefined.
A memory is described as:
Depth × Word Width
Capacity = Depth × Word Width
For a memory with D locations:
Address bits = ceil(log2(D))
Example: 256 × 8 → 2048 bits capacity and 8 address bits.
┌───────────────────┐
Address ───────►│ │
Data_In ───────►│ Memory │──────► Data_Out
CS / EN ───────►│ │
WE ────────────►│ │
OE / RE ───────►│ │
Clock* ────────►│ │
└───────────────────┘
CS/EN selects the memory, WE controls writing, and OE/RE controls reading/output.
When the memory is not enabled, no access occurs; the exact control polarity depends on the specified memory interface.
*Clock is used for synchronous memory operations.
Writes are rising-edge synchronous unless stated otherwise. Unwritten locations are undefined unless initialized.
| Case | Behavior |
|---|---|
| Asynchronous Read | Data_Out follows the selected address after access delay. |
| Synchronous Read | Data becomes valid according to a defined clock-cycle latency. |
| Read-First during R/W | Same-address read/write returns old data. |
| Write-First during R/W | Same-address read/write returns new data. |
| No-Change during R/W | Same-address read/write keeps the previous output. |
Access time is expressed in time, while read latency is expressed in clock cycles.
Smaller memories can be combined to increase word width or depth.
Width Expansion: Two 4 × 4 memories → 4 × 8
┌───────────┐
Address ────────►│ 4 × 4 │────► Data[3:0]
└───────────┘
▲
│ Same Address
▼
┌───────────┐
Address ────────►│ 4 × 4 │────► Data[7:4]
└───────────┘
Depth Expansion: Two 4 × 4 memories → 8 × 4
A2
│
┌──────┴───────┐
│ Memory Select│
└──────┬───────┘
│
┌────────┴────────┐
│ │
CS0 = A2' CS1 = A2
│ │
┌──────▼──────┐ ┌──────▼──────┐
A1:A0 ─►│ 4 × 4 │ │ 4 × 4 │◄─ A1:A0
│ Memory 0 │ │ Memory 1 │
└──────┬──────┘ └──────┬──────┘
│ │
└────────┬────────┘
▼
Selected Data[3:0]
For depth expansion, higher address bits select the memory or bank, while lower bits select the local address.
Address decoding generates the required CS or bank-select signals so only the intended memory responds.
Incomplete decoding can cause address aliasing, where multiple system addresses access the same physical location.
Static RAM (SRAM) is fast, volatile memory that retains stored data while power is present and does not require periodic refresh.
SRAM is commonly used where low access latency is more important than storage density.
ROM stores fixed or preinitialized data and retains its contents without power.
| Type | Update Behavior |
|---|---|
| Mask ROM | Programmed during manufacture; normally not changed afterward |
| EEPROM | Electrically erasable and reprogrammable |
| Flash | Non-volatile memory programmed and erased electrically, typically in larger regions |
ROM-type storage is useful for fixed tables, constants, configuration data, and firmware-like contents.
Dynamic RAM (DRAM) provides dense volatile storage and requires periodic refresh.
DRAM is organized conceptually into:
DRAM
└─ Banks
└─ Rows
└─ Columns
A row must be opened before data in that row can be accessed.
| Command | Purpose |
|---|---|
ACTIVATE | Opens the required row |
READ / WRITE | Accesses data in the open row |
PRECHARGE | Closes the currently open row |
REFRESH | Restores stored information periodically |
The required command sequence depends on the current open-row state.
Closed Row → ACTIVATE → READ / WRITE
Row Hit → READ / WRITE
Row Conflict → PRECHARGE → ACTIVATE → READ / WRITE
A row hit avoids reopening the row, while a row conflict requires the existing row to be closed before another row can be activated.
Refresh periodically restores DRAM information and may temporarily delay normal memory accesses.
At the architectural level, refresh is treated as a controller-scheduled memory operation rather than as a device-physics process.
Flash memory is non-volatile.
Program: 1 → 0
Erase: restores the erase region to 1
Programming and erasing therefore have different behavior; an already-programmed 0 is not simply changed back to 1 by another program operation.
| Memory | Volatile? | Relative Characteristic | Update Behavior | Typical Use |
|---|---|---|---|---|
| SRAM | Yes | Fast access, lower density | Direct read/write | Small fast storage |
| ROM | No | Fixed/preinitialized storage | Normally fixed | Constants and lookup tables |
| DRAM | Yes | High density | Read/write + refresh | Large working memory |
| EEPROM | No | Reprogrammable NVM | Electrical erase/write | Configuration storage |
| Flash | No | Dense NVM | Program + erase regions | Bulk non-volatile storage |
Memory selection depends on required volatility, access latency, density, update behavior, and application role.
A register file is a small structured memory optimized for fast access near datapaths.
A typical 2-read / 1-write register file provides:
Write_Data
│
Write_Addr ──► Write Decoder
│
Write Select
│
┌─────────────┐
│ Register │
│ Bank │
└──────┬──────┘
┌────┴────┐
│ │
Read_Addr_A ───► Read MUX A │
│ │
▼ │
Read_Data_A │
│
Read_Addr_B ─────────► Read MUX B
│
▼
Read_Data_B
Internally, the write decoder selects the destination entry, while independent read MUX paths select the two read outputs.
Write_Enable = 1.For same-address read/write access, there is no bypass unless explicitly stated.
Before write edge → Read shows old data
After write edge → Read shows newly stored data
| Architecture | Access Capability |
|---|---|
| Single-Port | One shared access port |
| Simple Dual-Port | Separate read and write ports |
| True Dual-Port | Two independently controlled read/write ports |
Multi-port memories improve concurrency because more than one access can occur in the same cycle.
Different-address operations may proceed concurrently when the architecture supports them.
When two ports access the same address, the required behavior must be defined.
For the dual-port behavior defined here:
| Collision | Behavior |
|---|---|
| Read / Write, same address | Read-first: the read observes old data on the write edge |
| Write / Write, same address | Collision = 1; Port A wins and Port B write is blocked |
Same-address behavior should never be assumed from the term dual-port alone.
| Property | Register File | RAM |
|---|---|---|
| Typical Size | Small | Small to very large |
| Main Role | Fast operand/state access near datapaths | General data storage |
| Ports | Often multiple dedicated read/write ports | Depends on memory architecture |
| Hardware Cost | Increases quickly with more ports | Usually more area-efficient for larger storage |
More ports improve concurrent access, but increase hardware and routing cost.
A First-In, First-Out (FIFO) stores data in the same order in which it is written.
Write_Data ──► [ FIFO Storage ] ──► Data_Out
▲ ▲
│ │
Write Ptr Read Ptr
│ │
Status / Control
A FIFO typically contains:
The write pointer selects the next location to receive data, while the read pointer selects the oldest valid entry.
0 → 1 → 2 → 3
↑ ↓
└───────────┘
After the final location, the pointer wraps around to the first location.
| Status | Meaning |
|---|---|
| Empty | No valid entries are available to read |
| Full | No free entries are available to write |
| Occupancy | Number of valid entries currently stored |
Access is accepted only when valid:
Write accepted when Full = 0
Read accepted when Empty = 0
Blocked accesses must not change the FIFO state.
| Operation | Effect |
|---|---|
| Write only | Store data, advance the write pointer, occupancy +1 |
| Read only | Output data, advance the read pointer, occupancy -1 |
| Valid Read + Write | Both operations occur; occupancy is unchanged |
| Blocked Write | No state change when Full = 1 |
| Blocked Read | No state change when Empty = 1 |
Data_Out updates only on an accepted read and otherwise retains its previous value.
Reset clears the FIFO's logical state:
Data_Out may be reset to a defined value, but the payload storage itself does not need to be erased because Empty indicates that no stored entry is currently valid.
| Implementation | Typical Characteristic |
|---|---|
| Register-Based FIFO | Simple and suitable for small FIFOs |
| RAM-Based FIFO | More storage-efficient for larger FIFOs |
An asynchronous FIFO allows read and write operations in different clock domains, but its CDC implementation is outside this topic.
Memory banking divides storage into independently accessible banks.
┌──────────┐
Address ────────►│ Bank │
│ Select │
└────┬─────┘
│
┌──────┴──────┐
│ │
┌────▼────┐ ┌────▼────┐
│ Bank 0 │ │ Bank 1 │
└─────────┘ └─────────┘
The address is divided into:
Bank-select bits → Target bank
Local-address bits → Location inside that bank
Interleaving distributes sequential addresses across different banks.
Example: two-bank interleaving
Address 0 → Bank 0
Address 1 → Bank 1
Address 2 → Bank 0
Address 3 → Bank 1
Here, one address bit selects the bank while the remaining bits form the local address.
Requests to different banks may proceed concurrently. Requests targeting the same bank create a bank conflict and require arbitration.
Example fixed-priority policy:
Requester 0 > Requester 1
| Requests | Result |
|---|---|
| Different banks | Both requests may proceed |
| Same bank | Bank conflict occurs |
| Same bank with fixed priority | Requester 0 is granted; Requester 1 waits |
An arbiter applies the defined priority rule so competing requests are resolved deterministically.
Banking primarily improves throughput by allowing accesses to different banks in parallel.
It does not inherently reduce the intrinsic latency of a single memory access.
A Content-Addressable Memory (CAM) searches stored entries by content rather than by address.
| Memory | Access Method |
|---|---|
| RAM | Provide an address to read or write a location |
| CAM | Provide a search key and find matching stored entries |
Each CAM entry contains:
Valid + Key
Only entries with Valid = 1 participate in a search.
Search_Key
│
├────► Entry 0: Valid + Key ─► Compare
├────► Entry 1: Valid + Key ─► Compare
├────► Entry 2: Valid + Key ─► Compare
└────► Entry 3: Valid + Key ─► Compare
│
▼
Priority Select
│
Match / Match_Index
CAM search is combinational: all valid entries are compared with Search_Key in parallel.
| Output | Meaning |
|---|---|
Match | Indicates that at least one valid entry matches |
Match_Index | Identifies the selected matching entry |
If no valid entry matches:
Match = 0
When multiple valid entries match, the lowest matching index wins.
Matching entries: 1 and 3
Selected Match_Index: 1
A CAM entry can be added or replaced by selecting an entry and updating its stored Key and Valid state.
Write_Index + Key_In + Valid_In
│
▼
Selected CAM Entry
The selected entry is updated on the rising clock edge when writing is enabled.
A Ternary CAM (TCAM) extends CAM matching by allowing masked or don't-care bits in stored entries.
This enables a stored entry to match more than one exact binary key.
Stored or transferred data may become corrupted. Parity provides a simple way to detect selected error patterns.
With even parity, the total number of 1 bits in the protected word, including the parity bit, is even.
Write: Data ──► Generate Parity ──► Store Data + Parity
Read: Data + Parity ──► Recompute / Check ──► Error
Parity can detect errors, but it does not identify or correct the corrupted bit.
Error-Correcting Codes (ECC) use additional check bits to provide stronger protection than parity.
A syndrome represents the result of the ECC check and can indicate error status or location.
SECDED provides:
Detailed Hamming-code derivation is outside this topic.
A memory controller sequences transactions and coordinates memory availability.
Request
│
▼
Accept ──► Access / Wait ──► Complete
│
Busy / Wait
A request is accepted only when the controller is ready. Required request fields are captured at acceptance and held while the transaction is active.
Later changes on external request inputs do not alter the active transaction.
Ready or Done indicates completion. When Done is used, it is a one-clock pulse unless otherwise specified.
A new request may be accepted when the controller returns to its ready/idle state.
Multiple requesters may require arbitration before a transaction begins.
A DRAM controller converts memory requests into command sequences based on the currently open row.
Closed Row → ACTIVATE → READ / WRITE
Row Hit → READ / WRITE
Row Conflict → PRECHARGE → ACTIVATE → READ / WRITE
Each DRAM command in this simplified controller sequence occupies one controller cycle.
The controller tracks the currently open row and schedules refresh when required.
No row open → REFRESH
Row open → PRECHARGE → REFRESH
Refresh has priority when the controller becomes idle and leaves the row state closed.
Different storage architectures solve different design problems.
| Architecture | Typical Selection Reason |
|---|---|
| SRAM | Low access latency |
| DRAM | High storage density |
| Flash | Non-volatile storage |
| Register File | Fast multi-port operand access |
| FIFO | Ordered buffering |
| CAM | Search by content |
| Banked Memory | Higher concurrent throughput |
| Multi-Port Memory | Multiple simultaneous accesses |
Architecture selection depends on capacity, latency, throughput, volatility, and access requirements.