lowRISC / lowRISC/ethernet

Inconsistent use of synchronous and asynchronous resets

Open
#10 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
SystemVerilog
Stars
23
Forks
12
PR merge metrics
No merged PRs in 30d

Description

There are resets in this design which are used as both synchronous and asynchronous
There are also resets which can assert asynchronously but are used synchronously

# Some examples
At the time of writing (1a14e8d9)

`rgmii_phy_if.sv`
- Line 252 uses `rst` as an async reset (to synchronise `rx_rst_reg` to `mac_gmii_rx_clk`)
- Line 115 uses `rst` as a synchronous reset

Because of line 252, the RX reset can be asserted asynchronously (but asserts synchronous to `rx_clk`).
However, it is routed to `axis_gmii_rx` where it is used on line 250 as a synchronous reset.

# Recommendations for approaching
This issue spans several different modules and is hard to isolate.
Some modules (BRAM) prefer synchronous resets
As far as I know there is nothing that REQUIRES asynchronous resetting, but it is the preferred choice in general
Also note that a small amount of flops in the design have no reset

Currently there seem to be three reset nets in the design: TX reset, RX reset, logic reset (which go under several different names at different parts of the design and are inconsistently used as synchronous or asynchronous).

One approach to identifying where resets are used is to grep the codebase for regex `always(_ff)? ?@ ?\(posedge`:
Image
and look at the sensitivity list to identify asynchronous/synchronous resets. Also note that resets inside the MAC are generally active-high while resets outside the MAC are generally active-low as indicating by the "_n" suffix.

Contributor guide

No contributing guide indexed for this repository

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 auditing rgmii_phy_if.sv at lines 115 and 252, then inspect axis_gmii_rx at line 250. Use the suggested grep for always_ff/always blocks and sensitivity lists to inventory the TX, RX, and logic reset nets across modules. Done means the reset conventions are consistently applied, including active-high versus active-low usage and modules that require synchronous resets.

Written by the indexing model from the issue text.

Assessment

Domain
embedded-iot, networking
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.