Skip to content

ยง 4.3.5. Memory Access

These are CPU-side components. The lane/alignment logic is shared by both cores. The pipeline additionally uses a requester to hold one universal memory transaction until completion; the strict single-cycle and baseline cores use zero-wait endpoint pins with combinational port formatting, not a stateful requester. These components do not contain storage or replace a technology-specific controller.

Component Description Structural Behavioral
RV32IMemoryLanes Little-endian subword extraction, store placement, masks, and endpoint address Yes Yes
RV32IMemoryAlignmentUnit Address alignment predicate Yes Yes
RV32IMemoryRequest CPU-owned, one-outstanding transaction requester Yes Yes

Columns count registered implementations. Behavioral pipeline cores contain equivalent requester bookkeeping; the single-cycle Memory stage contains only equivalent formatting logic. Those helpers are not separately selectable implementations of these building blocks. C++ examples below specify binary behavior without propagation delays.

Memory requests out, load values back A request travels from the CPU through lane formatting and request tracking to an endpoint; returning load data is tracked, extracted, and extended before reaching the CPU. OUTGOING REQUEST RETURNING LOAD DATA CPU CPU address + data load value Lanes Lanes place / mask extract / extend Request Request hold until done response word Endpoint Endpoint access storage return word
Pipeline transaction path. Lanes = RV32IMemoryLanes; Request = RV32IMemoryRequest. Endpoint = controller plus native storage, or its fused MemoryEndpoint. The single-cycle and baseline cores re-use Lanes with combinational formatting to zero-wait endpoints. Arrows show payload flow, not clock cycles or the complete handshake wiring.

The two rows separate outgoing payloads from returning data; they do not duplicate hardware. Request/response handshakes and CPU-side issue, completion, and fault controls are specified in the pin tables below.

4.3.5.1. RV32IMemoryLanes

IO pins

Pin Direction Width Description
ADDR Input 32 CPU byte address
WRITE_DATA Input 32 Unshifted store source register
WORD_DATA Input 32 Complete word returned by the endpoint
SIZE Input 2 0: byte; 1: halfword; 2: word; 3: invalid
SIGN_EXTEND Input 1 Sign-extend byte/halfword loads
WORD_ADDR Output 32 Endpoint byte address, not a word index
WORD_WRITE_DATA Output 32 Store data shifted to its byte lane
READ_DATA Output 32 CPU load result
WRITE_MASK Output 4 One enable per endpoint byte lane

Behavior

Offset is ADDR[1:0]. Byte lane 0 is bits 7:0; lane 3 is bits 31:24. Valid accesses use WORD_ADDR = ADDR & ~3. Byte stores enable one lane; aligned halfword stores enable lanes 0โ€“1 or 2โ€“3; word stores enable all four. Store data moves left by offset*8; load data moves right by that amount, then is narrowed and sign/zero-extended.

A halfword at an odd address, word at a nonzero offset, or SIZE=3 must not silently become an aligned legal access. The output address therefore sets bit 0 on these cases, making the endpoint reject the request as unaligned. There is no split transaction across words. Invalid inputs still produce deterministic combinational data/masks, but these are not permission to write: the endpoint must reject the bad address. SIZE=3 gives read data and mask zero.

C++ example

#include <cstdint>
namespace memory_access_example {
struct Lanes { uint32_t WORD_ADDR, WORD_WRITE_DATA, READ_DATA; unsigned WRITE_MASK; };
Lanes lanes(uint32_t address, uint32_t write, uint32_t word, unsigned size, bool sign) {
    const unsigned offset=address&3;
    const bool bad=size==3 || (size==1 && (offset&1)) || (size==2 && offset!=0);
    const uint32_t shifted=word>>(8*offset);
    uint32_t read=size==0 ? shifted&255 : size==1 ? shifted&65535 : size==2 ? shifted : 0;
    if (sign && size==0 && (read&128)) read|=0xffffff00U;
    if (sign && size==1 && (read&32768)) read|=0xffff0000U;
    const unsigned mask=size==0 ? 1U<<offset : size==1 ? 3U<<(offset&2) : size==2 ? 15 : 0;
    return {(address&~uint32_t{3})|uint32_t(bad),write<<(8*offset),read,mask};
}
}

Unknown inputs

This is a combinational structural network. Splitters and rewires preserve individual X/Z bits; muxes and sign-extension gates can mask or propagate them. A known size or disabled sign extension may isolate unrelated bits. The binary example does not model those cases or the different path delays.

Implementation

Structural implementation

Nine top-level children expose the data flow instead of placing every bit gate side by side:

Child Structural helper / responsibility
ADDRESS RV32IMemoryAddress: address/size decoding, guarded word address, byte offset, byte/halfword/word enables
LANE_0 โ€ฆ LANE_3 Rewire four possible byte placements for store and load data
STORE_LANES, LOAD_LANES Select the requested byte offset
LOAD_EXTEND RV32ILoadExtender: select byte/halfword/word data and sign/zero extension
WRITE_MASK RV32IByteWriteMask: generate the four byte-write enables

ADDRESS receives ADDR[32] and SIZE[2]; it outputs WORD_ADDR[32], OFFSET[2], and BYTE/HALF/WORD. LOAD_EXTEND receives shifted DATA[32], those three enables, and SIGN_EXTEND; its OUT[32] is assembled from four RV32ILoadByte<0โ€ฆ3> circuits. Each byte circuit masks its eight data bits with the size enables in 8-bit word gates (BYTE, HALF, WORD, each enable spread across the byte by wiring) and merges them in two word ORs (RESULT_0, RESULT_1); lower bytes keep input bits while higher bytes take the relevant sign fill (BYTE_FILL, HALF_FILL) across the byte. WRITE_MASK receives the offset and size enables and produces MASK[4].

The internal helpers are fixed structural parts with no state and no behavioral variants of their own; grouping does not turn them into behavioral memory devices.

Behavioral implementation

RV32IMemoryLanesBehavioral computes the four outputs with the same lane functions the behavioral cores call (memoryWordAddress, memoryLoadData, memoryWriteMask, and the store shift), with gate-derived output timing when selected through the catalog. It is defined for known binary inputs: if any input bit is X or Z, every output is unknown. Partial-unknown behavior is specified by the structural gates only.

Examples

All 32 recorded rows of RV32IMemoryLanesTest, 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 SIGN_EXTENDInput ยท 1 bit SIZEInput ยท 2 bit WORD_DATAInput ยท 32 bit WRITE_DATAInput ยท 32 bit READ_DATAExpected output ยท 32 bit WORD_ADDRExpected output ยท 32 bit WORD_WRITE_DATAExpected output ยท 32 bit WRITE_MASKExpected output ยท 4 bit
#0size-0-lane-0-sign-08 0x00000100 0 0x0 0x80FF3412 0xDEADBEEF 0x00000012 0x00000100 0xDEADBEEF 0x1
#1size-0-lane-0-sign-110 0x00000100 1 0x0 0x80FF3412 0xDEADBEEF 0x00000012 0x00000100 0xDEADBEEF 0x1
#2size-0-lane-1-sign-019 0x00000101 0 0x0 0x80FF3412 0xDEADBEEF 0x00000034 0x00000100 0xADBEEF00 0x2
#3size-0-lane-1-sign-122 0x00000101 1 0x0 0x80FF3412 0xDEADBEEF 0x00000034 0x00000100 0xADBEEF00 0x2
#4size-0-lane-2-sign-031 0x00000102 0 0x0 0x80FF3412 0xDEADBEEF 0x000000FF 0x00000100 0xBEEF0000 0x4
#5size-0-lane-2-sign-136 0x00000102 1 0x0 0x80FF3412 0xDEADBEEF 0xFFFFFFFF 0x00000100 0xBEEF0000 0x4
#6size-0-lane-3-sign-045 0x00000103 0 0x0 0x80FF3412 0xDEADBEEF 0x00000080 0x00000100 0xEF000000 0x8
#7size-0-lane-3-sign-150 0x00000103 1 0x0 0x80FF3412 0xDEADBEEF 0xFFFFFF80 0x00000100 0xEF000000 0x8
#8size-1-lane-0-sign-059 0x00000100 0 0x1 0x80FF3412 0xDEADBEEF 0x00003412 0x00000100 0xDEADBEEF 0x3
#9size-1-lane-0-sign-161 0x00000100 1 0x1 0x80FF3412 0xDEADBEEF 0x00003412 0x00000100 0xDEADBEEF 0x3
#10size-1-lane-1-sign-070 0x00000101 0 0x1 0x80FF3412 0xDEADBEEF 0x0000FF34 0x00000101 0xADBEEF00 0x3
#11size-1-lane-1-sign-175 0x00000101 1 0x1 0x80FF3412 0xDEADBEEF 0xFFFFFF34 0x00000101 0xADBEEF00 0x3
#12size-1-lane-2-sign-084 0x00000102 0 0x1 0x80FF3412 0xDEADBEEF 0x000080FF 0x00000100 0xBEEF0000 0xC
#13size-1-lane-2-sign-189 0x00000102 1 0x1 0x80FF3412 0xDEADBEEF 0xFFFF80FF 0x00000100 0xBEEF0000 0xC
#14size-1-lane-3-sign-098 0x00000103 0 0x1 0x80FF3412 0xDEADBEEF 0x00000080 0x00000101 0xEF000000 0xC
#15size-1-lane-3-sign-1101 0x00000103 1 0x1 0x80FF3412 0xDEADBEEF 0x00000080 0x00000101 0xEF000000 0xC
#16size-2-lane-0-sign-0109 0x00000100 0 0x2 0x80FF3412 0xDEADBEEF 0x80FF3412 0x00000100 0xDEADBEEF 0xF
#17size-2-lane-0-sign-1111 0x00000100 1 0x2 0x80FF3412 0xDEADBEEF 0x80FF3412 0x00000100 0xDEADBEEF 0xF
#18size-2-lane-1-sign-0119 0x00000101 0 0x2 0x80FF3412 0xDEADBEEF 0x0080FF34 0x00000101 0xADBEEF00 0xF
#19size-2-lane-1-sign-1122 0x00000101 1 0x2 0x80FF3412 0xDEADBEEF 0x0080FF34 0x00000101 0xADBEEF00 0xF
#20size-2-lane-2-sign-0130 0x00000102 0 0x2 0x80FF3412 0xDEADBEEF 0x000080FF 0x00000101 0xBEEF0000 0xF
#21size-2-lane-2-sign-1133 0x00000102 1 0x2 0x80FF3412 0xDEADBEEF 0x000080FF 0x00000101 0xBEEF0000 0xF
#22size-2-lane-3-sign-0141 0x00000103 0 0x2 0x80FF3412 0xDEADBEEF 0x00000080 0x00000101 0xEF000000 0xF
#23size-2-lane-3-sign-1144 0x00000103 1 0x2 0x80FF3412 0xDEADBEEF 0x00000080 0x00000101 0xEF000000 0xF
#24size-3-lane-0-sign-0151 0x00000100 0 0x3 0x80FF3412 0xDEADBEEF 0x00000000 0x00000101 0xDEADBEEF 0x0
#25size-3-lane-0-sign-1153 0x00000100 1 0x3 0x80FF3412 0xDEADBEEF 0x00000000 0x00000101 0xDEADBEEF 0x0
#26size-3-lane-1-sign-0160 0x00000101 0 0x3 0x80FF3412 0xDEADBEEF 0x00000000 0x00000101 0xADBEEF00 0x0
#27size-3-lane-1-sign-1163 0x00000101 1 0x3 0x80FF3412 0xDEADBEEF 0x00000000 0x00000101 0xADBEEF00 0x0
#28size-3-lane-2-sign-0170 0x00000102 0 0x3 0x80FF3412 0xDEADBEEF 0x00000000 0x00000101 0xBEEF0000 0x0
#29size-3-lane-2-sign-1173 0x00000102 1 0x3 0x80FF3412 0xDEADBEEF 0x00000000 0x00000101 0xBEEF0000 0x0
#30size-3-lane-3-sign-0180 0x00000103 0 0x3 0x80FF3412 0xDEADBEEF 0x00000000 0x00000101 0xEF000000 0x0
#31size-3-lane-3-sign-1183 0x00000103 1 0x3 0x80FF3412 0xDEADBEEF 0x00000000 0x00000101 0xEF000000 0x0

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.

Embedded simulation

Open memory lanes

Tests

RV32IMemoryLanesTest exposes 32 checkpoints covering all four size encodings, four offsets, and both sign modes. RV32IMemoryMigrationTest additionally exercises formatting against real endpoint responses and checks that rejected stores do not change storage. These are sampled data words, not an exhaustive 32-bit operand test.

4.3.5.2. RV32IMemoryAlignmentUnit

IO pins

Pin Direction Width Description
ADDRESS Input 32 CPU byte address
SIZE Input 2 Access-size encoding
MISALIGNED Output 1 Address violates the selected alignment

Behavior

Byte accesses accept every address; halfwords require bit 0 zero; words require bits 1:0 zero. The circuit equation is SIZE[0]ยทADDRESS[0] OR SIZE[1]ยท(ADDRESS[0] OR ADDRESS[1]). Consequently reserved SIZE=3 has the same alignment predicate as word accesses; an aligned address produces zero. This component is not a size-validity checker. The lane formatter and execution-status unit separately reject size 3.

The single-cycle Memory stage also adds a size-3 check to its public MISALIGNED output. Fetch and Next PC use this building block with constant word size.

C++ example

namespace memory_access_example {
bool misaligned(uint32_t address, unsigned size) {
    return ((size&1) && (address&1)) || ((size&2) && (address&3));
}
}

Unknown inputs

Only the low two address bits and both size bits matter. AND with zero and OR with one mask unknowns; other indeterminate gate results become X. Both implementations use that equation, including SIZE=3 and X/Z. The registered behavioral checker uses gate-derived per-path delays; structural timing follows its individual gates.

Implementation

Structural implementation

Two splitters, two AND gates, and two OR gates evaluate the predicate. It is registered as rv32i.pipeline.memory-alignment, but its address check is not intrinsically pipeline-specific.

Behavioral implementation

RV32IMemoryAlignmentBehavioral evaluates the same four-state gate expression without internal components. It does not coerce unknown bits into a binary integer.

Examples

All 262 recorded rows of RV32IMemoryAlignmentUnitTest, 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 ADDRESSInput ยท 32 bit SIZEInput ยท 2 bit MISALIGNEDExpected output ยท 1 bit
#0byte-any-address2 0x00000103 0x0 0
#1aligned-halfword4 0x00000102 0x1 0
#2misaligned-halfword7 0x00000103 0x1 1
#3aligned-word11 0x00000104 0x2 0
#4word-offset-one15 0x00000105 0x2 1
#5word-offset-two17 0x00000106 0x2 1
#6four-state-020 0x00000100 0x0 0
#7four-state-123 0x00000101 0x0 0
#8four-state-226 0b0000000000000000000000010000000X 0x0 0
#9four-state-328 0b0000000000000000000000010000000Z 0x0 0
#10four-state-431 0x00000102 0x0 0
#11four-state-533 0x00000103 0x0 0
#12four-state-635 0b0000000000000000000000010000001X 0x0 0
#13four-state-737 0b0000000000000000000000010000001Z 0x0 0
#14four-state-840 0b000000000000000000000001000000X0 0x0 0
#15four-state-943 0b000000000000000000000001000000X1 0x0 0
#16four-state-1046 0b000000000000000000000001000000XX 0x0 0
#17four-state-1148 0b000000000000000000000001000000XZ 0x0 0
#18four-state-1250 0b000000000000000000000001000000Z0 0x0 0
#19four-state-1353 0b000000000000000000000001000000Z1 0x0 0
#20four-state-1456 0b000000000000000000000001000000ZX 0x0 0
#21four-state-1558 0b000000000000000000000001000000ZZ 0x0 0
#22four-state-1661 0x00000100 0x1 0
#23four-state-1764 0x00000101 0x1 1
#24four-state-1867 0b0000000000000000000000010000000X 0x1 X
#25four-state-1969 0b0000000000000000000000010000000Z 0x1 X
#26four-state-2072 0x00000102 0x1 0
#27four-state-2175 0x00000103 0x1 1
#28four-state-2278 0b0000000000000000000000010000001X 0x1 X
#29four-state-2380 0b0000000000000000000000010000001Z 0x1 X
#30four-state-2483 0b000000000000000000000001000000X0 0x1 0
#31four-state-2586 0b000000000000000000000001000000X1 0x1 1
#32four-state-2689 0b000000000000000000000001000000XX 0x1 X
#33four-state-2791 0b000000000000000000000001000000XZ 0x1 X
#34four-state-2894 0b000000000000000000000001000000Z0 0x1 0
#35four-state-2997 0b000000000000000000000001000000Z1 0x1 1
#36four-state-30100 0b000000000000000000000001000000ZX 0x1 X
#37four-state-31102 0b000000000000000000000001000000ZZ 0x1 X
#38four-state-32105 0x00000100 0b0X 0
#39four-state-33108 0x00000101 0b0X X
#40four-state-34111 0b0000000000000000000000010000000X 0b0X X
#41four-state-35113 0b0000000000000000000000010000000Z 0b0X X
#42four-state-36116 0x00000102 0b0X 0
#43four-state-37119 0x00000103 0b0X X
#44four-state-38121 0b0000000000000000000000010000001X 0b0X X
#45four-state-39123 0b0000000000000000000000010000001Z 0b0X X
#46four-state-40126 0b000000000000000000000001000000X0 0b0X 0
#47four-state-41129 0b000000000000000000000001000000X1 0b0X X
#48four-state-42132 0b000000000000000000000001000000XX 0b0X X
#49four-state-43134 0b000000000000000000000001000000XZ 0b0X X
#50four-state-44137 0b000000000000000000000001000000Z0 0b0X 0
#51four-state-45140 0b000000000000000000000001000000Z1 0b0X X
#52four-state-46143 0b000000000000000000000001000000ZX 0b0X X
#53four-state-47145 0b000000000000000000000001000000ZZ 0b0X X
#54four-state-48148 0x00000100 0b0Z 0
#55four-state-49151 0x00000101 0b0Z X
#56four-state-50154 0b0000000000000000000000010000000X 0b0Z X
#57four-state-51156 0b0000000000000000000000010000000Z 0b0Z X
#58four-state-52159 0x00000102 0b0Z 0
#59four-state-53162 0x00000103 0b0Z X
#60four-state-54164 0b0000000000000000000000010000001X 0b0Z X
#61four-state-55166 0b0000000000000000000000010000001Z 0b0Z X
#62four-state-56169 0b000000000000000000000001000000X0 0b0Z 0
#63four-state-57172 0b000000000000000000000001000000X1 0b0Z X
#64four-state-58175 0b000000000000000000000001000000XX 0b0Z X
#65four-state-59177 0b000000000000000000000001000000XZ 0b0Z X
#66four-state-60180 0b000000000000000000000001000000Z0 0b0Z 0
#67four-state-61183 0b000000000000000000000001000000Z1 0b0Z X
#68four-state-62186 0b000000000000000000000001000000ZX 0b0Z X
#69four-state-63188 0b000000000000000000000001000000ZZ 0b0Z X
#70four-state-64192 0x00000100 0x2 0
#71four-state-65196 0x00000101 0x2 1
#72four-state-66200 0b0000000000000000000000010000000X 0x2 X
#73four-state-67202 0b0000000000000000000000010000000Z 0x2 X
#74four-state-68206 0x00000102 0x2 1
#75four-state-69208 0x00000103 0x2 1
#76four-state-70210 0b0000000000000000000000010000001X 0x2 1
#77four-state-71212 0b0000000000000000000000010000001Z 0x2 1
#78four-state-72216 0b000000000000000000000001000000X0 0x2 X
#79four-state-73220 0b000000000000000000000001000000X1 0x2 1
#80four-state-74224 0b000000000000000000000001000000XX 0x2 X
#81four-state-75226 0b000000000000000000000001000000XZ 0x2 X
#82four-state-76228 0b000000000000000000000001000000Z0 0x2 X
#83four-state-77232 0b000000000000000000000001000000Z1 0x2 1
#84four-state-78236 0b000000000000000000000001000000ZX 0x2 X
#85four-state-79238 0b000000000000000000000001000000ZZ 0x2 X
#86four-state-80242 0x00000100 0x3 0
#87four-state-81246 0x00000101 0x3 1
#88four-state-82250 0b0000000000000000000000010000000X 0x3 X
#89four-state-83252 0b0000000000000000000000010000000Z 0x3 X
#90four-state-84256 0x00000102 0x3 1
#91four-state-85259 0x00000103 0x3 1
#92four-state-86262 0b0000000000000000000000010000001X 0x3 1
#93four-state-87264 0b0000000000000000000000010000001Z 0x3 1
#94four-state-88268 0b000000000000000000000001000000X0 0x3 X
#95four-state-89272 0b000000000000000000000001000000X1 0x3 1
#96four-state-90276 0b000000000000000000000001000000XX 0x3 X
#97four-state-91278 0b000000000000000000000001000000XZ 0x3 X
#98four-state-92281 0b000000000000000000000001000000Z0 0x3 X
#99four-state-93285 0b000000000000000000000001000000Z1 0x3 1
#100four-state-94289 0b000000000000000000000001000000ZX 0x3 X
#101four-state-95291 0b000000000000000000000001000000ZZ 0x3 X
#102four-state-96295 0x00000100 0b1X 0
#103four-state-97299 0x00000101 0b1X 1
#104four-state-98303 0b0000000000000000000000010000000X 0b1X X
#105four-state-99305 0b0000000000000000000000010000000Z 0b1X X
#106four-state-100309 0x00000102 0b1X 1
#107four-state-101312 0x00000103 0b1X 1
#108four-state-102314 0b0000000000000000000000010000001X 0b1X 1
#109four-state-103316 0b0000000000000000000000010000001Z 0b1X 1
#110four-state-104320 0b000000000000000000000001000000X0 0b1X X
#111four-state-105324 0b000000000000000000000001000000X1 0b1X 1
#112four-state-106328 0b000000000000000000000001000000XX 0b1X X
#113four-state-107330 0b000000000000000000000001000000XZ 0b1X X
#114four-state-108333 0b000000000000000000000001000000Z0 0b1X X
#115four-state-109337 0b000000000000000000000001000000Z1 0b1X 1
#116four-state-110341 0b000000000000000000000001000000ZX 0b1X X
#117four-state-111343 0b000000000000000000000001000000ZZ 0b1X X
#118four-state-112347 0x00000100 0b1Z 0
#119four-state-113351 0x00000101 0b1Z 1
#120four-state-114355 0b0000000000000000000000010000000X 0b1Z X
#121four-state-115357 0b0000000000000000000000010000000Z 0b1Z X
#122four-state-116361 0x00000102 0b1Z 1
#123four-state-117364 0x00000103 0b1Z 1
#124four-state-118366 0b0000000000000000000000010000001X 0b1Z 1
#125four-state-119368 0b0000000000000000000000010000001Z 0b1Z 1
#126four-state-120372 0b000000000000000000000001000000X0 0b1Z X
#127four-state-121376 0b000000000000000000000001000000X1 0b1Z 1
#128four-state-122380 0b000000000000000000000001000000XX 0b1Z X
#129four-state-123382 0b000000000000000000000001000000XZ 0b1Z X
#130four-state-124385 0b000000000000000000000001000000Z0 0b1Z X
#131four-state-125389 0b000000000000000000000001000000Z1 0b1Z 1
#132four-state-126393 0b000000000000000000000001000000ZX 0b1Z X
#133four-state-127395 0b000000000000000000000001000000ZZ 0b1Z X
#134four-state-128399 0x00000100 0bX0 0
#135four-state-129403 0x00000101 0bX0 X
#136four-state-130406 0b0000000000000000000000010000000X 0bX0 X
#137four-state-131408 0b0000000000000000000000010000000Z 0bX0 X
#138four-state-132411 0x00000102 0bX0 X
#139four-state-133413 0x00000103 0bX0 X
#140four-state-134415 0b0000000000000000000000010000001X 0bX0 X
#141four-state-135417 0b0000000000000000000000010000001Z 0bX0 X
#142four-state-136420 0b000000000000000000000001000000X0 0bX0 X
#143four-state-137423 0b000000000000000000000001000000X1 0bX0 X
#144four-state-138426 0b000000000000000000000001000000XX 0bX0 X
#145four-state-139428 0b000000000000000000000001000000XZ 0bX0 X
#146four-state-140430 0b000000000000000000000001000000Z0 0bX0 X
#147four-state-141433 0b000000000000000000000001000000Z1 0bX0 X
#148four-state-142436 0b000000000000000000000001000000ZX 0bX0 X
#149four-state-143438 0b000000000000000000000001000000ZZ 0bX0 X
#150four-state-144442 0x00000100 0bX1 0
#151four-state-145446 0x00000101 0bX1 1
#152four-state-146449 0b0000000000000000000000010000000X 0bX1 X
#153four-state-147451 0b0000000000000000000000010000000Z 0bX1 X
#154four-state-148454 0x00000102 0bX1 X
#155four-state-149457 0x00000103 0bX1 1
#156four-state-150460 0b0000000000000000000000010000001X 0bX1 X
#157four-state-151462 0b0000000000000000000000010000001Z 0bX1 X
#158four-state-152465 0b000000000000000000000001000000X0 0bX1 X
#159four-state-153468 0b000000000000000000000001000000X1 0bX1 1
#160four-state-154471 0b000000000000000000000001000000XX 0bX1 X
#161four-state-155473 0b000000000000000000000001000000XZ 0bX1 X
#162four-state-156476 0b000000000000000000000001000000Z0 0bX1 X
#163four-state-157479 0b000000000000000000000001000000Z1 0bX1 1
#164four-state-158482 0b000000000000000000000001000000ZX 0bX1 X
#165four-state-159484 0b000000000000000000000001000000ZZ 0bX1 X
#166four-state-160488 0x00000100 0bXX 0
#167four-state-161492 0x00000101 0bXX X
#168four-state-162495 0b0000000000000000000000010000000X 0bXX X
#169four-state-163497 0b0000000000000000000000010000000Z 0bXX X
#170four-state-164500 0x00000102 0bXX X
#171four-state-165503 0x00000103 0bXX X
#172four-state-166505 0b0000000000000000000000010000001X 0bXX X
#173four-state-167507 0b0000000000000000000000010000001Z 0bXX X
#174four-state-168510 0b000000000000000000000001000000X0 0bXX X
#175four-state-169513 0b000000000000000000000001000000X1 0bXX X
#176four-state-170516 0b000000000000000000000001000000XX 0bXX X
#177four-state-171518 0b000000000000000000000001000000XZ 0bXX X
#178four-state-172521 0b000000000000000000000001000000Z0 0bXX X
#179four-state-173524 0b000000000000000000000001000000Z1 0bXX X
#180four-state-174527 0b000000000000000000000001000000ZX 0bXX X
#181four-state-175529 0b000000000000000000000001000000ZZ 0bXX X
#182four-state-176533 0x00000100 0bXZ 0
#183four-state-177537 0x00000101 0bXZ X
#184four-state-178540 0b0000000000000000000000010000000X 0bXZ X
#185four-state-179542 0b0000000000000000000000010000000Z 0bXZ X
#186four-state-180545 0x00000102 0bXZ X
#187four-state-181548 0x00000103 0bXZ X
#188four-state-182550 0b0000000000000000000000010000001X 0bXZ X
#189four-state-183552 0b0000000000000000000000010000001Z 0bXZ X
#190four-state-184555 0b000000000000000000000001000000X0 0bXZ X
#191four-state-185558 0b000000000000000000000001000000X1 0bXZ X
#192four-state-186561 0b000000000000000000000001000000XX 0bXZ X
#193four-state-187563 0b000000000000000000000001000000XZ 0bXZ X
#194four-state-188566 0b000000000000000000000001000000Z0 0bXZ X
#195four-state-189569 0b000000000000000000000001000000Z1 0bXZ X
#196four-state-190572 0b000000000000000000000001000000ZX 0bXZ X
#197four-state-191574 0b000000000000000000000001000000ZZ 0bXZ X
#198four-state-192578 0x00000100 0bZ0 0
#199four-state-193582 0x00000101 0bZ0 X
#200four-state-194585 0b0000000000000000000000010000000X 0bZ0 X
#201four-state-195587 0b0000000000000000000000010000000Z 0bZ0 X
#202four-state-196590 0x00000102 0bZ0 X
#203four-state-197592 0x00000103 0bZ0 X
#204four-state-198594 0b0000000000000000000000010000001X 0bZ0 X
#205four-state-199596 0b0000000000000000000000010000001Z 0bZ0 X
#206four-state-200599 0b000000000000000000000001000000X0 0bZ0 X
#207four-state-201602 0b000000000000000000000001000000X1 0bZ0 X
#208four-state-202605 0b000000000000000000000001000000XX 0bZ0 X
#209four-state-203607 0b000000000000000000000001000000XZ 0bZ0 X
#210four-state-204609 0b000000000000000000000001000000Z0 0bZ0 X
#211four-state-205612 0b000000000000000000000001000000Z1 0bZ0 X
#212four-state-206615 0b000000000000000000000001000000ZX 0bZ0 X
#213four-state-207617 0b000000000000000000000001000000ZZ 0bZ0 X
#214four-state-208621 0x00000100 0bZ1 0
#215four-state-209625 0x00000101 0bZ1 1
#216four-state-210628 0b0000000000000000000000010000000X 0bZ1 X
#217four-state-211630 0b0000000000000000000000010000000Z 0bZ1 X
#218four-state-212633 0x00000102 0bZ1 X
#219four-state-213636 0x00000103 0bZ1 1
#220four-state-214639 0b0000000000000000000000010000001X 0bZ1 X
#221four-state-215641 0b0000000000000000000000010000001Z 0bZ1 X
#222four-state-216644 0b000000000000000000000001000000X0 0bZ1 X
#223four-state-217647 0b000000000000000000000001000000X1 0bZ1 1
#224four-state-218650 0b000000000000000000000001000000XX 0bZ1 X
#225four-state-219652 0b000000000000000000000001000000XZ 0bZ1 X
#226four-state-220655 0b000000000000000000000001000000Z0 0bZ1 X
#227four-state-221658 0b000000000000000000000001000000Z1 0bZ1 1
#228four-state-222661 0b000000000000000000000001000000ZX 0bZ1 X
#229four-state-223663 0b000000000000000000000001000000ZZ 0bZ1 X
#230four-state-224667 0x00000100 0bZX 0
#231four-state-225671 0x00000101 0bZX X
#232four-state-226674 0b0000000000000000000000010000000X 0bZX X
#233four-state-227676 0b0000000000000000000000010000000Z 0bZX X
#234four-state-228679 0x00000102 0bZX X
#235four-state-229682 0x00000103 0bZX X
#236four-state-230684 0b0000000000000000000000010000001X 0bZX X
#237four-state-231686 0b0000000000000000000000010000001Z 0bZX X
#238four-state-232689 0b000000000000000000000001000000X0 0bZX X
#239four-state-233692 0b000000000000000000000001000000X1 0bZX X
#240four-state-234695 0b000000000000000000000001000000XX 0bZX X
#241four-state-235697 0b000000000000000000000001000000XZ 0bZX X
#242four-state-236700 0b000000000000000000000001000000Z0 0bZX X
#243four-state-237703 0b000000000000000000000001000000Z1 0bZX X
#244four-state-238706 0b000000000000000000000001000000ZX 0bZX X
#245four-state-239708 0b000000000000000000000001000000ZZ 0bZX X
#246four-state-240712 0x00000100 0bZZ 0
#247four-state-241716 0x00000101 0bZZ X
#248four-state-242719 0b0000000000000000000000010000000X 0bZZ X
#249four-state-243721 0b0000000000000000000000010000000Z 0bZZ X
#250four-state-244724 0x00000102 0bZZ X
#251four-state-245727 0x00000103 0bZZ X
#252four-state-246729 0b0000000000000000000000010000001X 0bZZ X
#253four-state-247731 0b0000000000000000000000010000001Z 0bZZ X
#254four-state-248734 0b000000000000000000000001000000X0 0bZZ X
#255four-state-249737 0b000000000000000000000001000000X1 0bZZ X
#256four-state-250740 0b000000000000000000000001000000XX 0bZZ X
#257four-state-251742 0b000000000000000000000001000000XZ 0bZZ X
#258four-state-252745 0b000000000000000000000001000000Z0 0bZZ X
#259four-state-253748 0b000000000000000000000001000000Z1 0bZZ X
#260four-state-254751 0b000000000000000000000001000000ZX 0bZZ X
#261four-state-255753 0b000000000000000000000001000000ZZ 0bZZ X

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.

Embedded simulation

Open alignment checker

Tests

RV32IMemoryAlignmentUnitTest includes six named binary cases and all \(4^4=256\) combinations of LOW/HIGH/X/Z for the four meaningful bits. It checks 262 checkpoints in each implementation. Source: src/modules/rv32i/RV32IMemoryAlignmentUnit.cpp (structural) and src/modules/rv32i/RV32IPipelineControlBehavioral.cpp (behavioral).

4.3.5.3. RV32IMemoryRequest

IO pins

Pin Direction Width Description
CLK, RST Input 1 each Rising-edge transaction state; asynchronous active-high reset
ISSUE Input 1 Capture a new request when idle
TAKE Input 1 CPU can consume the current response
TAG Input 32 Current CPU request identity; a change abandons the saved request
ADDR, WRITE_DATA Input 32 each Endpoint byte address and lane-placed data
OP Input 3 Universal protocol operation (read=0, write=1); forwarded without decoding
WRITE_MASK Input 4 Endpoint byte write enables
BUS_REQ_READY Input 1 Endpoint can accept the request
BUS_RSP_VALID Input 1 Endpoint holds a response
BUS_RSP_READ_DATA Input 32 Endpoint response word
BUS_RSP_STATUS Input 3 Universal response status; zero is success
BUS_REQ_VALID Output 1 Saved request is awaiting acceptance
BUS_REQ_OP Output 3 Saved operation
BUS_REQ_ADDR, BUS_REQ_WRITE_DATA Output 32 each Saved request payload
BUS_REQ_WRITE_MASK Output 4 Saved byte mask
BUS_RSP_READY Output 1 Consume or discard endpoint response
DONE Output 1 A valid response belongs to the current CPU request
READ_DATA Output 32 Direct copy of response data; meaningful with DONE
FAULT Output 1 Nonzero response status; meaningful with DONE

Behavior

There is at most one outstanding transaction:

  1. While idle, ISSUE and the live payload immediately drive the bus. If the transaction cannot finish on the first edge, capture tag/payload to hold it.
  2. Keep BUS_REQ_VALID and the saved payload stable until a rising edge with BUS_REQ_READY=1. CPU input changes cannot mutate this request.
  3. A response may arrive during the request cycle or after acceptance. DONE announces a matching valid response even if TAKE=0; the endpoint holds response data/status under this backpressure.
  4. With TAKE or an abandoned tag, assert BUS_RSP_READY. A rising edge with response valid completes/drains the transaction. After completion, idle bypass exposes the next request during the following cycle. A ready zero-wait endpoint can therefore complete one request per cycle.

TAG is local bookkeeping, not a bus transaction ID. A mismatch immediately suppresses DONE and enables draining once the request has been sent. A mismatch sampled while busy is sticky: Aโ†’Bโ†’A across clock edges cannot make the old response valid again. A transient mismatch entirely between edges is not stored. Abandonment does not withdraw a stalled request or cancel an accepted store; it discards its eventual response. The CPU must choose tags that distinguish its requests and coordinate any redirects.

Reset clears busy/sent/abandoned and saved payload, suppresses bus valid/ready and DONE, and does not undo memory writes. Reset must be coordinated with the connected endpoint's transaction reset. READ_DATA and FAULT remain direct combinational response signals, even while idle or reset; they are not gated by DONE. ISSUE held high can start another transaction after the current one finishes, so the caller must manage it.

C++ example

This binary reference covers every output, payload hold, reset, completion, and abandonment rule. Start with reset asserted; input values must settle before each clock edge.

observe reads combinational outputs without advancing state. evaluate applies reset/edge changes and returns the resulting outputs. The core models use this distinction to capture all inputs from the old state.

namespace memory_access_example {
struct RequestInputs {
    bool CLK, RST, ISSUE, TAKE;
    uint32_t TAG, ADDR, WRITE_DATA;
    unsigned OP, WRITE_MASK;
    bool BUS_REQ_READY, BUS_RSP_VALID;
    uint32_t BUS_RSP_READ_DATA;
    unsigned BUS_RSP_STATUS;
};
struct RequestOutputs {
    bool DONE, FAULT;
    uint32_t READ_DATA;
    bool BUS_REQ_VALID, BUS_RSP_READY;
    unsigned BUS_REQ_OP;
    uint32_t BUS_REQ_ADDR, BUS_REQ_WRITE_DATA;
    unsigned BUS_REQ_WRITE_MASK;
};
class Request {
    bool busy=false, sent=false, abandoned=false, previous_clock=false;
    uint32_t tag=0, address=0, data=0;
    unsigned op=0, mask=0;
    bool discard(const RequestInputs& i) const { return busy && (abandoned || tag!=i.TAG); }
    RequestOutputs outputs(const RequestInputs& i) const {
        const bool sending=(busy||i.ISSUE)&&!sent&&!i.RST;
        const bool accepted=sending&&i.BUS_REQ_READY;
        return {(sent||accepted)&&i.BUS_RSP_VALID&&!discard(i)&&!i.RST,
                i.BUS_RSP_STATUS!=0,i.BUS_RSP_READ_DATA,
                sending,(sent||sending)&&(i.TAKE||discard(i))&&!i.RST,
                busy?op:i.OP,busy?address:i.ADDR,busy?data:i.WRITE_DATA,busy?mask:i.WRITE_MASK};
    }
public:
    RequestOutputs observe(const RequestInputs& i) const { return outputs(i); }
    RequestOutputs evaluate(const RequestInputs& i) {
        if (i.RST) {
            busy=sent=abandoned=false; tag=address=data=0; op=mask=0;
        } else if (!previous_clock && i.CLK) {
            const auto before=outputs(i);
            if (before.BUS_RSP_READY && i.BUS_RSP_VALID) busy=sent=abandoned=false;
            else if (!busy && i.ISSUE) {
                busy=true; sent=before.BUS_REQ_VALID&&i.BUS_REQ_READY; abandoned=false;
                tag=i.TAG; address=i.ADDR; data=i.WRITE_DATA; op=i.OP; mask=i.WRITE_MASK;
            } else if (busy) {
                abandoned=discard(i);
                if (before.BUS_REQ_VALID && i.BUS_REQ_READY) sent=true;
            }
        }
        previous_clock=i.CLK;
        return outputs(i);
    }
};
}

Unknown inputs

State is initially unknown until reset. Four-state behavior follows the FF cells, payload registers, equality gates, and enables. Response data is rewired and preserves X/Z; status is OR-reduced. The example assumes binary, stable handshake controls and does not model setup/hold violations or propagation glitches. Request/response handshakes are sampled on clock edges, not whenever valid and ready happen to overlap between edges.

Implementation

Structural implementation

BUSY, SENT, and ABANDONED are always-clocked ClockedStateBit children. The general requester retains five fields in Register children. Payload multiplexers select live fields while idle and held fields while busy. TAG_MATCH is a fixed structural RV32IRequestTagMatch: inputs CURRENT[32] and SAVED[32] feed one word XOR (TAG_DIFFERENT, XORGate<32>: 32 XOR comparisons) and an OR-reduction tree, producing CHANGED. Payload, handshake state, and response handling remain visible at the requester level.

Payload register Width Purpose
REQUEST_TAG 32 Compare the saved request identity with the current tag
REQUEST_OP 3 Hold the operation while the request is pending
REQUEST_ADDR 32 Hold the byte address
REQUEST_WRITE_DATA 32 Hold the store data
REQUEST_WRITE_MASK 4 Hold the byte enables

These are 103 payload bits plus three handshake-state bits. A payload register is one word with shared CLK/RST/WE, not independently addressed bits. Its structural implementation contains FF cells; its behavioral implementation stores the same vector in one component.

The advanced core's fetch requester is read-only and uses its saved address as the request tag. It stores only REQUEST_ADDR (32 payload bits), while driving the constant Read operation, zero write data, and full byte mask onto the bus. The general data requester retains all five fields, including its variable store payload, to keep a pending request stable under backpressure.

Response data is wired straight from BUS_RSP_READ_DATA to READ_DATA; there is no response register. The retained request/state is why a requester cannot be replaced with a port rename.

Behavioral implementation

RV32IMemoryRequestBehavioral holds its own four-state BUSY, SENT, and ABANDONED bits and saved request fields. It evaluates the request, response, tag-comparison, and register rules used by the structural requester, including uncertain inputs. The compact cores use the separate binary MemoryRequestState for their instruction and data requests. Catalog-selected outputs follow the requesterโ€™s characterized combinational or clock-to-output delays. Fault is still the OR of the status bits and response data is passed through unchanged.

Request presence, reset qualification and response validity are prepared before the late TAKE/discard decision. This shortens the combinational completion path without adding a cycle or changing when either handshake is accepted.

Examples

All 21 recorded rows of RV32IMemoryRequestTest, 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 BUS_REQ_READYInput ยท 1 bit BUS_RSP_READ_DATAInput ยท 32 bit BUS_RSP_STATUSInput ยท 3 bit BUS_RSP_VALIDInput ยท 1 bit CLKInput ยท 1 bit ISSUEInput ยท 1 bit OPInput ยท 3 bit RSTInput ยท 1 bit TAGInput ยท 32 bit TAKEInput ยท 1 bit WRITE_DATAInput ยท 32 bit WRITE_MASKInput ยท 4 bit BUS_REQ_ADDRExpected output ยท 32 bit BUS_REQ_OPExpected output ยท 3 bit BUS_REQ_VALIDExpected output ยท 1 bit BUS_REQ_WRITE_DATAExpected output ยท 32 bit BUS_REQ_WRITE_MASKExpected output ยท 4 bit BUS_RSP_READYExpected output ยท 1 bit DONEExpected output ยท 1 bit FAULTExpected output ยท 1 bit READ_DATAExpected output ยท 32 bit
#0reset12 0x00000100 0 0x00000000 0x0 0 0 0 0x1 1 0x00000000 0 0x12345678 0xF 0x00000100 not checked 0 not checked not checked 0 0 not checked not checked
#1issue-before-edge22 0x00000100 0 0x00000000 0x0 0 0 1 0x1 0 0x00000000 0 0x12345678 0xF 0x00000100 not checked 1 not checked not checked 0 0 not checked not checked
#2capture34 0x00000100 0 0x00000000 0x0 0 1 1 0x1 0 0x00000000 0 0x12345678 0xF 0x00000100 not checked 1 not checked not checked 0 0 not checked not checked
#3payload-held39 0x00000200 0 0x00000000 0x0 0 0 0 0x0 0 0x00000000 0 0x00000000 0x0 0x00000100 0x1 1 0x12345678 0xF not checked not checked not checked not checked
#4backpressure-edge44 0x00000200 0 0x00000000 0x0 0 1 0 0x0 0 0x00000000 0 0x00000000 0x0 0x00000100 not checked 1 not checked not checked 0 0 not checked not checked
#5accept-setup53 0x00000200 1 0x00000000 0x0 0 0 0 0x0 0 0x00000000 0 0x00000000 0x0 0x00000100 not checked 1 not checked not checked 0 0 not checked not checked
#6accepted62 0x00000200 1 0x00000000 0x0 0 1 0 0x0 0 0x00000000 0 0x00000000 0x0 0x00000100 not checked 0 not checked not checked 0 0 not checked not checked
#7response-held67 0x00000200 1 0x89ABCDEF 0x2 1 0 0 0x0 0 0x00000000 0 0x00000000 0x0 not checked not checked not checked not checked not checked 0 1 1 0x89ABCDEF
#8response-held-edge72 0x00000200 1 0x89ABCDEF 0x2 1 1 0 0x0 0 0x00000000 0 0x00000000 0x0 0x00000100 not checked 0 not checked not checked 0 1 not checked not checked
#9take-setup84 0x00000200 1 0x89ABCDEF 0x2 1 0 0 0x0 0 0x00000000 1 0x00000000 0x0 0x00000100 not checked 0 not checked not checked 1 1 not checked not checked
#10taken95 0x00000200 1 0x89ABCDEF 0x2 1 1 0 0x0 0 0x00000000 1 0x00000000 0x0 0x00000200 not checked 0 not checked not checked 0 0 not checked not checked
#11new-issue-setup108 0x00000200 0 0x89ABCDEF 0x2 0 0 1 0x0 0 0x00000004 0 0x00000000 0x0 0x00000200 not checked 1 not checked not checked 0 0 not checked not checked
#12second-capture124 0x00000200 0 0x89ABCDEF 0x2 0 1 1 0x0 0 0x00000004 0 0x00000000 0x0 0x00000200 not checked 1 not checked not checked 0 0 not checked not checked
#13redirect-before-accept140 0x00000200 0 0x89ABCDEF 0x2 0 0 0 0x0 0 0x00000008 0 0x00000000 0x0 0x00000200 not checked 1 not checked not checked 1 0 not checked not checked
#14record-abandonment146 0x00000200 0 0x89ABCDEF 0x2 0 1 0 0x0 0 0x00000008 0 0x00000000 0x0 0x00000200 not checked 1 not checked not checked 1 0 not checked not checked
#15tag-returns-ABA155 0x00000200 1 0x89ABCDEF 0x2 0 0 0 0x0 0 0x00000004 0 0x00000000 0x0 0x00000200 not checked 1 not checked not checked 1 0 not checked not checked
#16abandoned-accepted164 0x00000200 1 0x89ABCDEF 0x2 0 1 0 0x0 0 0x00000004 0 0x00000000 0x0 0x00000200 not checked 0 not checked not checked 1 0 not checked not checked
#17stale-response176 0x00000200 1 0x89ABCDEF 0x2 1 0 0 0x0 0 0x00000004 0 0x00000000 0x0 0x00000200 not checked 0 not checked not checked 1 0 not checked not checked
#18stale-drained186 0x00000200 1 0x89ABCDEF 0x2 1 1 0 0x0 0 0x00000004 0 0x00000000 0x0 0x00000200 not checked 0 not checked not checked 0 0 not checked not checked
#19ungated-response-wires191 0x00000200 1 0x89ABCDEF 0x2 0 0 0 0x0 0 0x00000004 0 0x00000000 0x0 not checked not checked not checked not checked not checked not checked 0 1 0x89ABCDEF
#20reset-again204 0x00000200 1 0x89ABCDEF 0x2 0 0 0 0x0 1 0x00000004 0 0x00000000 0x0 0x00000200 not checked 0 not checked not checked 0 0 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.

Embedded simulation

Open memory requester

Tests

RV32IMemoryRequestTest records 21 checkpoints: capture, backpressure, payload stability, acceptance, held response, faults, redirect/ABA abandonment, draining, and reset. RV32IMemoryMigrationTest checks transaction endpoints and zero-wait single-cycle integration. RV32IBuildingBlocksDocumentationTest executes the C++ examples. Sources: RV32IMemoryLanes.cpp and RV32IMemoryRequest.cpp.