Skip to content

ยง 3.3.3. DRAM

One-bank digital DRAM with explicit activation, a sensed row buffer, restoration, precharge, and refresh. It follows the common device architecture, but does not reuse FF/SRAM cell semantics.

Component Description Structural Behavioral
DRAMCell Charge bit with destructive sampling and restoration Yes No
DRAMRow<C> C cells sharing a wordline Yes Yes
DRAMSenseColumn<R> One row-buffer bit and restoration signal Yes No
DRAMStorageBank<W> Rows connected to shared sense columns Yes Yes
DRAMCommandControl<W> Clocked command acceptance and the timing chains of each command, as gates and delay lines Yes No
DRAM<W> Complete single-bank device Yes Yes

Real DRAM controllers track open rows, issue precharge and activate commands, and respect the device's intervals. This device keeps those distinctions, with intervals from the active timing profile: in embedded an SDR SDRAM (Micron MT48LC16M16A2), in desktop a DDR4 part (Micron MT40A1G8). It is not a pin-compatible SDRAM or DDR interface. See Microchip's SDRAM controller description.

Configuration

W, N, and K follow 3.1. Defaults are W=8 in examples, N=4, K=2.

Parameter Default Meaning / constraints
retention_ticks From the profile How long a closed row keeps its charge; 1,024 โ€ฆ 10ยนยฒ. In the realistic profiles 64 ms (tREF)
block_words 2 Columns read by one READ_BURST: a power of two, at most the row's words and 16
phase_ticks 32 Accepted (32โ€ฆ10,000) for compatibility; it no longer sets any timing

Storage starts X. Retention is checked lazily at the next activation, avoiding periodic decay events for every cell. A cell closed for at least retention_ticks samples X; refresh after expiry cannot recover its old data. While a row is open, the enabled sense amplifiers restore it. A displayed idle cell Q is not a continuously updated analog charge measurement.

Compile the C++ examples in page order: larger references compose the earlier ones. They cover binary controls, stored state and outputs. Their command steps use one placeholder duration, ticks, where the device uses the profile's intervals (see Timing); they do not model gate propagation or analog behavior.

Configuration is DRAMDeviceConfig. Catalog contracts are memory.dram.cell, memory.dram.row, memory.dram.sense-column, memory.dram.bank.W, memory.dram.command-control.W, and memory.dram.device.W. Standalone rows use columns and retention_ticks; sense columns use rows. Only the public bank/device wrappers are C++ width templates. The command controller is catalog-created, not a public C++ template.

3.3.3.1. DRAMCell

One digital charge bit with destructive sampling and restoration.

IO pins

Pin Direction Width Description
WL Input 1 Wordline; activation samples charge
RESTORE Input 1 Rewrite charge from D while WL is high
D Input 1 Restore/write value
SAMPLE Output 1 Value sampled on activation; held until close
Q Output 1 Modeled cell charge

Behavior

A newly selected cell copies retained charge into SAMPLE and invalidates Q. With WL=RESTORE=1, D restores Q. Closing clears SAMPLE and starts the retention interval; closing without restoration loses the bit. Reading a cell alone is destructive: the bank's sense column supplies restoration.

C++ example

Binary controls with std::optional<bool> representing known charge or X. Retention is tested at activation.

#include <cstddef>
#include <optional>
struct DRAMCellReference {
    std::optional<bool> q, sample;
    bool selected = false, restored = false;
    std::size_t closed_at = 0;
    void update(std::size_t now, std::size_t retention,
                bool wl, bool restore, std::optional<bool> data) {
        if (wl && !selected) {
            sample = now - closed_at >= retention ? std::nullopt : q;
            q.reset();
            restored = false;
        }
        if (wl && restore) { q = data; restored = true; }
        if (!wl && selected) {
            if (!restored) q.reset();
            sample.reset();
            closed_at = now;
            restored = false;
        }
        selected = wl;
    }
};

Unknown inputs

Starts X. Unknown WL makes charge and sample unknown; unknown RESTORE while selected makes charge unknown. D=Z stores X. WL=0 ignores restore/data. retention_ticks accepts 1,024โ€“10ยนยฒ. Expiry has no periodic event: the next activation observes loss.

Implementation

Structural implementation

Terminal digital charge primitive, not a flip-flop or an RC electrical simulation. Q and SAMPLE make the storage/sensing distinction explicit. No redundant behavioral-fidelity replacement is registered.

The visualizer displays separate charge (Q) and read sample (SAMPLE) panels, with WL/RESTORE indicators, using recorded pin values at the selected time. It does not invent an analog charge level or retention countdown; expiry is checked on activation as described above.

Examples

All 8 recorded rows of DRAMCellTest, in checkpoint order. Outputs are test expectations verified against the simulation. Time is the absolute settled checkpoint time in simulator units, not milliseconds or CPU cycles.

Default scenario profile: fidelity-gate-v1 / structural (ed03f70afe360dba). Changing fidelity or the circuit can change these times.

Checkpointzero-based number ยท timeline label Timesimulator units DInput ยท 1 bit RESTOREInput ยท 1 bit WLInput ยท 1 bit QExpected output ยท 1 bit SAMPLEExpected output ยท 1 bit
#0unknown-startup1 1 0 0 X X
#1activate-empty2 1 0 1 not checked X
#2restore-one4 1 1 1 1 not checked
#3close5 1 0 0 1 not checked
#4destructive-read7 1 0 1 X 1
#5omit-restore9 1 0 0 X not checked
#6activate-lost-bit10 1 0 1 not checked X
#7write-zero12 0 1 1 0 not checked

Scroll within the table for all rows and pins. Buses use hexadecimal; values containing X/Z use MSB-first binary. Inputs show the declared values in effect at each checkpoint, including retained inputs. Sequential tests also replay preparation changes between checkpoints, such as lowering the clock. Use the matching checkpoint label in the simulation below.

The sequence starts unknown, restores one, closes, samples that one destructively without restoring, observes loss, then writes zero. Device timing tests separately cover retention and refresh.

Embedded simulation

The standalone DRAMCellTest opens this component as MEMORY_ROOT. This component has one registered structural implementation.

Open DRAMCell in the simulator

Source and tests

Test Coverage
DRAMCellTest The complete standalone sequence shown above
MemoryDeviceTimingTest Retention, refresh before expiry, and loss after expiry through structural and compact devices

3.3.3.2. DRAMRow<C>

C charge cells sharing one wordline.

IO pins

Pin Direction Width Description
WL Input 1 Shared wordline
RESTORE_c Input 1 each Column c restoration enable
D_c Input 1 each Column c restore/write value
Q_c, SAMPLE_c Output 1 each Charge and sample, 0 โ‰ค c < C

Behavior

columns=C creates 1โ€“512 independent cells (default 4). Each follows the DRAMCell rule with shared WL and per-column restore/data. A row may contain K words; it has no address decoder or command port.

C++ example

Row composition. Instantiate Cell with the DRAMCellReference above; each record owns its charge, sample, and closed timestamp.

#include <array>
#include <cstddef>
#include <optional>
template<class Cell, std::size_t C>
void dram_row_update(std::array<Cell, C>& cells, std::size_t now,
                     std::size_t retention, bool wl,
                     const std::array<bool, C>& restore,
                     const std::array<std::optional<bool>, C>& data) {
    for (std::size_t c = 0; c < C; ++c)
        cells[c].update(now, retention, wl, restore[c], data[c]);
}

Unknown inputs

Each column applies the cell's X/Z and lazy-retention rules independently. An unknown shared WL affects every cell. Use separate settled activation and restoration steps; this is not an instantaneous atomic row read.

Implementation

Structural implementation

CELL_0 through CELL_(Cโˆ’1) are DRAMCell primitives. WL fans out to all cells; restoration and output pins remain per-column. Cells are laid out horizontally.

Behavioral implementation

Stores C charge records and applies sampling, restoration, close timestamps, and expiry directly. It preserves expanded row pins but removes the cell objects.

Examples

All 5 recorded rows of DRAMRowTest, in checkpoint order. Outputs are test expectations verified against the simulation. Time is the absolute settled checkpoint time in simulator units, not milliseconds or CPU cycles.

Default scenario profile: fidelity-gate-v1 / structural (ed03f70afe360dba). Changing fidelity or the circuit can change these times.

Checkpointzero-based number ยท timeline label Timesimulator units D_0Input ยท 1 bit D_1Input ยท 1 bit RESTORE_0Input ยท 1 bit RESTORE_1Input ยท 1 bit WLInput ยท 1 bit Q_0Expected output ยท 1 bit Q_1Expected output ยท 1 bit SAMPLE_0Expected output ยท 1 bit SAMPLE_1Expected output ยท 1 bit
#0initial1 1 0 0 0 0 X X not checked not checked
#1activate2 1 0 0 0 1 not checked not checked X not checked
#2write-row4 1 0 1 1 1 1 0 not checked not checked
#3close5 1 0 0 0 0 1 not checked not checked not checked
#4sample7 1 0 0 0 1 not checked not checked 1 0

Scroll within the table for all rows and pins. Buses use hexadecimal; values containing X/Z use MSB-first binary. Inputs show the declared values in effect at each checkpoint, including retained inputs. Sequential tests also replay preparation changes between checkpoints, such as lowering the clock. Use the matching checkpoint label in the simulation below.

The two-column example restores one and zero, closes the row, then reactivates it and checks both samples.

Embedded simulation

The standalone DRAMRowTest opens this component as MEMORY_ROOT. Use the explorer to compare structural and behavioral implementations.

Open DRAMRow<C> in the simulator

Source and tests

Test Coverage
DRAMRowTest The complete standalone sequence shown above
MemoryDeviceContractTest Structural/behavioral agreement at settled checkpoints, including mixed hierarchy selection

3.3.3.3. DRAMSenseColumn<R>

One shared column's row-buffer bit and restoration control.

IO pins

Pin Direction Width Description
PRECHARGE Input 1 Prepare the column with all wordlines low
SENSE Input 1 Enable sensing/restoration
WL_r, SAMPLE_r Input 1 each Selection and sampled charge, 0 โ‰ค r < R
WRITE Input 1 Replace the active row-buffer bit
D Input 1 Write value
Q Output 1 Latched row-buffer bit
RESTORE Output 1 Feed Q into the selected cell

Behavior

After precharge, sensing exactly one selected row latches its SAMPLE and asserts RESTORE. Subsequent SAMPLE changes do not overwrite the latch; WRITE changes it. No active sensing means RESTORE=0 while the buffer can remain latched. Switching to another row without precharging invalidates the buffer. rows=R accepts 1โ€“512, default 2.

C++ example

Binary controls, including zero/multiple selected rows. An empty data optional means X. The reference retains the buffer when sensing is disabled.

#include <cstddef>
#include <optional>
#include <vector>
struct DRAMSenseReference {
    bool prepared = true, restore = false;
    std::optional<std::size_t> sensed_row;
    std::optional<bool> q;
    void update(bool precharge, bool sense, const std::vector<bool>& wl,
                const std::vector<std::optional<bool>>& samples,
                bool write, std::optional<bool> data) {
        std::optional<std::size_t> row;
        unsigned count = 0;
        for (std::size_t r = 0; r < wl.size(); ++r)
            if (wl[r]) { row = r; ++count; }
        restore = false;
        if (precharge && !count) {
            prepared = true;
            sensed_row.reset(); q.reset();
        } else if (precharge || count > 1) {
            prepared = false;
            sensed_row.reset(); q.reset();
        } else if (sense && row) {
            if (!prepared || (sensed_row && sensed_row != row)) {
                prepared = false; sensed_row.reset(); q.reset();
                return;
            }
            if (!sensed_row) { sensed_row = row; q = samples.at(*row); }
            if (write) q = data;
            restore = true;
        }
    }
};

Unknown inputs

Starts prepared with Q=X. Unknown wordlines, more than one selected row, unknown SENSE, or invalid precharge conditions invalidate preparation and Q. Unknown WRITE during sensing makes Q unknown. PRECHARGE=1 with all wordlines low prepares regardless of SENSE. It is a memory primitive; samples must settle before SENSE.

Implementation

Structural implementation

Terminal stateful sense primitive. Its latched Q forms one bit of the bank's row buffer; RESTORE feeds the selected cells. It models the result of sensing/restoration, not voltage differences or transistor gain.

Examples

All 6 recorded rows of DRAMSenseColumnTest, in checkpoint order. Outputs are test expectations verified against the simulation. Time is the absolute settled checkpoint time in simulator units, not milliseconds or CPU cycles.

Default scenario profile: fidelity-gate-v1 / structural (ed03f70afe360dba). Changing fidelity or the circuit can change these times.

Checkpointzero-based number ยท timeline label Timesimulator units DInput ยท 1 bit PRECHARGEInput ยท 1 bit SAMPLE_0Input ยท 1 bit SAMPLE_1Input ยท 1 bit SENSEInput ยท 1 bit WL_0Input ยท 1 bit WL_1Input ยท 1 bit WRITEInput ยท 1 bit QExpected output ยท 1 bit RESTOREExpected output ยท 1 bit
#0precharge32 0 1 1 0 0 0 0 0 X 0
#1activate33 0 0 1 0 0 1 0 0 not checked 0
#2sense-and-restore66 0 0 1 0 1 1 0 0 1 1
#3latch-survives-sample-change67 0 0 X 0 1 1 0 0 1 not checked
#4write-row-buffer100 0 0 X 0 1 1 0 1 0 not checked
#5conflicting-rows133 0 0 X 0 1 1 1 1 X 0

Scroll within the table for all rows and pins. Buses use hexadecimal; values containing X/Z use MSB-first binary. Inputs show the declared values in effect at each checkpoint, including retained inputs. Sequential tests also replay preparation changes between checkpoints, such as lowering the clock. Use the matching checkpoint label in the simulation below.

Precharge, activate row zero, sense one, change SAMPLE to X while retaining the latch, write zero into the buffer, then assert conflicting wordlines and check invalidation.

Embedded simulation

The standalone DRAMSenseColumnTest opens this component as MEMORY_ROOT. This component has one registered structural implementation.

Open DRAMSenseColumn<R> in the simulator

Source and tests

Test Coverage
DRAMSenseColumnTest The complete standalone sequence shown above
MemoryDeviceContractTest Integration in the new structural devices and comparison with their compact implementations

3.3.3.4. DRAMStorageBank<W>

A matrix of charge cells connected to a shared row buffer.

IO pins

Pin Direction Width Description
PRECHARGE, SENSE Input 1 each Shared column controls
WL_r Input 1 each Row wordlines, 0 โ‰ค r < N/K
DRIVE_c, DATA_c Input 1 each Column write enables and values
COL_c Output 1 each Row-buffer bits, 0 โ‰ค c < Wร—K

Behavior

Activate one wordline, allow cell samples to settle, then enable SENSE. Each column latches and restores its sample. DRIVE_c writes that column's row-buffer bit and restores it into the selected cell. Close the wordline before precharge. Address translation, byte masks, and legal command sequencing belong to the device.

C++ example

The bank composes the preceding cell and sense-column references. Each call settles charge sampling, column sensing, and restoration in that order; it does not model the individual gate delays between them.

#include <vector>
struct DRAMBankReference {
    std::vector<std::vector<DRAMCellReference>> rows;
    std::vector<DRAMSenseReference> columns;
    DRAMBankReference(std::size_t r, std::size_t c)
        : rows(r, std::vector<DRAMCellReference>(c)), columns(c) {}
    void update(std::size_t now, std::size_t retention, bool precharge, bool sense,
                const std::vector<bool>& wl, const std::vector<bool>& drive,
                const std::vector<std::optional<bool>>& data) {
        for (std::size_t c = 0; c < columns.size(); ++c) {
            std::vector<std::optional<bool>> samples;
            for (std::size_t r = 0; r < rows.size(); ++r) {
                rows[r][c].update(now, retention, wl.at(r), false, std::nullopt);
                samples.push_back(rows[r][c].sample);
            }
            auto& column = columns[c];
            column.update(precharge, sense, wl, samples, drive.at(c), data.at(c));
            for (std::size_t r = 0; r < rows.size(); ++r)
                rows[r][c].update(now, retention, wl.at(r), column.restore, column.q);
        }
    }
    // COL_c = columns[c].q. Cell charge and samples remain independently visible.
};

Unknown inputs

Selection conflicts and unknown controls follow DRAMSenseColumn; individual charge records follow DRAMCell. Closing without valid restoration can lose data. Both bank fidelities retain scalar pins and the 4,096-cell limit. Compare settled checkpoints, not transient gate waveforms or the exact retention boundary, across fidelities.

Implementation

Structural implementation

ROW_r contains Wร—K cells. COLUMN_c is a DRAMSenseColumn connected to SAMPLE_c from every row, with Q/RESTORE feedback to every cell in that column. WL qualifies which cell accepts restoration. Rows are stacked and sense columns align beneath them.

Behavioral implementation

Uses charge records plus a row-buffer vector, with independent selection/preparation state. It preserves destructive sampling, restoration, precharge, per-column writes, and retention without expanding the cells.

Examples

All 9 recorded rows of DRAMStorageBankTest, in checkpoint order. Outputs are test expectations verified against the simulation. Time is the absolute settled checkpoint time in simulator units, not milliseconds or CPU cycles.

Default scenario profile: fidelity-gate-v1 / structural (ed03f70afe360dba). Changing fidelity or the circuit can change these times.

Checkpointzero-based number ยท timeline label Timesimulator units DATA_0Input ยท 1 bit DATA_1Input ยท 1 bit DATA_10Input ยท 1 bit DATA_11Input ยท 1 bit DATA_12Input ยท 1 bit DATA_13Input ยท 1 bit DATA_14Input ยท 1 bit DATA_15Input ยท 1 bit DATA_2Input ยท 1 bit DATA_3Input ยท 1 bit DATA_4Input ยท 1 bit DATA_5Input ยท 1 bit DATA_6Input ยท 1 bit DATA_7Input ยท 1 bit DATA_8Input ยท 1 bit DATA_9Input ยท 1 bit DRIVE_0Input ยท 1 bit DRIVE_1Input ยท 1 bit DRIVE_10Input ยท 1 bit DRIVE_11Input ยท 1 bit DRIVE_12Input ยท 1 bit DRIVE_13Input ยท 1 bit DRIVE_14Input ยท 1 bit DRIVE_15Input ยท 1 bit DRIVE_2Input ยท 1 bit DRIVE_3Input ยท 1 bit DRIVE_4Input ยท 1 bit DRIVE_5Input ยท 1 bit DRIVE_6Input ยท 1 bit DRIVE_7Input ยท 1 bit DRIVE_8Input ยท 1 bit DRIVE_9Input ยท 1 bit PRECHARGEInput ยท 1 bit SENSEInput ยท 1 bit WL_0Input ยท 1 bit WL_1Input ยท 1 bit COL_0Expected output ยท 1 bit COL_1Expected output ยท 1 bit COL_10Expected output ยท 1 bit COL_11Expected output ยท 1 bit COL_12Expected output ยท 1 bit COL_13Expected output ยท 1 bit COL_14Expected output ยท 1 bit COL_15Expected output ยท 1 bit COL_2Expected output ยท 1 bit COL_3Expected output ยท 1 bit COL_4Expected output ยท 1 bit COL_5Expected output ยท 1 bit COL_6Expected output ยท 1 bit COL_7Expected output ยท 1 bit COL_8Expected output ยท 1 bit COL_9Expected output ยท 1 bit
#0precharge32 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 X not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#1activate-row-zero33 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#2sense-empty-row66 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 X not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#3write-row100 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
#4hold-row101 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
#5close-row134 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#6precharge-again167 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 X not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#7reopen-row169 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#8read-restored-row203 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

Scroll within the table for all rows and pins. Buses use hexadecimal; values containing X/Z use MSB-first binary. Inputs show the declared values in effect at each checkpoint, including retained inputs. Sequential tests also replay preparation changes between checkpoints, such as lowering the clock. Use the matching checkpoint label in the simulation below.

Writes alternating bits across row zero, releases write drive, closes/precharges, reopens the row, and checks that restoration preserved all 16 columns.

Embedded simulation

The standalone DRAMStorageBankTest opens this component as MEMORY_ROOT. Use the explorer to compare structural and behavioral implementations.

Open DRAMStorageBank<W> in the simulator

Source and tests

Test Coverage
DRAMStorageBankTest The complete standalone sequence shown above
MemoryDeviceContractTest Structural/behavioral agreement at settled checkpoints, including mixed hierarchy selection

3.3.3.5. DRAMCommandControl<W>

Takes a command at a rising clock edge and runs that command's timing chain of gates and delay lines.

IO pins

Pin Direction Width Description
CLK Input 1 Rising edge takes a command
CMD Input 3 NOP, ACTIVATE, READ, WRITE, PRECHARGE, REFRESH, READ_BURST
ADDR Input 32 Row for ACTIVATE, word slot for READ, WRITE and READ_BURST
WRITE_DATA Input W Write payload
WRITE_MASK Input W/8 Byte enables
BUSY, ERROR, READ_VALID, ROW_OPEN Output 1 each Device status
ROW_ADDR, COLUMN_ADDR Output 32 each Latched row and word slot
DATA Output W Latched write payload
MASK Output W/8 Latched write byte enables
PRECHARGE, SENSE Output 1 each Column controls
ROW_ENABLE, WRITE_ENABLE Output 1 each Row and write controls
OUTPUT_ENABLE Output 1 A finished read's data is on the output

Behavior

Carries out the command table of DRAM<W> without storing array data. A legal command at a rising edge latches what it needs, clears an old error and read-valid state, raises BUSY, and starts its chain: each step of the command is a delay line from the profile, gated by the command's run signal. The end of the chain is sampled at the next rising edge by a one-stage sampler; the completion is then shown at once (BUSY low, READ_VALID for a read, the new ROW_OPEN state) and takes effect at the following edge, which may already take the next command, as a real SDRAM takes its next command when the interval is over. NOP keeps the status. An illegal command while idle reports ERROR; a command while busy reports ERROR without disturbing the running operation.

C++ example

Binary pin values; geometry is prevalidated. Call on input changes and at every nonzero due. output supplies both READ_VALID and OUTPUT_ENABLE; wl supplies ROW_ENABLE. Every step takes the same placeholder ticks, and a new command waits until the previous one has finished (the device can take it in the completing cycle). READ_BURST is not modelled here.

#include <cstdint>
#include <cstddef>
#include <optional>
#include <vector>
template<std::size_t W> struct DRAMControlReference {
    struct Inputs {
        bool clock = false;
        unsigned cmd = 0;
        std::uint32_t address = 0, data = 0;
        unsigned mask = 0;
    };
    std::size_t rows, slots, ticks, due = 0;
    unsigned command = 0, stage = 0;
    std::size_t row = 0, col = 0, refresh_row = 0;
    bool busy = false, error = false, open = false, precharge = true;
    bool sense = false, wl = false, write = false, output = false;
    std::optional<bool> previous_clock; // First observed high is not a 0->1 edge.
    std::vector<std::optional<bool>> data = std::vector<std::optional<bool>>(W);
    unsigned mask = 0;
    DRAMControlReference(std::size_t r, std::size_t k, std::size_t t)
        : rows(r), slots(k), ticks(t) {}
    void update(std::size_t now, const Inputs& in) {
        // Finish the current phase before accepting a simultaneous command edge.
        if (due && now >= due) {
            due = 0; ++stage;
            switch (command) {
            case 1: // ACT: select -> sense/restore -> row open.
                if (stage == 1) wl = true;
                else if (stage == 2) sense = true;
                else { open = true; busy = false; }
                break;
            case 2: output = true; busy = false; break;
            case 3:
                if (stage == 1) write = true;
                else if (stage == 2) write = false;
                else busy = false;
                break;
            case 4:
                if (stage == 1) { wl = false; sense = false; }
                else if (stage == 2) precharge = true;
                else { open = false; busy = false; }
                break;
            case 5: // Refresh exactly one row, then advance the cursor.
                if (stage == 1) wl = true;
                else if (stage == 2) sense = true;
                else if (stage == 3) { wl = false; sense = false; }
                else if (stage == 4) precharge = true;
                else { refresh_row = (refresh_row + 1) % rows; busy = false; }
                break;
            }
            if (busy) due = now + ticks;
        }
        const bool edge = previous_clock == false && in.clock;
        previous_clock = in.clock;
        if (!edge || in.cmd == 0) return; // NOP preserves status, even while busy.
        if (busy) { error = true; return; } // Do not disturb the active operation.
        bool allowed = false;
        switch (in.cmd) {
        case 1: allowed = !open && in.address < rows; break;
        case 2: case 3: allowed = open && in.address < slots; break;
        case 4: allowed = open; break;
        case 5: allowed = !open; break;
        }
        output = false;
        if (!allowed) { error = true; return; }
        error = false; busy = true; command = in.cmd; stage = 0; due = now + ticks;
        if (command == 1 || command == 5) {
            row = command == 1 ? in.address : refresh_row;
            precharge = wl = sense = false;
        }
        if (command == 2 || command == 3) col = in.address;
        if (command == 3) {
            for (unsigned b = 0; b < W; ++b) data[b] = bool((in.data >> b) & 1u);
            mask = in.mask;
        }
    }
};

Unknown inputs

Only CLK=0 followed by CLK=1 takes a command; X/Zโ†’1 is not an edge. An unknown CMD reports ERROR. ACTIVATE, READ and WRITE need a binary ADDR; WRITE also needs a binary mask. Unknown payload bits become unknown storage in the enabled bytes. Inputs a command does not use are ignored.

Implementation

Structural implementation

Flip-flops hold the command, row, column, payload and status bits; gates decide legality and the next state at each edge. Each command's steps are MemoryDelayLines in a chain (ACTIVATE: wordline, sense, restore; READ: column; WRITE: drive on, drive off, recovery; PRECHARGE: close, precharge, equalize; REFRESH: an activation and a precharge of the next refresh row, plus the refresh cycle's remaining time in the realistic profiles). The sense and precharge steps also carry a replica of the row decoder, so they outlast it in every profile. A one-stage Synchronizer samples the end of the chain; a round-robin counter chooses the refresh row. A device with no reset pin starts idle through a PowerOnReset.

Examples

All 135 recorded rows of DRAMCommandControlTest, in checkpoint order. Outputs are test expectations verified against the simulation. Time is the absolute settled checkpoint time in simulator units, not milliseconds or CPU cycles.

Default scenario profile: fidelity-gate-v1 / structural (ed03f70afe360dba). Changing fidelity or the circuit can change these times.

Checkpointzero-based number ยท timeline label Timesimulator units ADDRInput ยท 32 bit CLKInput ยท 1 bit CMDInput ยท 3 bit WRITE_DATAInput ยท 8 bit WRITE_MASKInput ยท 1 bit BUSYExpected output ยท 1 bit COLUMN_ADDRExpected output ยท 32 bit DATAExpected output ยท 8 bit ERRORExpected output ยท 1 bit MASKExpected output ยท 1 bit OUTPUT_ENABLEExpected output ยท 1 bit PRECHARGEExpected output ยท 1 bit READ_VALIDExpected output ยท 1 bit ROW_ADDRExpected output ยท 32 bit ROW_ENABLEExpected output ยท 1 bit ROW_OPENExpected output ยท 1 bit SENSEExpected output ยท 1 bit WRITE_ENABLEExpected output ยท 1 bit
#0closed-startup20 0x00000000 0 0x0 0x81 1 0 not checked not checked not checked not checked not checked not checked not checked not checked not checked 0 not checked not checked
#1read-while-closed-setup34 0x00000000 0 0x2 0x81 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#2read-while-closed-edge40 0x00000000 1 0x2 0x81 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#3read-while-closed-command-removed51 0x00000000 0 0x0 0x81 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#4read-while-closed-clock-156 0x00000000 1 0x0 0x81 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#5read-while-closed-clock-1-low61 0x00000000 0 0x0 0x81 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#6read-while-closed-clock-266 0x00000000 1 0x0 0x81 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#7read-while-closed-clock-2-low71 0x00000000 0 0x0 0x81 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#8read-while-closed-clock-376 0x00000000 1 0x0 0x81 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#9read-while-closed81 0x00000000 0 0x0 0x81 1 0 not checked not checked 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked
#10activate-row-zero-setup101 0x00000000 0 0x1 0x81 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#11activate-row-zero-edge217 0x00000000 1 0x1 0x81 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#12activate-row-zero-command-removed233 0x00000000 0 0x0 0x81 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#13activate-row-zero-clock-1246 0x00000000 1 0x0 0x81 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#14activate-row-zero-clock-1-low253 0x00000000 0 0x0 0x81 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#15activate-row-zero-clock-2265 0x00000000 1 0x0 0x81 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#16activate-row-zero-clock-2-low273 0x00000000 0 0x0 0x81 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#17activate-row-zero-clock-3288 0x00000000 1 0x0 0x81 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#18activate-row-zero293 0x00000000 0 0x0 0x81 1 0 not checked not checked 0 not checked not checked not checked not checked not checked not checked 1 not checked not checked
#19write-column-zero-setup317 0x00000000 0 0x3 0x81 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#20write-column-zero-edge429 0x00000000 1 0x3 0x81 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#21write-column-zero-command-removed445 0x00000000 0 0x0 0x81 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#22write-column-zero-clock-1458 0x00000000 1 0x0 0x81 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#23write-column-zero-clock-1-low465 0x00000000 0 0x0 0x81 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#24write-column-zero-clock-2477 0x00000000 1 0x0 0x81 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#25write-column-zero-clock-2-low485 0x00000000 0 0x0 0x81 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#26write-column-zero-clock-3500 0x00000000 1 0x0 0x81 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#27write-column-zero505 0x00000000 0 0x0 0x81 1 0 not checked not checked 0 not checked not checked not checked not checked not checked not checked not checked not checked not checked
#28read-column-zero-setup529 0x00000000 0 0x2 0x81 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#29read-column-zero-edge575 0x00000000 1 0x2 0x81 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#30read-column-zero-command-removed591 0x00000000 0 0x0 0x81 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#31read-column-zero-clock-1604 0x00000000 1 0x0 0x81 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#32read-column-zero-clock-1-low611 0x00000000 0 0x0 0x81 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#33read-column-zero-clock-2623 0x00000000 1 0x0 0x81 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#34read-column-zero-clock-2-low631 0x00000000 0 0x0 0x81 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#35read-column-zero-clock-3646 0x00000000 1 0x0 0x81 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#36read-column-zero651 0x00000000 0 0x0 0x81 1 0 not checked not checked not checked not checked 1 not checked not checked not checked not checked not checked not checked not checked
#37masked-write-setup675 0x00000000 0 0x3 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#38masked-write-edge787 0x00000000 1 0x3 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#39masked-write-command-removed803 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#40masked-write-clock-1816 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#41masked-write-clock-1-low823 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#42masked-write-clock-2835 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#43masked-write-clock-2-low843 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#44masked-write-clock-3858 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#45masked-write863 0x00000000 0 0x0 0x5A 1 0 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#46read-masked-word-setup887 0x00000000 0 0x2 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#47read-masked-word-edge933 0x00000000 1 0x2 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#48read-masked-word-command-removed949 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#49read-masked-word-clock-1962 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#50read-masked-word-clock-1-low969 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#51read-masked-word-clock-2981 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#52read-masked-word-clock-2-low989 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#53read-masked-word-clock-31004 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#54read-masked-word1009 0x00000000 0 0x0 0x5A 1 0 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#55back-to-back-reads-first-setup1031 0x00000001 0 0x2 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#56back-to-back-reads-first-taken1077 0x00000001 1 0x2 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#57back-to-back-reads-first-removed1093 0x00000001 0 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#58back-to-back-reads-sampled1106 0x00000001 1 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#59back-to-back-reads-sampled-low1113 0x00000001 0 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#60back-to-back-reads-releasing1125 0x00000001 1 0x0 0x5A 1 0 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#61back-to-back-reads-second-setup1148 0x00000000 0 0x2 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#62back-to-back-reads-second-taken1162 0x00000000 1 0x2 0x5A 1 1 not checked not checked 0 not checked not checked not checked not checked not checked not checked not checked not checked not checked
#63back-to-back-reads-second-removed1178 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#64back-to-back-reads-clock-11225 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#65back-to-back-reads-clock-1-low1230 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#66back-to-back-reads-clock-21242 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#67back-to-back-reads-clock-2-low1249 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#68back-to-back-reads-clock-31261 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#69back-to-back-reads1269 0x00000000 0 0x0 0x5A 1 0 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#70unknown-command-setup1284 0x00000000 0 0bXXX 0x5A 1 not checked not checked not checked not checked not checked not checked not checked 1 not checked not checked not checked not checked not checked
#71unknown-command-rejected1299 0x00000000 1 0bXXX 0x5A 1 0 not checked not checked 1 not checked 0 not checked 0 not checked not checked not checked not checked not checked
#72nop-preserves-error-setup1315 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#73nop-preserves-error-edge1321 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#74nop-preserves-error-command-removed1326 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#75nop-preserves-error-clock-11331 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#76nop-preserves-error-clock-1-low1336 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#77nop-preserves-error-clock-21341 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#78nop-preserves-error-clock-2-low1346 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#79nop-preserves-error-clock-31351 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#80nop-preserves-error1356 0x00000000 0 0x0 0x5A 1 0 not checked not checked 1 not checked not checked not checked 0 not checked not checked not checked not checked not checked
#81bad-column-setup1381 0x00000002 0 0x2 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#82bad-column-edge1386 0x00000002 1 0x2 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#83bad-column-command-removed1397 0x00000002 0 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#84bad-column-clock-11402 0x00000002 1 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#85bad-column-clock-1-low1407 0x00000002 0 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#86bad-column-clock-21412 0x00000002 1 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#87bad-column-clock-2-low1417 0x00000002 0 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#88bad-column-clock-31422 0x00000002 1 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#89bad-column1427 0x00000002 0 0x0 0x5A 1 0 not checked not checked 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked
#90precharge-setup1445 0x00000000 0 0x4 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#91precharge-edge1560 0x00000000 1 0x4 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#92precharge-command-removed1575 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#93precharge-clock-11590 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#94precharge-clock-1-low1598 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#95precharge-clock-21610 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#96precharge-clock-2-low1618 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#97precharge-clock-31633 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#98precharge1638 0x00000000 0 0x0 0x5A 1 0 not checked not checked 0 not checked not checked not checked not checked not checked not checked 0 not checked not checked
#99refresh-next-row-setup1655 0x00000000 0 0x5 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#100refresh-next-row-edge1838 0x00000000 1 0x5 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#101refresh-next-row-command-removed1854 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#102refresh-next-row-clock-11867 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#103refresh-next-row-clock-1-low1874 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#104refresh-next-row-clock-21887 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#105refresh-next-row-clock-2-low1895 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#106refresh-next-row-clock-31908 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#107refresh-next-row1913 0x00000000 0 0x0 0x5A 1 0 not checked not checked 0 not checked not checked not checked not checked not checked not checked 0 not checked not checked
#108activate-restored-row-setup1933 0x00000000 0 0x1 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#109activate-restored-row-edge2049 0x00000000 1 0x1 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#110activate-restored-row-command-removed2065 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#111activate-restored-row-clock-12078 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#112activate-restored-row-clock-1-low2085 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#113activate-restored-row-clock-22097 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#114activate-restored-row-clock-2-low2105 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#115activate-restored-row-clock-32120 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#116activate-restored-row2125 0x00000000 0 0x0 0x5A 1 0 not checked not checked 0 not checked not checked not checked not checked not checked not checked not checked not checked not checked
#117read-persisted-word-setup2149 0x00000000 0 0x2 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#118read-persisted-word-edge2195 0x00000000 1 0x2 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#119read-persisted-word-command-removed2211 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#120read-persisted-word-clock-12224 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#121read-persisted-word-clock-1-low2231 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#122read-persisted-word-clock-22243 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#123read-persisted-word-clock-2-low2251 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#124read-persisted-word-clock-32266 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#125read-persisted-word2271 0x00000000 0 0x0 0x5A 1 0 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#126reserved-command-setup2293 0x00000000 0 0x7 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#127reserved-command-edge2300 0x00000000 1 0x7 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#128reserved-command-command-removed2311 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#129reserved-command-clock-12316 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#130reserved-command-clock-1-low2321 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#131reserved-command-clock-22326 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#132reserved-command-clock-2-low2331 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#133reserved-command-clock-32336 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked not checked
#134reserved-command2341 0x00000000 0 0x0 0x5A 1 0 not checked not checked 1 not checked not checked not checked not checked not checked not checked not checked not checked not checked

Scroll within the table for all rows and pins. Buses use hexadecimal; values containing X/Z use MSB-first binary. Inputs show the declared values in effect at each checkpoint, including retained inputs. Sequential tests also replay preparation changes between checkpoints, such as lowering the clock. Use the matching checkpoint label in the simulation below.

The sequence checks a read while closed, activation, write/read, byte mask, unknown and reserved commands, NOP status preservation, invalid column, precharge, and one refresh.

Embedded simulation

The standalone DRAMCommandControlTest opens this component as MEMORY_ROOT. Expand it to follow the command chains.

Open DRAMCommandControl<W> in the simulator

Source and tests

Test Coverage
DRAMCommandControlTest The complete standalone sequence shown above
MemoryDeviceTimingTest Intermediate BUSY and ROW_OPEN, and the command chains in the device

3.3.3.6. DRAM<W>

Complete single-bank command-addressed DRAM device.

IO pins

Pin Direction Width Description
CLK Input 1 Strict 0โ†’1 command edge
CMD Input 3 Command code below
ADDR Input 32 Row for ACT; word slot for READ/WRITE
WRITE_DATA Input W Latched write payload
WRITE_MASK Input W/8 Byte enables
BUSY Output 1 Command in progress
ERROR Output 1 Rejected request; next accepted non-NOP clears it
ROW_OPEN Output 1 Activation completed; row available
READ_VALID Output 1 Completed read available
READ_DATA Output W Selected word while valid, otherwise Z

Behavior

Commands operate on one open row at a time. A word's linear index is row*K + slot; ADDR itself is not always a linear word address.

Commands and timing

A command is taken at a rising CLK edge while the device is idle, or in the cycle the previous command completes. Each step lasts one of the profile's DRAM intervals (listed under Timing).

CMD Operation Legal when / ADDR Steps
0 NOP Inputs ignored None; status kept
1 ACTIVATE No row open; ADDR < N/K Wordline, sense, restore; then the row is open
2 READ Row open; ADDR < K Column read; then READ_VALID
3 WRITE Row open; ADDR < K; binary mask Drive on, drive off, recovery
4 PRECHARGE Row open; ADDR ignored Close, precharge, equalize; then no row is open
5 REFRESH No row open; ADDR ignored Activation and precharge of the next refresh row (and the rest of tRFC)
6 READ_BURST Row open; ADDR < K As READ; then the next columns of the aligned block_words block, wrapping within it, one per edge
7 Reserved Always rejected ERROR; no storage operation

REFRESH services one row at an internal round-robin cursor starting at zero; N/K refresh commands cover the bank. The device does not refresh itself; the DRAM controller issues REFRESH, and a direct user must do the same. Refresh samples an expired row as X and cannot repair it.

Write data, address and mask are latched when the command is taken. A zero mask is a valid write that changes nothing. Unknown payload bits become unknown storage only in enabled byte lanes. An initial CLK=X followed by high is not an edge. ROW_OPEN stays high during a precharge until it completes. A finished read stays valid until another command is taken or an idle illegal command clears it.

C++ example

Complete native-port reference composed from the command control and bank above, for W=8/16/32: command rejection, refresh, retention, destructive sampling and restoration, byte writes, status and disabled read output, with the placeholder step duration. Binary inputs and validated geometry are assumed; empty data optionals preserve unknown stored bits.

#include <cstddef>
#include <optional>
#include <vector>
template<std::size_t W> struct DRAMReference {
    static_assert(W == 8 || W == 16 || W == 32);
    DRAMControlReference<W> control;
    DRAMBankReference bank;
    std::size_t retention;
    std::vector<std::optional<bool>> read_data = std::vector<std::optional<bool>>(W);
    bool high_z = true;
    DRAMReference(std::size_t words, std::size_t slots, std::size_t ticks,
                  std::size_t retention_ticks)
        : control(words / slots, slots, ticks), bank(words / slots, W * slots),
          retention(retention_ticks) {}
    void update(std::size_t now, const typename DRAMControlReference<W>::Inputs& in) {
        control.update(now, in);
        std::vector<bool> wl(control.rows, false), drive(W * control.slots, false);
        std::vector<std::optional<bool>> data(W * control.slots);
        if (control.wl) wl[control.row] = true;
        for (std::size_t c = 0; c < data.size(); ++c) {
            data[c] = control.data[c % W];
            drive[c] = control.write && c / W == control.col &&
                       (control.mask & (1u << ((c % W) / 8)));
        }
        bank.update(now, retention, control.precharge, control.sense, wl, drive, data);
        high_z = !control.output;
        for (std::size_t b = 0; b < W; ++b)
            read_data[b] = high_z ? std::nullopt : bank.columns[control.col * W + b].q;
    }
    // BUSY / ERROR / READ_VALID / ROW_OPEN = control.busy / error / output / open.
    // Next scheduled device phase: control.due (0 means none).
};

Unknown inputs

Command validation follows DRAMCommandControl. A rejected unknown idle command clears an earlier read just like a reserved command; a command rejected while busy leaves the operation running. Masked-off bytes ignore unknown payload. Retention is measured from when a row closes to its next activation.

Implementation

Structural implementation

COMMAND_CONTROL drives ROW_DECODE and storage phases. STORAGE exposes cell rows and sense/restore columns; COLUMN_SELECT reads one word from the row buffer; WRITE_DRIVERS distributes byte-qualified writes; OUTPUT publishes only valid data. No FF or SRAM memory is hidden underneath.

Behavioral implementation

Uses packed MemoryStorage, per-row close times and a Wร—K row buffer. Activation samples the row destructively, sensing restores it, and writes merge enabled bytes into the buffer and storage. Its command control (DRAMSyncControl) follows the gate-level control edge for edge, with the same chain lengths, so it takes the same cycles; the storage and sense data path is implemented separately. History is read-only; initialize through ACTIVATE and WRITE, and disable history for large runs.

Timing. The steps of each command are delay lines with these intervals. In the realistic profiles they reproduce the datasheet's tRCD, CL and tRP (the ACTIVATE steps add up to tRCD, the READ step is CL, the PRECHARGE steps add up to tRP):

Analog intervals of the DRAM devices, per timing profile.

DRAM intervalunitticksembeddedtimedesktoptime
ACTIVATE: wordline323 ns2.5 ns
ACTIVATE: sense, base3212 ns9 ns
ACTIVATE: sense, per row00 ps0 ps
ACTIVATE: restore323 ns2.25 ns
READ: column to data3218 ns13.75 ns
WRITE: drive on326 ns7.5 ns
WRITE: drive off323 ns3.75 ns
WRITE: recovery323 ns3.75 ns
PRECHARGE: close row323 ns2.5 ns
PRECHARGE: precharge3212 ns9 ns
PRECHARGE: equalize323 ns2.25 ns
REFRESH: full restore027 ns20.5 ns
REFRESH: rest of the refresh cycle00 ps304 ns
Refresh interval (0: the controller's own count)07.81 ยตs7.81 ยตs
Cell retention100,00064 ms64 ms

A command is issued in one clock cycle, but the device then works through these intervals on its own time and reports BUSY until it is done. No clock can be certified around the device alone; its controller counts the cycles each command needs at the controller's clock. Through the controller, at 256 KiB:

Measured latency in clock cycles, from the edge that accepts a request to the edge that takes its response, through the compact endpoint of a 256 KiB memory at the advanced core's certified clock (unit 80 ticks, embedded 4.1 ns, desktop 2.86 ns). Refresh is off. โ€œConfiguredโ€ rows are too long to simulate and show the device interval instead.

MemoryAccessunitcyclesembeddedcyclesdesktopcycles
DRAMread, row closed7 (560 ticks)14 (57.46 ns)15 (42.87 ns)
DRAMread, row open (hit)4 (320 ticks)8 (32.83 ns)8 (22.86 ns)
DRAMread, other row open (conflict)10 (800 ticks)20 (82.08 ns)22 (62.88 ns)
DRAMwrite, row open (hit)5 (400 ticks)7 (28.73 ns)9 (25.72 ns)

Examples

All 135 recorded rows of DRAMTest, in checkpoint order. Outputs are test expectations verified against the simulation. Time is the absolute settled checkpoint time in simulator units, not milliseconds or CPU cycles.

Default scenario profile: fidelity-gate-v1 / structural (ed03f70afe360dba). Changing fidelity or the circuit can change these times.

Checkpointzero-based number ยท timeline label Timesimulator units ADDRInput ยท 32 bit CLKInput ยท 1 bit CMDInput ยท 3 bit WRITE_DATAInput ยท 8 bit WRITE_MASKInput ยท 1 bit BUSYExpected output ยท 1 bit ERRORExpected output ยท 1 bit READ_DATAExpected output ยท 8 bit READ_VALIDExpected output ยท 1 bit ROW_OPENExpected output ยท 1 bit
#0closed-startup36 0x00000000 0 0x0 0x81 1 0 not checked not checked not checked 0
#1read-while-closed-setup50 0x00000000 0 0x2 0x81 1 not checked not checked not checked not checked not checked
#2read-while-closed-edge56 0x00000000 1 0x2 0x81 1 not checked not checked not checked not checked not checked
#3read-while-closed-command-removed67 0x00000000 0 0x0 0x81 1 not checked not checked not checked not checked not checked
#4read-while-closed-clock-172 0x00000000 1 0x0 0x81 1 not checked not checked not checked not checked not checked
#5read-while-closed-clock-1-low77 0x00000000 0 0x0 0x81 1 not checked not checked not checked not checked not checked
#6read-while-closed-clock-282 0x00000000 1 0x0 0x81 1 not checked not checked not checked not checked not checked
#7read-while-closed-clock-2-low87 0x00000000 0 0x0 0x81 1 not checked not checked not checked not checked not checked
#8read-while-closed-clock-392 0x00000000 1 0x0 0x81 1 not checked not checked not checked not checked not checked
#9read-while-closed97 0x00000000 0 0x0 0x81 1 0 1 not checked not checked not checked
#10activate-row-zero-setup117 0x00000000 0 0x1 0x81 1 not checked not checked not checked not checked not checked
#11activate-row-zero-edge233 0x00000000 1 0x1 0x81 1 not checked not checked not checked not checked not checked
#12activate-row-zero-command-removed249 0x00000000 0 0x0 0x81 1 not checked not checked not checked not checked not checked
#13activate-row-zero-clock-1262 0x00000000 1 0x0 0x81 1 not checked not checked not checked not checked not checked
#14activate-row-zero-clock-1-low269 0x00000000 0 0x0 0x81 1 not checked not checked not checked not checked not checked
#15activate-row-zero-clock-2281 0x00000000 1 0x0 0x81 1 not checked not checked not checked not checked not checked
#16activate-row-zero-clock-2-low289 0x00000000 0 0x0 0x81 1 not checked not checked not checked not checked not checked
#17activate-row-zero-clock-3304 0x00000000 1 0x0 0x81 1 not checked not checked not checked not checked not checked
#18activate-row-zero309 0x00000000 0 0x0 0x81 1 0 0 not checked not checked 1
#19write-column-zero-setup333 0x00000000 0 0x3 0x81 1 not checked not checked not checked not checked not checked
#20write-column-zero-edge445 0x00000000 1 0x3 0x81 1 not checked not checked not checked not checked not checked
#21write-column-zero-command-removed461 0x00000000 0 0x0 0x81 1 not checked not checked not checked not checked not checked
#22write-column-zero-clock-1474 0x00000000 1 0x0 0x81 1 not checked not checked not checked not checked not checked
#23write-column-zero-clock-1-low481 0x00000000 0 0x0 0x81 1 not checked not checked not checked not checked not checked
#24write-column-zero-clock-2493 0x00000000 1 0x0 0x81 1 not checked not checked not checked not checked not checked
#25write-column-zero-clock-2-low501 0x00000000 0 0x0 0x81 1 not checked not checked not checked not checked not checked
#26write-column-zero-clock-3516 0x00000000 1 0x0 0x81 1 not checked not checked not checked not checked not checked
#27write-column-zero521 0x00000000 0 0x0 0x81 1 0 0 not checked not checked not checked
#28read-column-zero-setup545 0x00000000 0 0x2 0x81 1 not checked not checked not checked not checked not checked
#29read-column-zero-edge591 0x00000000 1 0x2 0x81 1 not checked not checked not checked not checked not checked
#30read-column-zero-command-removed607 0x00000000 0 0x0 0x81 1 not checked not checked not checked not checked not checked
#31read-column-zero-clock-1620 0x00000000 1 0x0 0x81 1 not checked not checked not checked not checked not checked
#32read-column-zero-clock-1-low627 0x00000000 0 0x0 0x81 1 not checked not checked not checked not checked not checked
#33read-column-zero-clock-2639 0x00000000 1 0x0 0x81 1 not checked not checked not checked not checked not checked
#34read-column-zero-clock-2-low647 0x00000000 0 0x0 0x81 1 not checked not checked not checked not checked not checked
#35read-column-zero-clock-3662 0x00000000 1 0x0 0x81 1 not checked not checked not checked not checked not checked
#36read-column-zero667 0x00000000 0 0x0 0x81 1 0 not checked 0x81 1 not checked
#37masked-write-setup691 0x00000000 0 0x3 0x5A 1 not checked not checked not checked not checked not checked
#38masked-write-edge803 0x00000000 1 0x3 0x5A 1 not checked not checked not checked not checked not checked
#39masked-write-command-removed819 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked
#40masked-write-clock-1832 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked
#41masked-write-clock-1-low839 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked
#42masked-write-clock-2851 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked
#43masked-write-clock-2-low859 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked
#44masked-write-clock-3874 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked
#45masked-write879 0x00000000 0 0x0 0x5A 1 0 not checked not checked not checked not checked
#46read-masked-word-setup903 0x00000000 0 0x2 0x5A 1 not checked not checked not checked not checked not checked
#47read-masked-word-edge949 0x00000000 1 0x2 0x5A 1 not checked not checked not checked not checked not checked
#48read-masked-word-command-removed965 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked
#49read-masked-word-clock-1978 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked
#50read-masked-word-clock-1-low985 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked
#51read-masked-word-clock-2997 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked
#52read-masked-word-clock-2-low1005 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked
#53read-masked-word-clock-31020 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked
#54read-masked-word1025 0x00000000 0 0x0 0x5A 1 0 not checked 0x5A not checked not checked
#55back-to-back-reads-first-setup1047 0x00000001 0 0x2 0x5A 1 not checked not checked not checked not checked not checked
#56back-to-back-reads-first-taken1093 0x00000001 1 0x2 0x5A 1 not checked not checked not checked not checked not checked
#57back-to-back-reads-first-removed1109 0x00000001 0 0x0 0x5A 1 not checked not checked not checked not checked not checked
#58back-to-back-reads-sampled1122 0x00000001 1 0x0 0x5A 1 not checked not checked not checked not checked not checked
#59back-to-back-reads-sampled-low1129 0x00000001 0 0x0 0x5A 1 not checked not checked not checked not checked not checked
#60back-to-back-reads-releasing1141 0x00000001 1 0x0 0x5A 1 0 not checked not checked not checked not checked
#61back-to-back-reads-second-setup1164 0x00000000 0 0x2 0x5A 1 not checked not checked not checked not checked not checked
#62back-to-back-reads-second-taken1178 0x00000000 1 0x2 0x5A 1 1 0 not checked not checked not checked
#63back-to-back-reads-second-removed1194 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked
#64back-to-back-reads-clock-11241 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked
#65back-to-back-reads-clock-1-low1246 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked
#66back-to-back-reads-clock-21258 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked
#67back-to-back-reads-clock-2-low1265 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked
#68back-to-back-reads-clock-31277 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked
#69back-to-back-reads1285 0x00000000 0 0x0 0x5A 1 0 not checked 0x5A 1 not checked
#70unknown-command-setup1300 0x00000000 0 0bXXX 0x5A 1 not checked not checked not checked 1 not checked
#71unknown-command-rejected1315 0x00000000 1 0bXXX 0x5A 1 0 1 0bZZZZZZZZ 0 not checked
#72nop-preserves-error-setup1331 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked
#73nop-preserves-error-edge1337 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked
#74nop-preserves-error-command-removed1342 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked
#75nop-preserves-error-clock-11347 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked
#76nop-preserves-error-clock-1-low1352 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked
#77nop-preserves-error-clock-21357 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked
#78nop-preserves-error-clock-2-low1362 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked
#79nop-preserves-error-clock-31367 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked
#80nop-preserves-error1372 0x00000000 0 0x0 0x5A 1 0 1 not checked 0 not checked
#81bad-column-setup1397 0x00000002 0 0x2 0x5A 1 not checked not checked not checked not checked not checked
#82bad-column-edge1402 0x00000002 1 0x2 0x5A 1 not checked not checked not checked not checked not checked
#83bad-column-command-removed1413 0x00000002 0 0x0 0x5A 1 not checked not checked not checked not checked not checked
#84bad-column-clock-11418 0x00000002 1 0x0 0x5A 1 not checked not checked not checked not checked not checked
#85bad-column-clock-1-low1423 0x00000002 0 0x0 0x5A 1 not checked not checked not checked not checked not checked
#86bad-column-clock-21428 0x00000002 1 0x0 0x5A 1 not checked not checked not checked not checked not checked
#87bad-column-clock-2-low1433 0x00000002 0 0x0 0x5A 1 not checked not checked not checked not checked not checked
#88bad-column-clock-31438 0x00000002 1 0x0 0x5A 1 not checked not checked not checked not checked not checked
#89bad-column1443 0x00000002 0 0x0 0x5A 1 0 1 not checked not checked not checked
#90precharge-setup1461 0x00000000 0 0x4 0x5A 1 not checked not checked not checked not checked not checked
#91precharge-edge1576 0x00000000 1 0x4 0x5A 1 not checked not checked not checked not checked not checked
#92precharge-command-removed1591 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked
#93precharge-clock-11606 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked
#94precharge-clock-1-low1614 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked
#95precharge-clock-21626 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked
#96precharge-clock-2-low1634 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked
#97precharge-clock-31649 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked
#98precharge1654 0x00000000 0 0x0 0x5A 1 0 0 not checked not checked 0
#99refresh-next-row-setup1671 0x00000000 0 0x5 0x5A 1 not checked not checked not checked not checked not checked
#100refresh-next-row-edge1855 0x00000000 1 0x5 0x5A 1 not checked not checked not checked not checked not checked
#101refresh-next-row-command-removed1871 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked
#102refresh-next-row-clock-11884 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked
#103refresh-next-row-clock-1-low1891 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked
#104refresh-next-row-clock-21904 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked
#105refresh-next-row-clock-2-low1912 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked
#106refresh-next-row-clock-31925 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked
#107refresh-next-row1930 0x00000000 0 0x0 0x5A 1 0 0 not checked not checked 0
#108activate-restored-row-setup1950 0x00000000 0 0x1 0x5A 1 not checked not checked not checked not checked not checked
#109activate-restored-row-edge2066 0x00000000 1 0x1 0x5A 1 not checked not checked not checked not checked not checked
#110activate-restored-row-command-removed2082 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked
#111activate-restored-row-clock-12095 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked
#112activate-restored-row-clock-1-low2102 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked
#113activate-restored-row-clock-22114 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked
#114activate-restored-row-clock-2-low2122 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked
#115activate-restored-row-clock-32137 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked
#116activate-restored-row2142 0x00000000 0 0x0 0x5A 1 0 0 not checked not checked not checked
#117read-persisted-word-setup2166 0x00000000 0 0x2 0x5A 1 not checked not checked not checked not checked not checked
#118read-persisted-word-edge2212 0x00000000 1 0x2 0x5A 1 not checked not checked not checked not checked not checked
#119read-persisted-word-command-removed2228 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked
#120read-persisted-word-clock-12241 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked
#121read-persisted-word-clock-1-low2248 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked
#122read-persisted-word-clock-22260 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked
#123read-persisted-word-clock-2-low2268 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked
#124read-persisted-word-clock-32283 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked
#125read-persisted-word2288 0x00000000 0 0x0 0x5A 1 0 not checked 0x5A not checked not checked
#126reserved-command-setup2310 0x00000000 0 0x7 0x5A 1 not checked not checked not checked not checked not checked
#127reserved-command-edge2317 0x00000000 1 0x7 0x5A 1 not checked not checked not checked not checked not checked
#128reserved-command-command-removed2328 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked
#129reserved-command-clock-12333 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked
#130reserved-command-clock-1-low2338 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked
#131reserved-command-clock-22343 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked
#132reserved-command-clock-2-low2348 0x00000000 0 0x0 0x5A 1 not checked not checked not checked not checked not checked
#133reserved-command-clock-32353 0x00000000 1 0x0 0x5A 1 not checked not checked not checked not checked not checked
#134reserved-command2358 0x00000000 0 0x0 0x5A 1 0 1 not checked not checked not checked

Scroll within the table for all rows and pins. Buses use hexadecimal; values containing X/Z use MSB-first binary. Inputs show the declared values in effect at each checkpoint, including retained inputs. Sequential tests also replay preparation changes between checkpoints, such as lowering the clock. Use the matching checkpoint label in the simulation below.

The W=8 device writes 0x81, changes its enabled byte to 0x5A, exercises invalid commands and status preservation, closes, refreshes, and reads 0x5A again. Wider byte-mask coverage is in the contract test. The table contains setup rows as well as command-completion rows.

Embedded simulation

The standalone DRAMTest opens this component as MEMORY_ROOT. Use the explorer to compare structural and behavioral implementations.

Open DRAM<W> in the simulator

Source and tests

Test Coverage
DRAMTest The complete standalone sequence shown above
MemoryDeviceContractTest W=8/16/32, K=1/2/4, mixed fidelity, a masked-write oracle, geometry rejection, and compact history/allocation
MemoryDeviceTimingTest Early BUSY, refresh preservation, expiry, and event-queue quiescence
MemoryDeviceDocumentationTest Compile the exact references; test cell/bank feedback, W=8/16/32 device behavior, refresh/expiry, busy rejection and simultaneous completion/command edges; replay native command/device binary-input prefixes