Counters. Utilizing the Chisel2 compatability layer.
A two way counter
- apply
(up: Bool, down: Bool, max: Int) => UInt
Count up whenup && !down
, down whendown && !up
, width of output islog2Up(max+1)
.
a counter that clock gates most of its MSBs using the LSB carry-out
case class WideCounter(width: Int, inc: UInt = UInt(1), reset: Boolean = true)
- width
Int
the width of the counter. - inc
UInt
the increment value. - reset
Boolean
reset to 0. - value
UInt
the counter value. - :=
(x: UInt) => Unit
set counter value tox
.
Last updated: 09/07/2017
CC BY-NC-SA 4.0, © (2017) Wei Song
Apache 2.0, © (2016-2017) SiFive, Inc
BSD, © (2012-2014, 2016) The Regents of the University of California (Regents)