[codegen] Emit literal identifiers for numeric ids (#3374)
Change the FIRRTL serializer to use literal identifiers if any identifiers
begin with a leading digit. This is a FIRRTL 3.0.0 feature that
simplifies parsing.
This enables literal identifier emission anywhere. However, this code
path is only reachable via MixedVec due to mangling of numeric names to
add a leading underscore in all other circumstances. In the future, this
commit will enable removing this restriction and switching to literal
identifiers when this happens.
No changes are made to annotation targets. E.g., the literal identifier,
"wire `42`" in circuit "Foo" and module "Bar" is still referred to by a
local target "~Foo|Bar>42". This is intentional (for now). Targets don't
have parsing ambiguity like FIRRTL text and the name of this wire is still
"42" not "`42`". It follows that the storage of this name in FIRRTL IR is
not changed. This is the same way that this is handled in CIRCT.
Signed-off-by:
Schuyler Eldridge <schuyler.eldridge@sifive.com>
parent
40005511