diff options
| author | Jim Lawson | 2016-08-16 11:08:32 -0700 |
|---|---|---|
| committer | Jim Lawson | 2016-08-16 11:08:32 -0700 |
| commit | a264157a47f56216cebf2d98c1c8118c344dad5f (patch) | |
| tree | 1724fe2900ce336822e73f9cae8280b8474f62ab /src | |
| parent | 4ab2aa0e9209000fb0ba1299ac18db2e033f708f (diff) | |
| parent | ddb7278760029be9d960ba8bf2b06ac8a8aac767 (diff) | |
Merge branch 'master' into sdtwigg_connectwrap_renamechisel3
Diffstat (limited to 'src')
| -rw-r--r-- | src/main/scala/chisel3/util/BitPat.scala | 2 | ||||
| -rw-r--r-- | src/main/scala/chisel3/util/Bitwise.scala | 2 | ||||
| -rw-r--r-- | src/test/scala/chiselTests/Reg.scala | 11 |
3 files changed, 9 insertions, 6 deletions
diff --git a/src/main/scala/chisel3/util/BitPat.scala b/src/main/scala/chisel3/util/BitPat.scala index 5b37bd1b..e79b882b 100644 --- a/src/main/scala/chisel3/util/BitPat.scala +++ b/src/main/scala/chisel3/util/BitPat.scala @@ -68,7 +68,7 @@ object BitPat { */ def apply(x: UInt): BitPat = { require(x.isLit) - val len = if (x.widthKnown) x.getWidth else 0 + val len = if (x.isWidthKnown) x.getWidth else 0 apply("b" + x.litValue.toString(2).reverse.padTo(len, "0").reverse.mkString) } } diff --git a/src/main/scala/chisel3/util/Bitwise.scala b/src/main/scala/chisel3/util/Bitwise.scala index 2743e59f..1d48ec0a 100644 --- a/src/main/scala/chisel3/util/Bitwise.scala +++ b/src/main/scala/chisel3/util/Bitwise.scala @@ -29,7 +29,7 @@ object Fill { n match { case 0 => UInt.width(0) case 1 => x - case _ if x.widthKnown && x.getWidth == 1 => + case _ if x.isWidthKnown && x.getWidth == 1 => Mux(x.toBool, UInt((BigInt(1) << n) - 1, n), UInt(0, n)) case _ if n > 1 => val p2 = Array.ofDim[UInt](log2Up(n + 1)) diff --git a/src/test/scala/chiselTests/Reg.scala b/src/test/scala/chiselTests/Reg.scala index b66d7cb4..a9086223 100644 --- a/src/test/scala/chiselTests/Reg.scala +++ b/src/test/scala/chiselTests/Reg.scala @@ -16,7 +16,7 @@ class RegSpec extends ChiselFlatSpec { "A Reg" should "be of the same type and width as outType, if specified" in { class RegOutTypeWidthTester extends BasicTester { - val reg = Reg(t=UInt.width(2), next=Wire(UInt.width(3)), init=UInt(20)) + val reg = Reg(t=UInt(width=2), next=Wire(UInt(width=3)), init=UInt(20)) reg.getWidth should be (2) } elaborate{ new RegOutTypeWidthTester } @@ -24,11 +24,14 @@ class RegSpec extends ChiselFlatSpec { "A Reg" should "be of unknown width if outType is not specified and width is not forced" in { class RegUnknownWidthTester extends BasicTester { - val reg1 = Reg(next=Wire(UInt.width(3)), init=20.U) + val reg1 = Reg(next=Wire(UInt(width=3)), init=UInt(20)) + reg1.isWidthKnown should be (false) DataMirror.widthOf(reg1).known should be (false) - val reg2 = Reg(init=20.U) + val reg2 = Reg(init=UInt(20)) + reg2.isWidthKnown should be (false) DataMirror.widthOf(reg2).known should be (false) - val reg3 = Reg(next=Wire(UInt.width(3)), init=5.U) + val reg3 = Reg(next=Wire(UInt(width=3)), init=UInt(5)) + reg3.isWidthKnown should be (false) DataMirror.widthOf(reg3).known should be (false) } elaborate { new RegUnknownWidthTester } |
