vlog95: add ability for user to change space increment.
This patch adds the ability for the user to change the spacing increment from the command line using the -pspacing=<num> flag. The is restricted to be a value between and including 1 and 16.
This commit is contained in:
parent
9229256f6f
commit
60d08d5f02
|
|
@ -495,7 +495,7 @@ extern int ivl_path_source_negedge(ivl_delaypath_t obj);
|
||||||
*
|
*
|
||||||
* ivl_design_flag
|
* ivl_design_flag
|
||||||
* This function returns the string value of a named flag. Flags
|
* This function returns the string value of a named flag. Flags
|
||||||
* come from the "-fkey=value" options to the iverilog command and
|
* come from the "-pkey=value" options to the iverilog command and
|
||||||
* are stored in a map for this function. Given the key, this
|
* are stored in a map for this function. Given the key, this
|
||||||
* function returns the value.
|
* function returns the value.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
# include "version_tag.h"
|
# include "version_tag.h"
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
# include "vlog95_priv.h"
|
# include "vlog95_priv.h"
|
||||||
|
# include <stdlib.h>
|
||||||
# include <string.h>
|
# include <string.h>
|
||||||
|
|
||||||
static const char*version_string =
|
static const char*version_string =
|
||||||
|
|
@ -56,8 +57,43 @@ int target_design(ivl_design_t des)
|
||||||
ivl_scope_t *roots;
|
ivl_scope_t *roots;
|
||||||
unsigned nroots, idx;
|
unsigned nroots, idx;
|
||||||
const char*path = ivl_design_flag(des, "-o");
|
const char*path = ivl_design_flag(des, "-o");
|
||||||
|
/* Set the indent spacing with the -pspacing flag passed to iverilog
|
||||||
|
* (e.g. -pspacing=4). */
|
||||||
|
const char*spacing = ivl_design_flag(des, "spacing");
|
||||||
assert(path);
|
assert(path);
|
||||||
|
|
||||||
|
/* Check for and use a provided indent spacing. */
|
||||||
|
if (strcmp(spacing, "") != 0) {
|
||||||
|
char *eptr;
|
||||||
|
long sp_incr = strtol(spacing, &eptr, 0);
|
||||||
|
/* Nothing usable in the spacing string. */
|
||||||
|
if (spacing == eptr) {
|
||||||
|
fprintf(stderr, "vlog95 error: Unable to extract spacing "
|
||||||
|
"increment from string: %s\n", spacing);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
/* Extra stuff at the end. */
|
||||||
|
if (*eptr != 0) {
|
||||||
|
fprintf(stderr, "vlog95 error: Extra characters '%s' "
|
||||||
|
"included at end of spacing string: %s\n",
|
||||||
|
eptr, spacing);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
/* The increment must be positive. */
|
||||||
|
if (sp_incr < 1) {
|
||||||
|
fprintf(stderr, "vlog95 error: Spacing increment (%ld) must "
|
||||||
|
"be greater than zero.\n", sp_incr);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
/* An increment of more than sixteen is too much. */
|
||||||
|
if (sp_incr > 16) {
|
||||||
|
fprintf(stderr, "vlog95 error: Spacing increment (%ld) must "
|
||||||
|
"be sixteen or less.\n", sp_incr);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
indent_incr = sp_incr;
|
||||||
|
}
|
||||||
|
|
||||||
design = des;
|
design = des;
|
||||||
|
|
||||||
#ifdef HAVE_FOPEN64
|
#ifdef HAVE_FOPEN64
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue