steveicarus / iverilog

Icarus Verilog
https://steveicarus.github.io/iverilog/
GNU General Public License v2.0
2.79k stars 520 forks source link

[Request] Add `--help` and `--version` args to `iverilog` #1019

Open DeflateAwning opened 10 months ago

DeflateAwning commented 10 months ago

Add --help and --version args to iverilog

These are very common test commands, which would be very helpful to have setup

martinwhitaker commented 10 months ago

We already have -h and -V.

DeflateAwning commented 10 months ago

Should be easy to extend then. The trend seems to be supporting these long-form ones, and even moving away from the shorter versions as those flags are non guaranteed to do other things.

I may work on implementing this!

caryr commented 10 months ago

Having the long-forms would be nice, though we need to make sure this works on all systems. In the past this was handled by adding the appropriate routines from the GNU source so that they can be used if the system does not fully support the long-form. If you want to take this on look at what is implemented for the short-form. Adding the long form would be helpful for a few other tickets.

DeflateAwning commented 10 months ago

Hmm quirky that it may cause issues? Can you point to the part of the code that handles CLI args (still getting familiar with it)? I wonder if we should start using a library to handle CLI args; it's very common in other languages/projects. Any thoughts?

Edit: Found the flag handler part. Will investigate.

martinwhitaker commented 10 months ago

Edit: Found the flag handler part. Will investigate.

That's for the main compiler, ivl, which is not normally executed directly. Theiverilog command is a wrapper that first calls the pre-processor, then the main compiler. Look in the driver subdirectory, specifically driver/main.c.