Skip to content
This repository has been archived by the owner on Jun 24, 2021. It is now read-only.

Latest commit

 

History

History
35 lines (29 loc) · 1.35 KB

Counters.md

File metadata and controls

35 lines (29 loc) · 1.35 KB

Counters. Utilizing the Chisel2 compatability layer.


object TwoWayCounter

A two way counter

  • apply (up: Bool, down: Bool, max: Int) => UInt
    Count up when up && !down, down when down && !up, width of output is log2Up(max+1).

case class WideCounter

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 to x.




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)