shift right does not complain about shift size greater than width
See original GitHub issueThe firrtl spec 7.12
The shift right operation truncates the least significant n bits from e. n must be non-negative and strictly less than the bit width of e.
The following code, run with n = 8, 9, 10
class BrokenShifter(n: Int) extends Module {
val io = IO(new Bundle {
val i = Input(FixedPoint(8.W, 4.BP))
val o = Output(FixedPoint(8.W, 4.BP))
val si = Input(SInt(8.W))
val so = Output(SInt(8.W))
})
io.o := io.i >> n
io.so := io.si >> n
}
generates the following firrtl, which is processed without complaint.
circuit BrokenShifter :
module BrokenShifter :
input clock : Clock
input reset : UInt<1>
output io : {flip i : Fixed<8><<4>>, o : Fixed<8><<4>>, flip si : SInt<8>, so : SInt<8>}
io is invalid
io is invalid
node _T_10 = shr(io.i, 9) @[FixedPointSpec.scala 135:16]
io.o <= _T_10 @[FixedPointSpec.scala 135:8]
node _T_11 = shr(io.si, 9) @[FixedPointSpec.scala 136:18]
io.so <= _T_11 @[FixedPointSpec.scala 136:9]
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Shifting unsigned int more than the size of it, undefined or not?
J. 2 Undefined behavior An expression is shifted by a negative number or by an amount greater than or equal to the width...
Read more >INT34-C. Do not shift an expression by a negative number of ...
This rule uses precision instead of width because, in almost every case, an attempt to shift by a number of bits greater than...
Read more >Salomon / Atomic / Armada SHIFT MNC Binding - Blister Review
The Shift is a very powerful binding with a noticeably-more-plush ride than a traditional tech binding. We haven't yet directly A/B'd it against ......
Read more >Using full-sized subfloats causes them to shift to the right - TeX
When using subfloats (with the subfig package) to include graphics at the full text/column width, the graphics seem to be shifted to the...
Read more >health_hazards_workbook.pdf
Course participants will learn how to anticipate, recognize, evaluate and control occupational health hazards; these hazards include, but are not limited to:.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
ok, seems like I should just update the firrtl spec
Resolution: need update spec.