chipsalliance / chipsalliance/chisel
How to parse firrtl file/string to Circuit instance?
- Dominant language
- Scala
- Stars
- 4.8k
- Forks
- 658
- Avg merge
- 18h 59m
- Merged PRs (30d)
- 14
Description
I can convert a Circuit instance into string FIRRTL code using Serializer.serialize(circuit). So, how can I do the reverse: parse FIRRTL code (or a file) back into a Circuit instance?
I asked AI, and it suggested `val circuit = Parser.parseFile(inputFile)`. However, the Parser object actually no longer has this parseFile method. Instead, the file as follows:
``` scala
package firrtl
object Parser {
sealed abstract class InfoMode
case object IgnoreInfo extends InfoMode
case object UseInfo extends InfoMode
case class GenInfo(filename: String) extends InfoMode
case class AppendInfo(filename: String) extends InfoMode
}
```
Contributor guide
Research direction
Read the current Parser API alongside Serializer.serialize(circuit), and verify which entry point accepts FIRRTL code or a file instead of relying on the obsolete Parser.parseFile example. Done means documenting the supported conversion path using the current API.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- compilers
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100