You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Check out fresh Chipyard, run ./scripts/init-submodules-no-riscv-tools.sh
Current Behavior
It looks like the recent update to Scala 2.13 (#1303) broke the Chisel Hierarchy API. It looks like we'll need an extra scalac option to fix the issue.
To reproduce, take this code snippet from the Chisel Hierarchy Cookbook, and place it at the end of generators/chipyard/src/main/scala/example/GCD.scala:
importchisel3.experimental.hierarchy.{Definition, Instance, instantiable, public}
@instantiable
classAddOne(width: Int) extendsModule {
@public valin=IO(Input(UInt(width.W)))
@public valout=IO(Output(UInt(width.W)))
out := in +1.U
}
classAddTwo(width: Int) extendsModule {
valin=IO(Input(UInt(width.W)))
valout=IO(Output(UInt(width.W)))
valaddOneDef=Definition(newAddOne(width))
vali0=Instance(addOneDef)
vali1=Instance(addOneDef)
i0.in := in
i1.in := i0.out
out := i1.out
}
Try to compile, and you should see these errors:
[info] compiling 1 Scala source to /path/to/chipyard/generators/chipyard/target/scala-2.13/classes ...
[error] /path/to/chipyard/generators/chipyard/src/main/scala/example/GCD.scala:224:6: value in is not a member of chisel3.experimental.hierarchy.Instance[chipyard.example.AddOne]
[error] did you mean isA?
[error] i0.in := in
[error] ^
[error] /path/to/chipyard/generators/chipyard/src/main/scala/example/GCD.scala:225:6: value in is not a member of chisel3.experimental.hierarchy.Instance[chipyard.example.AddOne]
[error] did you mean isA?
[error] i1.in := i0.out
[error] ^
[error] /path/to/chipyard/generators/chipyard/src/main/scala/example/GCD.scala:225:15: value out is not a member of chisel3.experimental.hierarchy.Instance[chipyard.example.AddOne]
[error] i1.in := i0.out
[error] ^
[error] /path/to/chipyard/generators/chipyard/src/main/scala/example/GCD.scala:226:15: value out is not a member of chisel3.experimental.hierarchy.Instance[chipyard.example.AddOne]
[error] out := i1.out
[error] ^
[error] four errors found
[error] (Compile / compileIncremental) Compilation failed
Expected Behavior
I would expect the above code to compile without error. In fact, if you add "-Ymacro-annotations" to scalacOptions in build.sbt, the build works. I'm not sure if there are other Scala compiler options that we're missing, but that one certainly seems necessary.
Other Information
No response
The text was updated successfully, but these errors were encountered:
Background Work
Chipyard Version and Hash
Release: main
Hash: c8764d6
OS Setup
macOS 13.2.1
Other Setup
Check out fresh Chipyard, run
./scripts/init-submodules-no-riscv-tools.sh
Current Behavior
It looks like the recent update to Scala 2.13 (#1303) broke the Chisel Hierarchy API. It looks like we'll need an extra
scalac
option to fix the issue.To reproduce, take this code snippet from the Chisel Hierarchy Cookbook, and place it at the end of
generators/chipyard/src/main/scala/example/GCD.scala
:Try to compile, and you should see these errors:
Expected Behavior
I would expect the above code to compile without error. In fact, if you add
"-Ymacro-annotations"
toscalacOptions
inbuild.sbt
, the build works. I'm not sure if there are other Scala compiler options that we're missing, but that one certainly seems necessary.Other Information
No response
The text was updated successfully, but these errors were encountered: