Skip to content

Implement single-cycle RV64I core - #3

Merged
bitglitcher merged 1 commit into
quantiumv:basic-arch-pathfrom
ranaumarnadeem:rv64i-core
Aug 4, 2026
Merged

Implement single-cycle RV64I core#3
bitglitcher merged 1 commit into
quantiumv:basic-arch-pathfrom
ranaumarnadeem:rv64i-core

Conversation

@ranaumarnadeem

Copy link
Copy Markdown
Contributor

Summary

First milestone of the RV64IMAC+Zicsr roadmap: a real, verified single-cycle RV64I core, built on this branch's simpler single-module architecture rather than main's pipeline.

  • Fixes real bugs in the reused alu.sv/register_file.sv/decoder.sv: SLT/SRA signedness, unmasked shift amounts, inverted regfile write-enable, x0 never hardwired, missing sign-extension on every immediate type (including a 12-vs-13-bit zero-pad bug specific to S-type store offsets), and SLLI/SRLI/SRAI reading garbage shift amounts instead of the actual shift field.
  • Widens alu.sv/register_file.sv/decoder.sv to WORD_SIZE=64 and adds the RV64I-only instructions: LWU/LD/SD and the *W/*IW word-arithmetic family.
  • Adds two new purpose-built memory modules, imem.sv/dmem.sv — combinational reads with real byte-enable writes, since the existing Wishbone-attached wb4_sram.sv is registered (minimum 2-cycle transaction) and can't support single-cycle timing. Real Wishbone integration is a later milestone, not this one.
  • design/core.sv is a full rewrite: a genuine single-cycle datapath (no FSM) — fetch, decode, execute, memory, and writeback all complete within one clock edge-to-edge cycle.

Out of scope here (later milestones): M/A/C extensions, Zicsr/CSRs, privilege modes, Sv39, UART, JTAG, pipelining, out-of-order.

Test plan

  • alu_tb.sv (11 checks) and register_file_tb.sv (6 checks) — unit-level, isolated from the core
  • core_alu_ops_tb.sv (7), core_upper_imm_tb.sv (3), core_load_store_tb.sv (4), core_branch_jump_tb.sv (7), core_rv64_word_ops_tb.sv (6) — integration, each targeting a specific regression rather than just "does it run" (negative immediates, the SLT/SRA fixes, the S-type offset bug via an independent load-path cross-check, JALR's LSB-clear, ADDW/SRAW vs their 64-bit equivalents on identical inputs)
  • 44/44 checks passing under iverilog (WSL)
  • verilator --lint-only -Wall clean (zero warnings) across the full design

🤖 Generated with Claude Code

Fixes real bugs found in the reused decoder/alu/register_file modules
(SLT/SRA signedness, unmasked shift amounts, inverted regfile
write-enable, x0 never hardwired, missing sign-extension on every
immediate type including a 12-vs-13-bit zero-pad bug specific to S-type
offsets, SLLI/SRLI/SRAI reading garbage shift amounts) and widens them
to WORD_SIZE=64.

Adds the RV64I-only instructions (LWU/LD/SD, the *W/*IW word-arithmetic
family) and two new purpose-built memory modules (imem/dmem) with
combinational reads and real byte-enable writes, since the existing
Wishbone-attached wb4_sram.sv is registered and can't support single-cycle
timing.

design/core.sv is a full rewrite: a genuine single-cycle datapath (no
FSM) wiring fetch/decode/execute/memory/writeback together in one clock
edge-to-edge cycle.

Verified with 7 testbenches (44 checks total, all passing under
iverilog, zero warnings under verilator --lint-only -Wall) targeting the
specific regressions above rather than just "does it run" -- negative
immediates, the SLT/SRA fixes, the S-type offset bug via an independent
load-path cross-check, JALR's LSB-clear, and ADDW/SRAW vs their 64-bit
equivalents on identical inputs.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

@bitglitcher bitglitcher left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approving base RV64I architecture

@bitglitcher
bitglitcher merged commit 5757b8a into quantiumv:basic-arch-path Aug 4, 2026
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