Implement single-cycle RV64I core - #3
Merged
Conversation
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
approved these changes
Aug 4, 2026
bitglitcher
left a comment
Member
There was a problem hiding this comment.
Approving base RV64I architecture
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.
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.
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.alu.sv/register_file.sv/decoder.svtoWORD_SIZE=64and adds the RV64I-only instructions:LWU/LD/SDand the*W/*IWword-arithmetic family.imem.sv/dmem.sv— combinational reads with real byte-enable writes, since the existing Wishbone-attachedwb4_sram.svis registered (minimum 2-cycle transaction) and can't support single-cycle timing. Real Wishbone integration is a later milestone, not this one.design/core.svis 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) andregister_file_tb.sv(6 checks) — unit-level, isolated from the corecore_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)iverilog(WSL)verilator --lint-only -Wallclean (zero warnings) across the full design🤖 Generated with Claude Code