Skip to content

Commit

Permalink
Add additional clarification about UInt vs SInt
Browse files Browse the repository at this point in the history
  • Loading branch information
zyedidia committed Aug 31, 2022
1 parent e5548d0 commit c06edb4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -1812,7 +1812,9 @@ The bit-index `x[i]` selects the single bit `i`.

The type of the bit-index expression `x[hi:lo]`.{firrtl} is `UInt<hi - lo +
1>`.{firrtl} (even if `x` is an `SInt`) and the type of `x[i]`.{firrtl} is
`UInt<1>`.{firrtl}.
`UInt<1>`.{firrtl}. This means that when connecting to a bit-indexed value, the
right-hand-side of the connection must be a `UInt`.{firrtl}, even if the value
being indexed is an `SInt`.{firrtl}.

The bit-index can be used as a sink or source. When used as a source,
`x[hi:lo]` is equivalent to `bits(x, hi, lo)` and `x[i]` is equivalent to
Expand Down

0 comments on commit c06edb4

Please sign in to comment.