Skip to content

Source Locators Missing from External Module Ports #5115

@seldridge

Description

@seldridge

Source locator information isn't showing up in the emitted FIRRTL text for the ports of external modules. Consider the following:

//> using repository https://central.sonatype.com/repository/maven-snapshots
//> using scala 2.13.18
//> using dep org.chipsalliance::chisel:7.5.0
//> using plugin org.chipsalliance:::chisel-plugin:7.5.0
//> using options -unchecked -deprecation -language:reflectiveCalls -feature -Xcheckinit
//> using options -Xfatal-warnings -Ywarn-dead-code -Ywarn-unused -Ymacro-annotations

import chisel3._
import circt.stage.ChiselStage

class Baz extends BlackBox {
  val io = IO {
    new Bundle {
      val a = Output(Bool())
    }
  }
}

class Bar extends ExtModule {
  val a = IO(Output(Bool()))
}

class Foo extends Module {
  val a = IO(Output(Bool()))

  private val bar = Module(new Bar)
  private val baz = Module(new Baz)
  a :<= bar.a ^ baz.io.a
}

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

This produces the following FIRRTL:

FIRRTL version 6.0.0
circuit Foo :
  layer Verification, bind, "verification" :
    layer Assert, bind, "verification/assert" :
      layer Temporal, inline :
    layer Assume, bind, "verification/assume" :
      layer Temporal, inline :
    layer Cover, bind, "verification/cover" :
      layer Temporal, inline :

  extmodule Bar : @[/Users/$user/repos/github.com/seldridge/scala-snippets/NoInfoExtModule.scala 19:7]
    output a : UInt<1>
    defname = Bar

  extmodule Baz : @[/Users/$user/repos/github.com/seldridge/scala-snippets/NoInfoExtModule.scala 11:7]
    output a : UInt<1>
    defname = Baz

  public module Foo : @[/Users/$user/repos/github.com/seldridge/scala-snippets/NoInfoExtModule.scala 23:7]
    input clock : Clock @[/Users/$user/repos/github.com/seldridge/scala-snippets/NoInfoExtModule.scala 23:7]
    input reset : UInt<1> @[/Users/$user/repos/github.com/seldridge/scala-snippets/NoInfoExtModule.scala 23:7]
    output a : UInt<1> @[/Users/$user/repos/github.com/seldridge/scala-snippets/NoInfoExtModule.scala 24:13]

    inst bar of Bar @[/Users/$user/repos/github.com/seldridge/scala-snippets/NoInfoExtModule.scala 26:27]
    inst baz of Baz @[/Users/$user/repos/github.com/seldridge/scala-snippets/NoInfoExtModule.scala 27:27]
    node _a_T = xor(bar.a, baz.a) @[/Users/$user/repos/github.com/seldridge/scala-snippets/NoInfoExtModule.scala 28:15]
    connect a, _a_T @[/Users/$user/repos/github.com/seldridge/scala-snippets/NoInfoExtModule.scala 28:5]

I'd expect to see the source info on the ports of the blackbox and extmodule. Not shown, but having this on the blackbox parameters would be good, too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions