【Bug】APLIC: setipnum/clripnum/setienum/clrienum do not strictly constrain writes to source numbers
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- scala
- Domain
- embedded-iot
Research direction
Read ChiselAIA/src/main/scala/APLIC.scala and the cited specification first. Trace the setipnum, clripnum, setienum, and clrienum register writes, then reproduce the source-1 case with an out-of-range value such as 129. Done means out-of-range writes are ignored rather than aliasing to another source number.
Written by the indexing model from the issue text.
Description
Violated specification
code
ChiselAIA/src/main/scala/APLIC.scala
Description
According to my understanding, The current implementation truncates the 32-bit write data to the lowest aplicIntSrcWidth bits to form the source index.
As a result, writes with values outside the legal source number range (which should be ignored) are instead alias-mapped to a different valid source number due to truncation, causing erroneous interrupt behavior.
Specifically, after source 1 has been configured as active, writing an out-of-range value 129 (0x81) to the setipnum register should be ignored according to the specification.
However, in the current XiangShan implementation, this write results in execution of ips.wBitUI(1, true.B), setting interrupt-pending for source 1.
So I think the code should probably add an in-range check to these two register writes, and only allow entering wBitUI() when the written 32-bit value falls within [1, intSrcNum-1]
- Dominant language
- Scala
- Stars
- 14
- Forks
- 8
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 2
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/ChiselAIA
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
OpenXiangShan/ChiselAIA#16 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
OpenXiangShan/ChiselAIA#10 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 38/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 20/100
OpenXiangShan/ChiselAIA#7 · 1 comment ·
All issues in OpenXiangShan/ChiselAIA
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
com-lihaoyi/mill#7998 ·
Maintainers usually reply within 1 day