diff options
| author | ducky | 2016-11-17 13:01:03 -0800 |
|---|---|---|
| committer | ducky | 2016-11-21 13:31:12 -0800 |
| commit | 54d3f8dc054e55dfbd01d1aa034169a3dabe89f2 (patch) | |
| tree | 7f6f9de04de6eb08878ac46be339fefc2a71395f /chiselFrontend/src/main/scala/chisel3/core/package.scala | |
| parent | cd904da0aa0e96ba679906a3ee5dbdc068eace48 (diff) | |
Restyle a lot of test code, mainly with regex
Diffstat (limited to 'chiselFrontend/src/main/scala/chisel3/core/package.scala')
| -rw-r--r-- | chiselFrontend/src/main/scala/chisel3/core/package.scala | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/chiselFrontend/src/main/scala/chisel3/core/package.scala b/chiselFrontend/src/main/scala/chisel3/core/package.scala index ac10a140..cae64df6 100644 --- a/chiselFrontend/src/main/scala/chisel3/core/package.scala +++ b/chiselFrontend/src/main/scala/chisel3/core/package.scala @@ -24,6 +24,12 @@ package chisel3 { /** Int to SInt conversion, recommended style for constants. */ def S: SInt = SInt.Lit(BigInt(x), Width()) // scalastyle:ignore method.name + /** Int to UInt conversion with specified width, recommended style for constants. + */ + def U(width: Width): UInt = UInt.Lit(BigInt(x), width) // scalastyle:ignore method.name + /** Int to SInt conversion with specified width, recommended style for constants. + */ + def S(width: Width): SInt = SInt.Lit(BigInt(x), width) // scalastyle:ignore method.name /** Int to UInt conversion, recommended style for variables. */ @@ -54,6 +60,12 @@ package chisel3 { /** Int to SInt conversion, recommended style for constants. */ def S: SInt = SInt.Lit(x, Width()) // scalastyle:ignore method.name + /** Int to UInt conversion with specified width, recommended style for constants. + */ + def U(width: Width): UInt = UInt.Lit(x, width) // scalastyle:ignore method.name + /** Int to SInt conversion with specified width, recommended style for constants. + */ + def S(width: Width): SInt = SInt.Lit(x, width) // scalastyle:ignore method.name /** Int to UInt conversion, recommended style for variables. */ @@ -77,7 +89,13 @@ package chisel3 { } implicit class fromStringToLiteral(val x: String) { + /** String to UInt parse, recommended style for constants. + */ def U: UInt = UInt.Lit(fromStringToLiteral.parse(x), fromStringToLiteral.parsedWidth(x)) // scalastyle:ignore method.name + + /** String to UInt parse, recommended style for variables. + */ + def asUInt: UInt = UInt.Lit(fromStringToLiteral.parse(x), fromStringToLiteral.parsedWidth(x)) } object fromStringToLiteral { |
