chisel
                                
                                 chisel copied to clipboard
                                
                                    chisel copied to clipboard
                            
                            
                            
                        Hierarchy API does not support @public on `val`s in constructors
Type of issue: feature request
Impact: API addition (no impact on existing code)
Development Phase: request
Other information
This is pretty easy to work around, but it might be nice to have support for this.
https://scastie.scala-lang.org/debs-sifive/zAVcJfvxTnGqhKLbTa7sUw/51
This does not work:
@instantiable
class PassThrough(@public val hello: String) extends Module {
  ...
Workaround:
@instantiable
class PassThrough(val hello: String) extends Module {
  @public val hello = hello
  ...
Please tell us about your environment: See Scastie.
What is the use case for changing the behavior? Less typing.
I think the workaround is the documented behavior...
@mwachs5 do you know where that's documented?
See the hierarchy cookbook, search for @public val clock
https://github.com/chipsalliance/chisel3/blob/master/docs/src/cookbooks/hierarchy.md
To mark a superclass's member as @public, use the following pattern (shown with val clock).
import chisel3._
import chisel3.experimental.hierarchy.{instantiable, public}
@instantiable
class MyModule extends Module {
  @public val clock = clock
}
Oh gotcha, yes the workaround is pretty much to do what's normal. I just think it's kind of confusing/verbose to have to make another val and @public the second one.