diff options
| author | chick | 2016-11-09 16:23:52 -0800 |
|---|---|---|
| committer | ducky | 2016-11-21 12:48:10 -0800 |
| commit | 22406a589c4a3f8de42a9f5c988201f474c11282 (patch) | |
| tree | 35f8bdcfe288ed5b9fd051172afe342f3686f1e9 /chiselFrontend | |
| parent | d46b9acd557d2fe6ffe27f43ee72cd9b2a22f65d (diff) | |
simple test that range interpolator works with UInt factory method
Diffstat (limited to 'chiselFrontend')
| -rw-r--r-- | chiselFrontend/src/main/scala/chisel3/core/Bits.scala | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/chiselFrontend/src/main/scala/chisel3/core/Bits.scala b/chiselFrontend/src/main/scala/chisel3/core/Bits.scala index 83733089..82b60a4c 100644 --- a/chiselFrontend/src/main/scala/chisel3/core/Bits.scala +++ b/chiselFrontend/src/main/scala/chisel3/core/Bits.scala @@ -563,10 +563,14 @@ private[core] sealed trait UIntFactory { result.binding = LitBinding() result } - /** Create a UInt with the specified range */ + /** Create a UInt with the specified range */ def apply(range: Range): UInt = { width(range.getWidth) } + /** Create a UInt with the specified range */ + def apply(range: (NumericBound[Int], NumericBound[Int])): UInt = { + apply(KnownUIntRange(range._1, range._2)) + } /** Create a UInt with a specified width - compatibility with Chisel2. */ // NOTE: This resolves UInt(width = 32) @@ -736,6 +740,10 @@ object SInt { def apply(range: Range): SInt = { width(range.getWidth) } + /** Create a SInt with the specified range */ + def apply(range: (NumericBound[Int], NumericBound[Int])): SInt = { + apply(KnownSIntRange(range._1, range._2)) + } def Lit(value: BigInt): SInt = Lit(value, Width()) def Lit(value: BigInt, width: Int): SInt = Lit(value, Width(width)) |
