Unverified Commit 135594a1 authored by mergify[bot]'s avatar mergify[bot] Committed by GitHub
Browse files

Support zero-width integer literals. (#2932) (#2938)

* assert{Inferred,Known}Width: tweak to support width of zero.

Can't create -1.S(0.W), special-case zero-width.

* Bits: nicer error messages for zero-width

* Support zero-width integer literals.

These are in the FIRRTL language specification now
and supported by both SFC + MFC.

For SInt, special-case handle zero-width as not needing a sign bit.

Zero-width literals must be explicitly zero-width (`0.U(0.W)`);
literals such as `0.U` are (still) at least 1-bit.

* check zero-width to bool conversion

* onehot test

* UIntOps: test a few operations.

* SIntOps: test a few operations

* {S,U}IntOps: touchup test description, now includes head/tail/pad.

* ChiselSpec: Fix assert{Known,Inferred}Width for zero-width.

Specifically, fix the inferred-width check.

Start from zero-width literal, otherwise 0.U will need 1 bit.

* WidthSpec: update inferred zero-width test

(cherry picked from commit fc3b4a08

)

Co-authored-by: default avatarWill Dietz <will.dietz@sifive.com>
parent 6a63353f
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment