lowRISC / lowRISC/opentitan

[i3c] Bitwidth parameters should use `prim_util_pkg::vbits()`

Open
#31,082 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description

I've noticed that in a lot of places the I3C code uses $clog2() directly. The main use is for bitwidth computations like localparam int unsigned Log2NT = $clog2(NumTargets). However, if NumTargets = 1, which I think is a valid option, all these signal declarations won't compile anymore.

We should use prim_util_pkg::vbits() which ensures we always at least get 1.

cc @alees24 @glaserf

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

Search the I3C code for direct $clog2() bitwidth calculations and inspect prim_util_pkg::vbits() before changing the relevant declarations. Confirm that all applicable parameters use the helper and that the I3C code compiles when NumTargets = 1.

Written by the indexing model from the issue text.

Assessment

Domain
embedded-iot
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.