Convert $monitor to use string based formatting.

This completes the transition to the new string based formatting.
All the tasks now use the string formatting routines. Better
compile time checking and better messages were also added.

Also a couple of types were added to vpi_get_str(vpiType, ...)
and the calculation for vpiConstantSelect was fixed for both
the &A<> and &PV<> constructs. If the value is a plain variable
or if it is calculated in thread space we assume it is not a
constant.  This may not be true because of limitations/bugs in
the compiler (constant user functions are one known problem).
This commit is contained in:
Cary R 2009-01-15 10:43:46 -08:00 committed by Stephen Williams
parent 22cc681073
commit d2e7ea0b68
4 changed files with 310 additions and 1017 deletions

File diff suppressed because it is too large Load Diff

View File

@ -640,10 +640,13 @@ static int vpi_array_vthr_A_get(int code, vpiHandle ref)
case vpiAutomatic: case vpiAutomatic:
return (int) parent->scope->is_automatic; return (int) parent->scope->is_automatic;
// For now &A<> is only a constant select. This will need // If address_handle is not zero we definitely have a
// to be changed when it supports variable selection. // variable. If the wid is not zero we have a calculation
// from thread space which probably includes a variable.
// This assumes that the compiler is squashing all the
// constant expressions down to a single value.
case vpiConstantSelect: case vpiConstantSelect:
return 1; return obj->address_handle == 0 && obj->wid == 0;
default: default:
return 0; return 0;

View File

@ -228,6 +228,10 @@ static const char* vpi_type_values(PLI_INT32 code)
return "vpiRealVar"; return "vpiRealVar";
case vpiReg: case vpiReg:
return "vpiReg"; return "vpiReg";
case vpiSysFuncCall:
return "vpiSysFuncCall";
case vpiSysTaskCall:
return "vpiSysTaskCall";
case vpiTask: case vpiTask:
return "vpiTask"; return "vpiTask";
case vpiTimeVar: case vpiTimeVar:

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2001-2008 Stephen Williams (steve@icarus.com) * Copyright (c) 2001-2009 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -972,8 +972,9 @@ static int PV_get(int code, vpiHandle ref)
case vpiSize: case vpiSize:
return rfp->width; return rfp->width;
/* This is like the &A<> in array.cc. */
case vpiConstantSelect: case vpiConstantSelect:
return rfp->twid == 0; return rfp->sbase == 0 && rfp->twid == 0;
case vpiLeftRange: case vpiLeftRange:
rval += rfp->width; rval += rfp->width;