llvm / llvm/circt

[FIRRTL] FIRRTL Exporter needs to unique names

Open
#5,721 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug good first issue
Dominant language
C++
Stars
2.2k
Forks
524
Avg merge
3d 2h
Merged PRs (30d)
46

Description

Currently, the FIRRTL exporter will not properly unique names during emission (like what ExportVerilog does). Consider the following:

firrtl.circuit "Foo" {
  firrtl.module @Foo() {
    %0 = firrtl.wire {name = "a"} : !firrtl.uint<1>
    %1 = firrtl.wire {name = "a"} : !firrtl.uint<1>
  }
}

This produces the following illegal FIRRTL (circt-translate -export-firrtl Foo.mlir):

FIRRTL version 3.1.0
circuit Foo :
  module Foo : 
    wire a : UInt<1> 
    wire a : UInt<1> 

wire a is defined twice.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the FIRRTL exporter entry point used by circt-translate -export-firrtl and compare its naming behavior with ExportVerilog. Reproduce the issue with the provided MLIR example and verify that the emitted FIRRTL no longer defines wire a twice.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.