diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/main/scala/chisel3/compatibility.scala | 47 | ||||
| -rw-r--r-- | src/main/scala/chisel3/package.scala | 32 |
2 files changed, 39 insertions, 40 deletions
diff --git a/src/main/scala/chisel3/compatibility.scala b/src/main/scala/chisel3/compatibility.scala index 625628dd..fbe37f50 100644 --- a/src/main/scala/chisel3/compatibility.scala +++ b/src/main/scala/chisel3/compatibility.scala @@ -45,29 +45,28 @@ package object Chisel { // scalastyle:ignore package.object.name */ trait UIntFactory extends chisel3.core.UIntFactory { /** Create a UInt literal with inferred width. */ - def apply(n: String): UInt = Lit(chisel3.core.fromStringToLiteral.parse(n), - chisel3.core.fromStringToLiteral.parsedWidth(n)) + def apply(n: String): UInt = n.asUInt /** Create a UInt literal with fixed width. */ - def apply(n: String, width: Int): UInt = Lit(chisel3.core.fromStringToLiteral.parse(n), - Width(width)) + def apply(n: String, width: Int): UInt = n.asUInt(width.W) /** Create a UInt literal with specified width. */ - def apply(value: BigInt, width: Width): UInt = Lit(value, width) + def apply(value: BigInt, width: Width): UInt = value.asUInt(width) /** Create a UInt literal with fixed width. */ - def apply(value: BigInt, width: Int): UInt = Lit(value, Width(width)) + def apply(value: BigInt, width: Int): UInt = value.asUInt(width.W) /** Create a UInt with a specified width - compatibility with Chisel2. */ // NOTE: This resolves UInt(width = 32) - def apply(dir: Option[Direction] = None, width: Int): UInt = apply(Width(width)) + def apply(dir: Option[Direction] = None, width: Int): UInt = apply(width.W) /** Create a UInt literal with inferred width.- compatibility with Chisel2. */ - def apply(value: BigInt): UInt = apply(value, Width()) + def apply(value: BigInt): UInt = value.asUInt + /** Create a UInt with a specified direction and width - compatibility with Chisel2. */ - def apply(dir: Direction, width: Int): UInt = apply(dir, Width(width)) + def apply(dir: Direction, width: Int): UInt = apply(dir, width.W) /** Create a UInt with a specified direction, but unspecified width - compatibility with Chisel2. */ def apply(dir: Direction): UInt = apply(dir, Width()) - def apply(dir: Direction, wWidth: Width): UInt = { - val result = apply(wWidth) + def apply(dir: Direction, width: Width): UInt = { + val result = apply(width) dir match { case chisel3.core.Direction.Input => chisel3.core.Input(result) case chisel3.core.Direction.Output => chisel3.core.Output(result) @@ -76,7 +75,7 @@ package object Chisel { // scalastyle:ignore package.object.name } /** Create a UInt with a specified width */ - def width(width: Int): UInt = apply(Width(width)) + def width(width: Int): UInt = apply(width.W) /** Create a UInt port with specified width. */ def width(width: Width): UInt = apply(width) @@ -86,29 +85,29 @@ package object Chisel { // scalastyle:ignore package.object.name */ trait SIntFactory extends chisel3.core.SIntFactory { /** Create a SInt type or port with fixed width. */ - def width(width: Int): SInt = apply(Width(width)) + def width(width: Int): SInt = apply(width.W) /** Create an SInt type with specified width. */ def width(width: Width): SInt = apply(width) /** Create an SInt literal with inferred width. */ - def apply(value: BigInt): SInt = Lit(value) + def apply(value: BigInt): SInt = value.S /** Create an SInt literal with fixed width. */ - def apply(value: BigInt, width: Int): SInt = Lit(value, width) + def apply(value: BigInt, width: Int): SInt = value.S(width.W) /** Create an SInt literal with specified width. */ - def apply(value: BigInt, width: Width): SInt = Lit(value, width) + def apply(value: BigInt, width: Width): SInt = value.S(width) - def Lit(value: BigInt): SInt = Lit(value, Width()) - def Lit(value: BigInt, width: Int): SInt = Lit(value, Width(width)) + def Lit(value: BigInt): SInt = value.S + def Lit(value: BigInt, width: Int): SInt = value.S(width.W) /** Create a SInt with a specified width - compatibility with Chisel2. */ - def apply(dir: Option[Direction] = None, width: Int): SInt = apply(Width(width)) + def apply(dir: Option[Direction] = None, width: Int): SInt = apply(width.W) /** Create a SInt with a specified direction and width - compatibility with Chisel2. */ - def apply(dir: Direction, width: Int): SInt = apply(dir, Width(width)) + def apply(dir: Direction, width: Int): SInt = apply(dir, width.W) /** Create a SInt with a specified direction, but unspecified width - compatibility with Chisel2. */ def apply(dir: Direction): SInt = apply(dir, Width()) - def apply(dir: Direction, wWidth: Width): SInt = { - val result = apply(wWidth) + def apply(dir: Direction, width: Width): SInt = { + val result = apply(width) dir match { case chisel3.core.Direction.Input => chisel3.core.Input(result) case chisel3.core.Direction.Output => chisel3.core.Output(result) @@ -122,7 +121,7 @@ package object Chisel { // scalastyle:ignore package.object.name trait BoolFactory extends chisel3.core.BoolFactory { /** Creates Bool literal. */ - def apply(x: Boolean): Bool = Lit(x) + def apply(x: Boolean): Bool = x.B /** Create a UInt with a specified direction and width - compatibility with Chisel2. */ def apply(dir: Direction): Bool = { @@ -175,6 +174,7 @@ package object Chisel { // scalastyle:ignore package.object.name val Driver = chisel3.Driver val ImplicitConversions = chisel3.util.ImplicitConversions + // Deprecated as of Chisel3 object chiselMain { import java.io.File @@ -194,6 +194,7 @@ package object Chisel { // scalastyle:ignore package.object.name def apply (arg: Data): Data = arg } + // Deprecated as of Chsiel3 @throws(classOf[Exception]) object throwException { def apply(s: String, t: Throwable = null) = { diff --git a/src/main/scala/chisel3/package.scala b/src/main/scala/chisel3/package.scala index 5b02be34..326f8d7c 100644 --- a/src/main/scala/chisel3/package.scala +++ b/src/main/scala/chisel3/package.scala @@ -33,7 +33,7 @@ package object chisel3 { // scalastyle:ignore package.object.name type Bits = chisel3.core.Bits /** This contains literal constructor factory methods that are deprecated as of Chisel3. - * These will be removed very soon. It's recommended you move your code soon. + * These will be removed very soon. It's recommended you port your code ASAP. * * Some recommended regex replacements: * (note: these are not guaranteed to handle all edge cases! check all replacements!) @@ -48,32 +48,30 @@ package object chisel3 { // scalastyle:ignore package.object.name trait UIntFactory extends chisel3.core.UIntFactory { /** Create a UInt literal with inferred width. */ @deprecated("use n.U", "chisel3, will be removed by end of 2016") - def apply(n: String): UInt = Lit(chisel3.core.fromStringToLiteral.parse(n), - chisel3.core.fromStringToLiteral.parsedWidth(n)) + def apply(n: String): UInt = n.asUInt /** Create a UInt literal with fixed width. */ @deprecated("use n.U(width.W)", "chisel3, will be removed by end of 2016") - def apply(n: String, width: Int): UInt = Lit(chisel3.core.fromStringToLiteral.parse(n), - Width(width)) + def apply(n: String, width: Int): UInt = n.asUInt(width.W) /** Create a UInt literal with specified width. */ @deprecated("use value.U(width)", "chisel3, will be removed by end of 2016") - def apply(value: BigInt, width: Width): UInt = Lit(value, width) + def apply(value: BigInt, width: Width): UInt = value.asUInt(width) /** Create a UInt literal with fixed width. */ @deprecated("use value.U(width.W)", "chisel3, will be removed by end of 2016") - def apply(value: BigInt, width: Int): UInt = Lit(value, Width(width)) + def apply(value: BigInt, width: Int): UInt = value.asUInt(width.W) /** Create a UInt with a specified width - compatibility with Chisel2. */ @deprecated("use UInt(width.W)", "chisel3, will be removed by end of 2016") - def apply(dir: Option[Direction] = None, width: Int): UInt = apply(Width(width)) + def apply(dir: Option[Direction] = None, width: Int): UInt = apply(width.W) /** Create a UInt literal with inferred width.- compatibility with Chisel2. */ @deprecated("use value.U", "chisel3, will be removed by end of 2016") - def apply(value: BigInt): UInt = apply(value, Width()) + def apply(value: BigInt): UInt = value.asUInt /** Create a UInt with a specified width */ @deprecated("use UInt(width.W)", "chisel3, will be removed by end of 2016") - def width(width: Int): UInt = apply(Width(width)) + def width(width: Int): UInt = apply(width.W) /** Create a UInt port with specified width. */ @deprecated("use UInt(width)", "chisel3, will be removed by end of 2016") @@ -86,27 +84,27 @@ package object chisel3 { // scalastyle:ignore package.object.name trait SIntFactory extends chisel3.core.SIntFactory { /** Create a SInt type or port with fixed width. */ @deprecated("use SInt(width.W)", "chisel3, will be removed by end of 2016") - def width(width: Int): SInt = apply(Width(width)) + def width(width: Int): SInt = apply(width.W) /** Create an SInt type with specified width. */ @deprecated("use SInt(width)", "chisel3, will be removed by end of 2016") def width(width: Width): SInt = apply(width) /** Create an SInt literal with inferred width. */ @deprecated("use value.S", "chisel3, will be removed by end of 2016") - def apply(value: BigInt): SInt = Lit(value) + def apply(value: BigInt): SInt = value.asSInt /** Create an SInt literal with fixed width. */ @deprecated("use value.S(width.W)", "chisel3, will be removed by end of 2016") - def apply(value: BigInt, width: Int): SInt = Lit(value, width) + def apply(value: BigInt, width: Int): SInt = value.asSInt(width.W) /** Create an SInt literal with specified width. */ @deprecated("use value.S(width)", "chisel3, will be removed by end of 2016") - def apply(value: BigInt, width: Width): SInt = Lit(value, width) + def apply(value: BigInt, width: Width): SInt = value.asSInt(width) @deprecated("use value.S", "chisel3, will be removed by end of 2016") - def Lit(value: BigInt): SInt = Lit(value, Width()) + def Lit(value: BigInt): SInt = value.asSInt @deprecated("use value.S(width)", "chisel3, will be removed by end of 2016") - def Lit(value: BigInt, width: Int): SInt = Lit(value, Width(width)) + def Lit(value: BigInt, width: Int): SInt = value.asSInt(width.W) } /** This contains literal constructor factory methods that are deprecated as of Chisel3. @@ -116,7 +114,7 @@ package object chisel3 { // scalastyle:ignore package.object.name /** Creates Bool literal. */ @deprecated("use x.B", "chisel3, will be removed by end of 2016") - def apply(x: Boolean): Bool = Lit(x) + def apply(x: Boolean): Bool = x.B } object Bits extends UIntFactory |
