Need for explicit widths in BlackBox parameters

Open
#4,488 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
30/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
scala
Domain
compilers

Research direction

The issue names no file, test, or entry point; begin by locating the Verilog blackbox parameter-emission path and reviewing how parameter widths are derived. Reproduce the 64-bit address case with Verilator, then define completion as explicit-width parameters being emitted without invalid-bit errors while preserving existing parameter behavior.

Written by the indexing model from the issue text.

Description

Hello!

There seems to be a need for being able to explicitly define how wide you want your verilog parameters to be when using a Verilog component as a blackbox. Consider the case where you have a module with parameters ADDR({ADDR1, ADDR0}) and .ADDR_COUNT(2). Say your addresses are {0x0100_dead, 0x0000_beef} or something. If you define these addresses in chisel, The generated verilog parameters will crop the top 4 leading 0s in the address, which translates to 0x100_dead0000_beef.

Thats all fine and well. The problem is now if you attempt to access the top 32 bits of the parametrized address, the simulator may or may not fail. Verilator, for instance, fails with an error saying that it does not support invalid bits for parameters.

I cant think of a better solution than providing support for explicit widths in verilog parameters via the chisel code. The verilog assuming it has all 64 bits is a pretty fair assumption, so I dont think its at fault here. I also think its probably for the best for the simulator to fail in this case.

Currently, I've resorted to padding a dummy 1 to my address fields parameter. If there is a better solution, I would love to hear it. Thanks. Take care.

Dominant language
Scala
Stars
4.8k
Forks
669
Avg merge
1d 12h
Merged PRs (30d)
25

Getting set up

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.

More from chipsalliance/chisel

All issues in chipsalliance/chisel

Similar issues

More Scala issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.