From 321114e4dbf2b9279bf64ff863b68f986efc1a83 Mon Sep 17 00:00:00 2001 From: Cary R Date: Mon, 14 Apr 2008 15:41:39 -0700 Subject: [PATCH] Add an underscore between multiple strength values. When printing the strength information for a multi bit net this patch adds an underscore between the individual bit strength values. This makes it easier to see the individual bit values. --- vpi/sys_display.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vpi/sys_display.c b/vpi/sys_display.c index 69a248fcc..e92ca15b6 100644 --- a/vpi/sys_display.c +++ b/vpi/sys_display.c @@ -326,6 +326,7 @@ static void format_strength(unsigned int mcd, s_vpi_value*value, for (bit = size-1; bit >= 0; bit -= 1) { vpip_format_strength(str, value, (unsigned) bit); my_mcd_printf(mcd, "%s", str); + if (bit > 0) my_mcd_printf(mcd, "_"); } } @@ -1660,13 +1661,17 @@ static unsigned int get_format_char(char **rtn, int ljust, int plus, /* If a width was not given use a width of zero. */ if (width == -1) width = 0; nbits = vpi_get(vpiSize, info->items[*idx]); - rsize = nbits*3 + 1; + /* This is 4 chars for all but the last bit (strenght + "_") + * which only needs three chars (strength), but then you need + * space for the EOS '\0', so it is just number of bits * 4. */ + rsize = nbits*4; rbuf = malloc(rsize*sizeof(char)); if (rsize > ini_size) result = realloc(result, rsize*sizeof(char)); strcpy(rbuf, ""); for (bit = nbits-1; bit >= 0; bit -= 1) { vpip_format_strength(tbuf, &value, bit); strcat(rbuf, tbuf); + if (bit > 0) strcat(rbuf, "_"); } if (ljust == 0) sprintf(result, "%*s", width, rbuf); else sprintf(result, "%-*s", width, rbuf);