Skip to content

Subfield domain association to wires should be rejected #5507

Closed

Description

@uenoku

Type of issue: Bug Report

Please provide the steps to reproduce the problem:

//> using scala 2.13.18
//> using dep org.chipsalliance::chisel:7.15.0+11-6a43b9a1-SNAPSHOT
//> using plugin org.chipsalliance:::chisel-plugin:7.15.0+11-6a43b9a1-SNAPSHOT
//> using repository https://central.sonatype.com/repository/maven-snapshots

import chisel3._
import chisel3.domains.ClockDomain
import circt.stage.ChiselStage

object ReproChiselWireFieldDomain {
  class ClockReset extends Bundle {
    val clock = Clock()
    val reset = Reset()
  }

  class Repro extends RawModule {
    val A      = IO(Input(ClockDomain.Type()))
    val source = IO(Input(new ClockReset))
    val wire = Wire(new ClockReset)
    wire := source
    // Error when port subfield was associated. 
    //  associate(source.clock, A) 
    associate(wire.clock, A)
    associate(wire.reset, A)
  }

  def main(args: Array[String]): Unit = {
    val chirrtl = ChiselStage.emitCHIRRTL(new Repro)
    println(chirrtl)
  }
}
$ scala-cli foo.scala
... 
wire wire : { clock : Clock, reset : Reset} 
...

What is the current behavior?
FIRRTL is emitted successfully.

    associate(wire.clock, A)
    associate(wire.reset, A)

is silently dropped. For ports it's rejected properly.

What is the expected behavior?
It should be chisel elaboration error since subfield domain association is not supported.

Please tell us about your environment:

Other Information

What is the use case for changing the behavior?

Activity

  1. anirudh12032008 commented on Nov 12, 2026

    @anirudh12032008
    Contributor

    isOurWire in Module.scala checks topBindingOpt, so a wire subfield counts as the wire itself and gets stored, then dropped on emission (port subfields already fail via portsContains). Using the direct binding gives the existing error. I'll take this, with tests.

  2. added a commit that references this issue on Nov 15, 2026
    2a75ff9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions