chipsalliance / chipsalliance/chisel

Escape FIRRTL Keywords in Emission

Open
#5,218 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Scala
Stars
4.8k
Forks
658
Avg merge
18h 59m
Merged PRs (30d)
14

Description

Change the emission of FIRRTL to escape all FIRRTL keywords by making them literal identifiers. E.g., if a port is called `UInt`, this should be emitted as `` `UInt` ``.

The following example should compile:

``` scala
//> using repository https://central.sonatype.com/repository/maven-snapshots
//> using scala 2.13.18
//> using dep org.chipsalliance::chisel:7.9.0
//> using plugin org.chipsalliance:::chisel-plugin:7.9.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 Foo extends RawModule {
val UInt = IO(chisel3.UInt(2.W))
UInt :<= 3.U
}

object Main extends App {
println(ChiselStage.emitCHIRRTL(new Foo))
println(
ChiselStage.emitSystemVerilog(
gen = new Foo,
args = Array("--throw-on-first-error", "--full-stacktrace", "--strip-debug-info")
)
)
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.