summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authormergify[bot]2022-07-06 00:28:02 +0000
committerGitHub2022-07-06 00:28:02 +0000
commit2b977a74293a49e9e2a5d960a6a9c07df22430ce (patch)
tree320e9ee49d336fa18e63a04bf79dfcf6dbb1856d /src/main
parenta931c5e218014c659bbff7d0dec74c882281d9a0 (diff)
Implement trait for Chisel compiler to name arbitrary non-Data types (#2610) (#2617)
Co-authored-by: Jack Koenig <koenig@sifive.com> Co-authored-by: Megan Wachs <megan@sifive.com> (cherry picked from commit 3ab34cddd8b87c22d5fc31020f10ddb2f1990d51) Co-authored-by: Jared Barocsi <82000041+jared-barocsi@users.noreply.github.com>
Diffstat (limited to 'src/main')
-rw-r--r--src/main/scala/chisel3/util/Counter.scala4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/main/scala/chisel3/util/Counter.scala b/src/main/scala/chisel3/util/Counter.scala
index ef1eff9f..0d1b8db1 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.experimental.AffectsChiselPrefix
import chisel3.internal.naming.chiselName // can't use chisel3_ version because of compile order
/** Used to generate an inline (logic directly in the containing Module, no internal Module is created)
@@ -27,8 +28,7 @@ import chisel3.internal.naming.chiselName // can't use chisel3_ version because
* }
* }}}
*/
-@chiselName
-class Counter private (r: Range, oldN: Option[Int] = None) {
+class Counter private (r: Range, oldN: Option[Int] = None) extends AffectsChiselPrefix {
require(r.length > 0, s"Counter range cannot be empty, got: $r")
require(r.start >= 0 && r.end >= 0, s"Counter range must be positive, got: $r")