Skip to content

Pitfall: clearing the 68080 data-cache enable bit does not turn the cache off - #58

Merged
WDrijver merged 1 commit into
mainfrom
pitfall/cacr-data-cache-bit
Nov 17, 2026
Merged

WDrijver merged 1 commit into
mainfrom
pitfall/cacr-data-cache-bit

Conversation

@WDrijver

Copy link
Copy Markdown
Contributor

What

A new pitfall, core/pitfalls/cacr-data-cache-bit-ignored.md, and the hardware test behind it, tools/v4/tests/dcache-enable-bit.

On Core 12856 (V4 UniCorn), CACR bit 31 (DE / CACRF_EnableD) can be written and reads back ($00008000 ↔ $80008000). Data-load latency doesn't change with it:

Case Cycles for 16384 dependent loads
64 KB, bit clear (as found) 49161
64 KB, CacheControl(0, CACRF_EnableD) 49161
64 KB, CacheControl(CACRF_EnableD, CACRF_EnableD) 49161
4 MB (cannot fit) 468071–470680

That is 3 cycles per load for 64 KB against ~28.6 for 4 MB, so the test does see a miss. The data cache stays on whatever the bit says.

The file also records a trap in measuring this: a sequential sum gives the same time for 64 KB and 4 MB (prefetch), so it says nothing about the cache.

Found during

The ApolloOS R10 port: rxnet reports "DCache off" on R10 (no SetPatch on the test card), and we needed to know whether that mattered.

Knowledge base files relied on

  • core/cpu-68080/caches-and-memory.md
  • core/pitfalls/self-modifying-code-and-caches.md
  • tools/v4/v4test.py and tools/v4/tests/akbtest.h

Local checks: check_frontmatter, check_links and check_saga_addresses pass, and v4test.py build builds the test. It ran 5 times on the V4 with identical results.

🤖 Generated with Claude Code

…ache off

Measured on V4 UniCorn, Core 12856, with a pointer-chase hardware test
(tools/v4/tests/dcache-enable-bit): CACR bit 31 reads back as written,
but cached load latency stays at 3 cycles with it clear or set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@WDrijver
WDrijver requested a review from TuKo1982 as a code owner November 17, 2026 08:08
@WDrijver
WDrijver merged commit afc564f into main Nov 17, 2026
2 checks passed
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