Skip to content

Add a return-address stack (RAS) - #4

Merged
MaxXSoft merged 9 commits into
masterfrom
codex/ras
Oct 20, 2026
Merged

MaxXSoft merged 9 commits into
masterfrom
codex/ras

Conversation

@MaxXSoft

Copy link
Copy Markdown
Owner
  • Coauthored by: GPT-6 Astra
  • Reviewed by: MaxXing

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

Static review and the reported standalone stack-model check found no blocking issues; project simulations were not run.

No open issues 🎉

What changed in this PR

Adds a speculative 16-entry return-address stack to improve return prediction alongside the existing branch predictor.

Changes:

  • Recognizes standard and compressed call/return hints, with backend-flush recovery.
  • Adds stack, predictor, fetch, and core integration tests to CI.
  • Documents RAS behavior and consolidates instruction constants.
File Description
src/​test/​scala/​core/​stages/​FetchRasTest.scala Tests stalls, nested returns, flushes, and faults.
src/​test/​scala/​core/​integration/​CoreRasTest.scala Tests return prediction and retirement under stalls.
src/​test/​scala/​bpu/​ReturnAddressStackTest.scala Tests stack boundaries and randomized operations.
src/​test/​scala/​bpu/​RasPredictionTest.scala Tests instruction hints and prediction fallback.
src/​test/​scala/​bpu/​DecoderTrainingTest.scala Initializes new predictor inputs.
src/​test/​scala/​bpu/​BranchPredictorTest.scala Initializes new predictor inputs.
src/​main/​scala/​core/​Fetch.scala Connects instruction acceptance and flush signals.
src/​main/​scala/​core/​Decoder.scala Adds whitespace only.
src/​main/​scala/​core/​CompressedDecoder.scala Uses shared constants and explicit opcodes.
src/​main/​scala/​consts/​Parameters.scala Defines RAS capacity.
src/​main/​scala/​consts/​Instructions.scala Adds a shared EBREAK encoding.
src/​main/​scala/​bpu/​ReturnAddressStack.scala Implements the bounded speculative stack.
src/​main/​scala/​bpu/​BranchPredictor.scala Adds call/return predecode and RAS prediction.
README.md Documents RAS behavior and recovery limitations.
CHANGELOG.md Records the RAS addition.
.github/​workflows/​test.yml Runs the new regression tests.

Review effort: Balanced

@MaxXSoft
MaxXSoft merged commit b31b206 into master Oct 20, 2026
2 checks passed
@MaxXSoft
MaxXSoft deleted the codex/ras branch October 20, 2026 02:43
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.

2 participants