Add support for %v is the display system task.

Change the encoding of H and L outputs from
 the bufif devices so that they are logic x.
This commit is contained in:
steve 2002-09-06 04:56:28 +00:00
parent 4d090b64bd
commit ea21fab379
6 changed files with 188 additions and 16 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: sys_display.c,v 1.44 2002/08/24 02:02:44 steve Exp $"
#ident "$Id: sys_display.c,v 1.45 2002/09/06 04:56:28 steve Exp $"
#endif
# include "config.h"
@ -206,6 +206,91 @@ static void format_time(unsigned mcd, int fsize, const char*value)
vpi_mcd_printf(mcd, "%s", bp);
}
static const char str_char1_table[256] = {
".HS1M222" "W3333333" /* 00 0F */ "L4444444" "44444444" /* 10 1F */
"P5555555" "55555555" /* 20 2F */ "55555555" "55555555" /* 30 3F */
"S6666666" "66666666" /* 40 4F */ "66666666" "66666666" /* 50 5F */
"66666666" "66666666" /* 60 6F */ "66666666" "66666666" /* 70 7F */
"S7777777" "77777777" /* 80 8F */ "77777777" "77777777" /* 90 9F */
"77777777" "77777777" /* A0 AF */ "77777777" "77777777" /* B0 BF */
"77777777" "77777777" /* C0 CF */ "77777777" "77777777" /* D0 DF */
"77777777" "77777777" /* E0 EF */ "77777777" "77777777" /* F0 FF */ };
static const char str_char2_table[256] = {
".im0e010" "e0102010" /* 00 0F */ "a0102010" "30102010" /* 10 1F */
"u0102010" "30102010" /* 20 2F */ "40102010" "30102010" /* 30 3F */
"t0102010" "30102010" /* 40 4F */ "40102010" "30102010" /* 50 5F */
"50102010" "30102010" /* 60 6F */ "40102010" "30102010" /* 70 7F */
"u0102010" "30102010" /* 80 8F */ "40102010" "30102010" /* 90 9F */
"50102010" "30102010" /* A0 AF */ "40102010" "30102010" /* B0 BF */
"60102010" "30102010" /* C0 CF */ "40102010" "30102010" /* D0 DF */
"50102010" "30102010" /* E0 EF */ "40102010" "30102010" /* F0 FF */ };
static void format_strength(unsigned int mcd, s_vpi_value*value)
{
char str[4];
str[0] = '.';
str[1] = '.';
str[2] = '.';
str[3] = 0;
switch (value->value.strength[0].logic) {
case vpi0:
str[0] = str_char1_table[value->value.strength[0].s0];
str[1] = str_char2_table[value->value.strength[0].s0];
str[2] = '0';
break;
case vpi1:
str[0] = str_char1_table[value->value.strength[0].s1];
str[1] = str_char2_table[value->value.strength[0].s1];
str[2] = '1';
break;
case vpiX:
if (value->value.strength[0].s0 == 1) {
str[0] = str_char1_table[value->value.strength[0].s1];
str[1] = str_char2_table[value->value.strength[0].s1];
str[2] = 'H';
} else if (value->value.strength[0].s1 == 1) {
str[0] = str_char1_table[value->value.strength[0].s0];
str[1] = str_char2_table[value->value.strength[0].s0];
str[2] = 'L';
} else if (value->value.strength[0].s1 ==
value->value.strength[0].s0) {
str[0] = str_char1_table[value->value.strength[0].s0];
str[1] = str_char2_table[value->value.strength[0].s0];
str[2] = 'X';
} else {
int ss;
str[0] = '0';
ss = value->value.strength[0].s0;
while (ss > 1) {
str[0] += 1;
ss >>= 1;
}
str[1] = '0';
ss = value->value.strength[0].s1;
while (ss > 1) {
str[1] += 1;
ss >>= 1;
}
str[2] = 'X';
}
break;
case vpiZ:
str[0] = 'H';
str[1] = 'i';
str[2] = 'Z';
break;
default:
assert(0);
}
vpi_mcd_printf(mcd, "%s", str);
}
/*
* If $display discovers a string as a parameter, this function is
* called to process it as a format string. I need the argv handle as
@ -354,6 +439,14 @@ static int format_str(vpiHandle scope, unsigned int mcd,
cp += 1;
break;
case 'v':
case 'V':
format_char = 'v';
do_arg = 1;
value.format = vpiStrengthVal;
cp += 1;
break;
case '%':
if (fsize != -1 && ffsize != -1) {
vpi_printf("\nERROR: Illegal format \"%s\"\n", fmt);
@ -364,8 +457,6 @@ static int format_str(vpiHandle scope, unsigned int mcd,
cp += 1;
break;
case 'v':
case 'V':
case 'e':
case 'f':
case 'g':
@ -477,6 +568,10 @@ static int format_str(vpiHandle scope, unsigned int mcd,
}
break;
case 'v':
format_strength(mcd, &value);
break;
default:
if (fsize > 0)
vpi_mcd_printf(mcd, "%*s", fsize,
@ -1366,6 +1461,11 @@ void sys_display_register()
/*
* $Log: sys_display.c,v $
* Revision 1.45 2002/09/06 04:56:28 steve
* Add support for %v is the display system task.
* Change the encoding of H and L outputs from
* the bufif devices so that they are logic x.
*
* Revision 1.44 2002/08/24 02:02:44 steve
* Rewire time formatting to handle all cases.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: bufif.cc,v 1.8 2002/08/12 01:35:07 steve Exp $"
#ident "$Id: bufif.cc,v 1.9 2002/09/06 04:56:28 steve Exp $"
#endif
# include "bufif.h"
@ -25,9 +25,12 @@
# include "schedule.h"
# include "statistics.h"
vvp_bufif_s::vvp_bufif_s(bool en_invert, bool out_invert)
vvp_bufif_s::vvp_bufif_s(bool en_invert, bool out_invert,
unsigned str0, unsigned str1)
: pol_(en_invert? 1 : 0), inv_(out_invert? 1 : 0)
{
odrive0 = str0;
odrive1 = str1;
count_functors_bufif += 1;
}
@ -41,8 +44,8 @@ void vvp_bufif_s::set(vvp_ipoint_t ptr, bool push, unsigned v, unsigned)
unsigned char out0 = 0x00 | (odrive0<<0) | (odrive0<<4);
unsigned char out1 = 0x88 | (odrive1<<0) | (odrive1<<4);
unsigned char outX = 0x80 | (odrive0<<0) | (odrive1<<4);
unsigned char outH = 0x88 | (0) | (odrive1<<4);
unsigned char outL = 0x00 | (odrive0<<0) | (0);
unsigned char outH = 0x80 | (0) | (odrive1<<4);
unsigned char outL = 0x80 | (odrive0<<0) | (0);
unsigned val;
unsigned str;
@ -98,6 +101,11 @@ void vvp_bufif_s::set(vvp_ipoint_t ptr, bool push, unsigned v, unsigned)
/*
* $Log: bufif.cc,v $
* Revision 1.9 2002/09/06 04:56:28 steve
* Add support for %v is the display system task.
* Change the encoding of H and L outputs from
* the bufif devices so that they are logic x.
*
* Revision 1.8 2002/08/12 01:35:07 steve
* conditional ident string using autoconfig.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: bufif.h,v 1.5 2002/08/12 01:35:07 steve Exp $"
#ident "$Id: bufif.h,v 1.6 2002/09/06 04:56:29 steve Exp $"
#endif
# include "functor.h"
@ -27,7 +27,8 @@
class vvp_bufif_s : public functor_s {
public:
vvp_bufif_s(bool en_invert, bool out_invert);
vvp_bufif_s(bool en_invert, bool out_invert,
unsigned str0, unsigned str1);
virtual void set(vvp_ipoint_t i, bool push, unsigned val, unsigned str);
@ -38,6 +39,11 @@ class vvp_bufif_s : public functor_s {
/*
* $Log: bufif.h,v $
* Revision 1.6 2002/09/06 04:56:29 steve
* Add support for %v is the display system task.
* Change the encoding of H and L outputs from
* the bufif devices so that they are logic x.
*
* Revision 1.5 2002/08/12 01:35:07 steve
* conditional ident string using autoconfig.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: logic.cc,v 1.11 2002/08/29 03:04:01 steve Exp $"
#ident "$Id: logic.cc,v 1.12 2002/09/06 04:56:29 steve Exp $"
#endif
# include "logic.h"
@ -92,10 +92,10 @@ void compile_functor(char*label, char*type,
obj = new table_functor_s(ft_BUF, ostr0, ostr1);
} else if (strcmp(type, "BUFIF0") == 0) {
obj = new vvp_bufif_s(true,false);
obj = new vvp_bufif_s(true,false, ostr0, ostr1);
} else if (strcmp(type, "BUFIF1") == 0) {
obj = new vvp_bufif_s(false,false);
obj = new vvp_bufif_s(false,false, ostr0, ostr1);
} else if (strcmp(type, "BUFZ") == 0) {
obj = new table_functor_s(ft_BUFZ, ostr0, ostr1);
@ -131,10 +131,10 @@ void compile_functor(char*label, char*type,
obj = new table_functor_s(ft_NOT, ostr0, ostr1);
} else if (strcmp(type, "NOTIF0") == 0) {
obj = new vvp_bufif_s(true,true);
obj = new vvp_bufif_s(true,true, ostr0, ostr1);
} else if (strcmp(type, "NOTIF1") == 0) {
obj = new vvp_bufif_s(false,true);
obj = new vvp_bufif_s(false,true, ostr0, ostr1);
} else if (strcmp(type, "XNOR") == 0) {
obj = new table_functor_s(ft_XNOR, ostr0, ostr1);
@ -167,6 +167,11 @@ void compile_functor(char*label, char*type,
/*
* $Log: logic.cc,v $
* Revision 1.12 2002/09/06 04:56:29 steve
* Add support for %v is the display system task.
* Change the encoding of H and L outputs from
* the bufif devices so that they are logic x.
*
* Revision 1.11 2002/08/29 03:04:01 steve
* Generate x out for x select on wide muxes.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: resolv.cc,v 1.14 2002/08/12 01:35:08 steve Exp $"
#ident "$Id: resolv.cc,v 1.15 2002/09/06 04:56:29 steve Exp $"
#endif
# include "resolv.h"
@ -35,6 +35,7 @@
# define STREN1(v) ( ((v)&0x80)? ((v)&0xf0) : (0x70 - ((v)&0xf0)) )
# define STREN0(v) ( ((v)&0x08)? ((v)&0x0f) : (0x07 - ((v)&0x0f)) )
# include <iostream>
static unsigned blend(unsigned a, unsigned b)
{
if (a == HiZ)
@ -203,6 +204,11 @@ void resolv_functor_s::debug_print(vvp_ipoint_t fnc)
/*
* $Log: resolv.cc,v $
* Revision 1.15 2002/09/06 04:56:29 steve
* Add support for %v is the display system task.
* Change the encoding of H and L outputs from
* the bufif devices so that they are logic x.
*
* Revision 1.14 2002/08/12 01:35:08 steve
* conditional ident string using autoconfig.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: vpi_signal.cc,v 1.46 2002/08/12 01:35:09 steve Exp $"
#ident "$Id: vpi_signal.cc,v 1.47 2002/09/06 04:56:29 steve Exp $"
#endif
/*
@ -378,6 +378,48 @@ static void signal_get_value(vpiHandle ref, s_vpi_value*vp)
break;
}
case vpiStrengthVal: {
s_vpi_strengthval*op = (s_vpi_strengthval*)
need_result_buf(wid * sizeof(s_vpi_strengthval),
RBUF_VAL);
/* Convert the internal strength values of each
functor in the vector to a PLI2.0 version. */
for (unsigned idx = 0 ; idx < wid ; idx += 1) {
vvp_ipoint_t fptr = vvp_fvector_get(rfp->bits, idx);
functor_t fp = functor_index(fptr);
unsigned str = fp->get_ostr();
unsigned s0 = 1 << (str&0x07);
unsigned s1 = 1 << ((str>>4) & 0x07);
switch (fp->get()) {
case 0:
op[idx].logic = vpi0;
op[idx].s0 = s0|s1;
op[idx].s1 = 0;
break;
case 1:
op[idx].logic = vpi1;
op[idx].s0 = 0;
op[idx].s1 = s0|s1;
break;
case 2:
op[idx].logic = vpiX;
op[idx].s0 = s0;
op[idx].s1 = s1;
break;
case 3:
op[idx].logic = vpiZ;
op[idx].s0 = vpiHiZ;
op[idx].s1 = vpiHiZ;
break;
}
}
break;
}
default:
fprintf(stderr, "vvp internal error: signal_get_value: "
"value type %u not implemented.\n", vp->format);
@ -673,6 +715,11 @@ vpiHandle vpip_make_net(const char*name, int msb, int lsb,
/*
* $Log: vpi_signal.cc,v $
* Revision 1.47 2002/09/06 04:56:29 steve
* Add support for %v is the display system task.
* Change the encoding of H and L outputs from
* the bufif devices so that they are logic x.
*
* Revision 1.46 2002/08/12 01:35:09 steve
* conditional ident string using autoconfig.
*