`addAttribute` cannot be used on RawModule

Aperta Adatta ai principianti
#5,570 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
65/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
scala
Ambito
backend

Direzione di ricerca

Inizia leggendo la definizione di addAttribute e le sue chiamate a annotate e target.toNamed. Verifica come RawModule è rappresentato come destinazione dell’annotazione e se i test vicini coprono addAttribute. Il lavoro è terminato quando i tipi di destinazione accettati documentati corrispondono a quelli supportati dall’API e il comportamento è coperto da un test pertinente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Type of issue: Bug Report

object addAttribute {

  /** Add attribute annotation to a chisel target.
    *
    *  == Example ==
    *  {{{
    *  import chisel3._
    *  import chisel3.util.addAttribute
    *  class AttributeExample extends Module {
    *    val io = IO(new Bundle {
    *      val input = Input(UInt(8.W))
    *      val output = Output(UInt(8.W))
    *    })
    *
    *    val reg = RegNext(io.input)
    *
    *    addAttribute(reg, "synthesis translate_off")
    *
    *    io.output := reg
    *  }
    *
    *  }}}
    *
    * @param target Chisel target. Must be Reg, Wire, or RawModule type.
    * @param annoString attribute string to add to target.
    */
  def apply(target: Data, annoString: String): Unit = {
    annotate(target)(Seq(AttributeAnnotation(target.toNamed, annoString)))
  }
}

What is the current behavior?

According to the comment, the target param of addAttribute can be a Reg, Wire, or RawModule. But target is declared as a Data, so RawModule cannot be passed to target.

What is the expected behavior?

The target param should accept RawModule and Data, or we should update the comment.

Please tell us about your environment:

  • version: 7.17-SNAPSHOT
  • OS: Linux 7.3.6-arch1-2.1 #1 SMP PREEMPT_DYNAMIC Mon, 30 Nov 2026 16:56:41 +0000 x86_64 GNU/Linux
Lingua principale
Scala
Stelle
4.8k
Fork
669
Merge medio
1g 12h
PR unite (30g)
25

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di chipsalliance/chisel

Tutte le issue di chipsalliance/chisel

Issue simili

Altre issue su Scala

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.