llvm / llvm/circt

[FIRRTL][LowerAnnotations] Should be more strict when parsing member targets

Open
#5,894 0 comments 0 reactions 0 assignees View on GitHub
FIRRTL
Dominant language
C++
Stars
2.2k
Forks
524
Avg merge
3d 2h
Merged PRs (30d)
46

Description

In the following example, the target string ends in `>`, which normally indicate that the annotation is targeting a member or port a module, but there is no following identifier. We accept this target string and attach the annotation to the module itself. Instead, we should require that there be a valid identifier after the `>`.
`./bin/firtool --parse-only`
```firrtl
circuit Test: %[[{
"class": "sifive.enterprise.firrtl.MarkDUTAnnotation",
"target":"~Test|Test>"
}]]
module Test:
output o : UInt<8>
```
```mlir
module {
firrtl.circuit "Test" {
firrtl.module @Test(out %o: !firrtl.uint<8>) attributes {annotations = [{class = "sifive.enterprise.firrtl.MarkDUTAnnotation"}], convention = #firrtl} {
}
}
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with ./bin/firtool --parse-only and the FIRRTL LowerAnnotations parsing path; the issue provides no source file or test name. Use the supplied ~Test|Test> target as the regression case, and consider the work done when it is no longer accepted without a following identifier.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.