diff --git a/jtag/ChangeLog b/jtag/ChangeLog index 5107b223..c2a427ec 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -1,3 +1,11 @@ +2008-05-27 Arnim Laeuger + + * UrJTAG.txt: document progress option of svf command + * src/cmd/svf.c (cmd_svf_run): new command option 'progress' + * src/svf/svf.c (svf_run), include/svf.h (svf_run): new parameter + print_progress + * src/svf/svf_flex.l (fix_yylloc_nl): report line / total number + 2008-05-26 Arnim Laeuger [adding svf progress output] (Steve Franks) diff --git a/jtag/doc/UrJTAG.txt b/jtag/doc/UrJTAG.txt index 1792cdc8..0d735ba9 100644 --- a/jtag/doc/UrJTAG.txt +++ b/jtag/doc/UrJTAG.txt @@ -856,6 +856,10 @@ In case the TDO parameter of an SDR command leads to a mismatch the player issues a warning and continues. If the player should abort in this case then specify 'stop' at the svf command. +The absence of error or warning messages indicate that the SVF file could be +executed without problems. To get a progress reporting while the player advances +through the SVF file, specify 'progress' at the svf command. + .Limitations and Deficiencies ***************************** Several limitations exist for the SVF player. diff --git a/jtag/include/svf.h b/jtag/include/svf.h index 5d91dd14..756c2ab6 100644 --- a/jtag/include/svf.h +++ b/jtag/include/svf.h @@ -27,6 +27,6 @@ #include "chain.h" -void svf_run(chain_t *chain, FILE *, int); +void svf_run(chain_t *chain, FILE *, int, int); #endif /* SVF_H */ diff --git a/jtag/src/cmd/svf.c b/jtag/src/cmd/svf.c index 7a28b1b6..595fa26e 100644 --- a/jtag/src/cmd/svf.c +++ b/jtag/src/cmd/svf.c @@ -35,21 +35,24 @@ static int cmd_svf_run( chain_t *chain, char *params[] ) { FILE *SVF_FILE; - int num_params, result = -1; + int num_params, i, result = -1; + int stop = 0; + int print_progress = 0; num_params = cmd_params( params ); - if (num_params == 2 || num_params == 3) { - if ((SVF_FILE = fopen(params[1], "r")) != NULL) { + if (num_params > 1) { + for (i = 2; i < num_params; i++) { + if (strcasecmp(params[i], "stop") == 0) + stop = 1; + else if (strcasecmp(params[i], "progress") == 0) + print_progress = 1; + else + return -1; + } - if (num_params == 3) { - if (strcasecmp(params[2], "stop") == 0) { - svf_run(chain, SVF_FILE, 1); - result = 1; - } - } else { - svf_run(chain, SVF_FILE, 0); - result = 1; - } + if ((SVF_FILE = fopen(params[1], "r")) != NULL) { + svf_run(chain, SVF_FILE, stop, print_progress); + result = 1; fclose(SVF_FILE); } else { @@ -66,13 +69,13 @@ static void cmd_svf_help( void ) { printf( _( - "Usage: %s FILE\n" - "Usage: %s FILE stop\n" + "Usage: %s FILE [stop] [progress]\n" "Execute svf commands from FILE.\n" - "Command execution stops upon TDO mismatch when 'stop' is specified.\n" + "stop : Command execution stops upon TDO mismatch.\n" + "progress : Continually displays progress status.\n" "\n" "FILE file containing SVF commans\n" - ), "svf", "svf" ); + ), "svf" ); } cmd_t cmd_svf = { diff --git a/jtag/src/svf/svf.c b/jtag/src/svf/svf.c index 53d2b1a4..494e254e 100644 --- a/jtag/src/svf/svf.c +++ b/jtag/src/svf/svf.c @@ -1008,13 +1008,15 @@ svf_txr(enum generic_irdr_coding ir_dr, struct ths_params *params) * SVF_FILE : file handle of SVF file * stop_on_mismatch : 1 = stop upon tdo mismatch * 0 = continue upon mismatch + * print_progress : 1 = continually print progress status + * 0 = don't print * * Return value: * 1 : all ok * 0 : error occured * ***************************************************************************/ void -svf_run(chain_t *chain, FILE *SVF_FILE, int stop_on_mismatch) +svf_run(chain_t *chain, FILE *SVF_FILE, int stop_on_mismatch, int print_progress) { const sxr_t sxr_default = { {0.0, NULL, NULL, NULL, NULL}, 1, 1}; @@ -1117,7 +1119,7 @@ svf_run(chain_t *chain, FILE *SVF_FILE, int stop_on_mismatch) /* select SIR instruction */ part_set_instruction(priv.part, "SIR"); - if (svf_bison_init(&priv, SVF_FILE, num_lines, 0)) { + if (svf_bison_init(&priv, SVF_FILE, num_lines, print_progress)) { svfparse(&priv, chain); svf_bison_deinit(&priv); } diff --git a/jtag/src/svf/svf_flex.l b/jtag/src/svf/svf_flex.l index 740f4f15..c415eeba 100644 --- a/jtag/src/svf/svf_flex.l +++ b/jtag/src/svf/svf_flex.l @@ -306,7 +306,9 @@ fix_yylloc_nl(YYLTYPE * mylloc, char *str, YY_EXTRA_TYPE extra) mylloc->last_column = 0; ++mylloc->last_line; if (extra->print_progress) - printf( _("\rParsing (%3.0d%%)"), ((mylloc->last_line * 100) + 1) / extra->num_lines); + printf( _("\rParsing %6d/%d (%3.0d%%)"), + mylloc->last_line, extra->num_lines, + ((mylloc->last_line * 100) + 1) / extra->num_lines ); } else { ++mylloc->last_column; }