lowRISC / lowRISC/opentitan

[dma] Clearing error code by writing to the status.error field seems to be one cycle delayed?

Open
#29,445 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
SystemVerilog
Stars
3.6k
Forks
1.1k
Avg merge
2d 22h
Merged PRs (30d)
141

Description

### Description

Our team has seen some weird behaviour with the error code not being cleared when the status.error field has a 1 written to it.

In this test, an error was caused intentionally and the status.error bit was written to clear it.
Looking at the RTL at [line 1415](https://github.com/lowRISC/opentitan/blob/bb630faffe46d03c7f056e3d294b42a538528477/hw/ip/dma/rtl/dma_reg_top.sv#L1415) of the dma_reg_top module, we can see our write from the _status_we_, _status_error_wd_ and _status_flds_we[3]_ signal being 1. Then _reg2hw.status.error.q_ is cleared to one following the RW1C behaviour.
On [line 1324](https://github.com/lowRISC/opentitan/blob/bb630faffe46d03c7f056e3d294b42a538528477/hw/ip/dma/rtl/dma_reg_top.sv#L1324), _status_flds_we[3]_ is flopped before becoming _reg2hw.status.error.qe_ (red arrow).
Image

When it comes to clearing the error code on [line 1321](https://github.com/lowRISC/opentitan/blob/bb630faffe46d03c7f056e3d294b42a538528477/hw/ip/dma/rtl/dma.sv#L1323) in the dma, it looks for (_reg2hw.status.error.qe_ & _reg2hw.status.error.q_) to clear the error codes. But _reg2hw.status.error.q_ was already cleared to 0 from the register write. So, we get qe being 1 but q as 0, causing the error codes to not clear.

Is there something that we are missing?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting hw/ip/dma/rtl/dma_reg_top.sv around lines 1324 and 1415, then hw/ip/dma/rtl/dma.sv around line 1323. Reproduce the described RW1C write and follow status.error.q, status.error.qe, and the DMA error-clearing condition across cycles; done means determining whether the apparent delay is expected or identifies a DMA RTL bug.

Written by the indexing model from the issue text.

Assessment

Domain
embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.