Single port SRAM read -> write path causes a getSplitArray assertion failure
Maintainers usually reply within 2 days
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 20/100
Research direction
The assertion fires in getSplitArray in src/splitArray.cpp at line 115, so start there and see how read-port data is split when a read and write share one port. Run gsim on the minimal.fir reproducer from the issue to confirm the failure. Done means it compiles without the assertion and matches Verilator's output. A fix is already open as PR #146, so check that before starting.
Written by the indexing model from the issue text.
Description
Before start
- I confirm that this is a bug of GSIM, rather than a usage problem or other types of problems. 我确认这是一个 GSIM 的 bug,而不是使用上的问题或者其他类型的问题。
- I have searched the previous issues and did not find anything relevant. 我已经搜索过之前的 issue,并没有找到相关的。
- I have reviewed the commit messages from the relevant commit history. 我已经浏览过相关的提交历史和提交信息。
- I have reproduced the incorrect behaviors using the latest commit on the corresponding branch. 我已经使用相应分支最新的 commit 复现了不正确的行为。
Branch
master
Describe the bug
A pure-combinational path between the r/w port of one SRAM like this:
// read sram in s0
sram.io.r.req.valid := s0_valid
// get sram result, do some computation in s1
val s1_rdata = sram.io.r.resp.bits.data
val s1_wdata = s1_rdata + 1.U
// then write back, still in s1
sram.io.w.req.valid := s1_valid && !s0_valid // drop if there is a new request, to prevent r-w conflict
sram.io.w.req.bits.data := s1_wdata
will result in:
Should Not Reach Here!
current sram$array$RW0$$wdata 1/2
missing sram$wdata
...
current sram$rdataReg$NEXT 1/2
missing sram$array$RW0$$rdata
gsim: src/splitArray.cpp:115: Node *getSplitArray(graph *): Assertion `0' failed.
A minimal .fir reproducer will be like:
smem mem : UInt<8>[4]
node wdata = xor(rdata, UInt<8>(0h1))
when en :
rdwr mport p = mem[addr], clock
when write :
connect p, wdata
connect rdata, p
which gives a similar failure:
Should Not Reach Here!
current p 4/5
missing wdata
gsim: src/splitArray.cpp:115: Node *getSplitArray(graph *): Assertion `0' failed.
Expected behavior
Should compile normally, as verilator does.
Environment
$ gsim --version
GSIM master-2026-10-26-cd08a32
Build Date: 2026-10-27T07:47:12Z
Build CXX: Ubuntu clang version 19.1.1 (1ubuntu1~24.04.2)
To Reproduce
Pipeline:
- chisel source: RwPipeline.scala
- compiled fir: RwPipeline.fir
Minimal .fir: minimal.fir
Additional context
AI disclosure: the minimal .fir reproducer is generated by GPT 6.1 Sol
- Dominant language
- C++
- Stars
- 93
- Forks
- 16
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 11
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from OpenXiangShan/gsim
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
OpenXiangShan/gsim#169 ·
Maintainers usually reply within 2 days
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
OpenXiangShan/gsim#168 ·
Maintainers usually reply within 2 days
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
OpenXiangShan/gsim#158 ·
Maintainers usually reply within 2 days
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
OpenXiangShan/gsim#120 · 2 comments ·
Maintainers usually reply within 2 days
-
DeadLoop Bug in GSim SplitArray on TilelinkMay be free again @Wolf-Tungsten claimed this 233 days ago, and no pull request is open. Open
OpenXiangShan/gsim#103 · 1 comment · 1 assignee ·
Maintainers usually reply within 2 days
All issues in OpenXiangShan/gsim
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
microsoft/DirectXShaderCompiler#9173 ·
Maintainers usually reply within 2 days
-
feature:config kind:docs os:windows toolchain:cmake triaged
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
arch-based bug niri
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
noctalia-dev/noctalia#5552 ·
Maintainers usually reply within 1 day