|
From: <boe...@ph...> - 2014-12-07 21:35:22
|
Cary,
"Cary R." <cy...@ya...> writes:
> This looks reasonable, but it doesn't work for all use cases (e.g. vvp
> <output_file>). We could modify vvp to look at the #! line to make
> sure the flag is found.
I don't think you want that flag to be found in all cases. This is only
for the case when you run the <outputfile> directly, and get the same
verbosity as iverilog used.
If you run the simulation as vvp <output_file>, you can add the -v flag
at that occasion
vvp -v <output_file>
If you run the outputfile as
./<output_file> -v
it does not work, since it translates to
/usr/local/bin/vvp <output_file> -v
and in that position, the -v flag is ignored.
man vvp(1):
> EXTENDED ARGUMENTS
> The vvp options described above must come before the design file name.
> After the design file name, however, there may be any number of unspec‐
> ified arguments. These arguments are not interpreted by vvp but are
> instead passed on to the executed design, and are available via the
> $test$plusargs and $value$plusargs system functions.
I had the following Makefile rules:
> VERILOG=/usr/local/bin/iverilog
> VERILOGFLAGS = -v -Wall -Wno-timescale -DSIMULATION $($*_FLAGS)
> %.vvp:
> $(VERILOG) $(VERILOGFLAGS) -o $@ $(filter %.v, $^)
> vcd/%.lxt: %.vvp
> $< -lxt2 | tee $*.log
To run vvp -v, I had to do
> VERILOG=/usr/local/bin/iverilog
> VVP=$(subst iverilog,vvp,$(VERILOG)) -v
> VERILOGFLAGS = -v -Wall -Wno-timescale -DSIMULATION $($*_FLAGS)
> %.vvp: %.v
> $(VERILOG) $(VERILOGFLAGS) -o $@ $(filter %.v,$^)
> vcd/%.lxt: %.vvp
> $(VVP) -v $< -lxt2 | tee $*.log
With the patch, the nice old rules default to pass -v to vvp.
This came up, because I want to run
make VERILOG=/usr/local/test/bin/iverilog vcd/<FILE>.lxt
and make sure the Makefile picks the correct vvp executable, and compare
the execution times reported by -v.
Stephan
> This is probably better than adding a different construct to the
> output file to pass the information and this patch works for one use
> case until vvp is modified so I don;t have an objection to it being
> added.
>
> FYI I run this as vvp <output_file> not as <output_file> or the
> slightly safer ./<output_file> since the later two make an assumption
> that <output_file> is a vvp simulation file which may not always be
> 100% true and in an extreme case could be used for nefarious reasons.
> I'm not a complete security nut so I do have . in my path, but it is
> last so <output_file> would find any other system executable instead
> of the vvp file I just generated if there was a name collision.
>
> Cary
>
> On Sunday, December 7, 2014 12:42 PM, "boe...@ph..."
> <boe...@ph...> wrote:
>
> Resent with subscribed From address ...
>
> Steven, Cary, Martin, ...
>
> please consider this patch to pass the -v flag from iverilog to vvp.
>
> Cheers, Stephan
>
> diff --git a/main.cc b/main.cc
> index 21d7232..b98c4d8 100644
> --- a/main.cc
> +++ b/main.cc
> @@ -859,6 +859,7 @@ int main(int argc, char*argv[])
> # if defined(HAVE_TIMES)
> times_flag = true;
> # endif
> + flags["VVP_EXTRA_ARG"] = strdup(" -v");
> break;
> case 'V':
> version_flag = true;
> diff --git a/tgt-vvp/vvp.c b/tgt-vvp/vvp.c
> index 55920f3..7cc180a 100644
> --- a/tgt-vvp/vvp.c
> +++ b/tgt-vvp/vvp.c
> @@ -59,7 +59,10 @@ __inline__ static void draw_execute_header
> (ivl_design_t des)
> {
> const char*cp = ivl_design_flag(des, "VVP_EXECUTABLE");
> if (cp) {
> - fprintf(vvp_out, "#! %s\n", cp);
> + const char *verbose_flag = ivl_design_flag(des, "VVP_EXTRA_ARG");
> + if (!verbose_flag)
> + verbose_flag = "";
> + fprintf(vvp_out, "#! %s%s\n", cp, verbose_flag);
> #if !defined(__MINGW32__)
> fchmod(fileno(vvp_out), 0755);
> #endif
--
Dr. Stephan Böttcher Tel: +49-431-880-2508
Christian-Albrechts-Universität zu Kiel
Inst. f. Exp. u. Angew. Physik, Abt. Extraterrestrische Physik
Leibnizstr. 11, 24118 Kiel, Germany
|