verilator icon indicating copy to clipboard operation
verilator copied to clipboard

Support option for simpler building of executables

Open gezalore opened this issue 3 years ago • 6 comments

Now that v5 has timing support and hand-written C++ is no longer required, I wonder if it would be helpful for new/simple users to have an option like --run, which verilates, compiles, and runs the simulation. Currently you have to type:

verilator --cc --timing --main --exe --build foo.v
./obj_dir/Vfoo

Instead could just be

verilator --run foo.v

I don't have strong feelings about it and I am unlikely to use this myself, but might help lower the entry barrier?

gezalore avatar Sep 14 '22 15:09 gezalore

I don't want to support --run, because I think it combines two things that should be separated in the user's mind to avoid rebuild penalties. Also more trivially bin/verilator needs to handle runtime flags and that's a whole collision to avoid.

Maybe we should change --main to imply --cc, as it is an output mode of sorts.

Perhaps a new option to combine "--timing --main --exe --build"? It's too bad --exe already is taken, as that's what it is creating.

wsnyder avatar Sep 14 '22 16:09 wsnyder

Maybe --bin?

wsnyder avatar Sep 14 '22 16:09 wsnyder

Fair enough regarding the compile/run separation (that is until the hot-swappable JIT backend arrives ;))

Maybe we should change --main to imply --cc, as it is an output mode of sorts.

Probably should do that as I guess --main --sc would bomb anyway?

gezalore avatar Sep 14 '22 16:09 gezalore

Maybe --bin?

Could be, or --sim / --sim-exe / --sim-bin ?

gezalore avatar Sep 14 '22 16:09 gezalore

I pushed a commit to have --main imply -cc. Also I realized that --main was still internal only, so pushed documenting it.

wsnyder avatar Sep 15 '22 00:09 wsnyder

I realized that --bin was taken, it's a rare option that has a parameter so we could still take it (since an error will happen if someone uses the old form). It might make sense to rename --bin as --exe-name regardless.

wsnyder avatar Sep 15 '22 01:09 wsnyder

--bin was renamed, thinking of --binary for this.

wsnyder avatar Sep 26 '22 11:09 wsnyder

Shouldn't this also add --timing? (unless --no-timing was given explicitly?)

gezalore avatar Sep 28 '22 13:09 gezalore