From 110705eeace4f9165dc6377e55c86a599f37a465 Mon Sep 17 00:00:00 2001 From: Jared Barocsi Date: Tue, 5 Oct 2021 12:33:23 -0700 Subject: Deprecate auto-application of empty argument lists to parameterless functions (#2124) * Migrate nullary funcs to parameterless versions * Make deprecation message and dummy arguments clear and consistent Co-authored-by: Megan Wachs --- core/src/main/scala/chisel3/package.scala | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'core/src/main/scala/chisel3/package.scala') diff --git a/core/src/main/scala/chisel3/package.scala b/core/src/main/scala/chisel3/package.scala index 64cfa8b9..68e482dd 100644 --- a/core/src/main/scala/chisel3/package.scala +++ b/core/src/main/scala/chisel3/package.scala @@ -50,10 +50,18 @@ package object chisel3 { /** Int to UInt conversion, recommended style for variables. */ - def asUInt(): UInt = UInt.Lit(bigint, Width()) + def asUInt: UInt = UInt.Lit(bigint, Width()) + + @deprecated("Calling this function with an empty argument list is invalid in Scala 3. Use the form without parentheses instead", "Chisel 3.5") + def asUInt(dummy: Int*): UInt = asUInt + /** Int to SInt conversion, recommended style for variables. */ - def asSInt(): SInt = SInt.Lit(bigint, Width()) + def asSInt: SInt = SInt.Lit(bigint, Width()) + + @deprecated("Calling this function with an empty argument list is invalid in Scala 3. Use the form without parentheses instead", "Chisel 3.5") + def asSInt(dummy: Int*): SInt = asSInt + /** Int to UInt conversion with specified width, recommended style for variables. */ def asUInt(width: Width): UInt = UInt.Lit(bigint, width) @@ -68,17 +76,21 @@ package object chisel3 { implicit class fromStringToLiteral(str: String) { /** String to UInt parse, recommended style for constants. */ - def U: UInt = str.asUInt() + def U: UInt = str.asUInt /** String to UInt parse with specified width, recommended style for constants. */ def U(width: Width): UInt = str.asUInt(width) /** String to UInt parse, recommended style for variables. */ - def asUInt(): UInt = { + def asUInt: UInt = { val bigInt = parse(str) UInt.Lit(bigInt, Width(bigInt.bitLength max 1)) } + + @deprecated("Calling this function with an empty argument list is invalid in Scala 3. Use the form without parentheses instead", "Chisel 3.5") + def asUInt(dummy: Int*): UInt = asUInt + /** String to UInt parse with specified width, recommended style for variables. */ def asUInt(width: Width): UInt = UInt.Lit(parse(str), width) @@ -107,7 +119,10 @@ package object chisel3 { /** Boolean to Bool conversion, recommended style for variables. */ - def asBool(): Bool = Bool.Lit(boolean) + def asBool: Bool = Bool.Lit(boolean) + + @deprecated("Calling this function with an empty argument list is invalid in Scala 3. Use the form without parentheses instead", "Chisel 3.5") + def asBool(dummy: Int*): Bool = asBool } // Fixed Point is experimental for now, but we alias the implicit conversion classes here -- cgit v1.2.3 From 7e8ec50376f852d5ab35d7609d986c7e4128abb1 Mon Sep 17 00:00:00 2001 From: Jiuyang Liu Date: Wed, 15 Dec 2021 08:40:14 +0800 Subject: deprecate getModulePorts (#2284) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>--- core/src/main/scala/chisel3/package.scala | 1 + 1 file changed, 1 insertion(+) (limited to 'core/src/main/scala/chisel3/package.scala') diff --git a/core/src/main/scala/chisel3/package.scala b/core/src/main/scala/chisel3/package.scala index 68e482dd..faca3ae4 100644 --- a/core/src/main/scala/chisel3/package.scala +++ b/core/src/main/scala/chisel3/package.scala @@ -221,6 +221,7 @@ package object chisel3 { def getDataElements(a: Aggregate): Seq[Element] = { a.allElements } + @deprecated("duplicated with DataMirror.fullModulePorts, this returns an internal API, will be removed in Chisel 3.6", "Chisel 3.5") def getModulePorts(m: Module): Seq[Port] = m.getPorts class BindingException(message: String) extends ChiselException(message) -- cgit v1.2.3