Repository navigation
Core content from Gunnar's coding guidelines - #15
Merged
Merged
Conversation
Gunnar's "Simply 68080 coding guidelines" draft and his answers of 2026-11-03, split into the knowledge base (owner WDrijver for new files). New: - core/cpu-68080/execution-units.md: branch path, two EA units, ALUs, 16-byte instruction groups, memory per cycle. - core/best-practices/fewer-and-shorter-instructions.md - core/pitfalls/double-memory-indirect.md (fine in JMP/JSR only) Corrected: - Instruction groups are at most 16 bytes; the decoders get 16 bytes per cycle (was "32-byte fetch"). - The data cache does 1 read and 1 write per cycle (was "1 read, or 1 write, or 1 read-modify-write"). - Loops: dbra, dbra.l for 32-bit counters; subq.l + bne is not recommended. - ALU-to-EA bubble: 2 cycles by Gunnar's count, may grow. Added: cache-miss factors, the 16-cycle table rule, prefetch and write combining notes, code and data placement, limited copy unrolling, FPU rule of thumb, write alignment note, dependency example. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Gunnar's draft "Simply 68080 coding guidelines" and his answers of 2026-11-03, split into the knowledge base. Every fact from him is tagged (G). Gunnar has no GitHub account, so new files have owner WDrijver; changed files keep their owner. All files are
draft.New files
core/cpu-68080/execution-units.md:core/best-practices/fewer-and-shorter-instructions.md: fewer instructions even if longer, then the shortest encoding.core/pitfalls/double-memory-indirect.md: memory indirect blocks the core, except in JMP/JSR.Corrections to existing files
core-at-a-glance,superscalar-issuecore-at-a-glance,pipeline-15-stagessubq.l+bne.sdbra.l; Gunnar does not recommendsubq.l+bne(loop size limit)close-loops-with-dbra,branches-and-predictionalu-to-ea-bubble,pipeline-15-stagesIn
close-loops-with-dbra.md, TuKo's example with the loop counter in An andsubq/move/bneis replaced by Gunnar's pattern: the index in An, stepped withaddq, and the counter in Dn withdbra.l. TuKo's measurements stay.Additions
caches-and-memory: what a miss costs depends on several factors: burst, row/page/bank, read after write, other memory users, and the memory controller per model. The measured 27 cycles is one case.memory-access-patterns:-(An)is predicted less well than(An)+;code-size-and-placement: code and constants in two blocks per 4 KB page; no writable data in a code page; limited copy unrolling.fpu-performance-model: Gunnar's rule of thumb: about 6 cycles latency, 32 registers for FPU work.align-copy-destination: Gunnar expects write combining to soften misaligned writes. The measured 1.7–1.8x stays.interleave-dependency-chains: Gunnar's good/bad dependency example.Open
add.l #1,memcounter+dbrato run at about 1 iteration per cycle. TuKo's notes say a counter in memory serialises. Both are recorded; a measurement would settle it.double-indirect-fix.patchand the suspected crash on computed gotos (ApolloCrossDev commit ea05a70).Knowledge base files relied on
core/cpu-68080/prm/integer/dbcc-l.md,core/cpu-68080/prm/integer/bcc-s-plus.md,core/cpu-68080/prm/integer/moviw.md🤖 Generated with Claude Code