[circt-verilog] Align command-line options with Slang v9
Slang has seen a few changes to its options. We should make sure that our ImportVerilogOptions (in include/circt/Conversion/ImportVerilog.h) line up with the Driver::Options ones in Slang (in include/slang/driver/Driver.h). The circt-verilog tool should also expose all new options as its own command line arguments.
Hey could I please get assigned to this?
Absolutely! 🙂
Thanks! Just to clarify, when you say align, do you mean I should add every missing option from Slang’s Driver::Options that isn’t currently in ImportVerilogOptions? For example, in the preprocessing section, ImportVerilogOptions is missing options like enableLegacyProtect, ignoreDirectives, and translateOffOptions. So, should I add those to ensure the options match? Is that what you mean by aligning the options between Slang and CIRCT?
Yes exactly! ImportVerilog has its own ImportVerilogOptions struct such that other parts of CIRCT don't have to include any Slang headers to get access to the options. This allows us to neatly tuck away the optional Slang dependency in a single ImportVerilog target, and all other parts of CIRCT interact with the Verilog frontend through ImportVerilog.
The downside is that we effectively have to maintain a copy of Slang's Driver::Options, with a few tweaks here and there where needed.
It would be awesome if you could add any options that are new in Driver::Options which we are still missing in ImportVerilogOptions. You'll have to update tools/circt-verilog/circt-verilog.cpp too, since that's where we expose the options for the user. Slang's Driver::addStandardArgs() is an excellent reference to get some ideas for how the options could be named. We're trying to stay as close to Slang as possible with the command line options, only deviating where they conflict with other MLIR options.
Okay thanks for the clarification. What about options that are in ImportVerilogOptions but not in Driver::Options? Should I get rid of them? Should it be an identical copy?
Removing those would be fantastic, too! Otherwise we'd be offering up options to the user that we would then not be able to pass along to Slang. Should be an identical copy ideally. (Unless we want to skip a few Slang options for some good reason, but so far all options have made sense to include in ImportVerilogOptions.)
Thanks again. I’m now wondering about some of the options at the top of ImportVerilogOptions that seem specific to MLIR. I’m wondering if it’s safe to remove them.
Yeah good catch. The first few options here are specific to circt-verilog and MLIR. The Slang options should start after the first bigger //===-------- comment separator. The file tries to replicate the grouping of options in Slang 🙂
is this still being worked on? @ayokunle321
Not rushing you at all 😄 , but I might take it if you don't want it anymore.
is this still being worked on? @ayokunle321
Not rushing you at all 😄 , but I might take it if you don't want it anymore.
Yeah you can take it, been unfortunately busy with some other things @Flinner