diff options
| author | ducky | 2017-02-01 16:07:09 -0800 |
|---|---|---|
| committer | Richard Lin | 2017-02-07 16:24:17 -0800 |
| commit | 8d2fff4eff3ba0f92437b290985b35afbb0ed565 (patch) | |
| tree | 97b3f62d73c61ceb12ccb6bd684e63df5be8ed0d /src/main/scala/chisel3/util/Counter.scala | |
| parent | ad20406f301e04075e051147092cf9c12a6a6ca8 (diff) | |
Name all the things
Diffstat (limited to 'src/main/scala/chisel3/util/Counter.scala')
| -rw-r--r-- | src/main/scala/chisel3/util/Counter.scala | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/main/scala/chisel3/util/Counter.scala b/src/main/scala/chisel3/util/Counter.scala index 6d59eaaf..66dd1127 100644 --- a/src/main/scala/chisel3/util/Counter.scala +++ b/src/main/scala/chisel3/util/Counter.scala @@ -3,6 +3,7 @@ package chisel3.util import chisel3._ +import chisel3.internal.naming.chiselName // can't use chisel3_ version because of compile order //import chisel3.core.ExplicitCompileOptions.Strict /** A counter module @@ -10,6 +11,7 @@ import chisel3._ * @param n number of counts before the counter resets (or one more than the * maximum output value of the counter), need not be a power of two */ +@chiselName class Counter(val n: Int) { require(n >= 0) val value = if (n > 1) Reg(init=0.U(log2Up(n).W)) else 0.U @@ -53,6 +55,7 @@ object Counter * } * }}} */ + @chiselName def apply(cond: Bool, n: Int): (UInt, Bool) = { val c = new Counter(n) var wrap: Bool = null |
