Add support for a SV string to $swrite and $sformat
This commit is contained in:
parent
feb710a186
commit
8e0ae733ca
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1999-2014 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 1999-2015 Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
|
|
@ -1567,7 +1567,8 @@ static PLI_INT32 sys_swrite_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name)
|
|||
{
|
||||
vpiHandle callh = vpi_handle(vpiSysTfCall, 0);
|
||||
vpiHandle argv = vpi_iterate(vpiArgument, callh);
|
||||
vpiHandle reg;
|
||||
vpiHandle arg;
|
||||
PLI_INT32 type;
|
||||
|
||||
/* Check that there are arguments. */
|
||||
if (argv == 0) {
|
||||
|
|
@ -1578,12 +1579,13 @@ static PLI_INT32 sys_swrite_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* The first argument must be a register. */
|
||||
reg = vpi_scan(argv); /* This should never be zero. */
|
||||
if (vpi_get(vpiType, reg) != vpiReg) {
|
||||
/* The first argument must be a register or a SV string. */
|
||||
arg = vpi_scan(argv); /* This should never be zero. */
|
||||
type = vpi_get(vpiType, arg);
|
||||
if (type != vpiReg && type != vpiStringVar) {
|
||||
vpi_printf("ERROR:%s:%d: ", vpi_get_str(vpiFile, callh),
|
||||
(int)vpi_get(vpiLineNo, callh));
|
||||
vpi_printf("%s's first argument must be a register.\n", name);
|
||||
vpi_printf("%s's first argument must be a register or SV string.\n", name);
|
||||
vpi_control(vpiFinish, 1);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1646,17 +1648,18 @@ static PLI_INT32 sys_sformat_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* The first argument must be a register. */
|
||||
/* The first argument must be a register or a SV string. */
|
||||
arg = vpi_scan(argv); /* This should never be zero. */
|
||||
if (vpi_get(vpiType, arg) != vpiReg) {
|
||||
type = vpi_get(vpiType, arg);
|
||||
if (type != vpiReg && type != vpiStringVar) {
|
||||
vpi_printf("ERROR:%s:%d: ", vpi_get_str(vpiFile, callh),
|
||||
(int)vpi_get(vpiLineNo, callh));
|
||||
vpi_printf("%s's first argument must be a register.\n", name);
|
||||
vpi_printf("%s's first argument must be a register or SV string.\n", name);
|
||||
vpi_control(vpiFinish, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* The second argument must be a string or a register. */
|
||||
/* The second argument must be a string, a register or a SV string. */
|
||||
arg = vpi_scan(argv);
|
||||
if (arg == 0) {
|
||||
vpi_printf("ERROR:%s:%d: ", vpi_get_str(vpiFile, callh),
|
||||
|
|
@ -1667,7 +1670,8 @@ static PLI_INT32 sys_sformat_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name)
|
|||
}
|
||||
type = vpi_get(vpiType, arg);
|
||||
if (((type != vpiConstant && type != vpiParameter) ||
|
||||
vpi_get(vpiConstType, arg) != vpiStringConst) && type != vpiReg) {
|
||||
vpi_get(vpiConstType, arg) != vpiStringConst) &&
|
||||
type != vpiReg && type != vpiStringVar) {
|
||||
vpi_printf("ERROR:%s:%d: ", vpi_get_str(vpiFile, callh),
|
||||
(int)vpi_get(vpiLineNo, callh));
|
||||
vpi_printf("%s's second argument must be a string or a register.\n", name);
|
||||
|
|
|
|||
Loading…
Reference in New Issue