Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Public is Incorrectly Applied to Definitions #3834

Closed
seldridge opened this issue Feb 17, 2024 · 0 comments · Fixed by #3835
Closed

Public is Incorrectly Applied to Definitions #3834

seldridge opened this issue Feb 17, 2024 · 0 comments · Fixed by #3835

Comments

@seldridge
Copy link
Member

seldridge commented Feb 17, 2024

A definition inside a public module (or the top module?) incorrectly gets marked as public. Consider the following:

//> using scala "2.13.12"
//> using repository sonatype-s01:snapshots
//> using lib "org.chipsalliance::chisel::6.0.0+74-0a437d8f-SNAPSHOT"
//> using plugin "org.chipsalliance:::chisel-plugin::6.0.0+74-0a437d8f-SNAPSHOT"
//> using options "-unchecked", "-deprecation", "-language:reflectiveCalls", "-feature", "-Xcheckinit", "-Xfatal-warnings", "-Ywarn-dead-code", "-Ywarn-unused", "-Ymacro-annotations"

import chisel3._
import chisel3.experimental.hierarchy.{
  Definition,
  Instance,
  instantiable
}
import circt.stage.ChiselStage

@instantiable
class Bar extends RawModule

class Foo extends Module {
  private val barDef = Definition(new Bar)
  private val bar = Instance(barDef)
}

object Main extends App {
  println(ChiselStage.emitCHIRRTL(new Foo))
}

This produces the following FIRRTL with scala-cli Foo.scala:

FIRRTL version 4.0.0
circuit Foo :
  public module Bar :

    skip

  public module Foo :
    input clock : Clock
    input reset : UInt<1>

    inst bar of Bar

Module Bar should not be public.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant