Skip to content

uncore: size local memories from the range mask, not RANGE/8 words - #1987

Open
davidharrishmc wants to merge 1 commit into
openhwfoundation:mainfrom
davidharrishmc:dh/ram-ahb-depth
Open

davidharrishmc wants to merge 1 commit into
openhwfoundation:mainfrom
davidharrishmc:dh/ram-ahb-depth

Conversation

@davidharrishmc

Copy link
Copy Markdown
Contributor

The *_RANGE parameters are masks (size-1), but ram_ahb sized its backing array as RANGE/8 entries of XLEN bits. On RV32 that backs only 64 MiB of the 128 MiB RAM region and the 24-bit index silently aliases 0x84000000+ onto 0x80000000+ on writeback; on RV64 the region's top doubleword is out of the array. rom_ahb, dtim and irom have the same off-by-one, so all four now size as (RANGE+1)/(XLEN/8) entries. The new tests/coverage/ramtop.S and tests/coverage32/ramtop32.S force lines through the RAM with cbo.flush (coverage32 march gains Zicbom) and fail on main.

🤖 Generated with Claude Code

UNCORE_RAM_RANGE and the other *_RANGE parameters are masks (size-1), but
ram_ahb sized its backing array as RANGE/8 entries of XLEN bits.  On RV32
that backs only 64 MiB of the 128 MiB RAM region and the 24-bit index
silently aliases 0x84000000+ onto 0x80000000+ on writeback; on RV64 the
region's top doubleword is out of the array.  rom_ahb, dtim and irom have
the same off-by-one shape.  Size them all as (RANGE+1)/(XLEN/8) entries.

Add tests/coverage/ramtop.S and tests/coverage32/ramtop32.S (coverage32
march gains Zicbom), which force lines through the RAM with cbo.flush and
fail on main.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant