2003-10-30 04:43:19 +01:00
|
|
|
/*
|
2009-01-17 01:12:44 +01:00
|
|
|
* Copyright (c) 2003-2009 Stephen Williams (steve@icarus.com)
|
2003-10-30 04:43:19 +01:00
|
|
|
*
|
|
|
|
|
* This source code is free software; you can redistribute it
|
|
|
|
|
* and/or modify it in source code form under the terms of the GNU
|
|
|
|
|
* General Public License as published by the Free Software
|
|
|
|
|
* Foundation; either version 2 of the License, or (at your option)
|
|
|
|
|
* any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
# include "vpi_user.h"
|
|
|
|
|
# include "sys_priv.h"
|
|
|
|
|
# include <assert.h>
|
2008-06-17 01:25:37 +02:00
|
|
|
# include <ctype.h>
|
2003-10-30 04:43:19 +01:00
|
|
|
# include <string.h>
|
|
|
|
|
# include <stdio.h>
|
|
|
|
|
# include <stdlib.h>
|
|
|
|
|
|
|
|
|
|
#define IS_MCD(mcd) !((mcd)>>31&1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Implement the $fopen system function.
|
|
|
|
|
*/
|
2008-06-14 05:46:18 +02:00
|
|
|
static PLI_INT32 sys_fopen_compiletf(PLI_BYTE8 *name)
|
2003-10-30 04:43:19 +01:00
|
|
|
{
|
2008-06-14 05:46:18 +02:00
|
|
|
vpiHandle callh = vpi_handle(vpiSysTfCall, 0);
|
2008-09-30 03:06:47 +02:00
|
|
|
vpiHandle argv;
|
2008-06-14 05:46:18 +02:00
|
|
|
vpiHandle arg;
|
2008-09-30 03:06:47 +02:00
|
|
|
assert(callh != 0);
|
|
|
|
|
argv = vpi_iterate(vpiArgument, callh);
|
2003-10-30 04:43:19 +01:00
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
/* Check that there is a file name argument and that it is a string. */
|
2006-08-03 07:02:46 +02:00
|
|
|
if (argv == 0) {
|
Rework $plusarg routines.
This patch addresses a number of issues:
Rewrote the $test$plusargs and $value$plusargs routines to have
better error/warning messages, to support runtime strings, to
correctly load bit based values (truncating, padding, negative
value), added support for the real formats using strtod() and
added "x/X" as an alias for "h/H" to match the other part of
Icarus.
Rewrite the vpip_{bin,oct,hex}_str_to_vec4 routines to ignore
embedded "_" characters. Add support for a negative value and
set the entire value to 'bx if an invalid digit is found. A
warning is printed for this case.
Rewrite vpip_dec_str_to_vec4 to ignore embedded "_" characters,
to support a single "x" or "z" constant and to return 'bx if an
invalid digit is found. A warning is printed for this case.
It simplifies the system task/functions error/warning messages.
It removes the signed flag for the bin and dec string conversions.
This was not being used (was always false) and the new negative
value support makes this obsolete.
Add support for a real variable to handle Bin, Oct, Dec and Hex
strings. They are converted into a vvp_vector4_t which is then
converted to a real value.
Add support for setting a bit based value using a real value.
Removed an unneeded rfp signal in vpip_make_reg()
2008-11-13 22:28:19 +01:00
|
|
|
vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh),
|
2008-06-14 05:46:18 +02:00
|
|
|
(int)vpi_get(vpiLineNo, callh));
|
|
|
|
|
vpi_printf("%s requires a string file name argument.\n", name);
|
2007-07-20 00:45:36 +02:00
|
|
|
vpi_control(vpiFinish, 1);
|
2008-06-14 05:46:18 +02:00
|
|
|
return 0;
|
2006-08-03 07:02:46 +02:00
|
|
|
}
|
2008-06-14 05:46:18 +02:00
|
|
|
if (! is_string_obj(vpi_scan(argv))) {
|
Rework $plusarg routines.
This patch addresses a number of issues:
Rewrote the $test$plusargs and $value$plusargs routines to have
better error/warning messages, to support runtime strings, to
correctly load bit based values (truncating, padding, negative
value), added support for the real formats using strtod() and
added "x/X" as an alias for "h/H" to match the other part of
Icarus.
Rewrite the vpip_{bin,oct,hex}_str_to_vec4 routines to ignore
embedded "_" characters. Add support for a negative value and
set the entire value to 'bx if an invalid digit is found. A
warning is printed for this case.
Rewrite vpip_dec_str_to_vec4 to ignore embedded "_" characters,
to support a single "x" or "z" constant and to return 'bx if an
invalid digit is found. A warning is printed for this case.
It simplifies the system task/functions error/warning messages.
It removes the signed flag for the bin and dec string conversions.
This was not being used (was always false) and the new negative
value support makes this obsolete.
Add support for a real variable to handle Bin, Oct, Dec and Hex
strings. They are converted into a vvp_vector4_t which is then
converted to a real value.
Add support for setting a bit based value using a real value.
Removed an unneeded rfp signal in vpip_make_reg()
2008-11-13 22:28:19 +01:00
|
|
|
vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh),
|
2008-06-14 05:46:18 +02:00
|
|
|
(int)vpi_get(vpiLineNo, callh));
|
|
|
|
|
vpi_printf("%s's file name argument must be a string.\n", name);
|
2007-07-20 00:45:36 +02:00
|
|
|
vpi_control(vpiFinish, 1);
|
2006-08-03 07:02:46 +02:00
|
|
|
}
|
2003-10-30 04:43:19 +01:00
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
/* The type argument is optional. */
|
|
|
|
|
arg = vpi_scan(argv);
|
|
|
|
|
if (arg == 0) return 0;
|
2003-10-30 04:43:19 +01:00
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
/* When provided, the type argument must be a string. */
|
|
|
|
|
if (! is_string_obj(arg)) {
|
Rework $plusarg routines.
This patch addresses a number of issues:
Rewrote the $test$plusargs and $value$plusargs routines to have
better error/warning messages, to support runtime strings, to
correctly load bit based values (truncating, padding, negative
value), added support for the real formats using strtod() and
added "x/X" as an alias for "h/H" to match the other part of
Icarus.
Rewrite the vpip_{bin,oct,hex}_str_to_vec4 routines to ignore
embedded "_" characters. Add support for a negative value and
set the entire value to 'bx if an invalid digit is found. A
warning is printed for this case.
Rewrite vpip_dec_str_to_vec4 to ignore embedded "_" characters,
to support a single "x" or "z" constant and to return 'bx if an
invalid digit is found. A warning is printed for this case.
It simplifies the system task/functions error/warning messages.
It removes the signed flag for the bin and dec string conversions.
This was not being used (was always false) and the new negative
value support makes this obsolete.
Add support for a real variable to handle Bin, Oct, Dec and Hex
strings. They are converted into a vvp_vector4_t which is then
converted to a real value.
Add support for setting a bit based value using a real value.
Removed an unneeded rfp signal in vpip_make_reg()
2008-11-13 22:28:19 +01:00
|
|
|
vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh),
|
2008-06-14 05:46:18 +02:00
|
|
|
(int)vpi_get(vpiLineNo, callh));
|
|
|
|
|
vpi_printf("%s's type argument must be a string.\n", name);
|
2007-07-20 00:45:36 +02:00
|
|
|
vpi_control(vpiFinish, 1);
|
2006-08-03 07:02:46 +02:00
|
|
|
}
|
|
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
/* Make sure there are no extra arguments. */
|
|
|
|
|
if (vpi_scan(argv) != 0) {
|
|
|
|
|
char msg [64];
|
2008-09-30 03:06:47 +02:00
|
|
|
unsigned argc;
|
|
|
|
|
|
Rework $plusarg routines.
This patch addresses a number of issues:
Rewrote the $test$plusargs and $value$plusargs routines to have
better error/warning messages, to support runtime strings, to
correctly load bit based values (truncating, padding, negative
value), added support for the real formats using strtod() and
added "x/X" as an alias for "h/H" to match the other part of
Icarus.
Rewrite the vpip_{bin,oct,hex}_str_to_vec4 routines to ignore
embedded "_" characters. Add support for a negative value and
set the entire value to 'bx if an invalid digit is found. A
warning is printed for this case.
Rewrite vpip_dec_str_to_vec4 to ignore embedded "_" characters,
to support a single "x" or "z" constant and to return 'bx if an
invalid digit is found. A warning is printed for this case.
It simplifies the system task/functions error/warning messages.
It removes the signed flag for the bin and dec string conversions.
This was not being used (was always false) and the new negative
value support makes this obsolete.
Add support for a real variable to handle Bin, Oct, Dec and Hex
strings. They are converted into a vvp_vector4_t which is then
converted to a real value.
Add support for setting a bit based value using a real value.
Removed an unneeded rfp signal in vpip_make_reg()
2008-11-13 22:28:19 +01:00
|
|
|
snprintf(msg, 64, "ERROR: %s:%d:",
|
2008-06-14 05:46:18 +02:00
|
|
|
vpi_get_str(vpiFile, callh),
|
|
|
|
|
(int)vpi_get(vpiLineNo, callh));
|
|
|
|
|
|
2008-09-30 03:06:47 +02:00
|
|
|
argc = 1;
|
2008-06-14 05:46:18 +02:00
|
|
|
while (vpi_scan(argv)) argc += 1;
|
|
|
|
|
|
|
|
|
|
vpi_printf("%s %s takes at most two string arguments.\n",
|
|
|
|
|
msg, name);
|
|
|
|
|
vpi_printf("%*s Found %u extra argument%s.\n",
|
2008-06-20 19:12:17 +02:00
|
|
|
(int) strlen(msg), " ", argc, argc == 1 ? "" : "s");
|
2007-07-20 00:45:36 +02:00
|
|
|
vpi_control(vpiFinish, 1);
|
2006-08-03 07:02:46 +02:00
|
|
|
}
|
2003-10-30 04:43:19 +01:00
|
|
|
|
2006-08-03 07:02:46 +02:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2007-03-14 05:05:51 +01:00
|
|
|
static PLI_INT32 sys_fopen_calltf(PLI_BYTE8*name)
|
2006-08-03 07:02:46 +02:00
|
|
|
{
|
2008-06-14 05:46:18 +02:00
|
|
|
vpiHandle callh = vpi_handle(vpiSysTfCall, 0);
|
|
|
|
|
vpiHandle argv = vpi_iterate(vpiArgument, callh);
|
|
|
|
|
s_vpi_value val;
|
|
|
|
|
int fail = 0;
|
2006-08-03 07:02:46 +02:00
|
|
|
char *mode_string = 0;
|
2008-06-17 01:25:37 +02:00
|
|
|
unsigned idx;
|
2006-08-03 07:02:46 +02:00
|
|
|
vpiHandle item = vpi_scan(argv);
|
|
|
|
|
vpiHandle mode = vpi_scan(argv);
|
2008-09-30 03:06:47 +02:00
|
|
|
unsigned len;
|
2006-08-03 07:02:46 +02:00
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
/* Get the mode handle if it exists. */
|
2003-10-30 04:43:19 +01:00
|
|
|
if (mode) {
|
2008-06-14 05:46:18 +02:00
|
|
|
val.format = vpiStringVal;
|
|
|
|
|
vpi_get_value(mode, &val);
|
|
|
|
|
/* Verify that we have a string and that it is not NULL. */
|
|
|
|
|
if (val.format != vpiStringVal || !*(val.value.str)) {
|
Rework $plusarg routines.
This patch addresses a number of issues:
Rewrote the $test$plusargs and $value$plusargs routines to have
better error/warning messages, to support runtime strings, to
correctly load bit based values (truncating, padding, negative
value), added support for the real formats using strtod() and
added "x/X" as an alias for "h/H" to match the other part of
Icarus.
Rewrite the vpip_{bin,oct,hex}_str_to_vec4 routines to ignore
embedded "_" characters. Add support for a negative value and
set the entire value to 'bx if an invalid digit is found. A
warning is printed for this case.
Rewrite vpip_dec_str_to_vec4 to ignore embedded "_" characters,
to support a single "x" or "z" constant and to return 'bx if an
invalid digit is found. A warning is printed for this case.
It simplifies the system task/functions error/warning messages.
It removes the signed flag for the bin and dec string conversions.
This was not being used (was always false) and the new negative
value support makes this obsolete.
Add support for a real variable to handle Bin, Oct, Dec and Hex
strings. They are converted into a vvp_vector4_t which is then
converted to a real value.
Add support for setting a bit based value using a real value.
Removed an unneeded rfp signal in vpip_make_reg()
2008-11-13 22:28:19 +01:00
|
|
|
vpi_printf("WARNING: %s:%d: ",
|
2008-06-14 05:46:18 +02:00
|
|
|
vpi_get_str(vpiFile, callh),
|
|
|
|
|
(int)vpi_get(vpiLineNo, callh));
|
2008-06-17 01:25:37 +02:00
|
|
|
vpi_printf("%s's mode argument is not a valid string.\n",
|
2008-06-14 05:46:18 +02:00
|
|
|
name);
|
|
|
|
|
fail = 1;
|
|
|
|
|
}
|
2008-06-17 01:25:37 +02:00
|
|
|
|
|
|
|
|
/* Make sure the mode string is correct. */
|
|
|
|
|
if (strlen(val.value.str) > 3) {
|
Rework $plusarg routines.
This patch addresses a number of issues:
Rewrote the $test$plusargs and $value$plusargs routines to have
better error/warning messages, to support runtime strings, to
correctly load bit based values (truncating, padding, negative
value), added support for the real formats using strtod() and
added "x/X" as an alias for "h/H" to match the other part of
Icarus.
Rewrite the vpip_{bin,oct,hex}_str_to_vec4 routines to ignore
embedded "_" characters. Add support for a negative value and
set the entire value to 'bx if an invalid digit is found. A
warning is printed for this case.
Rewrite vpip_dec_str_to_vec4 to ignore embedded "_" characters,
to support a single "x" or "z" constant and to return 'bx if an
invalid digit is found. A warning is printed for this case.
It simplifies the system task/functions error/warning messages.
It removes the signed flag for the bin and dec string conversions.
This was not being used (was always false) and the new negative
value support makes this obsolete.
Add support for a real variable to handle Bin, Oct, Dec and Hex
strings. They are converted into a vvp_vector4_t which is then
converted to a real value.
Add support for setting a bit based value using a real value.
Removed an unneeded rfp signal in vpip_make_reg()
2008-11-13 22:28:19 +01:00
|
|
|
vpi_printf("WARNING: %s:%d: ",
|
2008-06-17 01:25:37 +02:00
|
|
|
vpi_get_str(vpiFile, callh),
|
|
|
|
|
(int)vpi_get(vpiLineNo, callh));
|
|
|
|
|
vpi_printf("%s's mode argument (%s) is too long.\n",
|
|
|
|
|
name, val.value.str);
|
|
|
|
|
fail = 1;
|
|
|
|
|
} else {
|
|
|
|
|
unsigned bin = 0, plus = 0;
|
|
|
|
|
switch (val.value.str[0]) {
|
|
|
|
|
case 'r':
|
|
|
|
|
case 'w':
|
|
|
|
|
case 'a':
|
|
|
|
|
for (idx = 1; idx < 3 ; idx++) {
|
|
|
|
|
if (val.value.str[idx] == '\0') break;
|
|
|
|
|
switch (val.value.str[idx]) {
|
|
|
|
|
case 'b':
|
|
|
|
|
if (bin) fail = 1;
|
|
|
|
|
bin = 1;
|
|
|
|
|
break;
|
|
|
|
|
case '+':
|
|
|
|
|
if (plus) fail = 1;
|
|
|
|
|
plus = 1;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
fail = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (! fail) break;
|
|
|
|
|
|
|
|
|
|
default:
|
Rework $plusarg routines.
This patch addresses a number of issues:
Rewrote the $test$plusargs and $value$plusargs routines to have
better error/warning messages, to support runtime strings, to
correctly load bit based values (truncating, padding, negative
value), added support for the real formats using strtod() and
added "x/X" as an alias for "h/H" to match the other part of
Icarus.
Rewrite the vpip_{bin,oct,hex}_str_to_vec4 routines to ignore
embedded "_" characters. Add support for a negative value and
set the entire value to 'bx if an invalid digit is found. A
warning is printed for this case.
Rewrite vpip_dec_str_to_vec4 to ignore embedded "_" characters,
to support a single "x" or "z" constant and to return 'bx if an
invalid digit is found. A warning is printed for this case.
It simplifies the system task/functions error/warning messages.
It removes the signed flag for the bin and dec string conversions.
This was not being used (was always false) and the new negative
value support makes this obsolete.
Add support for a real variable to handle Bin, Oct, Dec and Hex
strings. They are converted into a vvp_vector4_t which is then
converted to a real value.
Add support for setting a bit based value using a real value.
Removed an unneeded rfp signal in vpip_make_reg()
2008-11-13 22:28:19 +01:00
|
|
|
vpi_printf("WARNING: %s:%d: ",
|
2008-06-17 01:25:37 +02:00
|
|
|
vpi_get_str(vpiFile, callh),
|
|
|
|
|
(int)vpi_get(vpiLineNo, callh));
|
|
|
|
|
vpi_printf("%s's mode argument (%s) is invalid.\n",
|
|
|
|
|
name, val.value.str);
|
|
|
|
|
fail = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
mode_string = strdup(val.value.str);
|
2006-08-03 07:02:46 +02:00
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
vpi_free_object(argv);
|
2003-10-30 04:43:19 +01:00
|
|
|
}
|
|
|
|
|
|
2005-01-09 21:12:22 +01:00
|
|
|
/* Get the string form of the file name from the file name
|
|
|
|
|
argument. */
|
2008-06-14 05:46:18 +02:00
|
|
|
val.format = vpiStringVal;
|
|
|
|
|
vpi_get_value(item, &val);
|
2003-10-30 04:43:19 +01:00
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
/* Verify that we have a string and that it is not NULL. */
|
|
|
|
|
if (val.format != vpiStringVal || !*(val.value.str)) {
|
Rework $plusarg routines.
This patch addresses a number of issues:
Rewrote the $test$plusargs and $value$plusargs routines to have
better error/warning messages, to support runtime strings, to
correctly load bit based values (truncating, padding, negative
value), added support for the real formats using strtod() and
added "x/X" as an alias for "h/H" to match the other part of
Icarus.
Rewrite the vpip_{bin,oct,hex}_str_to_vec4 routines to ignore
embedded "_" characters. Add support for a negative value and
set the entire value to 'bx if an invalid digit is found. A
warning is printed for this case.
Rewrite vpip_dec_str_to_vec4 to ignore embedded "_" characters,
to support a single "x" or "z" constant and to return 'bx if an
invalid digit is found. A warning is printed for this case.
It simplifies the system task/functions error/warning messages.
It removes the signed flag for the bin and dec string conversions.
This was not being used (was always false) and the new negative
value support makes this obsolete.
Add support for a real variable to handle Bin, Oct, Dec and Hex
strings. They are converted into a vvp_vector4_t which is then
converted to a real value.
Add support for setting a bit based value using a real value.
Removed an unneeded rfp signal in vpip_make_reg()
2008-11-13 22:28:19 +01:00
|
|
|
vpi_printf("WARNING: %s:%d: ", vpi_get_str(vpiFile, callh),
|
2008-06-14 05:46:18 +02:00
|
|
|
(int)vpi_get(vpiLineNo, callh));
|
2008-06-17 01:25:37 +02:00
|
|
|
vpi_printf("%s's file name argument is not a valid string.\n",
|
2008-06-14 05:46:18 +02:00
|
|
|
name);
|
|
|
|
|
fail = 1;
|
2005-01-09 21:12:22 +01:00
|
|
|
if (mode) free(mode_string);
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-17 01:25:37 +02:00
|
|
|
/*
|
|
|
|
|
* Verify that the file name is composed of only printable
|
|
|
|
|
* characters.
|
|
|
|
|
*/
|
2008-09-30 03:06:47 +02:00
|
|
|
len = strlen(val.value.str);
|
2008-06-17 01:25:37 +02:00
|
|
|
for (idx = 0; idx < len; idx++) {
|
|
|
|
|
if (! isprint(val.value.str[idx])) {
|
|
|
|
|
char msg [64];
|
Rework $plusarg routines.
This patch addresses a number of issues:
Rewrote the $test$plusargs and $value$plusargs routines to have
better error/warning messages, to support runtime strings, to
correctly load bit based values (truncating, padding, negative
value), added support for the real formats using strtod() and
added "x/X" as an alias for "h/H" to match the other part of
Icarus.
Rewrite the vpip_{bin,oct,hex}_str_to_vec4 routines to ignore
embedded "_" characters. Add support for a negative value and
set the entire value to 'bx if an invalid digit is found. A
warning is printed for this case.
Rewrite vpip_dec_str_to_vec4 to ignore embedded "_" characters,
to support a single "x" or "z" constant and to return 'bx if an
invalid digit is found. A warning is printed for this case.
It simplifies the system task/functions error/warning messages.
It removes the signed flag for the bin and dec string conversions.
This was not being used (was always false) and the new negative
value support makes this obsolete.
Add support for a real variable to handle Bin, Oct, Dec and Hex
strings. They are converted into a vvp_vector4_t which is then
converted to a real value.
Add support for setting a bit based value using a real value.
Removed an unneeded rfp signal in vpip_make_reg()
2008-11-13 22:28:19 +01:00
|
|
|
snprintf(msg, 64, "WARNING: %s:%d:",
|
2008-06-17 01:25:37 +02:00
|
|
|
vpi_get_str(vpiFile, callh),
|
|
|
|
|
(int)vpi_get(vpiLineNo, callh));
|
|
|
|
|
vpi_printf("%s %s's file name argument contains non-"
|
|
|
|
|
"printable characters.\n", msg, name);
|
2008-06-20 19:12:17 +02:00
|
|
|
vpi_printf("%*s \"%s\"\n", (int) strlen(msg), " ", val.value.str);
|
2008-06-17 01:25:37 +02:00
|
|
|
fail = 1;
|
|
|
|
|
if (mode) free(mode_string);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
/* If either the mode or file name are not valid just return. */
|
|
|
|
|
if (fail) return 0;
|
|
|
|
|
|
|
|
|
|
val.format = vpiIntVal;
|
2003-10-30 04:43:19 +01:00
|
|
|
if (mode) {
|
2008-06-14 05:46:18 +02:00
|
|
|
val.value.integer = vpi_fopen(val.value.str, mode_string);
|
2003-10-30 04:43:19 +01:00
|
|
|
free(mode_string);
|
|
|
|
|
} else
|
2008-06-14 05:46:18 +02:00
|
|
|
val.value.integer = vpi_mcd_open(val.value.str);
|
2003-10-30 04:43:19 +01:00
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
vpi_put_value(callh, &val, 0, vpiNoDelay);
|
2003-10-30 04:43:19 +01:00
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2007-10-11 18:32:23 +02:00
|
|
|
/*
|
2007-10-24 19:14:10 +02:00
|
|
|
* Implement the $fopenr(), $fopenw() and $fopena() system functions
|
2007-10-11 18:32:23 +02:00
|
|
|
* from Chris Spear's File I/O for Verilog.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
static PLI_INT32 sys_fopenrwa_calltf(PLI_BYTE8*name)
|
|
|
|
|
{
|
|
|
|
|
vpiHandle callh = vpi_handle(vpiSysTfCall, 0);
|
|
|
|
|
vpiHandle argv = vpi_iterate(vpiArgument, callh);
|
|
|
|
|
vpiHandle file = vpi_scan(argv);
|
2008-06-14 05:46:18 +02:00
|
|
|
s_vpi_value val;
|
|
|
|
|
char *mode;
|
2008-09-30 03:06:47 +02:00
|
|
|
unsigned idx, len;
|
|
|
|
|
|
|
|
|
|
vpi_free_object(argv);
|
2008-06-14 05:46:18 +02:00
|
|
|
|
|
|
|
|
/* Get the mode. */
|
2007-10-11 18:32:23 +02:00
|
|
|
mode = name + strlen(name) - 1;
|
|
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
/* Get the filename. */
|
2007-10-11 18:32:23 +02:00
|
|
|
val.format = vpiStringVal;
|
|
|
|
|
vpi_get_value(file, &val);
|
2008-06-14 05:46:18 +02:00
|
|
|
|
|
|
|
|
/* Verify that we have a string and that it is not NULL. */
|
|
|
|
|
if (val.format != vpiStringVal || !*(val.value.str)) {
|
Rework $plusarg routines.
This patch addresses a number of issues:
Rewrote the $test$plusargs and $value$plusargs routines to have
better error/warning messages, to support runtime strings, to
correctly load bit based values (truncating, padding, negative
value), added support for the real formats using strtod() and
added "x/X" as an alias for "h/H" to match the other part of
Icarus.
Rewrite the vpip_{bin,oct,hex}_str_to_vec4 routines to ignore
embedded "_" characters. Add support for a negative value and
set the entire value to 'bx if an invalid digit is found. A
warning is printed for this case.
Rewrite vpip_dec_str_to_vec4 to ignore embedded "_" characters,
to support a single "x" or "z" constant and to return 'bx if an
invalid digit is found. A warning is printed for this case.
It simplifies the system task/functions error/warning messages.
It removes the signed flag for the bin and dec string conversions.
This was not being used (was always false) and the new negative
value support makes this obsolete.
Add support for a real variable to handle Bin, Oct, Dec and Hex
strings. They are converted into a vvp_vector4_t which is then
converted to a real value.
Add support for setting a bit based value using a real value.
Removed an unneeded rfp signal in vpip_make_reg()
2008-11-13 22:28:19 +01:00
|
|
|
vpi_printf("WARNING: %s:%d: ", vpi_get_str(vpiFile, callh),
|
2008-06-14 05:46:18 +02:00
|
|
|
(int)vpi_get(vpiLineNo, callh));
|
2008-06-17 01:25:37 +02:00
|
|
|
vpi_printf("%s's file name argument is not a valid string.\n",
|
2008-06-14 05:46:18 +02:00
|
|
|
name);
|
2007-10-11 18:32:23 +02:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-17 01:25:37 +02:00
|
|
|
/*
|
|
|
|
|
* Verify that the file name is composed of only printable
|
|
|
|
|
* characters.
|
|
|
|
|
*/
|
2008-09-30 03:06:47 +02:00
|
|
|
len = strlen(val.value.str);
|
2008-06-17 01:25:37 +02:00
|
|
|
for (idx = 0; idx < len; idx++) {
|
|
|
|
|
if (! isprint(val.value.str[idx])) {
|
|
|
|
|
char msg [64];
|
Rework $plusarg routines.
This patch addresses a number of issues:
Rewrote the $test$plusargs and $value$plusargs routines to have
better error/warning messages, to support runtime strings, to
correctly load bit based values (truncating, padding, negative
value), added support for the real formats using strtod() and
added "x/X" as an alias for "h/H" to match the other part of
Icarus.
Rewrite the vpip_{bin,oct,hex}_str_to_vec4 routines to ignore
embedded "_" characters. Add support for a negative value and
set the entire value to 'bx if an invalid digit is found. A
warning is printed for this case.
Rewrite vpip_dec_str_to_vec4 to ignore embedded "_" characters,
to support a single "x" or "z" constant and to return 'bx if an
invalid digit is found. A warning is printed for this case.
It simplifies the system task/functions error/warning messages.
It removes the signed flag for the bin and dec string conversions.
This was not being used (was always false) and the new negative
value support makes this obsolete.
Add support for a real variable to handle Bin, Oct, Dec and Hex
strings. They are converted into a vvp_vector4_t which is then
converted to a real value.
Add support for setting a bit based value using a real value.
Removed an unneeded rfp signal in vpip_make_reg()
2008-11-13 22:28:19 +01:00
|
|
|
snprintf(msg, 64, "WARNING: %s:%d:",
|
2008-06-17 01:25:37 +02:00
|
|
|
vpi_get_str(vpiFile, callh),
|
|
|
|
|
(int)vpi_get(vpiLineNo, callh));
|
|
|
|
|
vpi_printf("%s %s's file name argument contains non-"
|
|
|
|
|
"printable characters.\n", msg, name);
|
2008-06-20 19:12:17 +02:00
|
|
|
vpi_printf("%*s \"%s\"\n", (int) strlen(msg), " ", val.value.str);
|
2008-06-17 01:25:37 +02:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
/* Open the file and return the result. */
|
2007-10-11 18:32:23 +02:00
|
|
|
val.format = vpiIntVal;
|
|
|
|
|
val.value.integer = vpi_fopen(val.value.str, mode);
|
|
|
|
|
vpi_put_value(callh, &val, 0, vpiNoDelay);
|
2008-06-14 05:46:18 +02:00
|
|
|
|
2007-10-11 18:32:23 +02:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2003-10-30 04:43:19 +01:00
|
|
|
/*
|
|
|
|
|
* Implement $fclose system function
|
|
|
|
|
*/
|
2007-03-14 05:05:51 +01:00
|
|
|
static PLI_INT32 sys_fclose_calltf(PLI_BYTE8*name)
|
2007-10-24 21:56:22 +02:00
|
|
|
{
|
|
|
|
|
vpiHandle callh = vpi_handle(vpiSysTfCall, 0);
|
|
|
|
|
vpiHandle argv = vpi_iterate(vpiArgument, callh);
|
2008-06-14 05:46:18 +02:00
|
|
|
vpiHandle fd = vpi_scan(argv);
|
|
|
|
|
s_vpi_value val;
|
|
|
|
|
PLI_UINT32 fd_mcd;
|
2007-10-24 21:56:22 +02:00
|
|
|
|
2008-09-30 03:06:47 +02:00
|
|
|
vpi_free_object(argv);
|
|
|
|
|
|
2009-01-17 01:12:44 +01:00
|
|
|
/* Get the file/MC descriptor and verify that it is valid. */
|
2008-06-14 05:46:18 +02:00
|
|
|
val.format = vpiIntVal;
|
|
|
|
|
vpi_get_value(fd, &val);
|
|
|
|
|
fd_mcd = val.value.integer;
|
|
|
|
|
|
2009-01-17 01:12:44 +01:00
|
|
|
if ((! IS_MCD(fd_mcd) && vpi_get_file(fd_mcd) == NULL) ||
|
|
|
|
|
( IS_MCD(fd_mcd) && my_mcd_printf(fd_mcd, "") == EOF)) {
|
|
|
|
|
vpi_printf("WARNING: %s:%d: ", vpi_get_str(vpiFile, callh),
|
|
|
|
|
(int)vpi_get(vpiLineNo, callh));
|
|
|
|
|
vpi_printf("invalid file descriptor/MCD (0x%x) given to %s.\n",
|
|
|
|
|
fd_mcd, name);
|
|
|
|
|
vpi_free_object(argv);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* We need to cancel any active $fstrobe()'s for this FD/MCD. */
|
2008-06-14 05:46:18 +02:00
|
|
|
vpi_mcd_close(fd_mcd);
|
2007-10-24 21:56:22 +02:00
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2009-01-17 01:12:44 +01:00
|
|
|
/*
|
|
|
|
|
* Implement $fflush system function
|
|
|
|
|
*/
|
2007-03-14 05:05:51 +01:00
|
|
|
static PLI_INT32 sys_fflush_calltf(PLI_BYTE8*name)
|
2003-11-07 20:40:05 +01:00
|
|
|
{
|
2007-10-24 21:56:22 +02:00
|
|
|
vpiHandle callh = vpi_handle(vpiSysTfCall, 0);
|
|
|
|
|
vpiHandle argv = vpi_iterate(vpiArgument, callh);
|
2008-06-14 05:46:18 +02:00
|
|
|
vpiHandle arg;
|
2007-10-24 21:56:22 +02:00
|
|
|
s_vpi_value val;
|
2008-06-14 05:46:18 +02:00
|
|
|
PLI_UINT32 fd_mcd;
|
2007-10-24 21:56:22 +02:00
|
|
|
FILE *fp;
|
|
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
/* If we have no argument then flush all the streams. */
|
2007-10-24 21:56:22 +02:00
|
|
|
if (argv == 0) {
|
|
|
|
|
fflush(NULL);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2009-01-17 01:12:44 +01:00
|
|
|
/* Get the file/MC descriptor and verify that it is valid. */
|
2008-06-14 05:46:18 +02:00
|
|
|
arg = vpi_scan(argv);
|
2007-10-24 21:56:22 +02:00
|
|
|
vpi_free_object(argv);
|
|
|
|
|
val.format = vpiIntVal;
|
2008-06-14 05:46:18 +02:00
|
|
|
vpi_get_value(arg, &val);
|
2007-10-24 21:56:22 +02:00
|
|
|
fd_mcd = val.value.integer;
|
|
|
|
|
|
2009-01-17 01:12:44 +01:00
|
|
|
if ((! IS_MCD(fd_mcd) && vpi_get_file(fd_mcd) == NULL) ||
|
|
|
|
|
( IS_MCD(fd_mcd) && my_mcd_printf(fd_mcd, "") == EOF)) {
|
|
|
|
|
vpi_printf("WARNING: %s:%d: ", vpi_get_str(vpiFile, callh),
|
|
|
|
|
(int)vpi_get(vpiLineNo, callh));
|
|
|
|
|
vpi_printf("invalid file descriptor/MCD (0x%x) given to %s.\n",
|
|
|
|
|
fd_mcd, name);
|
|
|
|
|
vpi_free_object(argv);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2007-10-24 21:56:22 +02:00
|
|
|
if (IS_MCD(fd_mcd)) {
|
|
|
|
|
vpi_mcd_flush(fd_mcd);
|
|
|
|
|
} else {
|
2008-06-14 05:46:18 +02:00
|
|
|
/* If we have a valid file descriptor flush the file. */
|
2007-10-24 21:56:22 +02:00
|
|
|
fp = vpi_get_file(fd_mcd);
|
|
|
|
|
if (fp) fflush(fp);
|
|
|
|
|
}
|
|
|
|
|
|
2003-11-07 20:40:05 +01:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2007-03-14 05:05:51 +01:00
|
|
|
static PLI_INT32 sys_fputc_calltf(PLI_BYTE8*name)
|
2003-10-30 04:43:19 +01:00
|
|
|
{
|
2008-06-14 05:46:18 +02:00
|
|
|
vpiHandle callh = vpi_handle(vpiSysTfCall, 0);
|
|
|
|
|
vpiHandle argv = vpi_iterate(vpiArgument, callh);
|
|
|
|
|
vpiHandle arg;
|
|
|
|
|
s_vpi_value val;
|
|
|
|
|
PLI_UINT32 fd_mcd;
|
2003-10-30 04:43:19 +01:00
|
|
|
FILE *fp;
|
2008-06-14 05:46:18 +02:00
|
|
|
unsigned char chr;
|
|
|
|
|
(void) name; /* Not used! */
|
2003-10-30 04:43:19 +01:00
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
/* Get the character. */
|
|
|
|
|
arg = vpi_scan(argv);
|
|
|
|
|
val.format = vpiIntVal;
|
|
|
|
|
vpi_get_value(arg, &val);
|
|
|
|
|
chr = val.value.integer;
|
2003-10-30 04:43:19 +01:00
|
|
|
|
|
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
/* Get the file/MC descriptor. */
|
|
|
|
|
arg = vpi_scan(argv);
|
|
|
|
|
vpi_free_object(argv);
|
|
|
|
|
val.format = vpiIntVal;
|
|
|
|
|
vpi_get_value(arg, &val);
|
|
|
|
|
fd_mcd = val.value.integer;
|
2003-10-30 04:43:19 +01:00
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
/* Put the character and return the result. */
|
|
|
|
|
fp = vpi_get_file(fd_mcd);
|
|
|
|
|
val.format = vpiIntVal;
|
|
|
|
|
if (!fp || IS_MCD(fd_mcd)) {
|
Rework $plusarg routines.
This patch addresses a number of issues:
Rewrote the $test$plusargs and $value$plusargs routines to have
better error/warning messages, to support runtime strings, to
correctly load bit based values (truncating, padding, negative
value), added support for the real formats using strtod() and
added "x/X" as an alias for "h/H" to match the other part of
Icarus.
Rewrite the vpip_{bin,oct,hex}_str_to_vec4 routines to ignore
embedded "_" characters. Add support for a negative value and
set the entire value to 'bx if an invalid digit is found. A
warning is printed for this case.
Rewrite vpip_dec_str_to_vec4 to ignore embedded "_" characters,
to support a single "x" or "z" constant and to return 'bx if an
invalid digit is found. A warning is printed for this case.
It simplifies the system task/functions error/warning messages.
It removes the signed flag for the bin and dec string conversions.
This was not being used (was always false) and the new negative
value support makes this obsolete.
Add support for a real variable to handle Bin, Oct, Dec and Hex
strings. They are converted into a vvp_vector4_t which is then
converted to a real value.
Add support for setting a bit based value using a real value.
Removed an unneeded rfp signal in vpip_make_reg()
2008-11-13 22:28:19 +01:00
|
|
|
vpi_printf("WARNING: %s:%d: ", vpi_get_str(vpiFile, callh),
|
2008-06-14 05:46:18 +02:00
|
|
|
(int)vpi_get(vpiLineNo, callh));
|
|
|
|
|
vpi_printf("invalid file descriptor (0x%x) given to %s.\n", fd_mcd,
|
|
|
|
|
name);
|
|
|
|
|
val.value.integer = EOF;
|
|
|
|
|
} else
|
|
|
|
|
val.value.integer = fputc(chr, fp);
|
|
|
|
|
vpi_put_value(callh, &val, 0, vpiNoDelay);
|
2003-10-30 04:43:19 +01:00
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2007-03-14 05:05:51 +01:00
|
|
|
static PLI_INT32 sys_fgets_compiletf(PLI_BYTE8*name)
|
2004-02-19 22:33:13 +01:00
|
|
|
{
|
2008-06-14 05:46:18 +02:00
|
|
|
vpiHandle callh = vpi_handle(vpiSysTfCall, 0);
|
|
|
|
|
vpiHandle argv = vpi_iterate(vpiArgument, callh);
|
|
|
|
|
vpiHandle arg;
|
2004-02-19 22:33:13 +01:00
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
/*
|
|
|
|
|
* Check that there are two arguments and that the first is a
|
|
|
|
|
* register and that the second is numeric.
|
|
|
|
|
*/
|
|
|
|
|
if (argv == 0) {
|
Rework $plusarg routines.
This patch addresses a number of issues:
Rewrote the $test$plusargs and $value$plusargs routines to have
better error/warning messages, to support runtime strings, to
correctly load bit based values (truncating, padding, negative
value), added support for the real formats using strtod() and
added "x/X" as an alias for "h/H" to match the other part of
Icarus.
Rewrite the vpip_{bin,oct,hex}_str_to_vec4 routines to ignore
embedded "_" characters. Add support for a negative value and
set the entire value to 'bx if an invalid digit is found. A
warning is printed for this case.
Rewrite vpip_dec_str_to_vec4 to ignore embedded "_" characters,
to support a single "x" or "z" constant and to return 'bx if an
invalid digit is found. A warning is printed for this case.
It simplifies the system task/functions error/warning messages.
It removes the signed flag for the bin and dec string conversions.
This was not being used (was always false) and the new negative
value support makes this obsolete.
Add support for a real variable to handle Bin, Oct, Dec and Hex
strings. They are converted into a vvp_vector4_t which is then
converted to a real value.
Add support for setting a bit based value using a real value.
Removed an unneeded rfp signal in vpip_make_reg()
2008-11-13 22:28:19 +01:00
|
|
|
vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh),
|
2008-06-14 05:46:18 +02:00
|
|
|
(int)vpi_get(vpiLineNo, callh));
|
|
|
|
|
vpi_printf("%s requires two arguments.\n", name);
|
|
|
|
|
vpi_control(vpiFinish, 1);
|
2004-02-19 22:33:13 +01:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
if (vpi_get(vpiType, vpi_scan(argv)) != vpiReg) {
|
Rework $plusarg routines.
This patch addresses a number of issues:
Rewrote the $test$plusargs and $value$plusargs routines to have
better error/warning messages, to support runtime strings, to
correctly load bit based values (truncating, padding, negative
value), added support for the real formats using strtod() and
added "x/X" as an alias for "h/H" to match the other part of
Icarus.
Rewrite the vpip_{bin,oct,hex}_str_to_vec4 routines to ignore
embedded "_" characters. Add support for a negative value and
set the entire value to 'bx if an invalid digit is found. A
warning is printed for this case.
Rewrite vpip_dec_str_to_vec4 to ignore embedded "_" characters,
to support a single "x" or "z" constant and to return 'bx if an
invalid digit is found. A warning is printed for this case.
It simplifies the system task/functions error/warning messages.
It removes the signed flag for the bin and dec string conversions.
This was not being used (was always false) and the new negative
value support makes this obsolete.
Add support for a real variable to handle Bin, Oct, Dec and Hex
strings. They are converted into a vvp_vector4_t which is then
converted to a real value.
Add support for setting a bit based value using a real value.
Removed an unneeded rfp signal in vpip_make_reg()
2008-11-13 22:28:19 +01:00
|
|
|
vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh),
|
2008-06-14 05:46:18 +02:00
|
|
|
(int)vpi_get(vpiLineNo, callh));
|
|
|
|
|
vpi_printf("%s's first argument must be a reg.\n", name);
|
|
|
|
|
vpi_control(vpiFinish, 1);
|
|
|
|
|
}
|
2004-02-19 22:33:13 +01:00
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
arg = vpi_scan(argv);
|
|
|
|
|
if (! arg) {
|
Rework $plusarg routines.
This patch addresses a number of issues:
Rewrote the $test$plusargs and $value$plusargs routines to have
better error/warning messages, to support runtime strings, to
correctly load bit based values (truncating, padding, negative
value), added support for the real formats using strtod() and
added "x/X" as an alias for "h/H" to match the other part of
Icarus.
Rewrite the vpip_{bin,oct,hex}_str_to_vec4 routines to ignore
embedded "_" characters. Add support for a negative value and
set the entire value to 'bx if an invalid digit is found. A
warning is printed for this case.
Rewrite vpip_dec_str_to_vec4 to ignore embedded "_" characters,
to support a single "x" or "z" constant and to return 'bx if an
invalid digit is found. A warning is printed for this case.
It simplifies the system task/functions error/warning messages.
It removes the signed flag for the bin and dec string conversions.
This was not being used (was always false) and the new negative
value support makes this obsolete.
Add support for a real variable to handle Bin, Oct, Dec and Hex
strings. They are converted into a vvp_vector4_t which is then
converted to a real value.
Add support for setting a bit based value using a real value.
Removed an unneeded rfp signal in vpip_make_reg()
2008-11-13 22:28:19 +01:00
|
|
|
vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh),
|
2008-06-14 05:46:18 +02:00
|
|
|
(int)vpi_get(vpiLineNo, callh));
|
|
|
|
|
vpi_printf("%s requires a second (numeric) argument.\n", name);
|
|
|
|
|
vpi_control(vpiFinish, 1);
|
2004-02-19 22:33:13 +01:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
if (! is_numeric_obj(arg)) {
|
Rework $plusarg routines.
This patch addresses a number of issues:
Rewrote the $test$plusargs and $value$plusargs routines to have
better error/warning messages, to support runtime strings, to
correctly load bit based values (truncating, padding, negative
value), added support for the real formats using strtod() and
added "x/X" as an alias for "h/H" to match the other part of
Icarus.
Rewrite the vpip_{bin,oct,hex}_str_to_vec4 routines to ignore
embedded "_" characters. Add support for a negative value and
set the entire value to 'bx if an invalid digit is found. A
warning is printed for this case.
Rewrite vpip_dec_str_to_vec4 to ignore embedded "_" characters,
to support a single "x" or "z" constant and to return 'bx if an
invalid digit is found. A warning is printed for this case.
It simplifies the system task/functions error/warning messages.
It removes the signed flag for the bin and dec string conversions.
This was not being used (was always false) and the new negative
value support makes this obsolete.
Add support for a real variable to handle Bin, Oct, Dec and Hex
strings. They are converted into a vvp_vector4_t which is then
converted to a real value.
Add support for setting a bit based value using a real value.
Removed an unneeded rfp signal in vpip_make_reg()
2008-11-13 22:28:19 +01:00
|
|
|
vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh),
|
2008-06-14 05:46:18 +02:00
|
|
|
(int)vpi_get(vpiLineNo, callh));
|
|
|
|
|
vpi_printf("%s's second argument must be numeric.\n", name);
|
|
|
|
|
vpi_control(vpiFinish, 1);
|
2004-02-19 22:33:13 +01:00
|
|
|
}
|
|
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
/* Make sure there are no extra arguments. */
|
|
|
|
|
if (vpi_scan(argv) != 0) {
|
|
|
|
|
char msg [64];
|
2008-09-30 03:06:47 +02:00
|
|
|
unsigned argc;
|
|
|
|
|
|
Rework $plusarg routines.
This patch addresses a number of issues:
Rewrote the $test$plusargs and $value$plusargs routines to have
better error/warning messages, to support runtime strings, to
correctly load bit based values (truncating, padding, negative
value), added support for the real formats using strtod() and
added "x/X" as an alias for "h/H" to match the other part of
Icarus.
Rewrite the vpip_{bin,oct,hex}_str_to_vec4 routines to ignore
embedded "_" characters. Add support for a negative value and
set the entire value to 'bx if an invalid digit is found. A
warning is printed for this case.
Rewrite vpip_dec_str_to_vec4 to ignore embedded "_" characters,
to support a single "x" or "z" constant and to return 'bx if an
invalid digit is found. A warning is printed for this case.
It simplifies the system task/functions error/warning messages.
It removes the signed flag for the bin and dec string conversions.
This was not being used (was always false) and the new negative
value support makes this obsolete.
Add support for a real variable to handle Bin, Oct, Dec and Hex
strings. They are converted into a vvp_vector4_t which is then
converted to a real value.
Add support for setting a bit based value using a real value.
Removed an unneeded rfp signal in vpip_make_reg()
2008-11-13 22:28:19 +01:00
|
|
|
snprintf(msg, 64, "ERROR: %s:%d:",
|
2008-06-14 05:46:18 +02:00
|
|
|
vpi_get_str(vpiFile, callh),
|
|
|
|
|
(int)vpi_get(vpiLineNo, callh));
|
|
|
|
|
|
2008-09-30 03:06:47 +02:00
|
|
|
argc = 1;
|
2008-06-14 05:46:18 +02:00
|
|
|
while (vpi_scan(argv)) argc += 1;
|
|
|
|
|
|
|
|
|
|
vpi_printf("%s %s takes two arguments.\n", msg, name);
|
|
|
|
|
vpi_printf("%*s Found %u extra argument%s.\n",
|
2008-06-20 19:12:17 +02:00
|
|
|
(int) strlen(msg), " ", argc, argc == 1 ? "" : "s");
|
2008-06-14 05:46:18 +02:00
|
|
|
vpi_control(vpiFinish, 1);
|
|
|
|
|
}
|
2004-02-19 22:33:13 +01:00
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2007-03-14 05:05:51 +01:00
|
|
|
static PLI_INT32 sys_fgets_calltf(PLI_BYTE8*name)
|
2004-02-19 22:33:13 +01:00
|
|
|
{
|
2008-06-14 05:46:18 +02:00
|
|
|
vpiHandle callh = vpi_handle(vpiSysTfCall, 0);
|
|
|
|
|
vpiHandle argv = vpi_iterate(vpiArgument, callh);
|
|
|
|
|
vpiHandle regh;
|
|
|
|
|
vpiHandle arg;
|
|
|
|
|
s_vpi_value val;
|
|
|
|
|
PLI_UINT32 fd_mcd;
|
|
|
|
|
FILE *fp;
|
|
|
|
|
PLI_INT32 reg_size;
|
|
|
|
|
char*text;
|
|
|
|
|
(void) name; /* Not used! */
|
|
|
|
|
|
|
|
|
|
/* Get the register handle. */
|
|
|
|
|
regh = vpi_scan(argv);
|
2004-02-19 22:33:13 +01:00
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
/* Get the file/MCD descriptor. */
|
|
|
|
|
arg = vpi_scan(argv);
|
|
|
|
|
vpi_free_object(argv);
|
|
|
|
|
val.format = vpiIntVal;
|
|
|
|
|
vpi_get_value(arg, &val);
|
|
|
|
|
fd_mcd = val.value.integer;
|
2004-02-19 22:33:13 +01:00
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
/* Return zero if this is not a valid fd. */
|
|
|
|
|
fp = vpi_get_file(fd_mcd);
|
|
|
|
|
if (!fp || IS_MCD(fd_mcd)) {
|
Rework $plusarg routines.
This patch addresses a number of issues:
Rewrote the $test$plusargs and $value$plusargs routines to have
better error/warning messages, to support runtime strings, to
correctly load bit based values (truncating, padding, negative
value), added support for the real formats using strtod() and
added "x/X" as an alias for "h/H" to match the other part of
Icarus.
Rewrite the vpip_{bin,oct,hex}_str_to_vec4 routines to ignore
embedded "_" characters. Add support for a negative value and
set the entire value to 'bx if an invalid digit is found. A
warning is printed for this case.
Rewrite vpip_dec_str_to_vec4 to ignore embedded "_" characters,
to support a single "x" or "z" constant and to return 'bx if an
invalid digit is found. A warning is printed for this case.
It simplifies the system task/functions error/warning messages.
It removes the signed flag for the bin and dec string conversions.
This was not being used (was always false) and the new negative
value support makes this obsolete.
Add support for a real variable to handle Bin, Oct, Dec and Hex
strings. They are converted into a vvp_vector4_t which is then
converted to a real value.
Add support for setting a bit based value using a real value.
Removed an unneeded rfp signal in vpip_make_reg()
2008-11-13 22:28:19 +01:00
|
|
|
vpi_printf("WARNING: %s:%d: ", vpi_get_str(vpiFile, callh),
|
2008-06-14 05:46:18 +02:00
|
|
|
(int)vpi_get(vpiLineNo, callh));
|
|
|
|
|
vpi_printf("invalid file descriptor (0x%x) given to %s.\n", fd_mcd,
|
|
|
|
|
name);
|
|
|
|
|
val.format = vpiIntVal;
|
|
|
|
|
val.value.integer = 0;
|
|
|
|
|
vpi_put_value(callh, &val, 0, vpiNoDelay);
|
2004-02-19 22:33:13 +01:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
/* Get the register size in bytes and allocate the buffer. */
|
|
|
|
|
reg_size = vpi_get(vpiSize, regh) / 8;
|
|
|
|
|
text = malloc(reg_size + 1);
|
2004-02-19 22:33:13 +01:00
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
/* Read in the bytes. Return 0 if there was an error. */
|
|
|
|
|
if (fgets(text, reg_size+1, fp) == 0) {
|
|
|
|
|
val.format = vpiIntVal;
|
|
|
|
|
val.value.integer = 0;
|
|
|
|
|
vpi_put_value(callh, &val, 0, vpiNoDelay);
|
|
|
|
|
free(text);
|
2003-10-30 04:43:19 +01:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
/* Return the number of character read. */
|
|
|
|
|
val.format = vpiIntVal;
|
|
|
|
|
val.value.integer = strlen(text);
|
|
|
|
|
vpi_put_value(callh, &val, 0, vpiNoDelay);
|
2003-10-30 04:43:19 +01:00
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
/* Return the characters to the register. */
|
|
|
|
|
val.format = vpiStringVal;
|
|
|
|
|
val.value.str = text;
|
|
|
|
|
vpi_put_value(regh, &val, 0, vpiNoDelay);
|
|
|
|
|
free(text);
|
2008-05-14 23:59:38 +02:00
|
|
|
|
2003-10-30 04:43:19 +01:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2007-03-14 05:05:51 +01:00
|
|
|
static PLI_INT32 sys_ungetc_calltf(PLI_BYTE8*name)
|
2003-10-30 04:43:19 +01:00
|
|
|
{
|
2008-06-14 05:46:18 +02:00
|
|
|
vpiHandle callh = vpi_handle(vpiSysTfCall, 0);
|
|
|
|
|
vpiHandle argv = vpi_iterate(vpiArgument, callh);
|
|
|
|
|
vpiHandle arg;
|
|
|
|
|
s_vpi_value val;
|
|
|
|
|
PLI_UINT32 fd_mcd;
|
2003-10-30 04:43:19 +01:00
|
|
|
FILE *fp;
|
2008-06-14 05:46:18 +02:00
|
|
|
unsigned char chr;
|
|
|
|
|
(void) name; /* Not used! */
|
2003-10-30 04:43:19 +01:00
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
/* Get the character. */
|
|
|
|
|
arg = vpi_scan(argv);
|
2008-05-14 23:59:38 +02:00
|
|
|
val.format = vpiIntVal;
|
2008-06-14 05:46:18 +02:00
|
|
|
vpi_get_value(arg, &val);
|
|
|
|
|
chr = val.value.integer;
|
2008-05-14 23:59:38 +02:00
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
/* Get the file/MC descriptor. */
|
|
|
|
|
arg = vpi_scan(argv);
|
|
|
|
|
vpi_free_object(argv);
|
2008-05-14 23:59:38 +02:00
|
|
|
val.format = vpiIntVal;
|
2008-06-14 05:46:18 +02:00
|
|
|
vpi_get_value(arg, &val);
|
|
|
|
|
fd_mcd = val.value.integer;
|
2003-10-30 04:43:19 +01:00
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
/* Return EOF if this is not a valid fd. */
|
|
|
|
|
fp = vpi_get_file(fd_mcd);
|
|
|
|
|
if (!fp || IS_MCD(fd_mcd)) {
|
Rework $plusarg routines.
This patch addresses a number of issues:
Rewrote the $test$plusargs and $value$plusargs routines to have
better error/warning messages, to support runtime strings, to
correctly load bit based values (truncating, padding, negative
value), added support for the real formats using strtod() and
added "x/X" as an alias for "h/H" to match the other part of
Icarus.
Rewrite the vpip_{bin,oct,hex}_str_to_vec4 routines to ignore
embedded "_" characters. Add support for a negative value and
set the entire value to 'bx if an invalid digit is found. A
warning is printed for this case.
Rewrite vpip_dec_str_to_vec4 to ignore embedded "_" characters,
to support a single "x" or "z" constant and to return 'bx if an
invalid digit is found. A warning is printed for this case.
It simplifies the system task/functions error/warning messages.
It removes the signed flag for the bin and dec string conversions.
This was not being used (was always false) and the new negative
value support makes this obsolete.
Add support for a real variable to handle Bin, Oct, Dec and Hex
strings. They are converted into a vvp_vector4_t which is then
converted to a real value.
Add support for setting a bit based value using a real value.
Removed an unneeded rfp signal in vpip_make_reg()
2008-11-13 22:28:19 +01:00
|
|
|
vpi_printf("WARNING: %s:%d: ", vpi_get_str(vpiFile, callh),
|
2008-06-14 05:46:18 +02:00
|
|
|
(int)vpi_get(vpiLineNo, callh));
|
|
|
|
|
vpi_printf("invalid file descriptor (0x%x) given to %s.\n", fd_mcd,
|
|
|
|
|
name);
|
|
|
|
|
val.format = vpiIntVal;
|
|
|
|
|
val.value.integer = EOF;
|
|
|
|
|
vpi_put_value(callh, &val, 0, vpiNoDelay);
|
2003-10-30 04:43:19 +01:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
/* ungetc the character and return the result. */
|
|
|
|
|
val.format = vpiIntVal;
|
|
|
|
|
val.value.integer = ungetc(chr, fp);
|
|
|
|
|
vpi_put_value(callh, &val, 0, vpiNoDelay);
|
2003-10-30 04:43:19 +01:00
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
static PLI_INT32 sys_fseek_compiletf(PLI_BYTE8*name)
|
2007-10-23 23:37:04 +02:00
|
|
|
{
|
|
|
|
|
vpiHandle callh = vpi_handle(vpiSysTfCall, 0);
|
|
|
|
|
vpiHandle argv = vpi_iterate(vpiArgument, callh);
|
2008-06-14 05:46:18 +02:00
|
|
|
vpiHandle arg;
|
2007-10-23 23:37:04 +02:00
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
/* Check that there are three numeric arguments. */
|
2007-10-23 23:37:04 +02:00
|
|
|
if (argv == 0) {
|
Rework $plusarg routines.
This patch addresses a number of issues:
Rewrote the $test$plusargs and $value$plusargs routines to have
better error/warning messages, to support runtime strings, to
correctly load bit based values (truncating, padding, negative
value), added support for the real formats using strtod() and
added "x/X" as an alias for "h/H" to match the other part of
Icarus.
Rewrite the vpip_{bin,oct,hex}_str_to_vec4 routines to ignore
embedded "_" characters. Add support for a negative value and
set the entire value to 'bx if an invalid digit is found. A
warning is printed for this case.
Rewrite vpip_dec_str_to_vec4 to ignore embedded "_" characters,
to support a single "x" or "z" constant and to return 'bx if an
invalid digit is found. A warning is printed for this case.
It simplifies the system task/functions error/warning messages.
It removes the signed flag for the bin and dec string conversions.
This was not being used (was always false) and the new negative
value support makes this obsolete.
Add support for a real variable to handle Bin, Oct, Dec and Hex
strings. They are converted into a vvp_vector4_t which is then
converted to a real value.
Add support for setting a bit based value using a real value.
Removed an unneeded rfp signal in vpip_make_reg()
2008-11-13 22:28:19 +01:00
|
|
|
vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh),
|
2008-06-14 05:46:18 +02:00
|
|
|
(int)vpi_get(vpiLineNo, callh));
|
|
|
|
|
vpi_printf("%s requires three arguments.\n", name);
|
2007-10-23 23:37:04 +02:00
|
|
|
vpi_control(vpiFinish, 1);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2008-06-14 05:46:18 +02:00
|
|
|
|
|
|
|
|
/* Check that the first argument is numeric. */
|
|
|
|
|
if (! is_numeric_obj(vpi_scan(argv))) {
|
Rework $plusarg routines.
This patch addresses a number of issues:
Rewrote the $test$plusargs and $value$plusargs routines to have
better error/warning messages, to support runtime strings, to
correctly load bit based values (truncating, padding, negative
value), added support for the real formats using strtod() and
added "x/X" as an alias for "h/H" to match the other part of
Icarus.
Rewrite the vpip_{bin,oct,hex}_str_to_vec4 routines to ignore
embedded "_" characters. Add support for a negative value and
set the entire value to 'bx if an invalid digit is found. A
warning is printed for this case.
Rewrite vpip_dec_str_to_vec4 to ignore embedded "_" characters,
to support a single "x" or "z" constant and to return 'bx if an
invalid digit is found. A warning is printed for this case.
It simplifies the system task/functions error/warning messages.
It removes the signed flag for the bin and dec string conversions.
This was not being used (was always false) and the new negative
value support makes this obsolete.
Add support for a real variable to handle Bin, Oct, Dec and Hex
strings. They are converted into a vvp_vector4_t which is then
converted to a real value.
Add support for setting a bit based value using a real value.
Removed an unneeded rfp signal in vpip_make_reg()
2008-11-13 22:28:19 +01:00
|
|
|
vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh),
|
2008-06-14 05:46:18 +02:00
|
|
|
(int)vpi_get(vpiLineNo, callh));
|
|
|
|
|
vpi_printf("%s's first argument must be numeric.\n", name);
|
|
|
|
|
vpi_control(vpiFinish, 1);
|
2007-10-23 23:37:04 +02:00
|
|
|
}
|
|
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
/* Check that the second argument exists and is numeric. */
|
|
|
|
|
arg = vpi_scan(argv);
|
|
|
|
|
if (! arg) {
|
Rework $plusarg routines.
This patch addresses a number of issues:
Rewrote the $test$plusargs and $value$plusargs routines to have
better error/warning messages, to support runtime strings, to
correctly load bit based values (truncating, padding, negative
value), added support for the real formats using strtod() and
added "x/X" as an alias for "h/H" to match the other part of
Icarus.
Rewrite the vpip_{bin,oct,hex}_str_to_vec4 routines to ignore
embedded "_" characters. Add support for a negative value and
set the entire value to 'bx if an invalid digit is found. A
warning is printed for this case.
Rewrite vpip_dec_str_to_vec4 to ignore embedded "_" characters,
to support a single "x" or "z" constant and to return 'bx if an
invalid digit is found. A warning is printed for this case.
It simplifies the system task/functions error/warning messages.
It removes the signed flag for the bin and dec string conversions.
This was not being used (was always false) and the new negative
value support makes this obsolete.
Add support for a real variable to handle Bin, Oct, Dec and Hex
strings. They are converted into a vvp_vector4_t which is then
converted to a real value.
Add support for setting a bit based value using a real value.
Removed an unneeded rfp signal in vpip_make_reg()
2008-11-13 22:28:19 +01:00
|
|
|
vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh),
|
2008-06-14 05:46:18 +02:00
|
|
|
(int)vpi_get(vpiLineNo, callh));
|
|
|
|
|
vpi_printf("%s requires a second (numeric) argument.\n", name);
|
2007-10-23 23:37:04 +02:00
|
|
|
vpi_control(vpiFinish, 1);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
if (!arg || !is_numeric_obj(arg)) {
|
Rework $plusarg routines.
This patch addresses a number of issues:
Rewrote the $test$plusargs and $value$plusargs routines to have
better error/warning messages, to support runtime strings, to
correctly load bit based values (truncating, padding, negative
value), added support for the real formats using strtod() and
added "x/X" as an alias for "h/H" to match the other part of
Icarus.
Rewrite the vpip_{bin,oct,hex}_str_to_vec4 routines to ignore
embedded "_" characters. Add support for a negative value and
set the entire value to 'bx if an invalid digit is found. A
warning is printed for this case.
Rewrite vpip_dec_str_to_vec4 to ignore embedded "_" characters,
to support a single "x" or "z" constant and to return 'bx if an
invalid digit is found. A warning is printed for this case.
It simplifies the system task/functions error/warning messages.
It removes the signed flag for the bin and dec string conversions.
This was not being used (was always false) and the new negative
value support makes this obsolete.
Add support for a real variable to handle Bin, Oct, Dec and Hex
strings. They are converted into a vvp_vector4_t which is then
converted to a real value.
Add support for setting a bit based value using a real value.
Removed an unneeded rfp signal in vpip_make_reg()
2008-11-13 22:28:19 +01:00
|
|
|
vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh),
|
2008-06-14 05:46:18 +02:00
|
|
|
(int)vpi_get(vpiLineNo, callh));
|
|
|
|
|
vpi_printf("%s's second argument must be numeric.\n", name);
|
|
|
|
|
vpi_control(vpiFinish, 1);
|
|
|
|
|
}
|
2007-10-23 23:37:04 +02:00
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
/* Check that the third argument exists and is numeric. */
|
|
|
|
|
arg = vpi_scan(argv);
|
|
|
|
|
if (! arg) {
|
Rework $plusarg routines.
This patch addresses a number of issues:
Rewrote the $test$plusargs and $value$plusargs routines to have
better error/warning messages, to support runtime strings, to
correctly load bit based values (truncating, padding, negative
value), added support for the real formats using strtod() and
added "x/X" as an alias for "h/H" to match the other part of
Icarus.
Rewrite the vpip_{bin,oct,hex}_str_to_vec4 routines to ignore
embedded "_" characters. Add support for a negative value and
set the entire value to 'bx if an invalid digit is found. A
warning is printed for this case.
Rewrite vpip_dec_str_to_vec4 to ignore embedded "_" characters,
to support a single "x" or "z" constant and to return 'bx if an
invalid digit is found. A warning is printed for this case.
It simplifies the system task/functions error/warning messages.
It removes the signed flag for the bin and dec string conversions.
This was not being used (was always false) and the new negative
value support makes this obsolete.
Add support for a real variable to handle Bin, Oct, Dec and Hex
strings. They are converted into a vvp_vector4_t which is then
converted to a real value.
Add support for setting a bit based value using a real value.
Removed an unneeded rfp signal in vpip_make_reg()
2008-11-13 22:28:19 +01:00
|
|
|
vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh),
|
2008-06-14 05:46:18 +02:00
|
|
|
(int)vpi_get(vpiLineNo, callh));
|
|
|
|
|
vpi_printf("%s requires a third (numeric) argument.\n", name);
|
2007-10-23 23:37:04 +02:00
|
|
|
vpi_control(vpiFinish, 1);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
if (!arg || !is_numeric_obj(arg)) {
|
Rework $plusarg routines.
This patch addresses a number of issues:
Rewrote the $test$plusargs and $value$plusargs routines to have
better error/warning messages, to support runtime strings, to
correctly load bit based values (truncating, padding, negative
value), added support for the real formats using strtod() and
added "x/X" as an alias for "h/H" to match the other part of
Icarus.
Rewrite the vpip_{bin,oct,hex}_str_to_vec4 routines to ignore
embedded "_" characters. Add support for a negative value and
set the entire value to 'bx if an invalid digit is found. A
warning is printed for this case.
Rewrite vpip_dec_str_to_vec4 to ignore embedded "_" characters,
to support a single "x" or "z" constant and to return 'bx if an
invalid digit is found. A warning is printed for this case.
It simplifies the system task/functions error/warning messages.
It removes the signed flag for the bin and dec string conversions.
This was not being used (was always false) and the new negative
value support makes this obsolete.
Add support for a real variable to handle Bin, Oct, Dec and Hex
strings. They are converted into a vvp_vector4_t which is then
converted to a real value.
Add support for setting a bit based value using a real value.
Removed an unneeded rfp signal in vpip_make_reg()
2008-11-13 22:28:19 +01:00
|
|
|
vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh),
|
2008-06-14 05:46:18 +02:00
|
|
|
(int)vpi_get(vpiLineNo, callh));
|
|
|
|
|
vpi_printf("%s's third argument must be numeric.\n", name);
|
|
|
|
|
vpi_control(vpiFinish, 1);
|
2007-10-24 19:14:10 +02:00
|
|
|
}
|
|
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
/* Make sure there are no extra arguments. */
|
|
|
|
|
if (vpi_scan(argv) != 0) {
|
|
|
|
|
char msg [64];
|
2008-09-30 03:06:47 +02:00
|
|
|
unsigned argc;
|
|
|
|
|
|
Rework $plusarg routines.
This patch addresses a number of issues:
Rewrote the $test$plusargs and $value$plusargs routines to have
better error/warning messages, to support runtime strings, to
correctly load bit based values (truncating, padding, negative
value), added support for the real formats using strtod() and
added "x/X" as an alias for "h/H" to match the other part of
Icarus.
Rewrite the vpip_{bin,oct,hex}_str_to_vec4 routines to ignore
embedded "_" characters. Add support for a negative value and
set the entire value to 'bx if an invalid digit is found. A
warning is printed for this case.
Rewrite vpip_dec_str_to_vec4 to ignore embedded "_" characters,
to support a single "x" or "z" constant and to return 'bx if an
invalid digit is found. A warning is printed for this case.
It simplifies the system task/functions error/warning messages.
It removes the signed flag for the bin and dec string conversions.
This was not being used (was always false) and the new negative
value support makes this obsolete.
Add support for a real variable to handle Bin, Oct, Dec and Hex
strings. They are converted into a vvp_vector4_t which is then
converted to a real value.
Add support for setting a bit based value using a real value.
Removed an unneeded rfp signal in vpip_make_reg()
2008-11-13 22:28:19 +01:00
|
|
|
snprintf(msg, 64, "ERROR: %s:%d:",
|
2008-06-14 05:46:18 +02:00
|
|
|
vpi_get_str(vpiFile, callh),
|
|
|
|
|
(int)vpi_get(vpiLineNo, callh));
|
2007-10-24 19:14:10 +02:00
|
|
|
|
2008-09-30 03:06:47 +02:00
|
|
|
argc = 1;
|
2008-06-14 05:46:18 +02:00
|
|
|
while (vpi_scan(argv)) argc += 1;
|
2007-10-24 19:14:10 +02:00
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
vpi_printf("%s %s takes three arguments.\n", msg, name);
|
|
|
|
|
vpi_printf("%*s Found %u extra argument%s.\n",
|
2008-06-20 19:12:17 +02:00
|
|
|
(int) strlen(msg), " ", argc, argc == 1 ? "" : "s");
|
2007-10-24 19:14:10 +02:00
|
|
|
vpi_control(vpiFinish, 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
static PLI_INT32 sys_fseek_calltf(PLI_BYTE8*name)
|
2007-10-24 19:14:10 +02:00
|
|
|
{
|
|
|
|
|
vpiHandle callh = vpi_handle(vpiSysTfCall, 0);
|
|
|
|
|
vpiHandle argv = vpi_iterate(vpiArgument, callh);
|
2008-06-14 05:46:18 +02:00
|
|
|
vpiHandle arg;
|
|
|
|
|
s_vpi_value val;
|
|
|
|
|
PLI_UINT32 fd_mcd;
|
|
|
|
|
PLI_INT32 offset, oper;
|
|
|
|
|
FILE *fp;
|
2007-10-24 19:14:10 +02:00
|
|
|
|
|
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
/* Get the file pointer. */
|
|
|
|
|
arg = vpi_scan(argv);
|
|
|
|
|
val.format = vpiIntVal;
|
|
|
|
|
vpi_get_value(arg, &val);
|
|
|
|
|
fd_mcd = val.value.integer;
|
2007-10-24 19:14:10 +02:00
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
/* Get the offset. */
|
|
|
|
|
arg = vpi_scan(argv);
|
|
|
|
|
val.format = vpiIntVal;
|
|
|
|
|
vpi_get_value(arg, &val);
|
|
|
|
|
offset = val.value.integer;
|
|
|
|
|
|
|
|
|
|
/* Get the operation. */
|
|
|
|
|
arg = vpi_scan(argv);
|
|
|
|
|
vpi_free_object(argv);
|
|
|
|
|
val.format = vpiIntVal;
|
|
|
|
|
vpi_get_value(arg, &val);
|
|
|
|
|
oper = val.value.integer;
|
|
|
|
|
|
|
|
|
|
/* Check that the operation is in the valid range. */
|
|
|
|
|
if ((oper < 0) || (oper > 2)) {
|
Rework $plusarg routines.
This patch addresses a number of issues:
Rewrote the $test$plusargs and $value$plusargs routines to have
better error/warning messages, to support runtime strings, to
correctly load bit based values (truncating, padding, negative
value), added support for the real formats using strtod() and
added "x/X" as an alias for "h/H" to match the other part of
Icarus.
Rewrite the vpip_{bin,oct,hex}_str_to_vec4 routines to ignore
embedded "_" characters. Add support for a negative value and
set the entire value to 'bx if an invalid digit is found. A
warning is printed for this case.
Rewrite vpip_dec_str_to_vec4 to ignore embedded "_" characters,
to support a single "x" or "z" constant and to return 'bx if an
invalid digit is found. A warning is printed for this case.
It simplifies the system task/functions error/warning messages.
It removes the signed flag for the bin and dec string conversions.
This was not being used (was always false) and the new negative
value support makes this obsolete.
Add support for a real variable to handle Bin, Oct, Dec and Hex
strings. They are converted into a vvp_vector4_t which is then
converted to a real value.
Add support for setting a bit based value using a real value.
Removed an unneeded rfp signal in vpip_make_reg()
2008-11-13 22:28:19 +01:00
|
|
|
vpi_printf("WARNING: %s:%d: ", vpi_get_str(vpiFile, callh),
|
2008-06-14 05:46:18 +02:00
|
|
|
(int)vpi_get(vpiLineNo, callh));
|
|
|
|
|
vpi_printf("%s's operation must be 0, 1 or 2 given %d.\n",
|
|
|
|
|
name, oper);
|
|
|
|
|
val.format = vpiIntVal;
|
|
|
|
|
val.value.integer = EOF;
|
|
|
|
|
vpi_put_value(callh, &val, 0, vpiNoDelay);
|
2007-10-24 19:14:10 +02:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
/* Return EOF if this is not a valid fd. */
|
|
|
|
|
fp = vpi_get_file(fd_mcd);
|
|
|
|
|
if (!fp || IS_MCD(fd_mcd)) {
|
Rework $plusarg routines.
This patch addresses a number of issues:
Rewrote the $test$plusargs and $value$plusargs routines to have
better error/warning messages, to support runtime strings, to
correctly load bit based values (truncating, padding, negative
value), added support for the real formats using strtod() and
added "x/X" as an alias for "h/H" to match the other part of
Icarus.
Rewrite the vpip_{bin,oct,hex}_str_to_vec4 routines to ignore
embedded "_" characters. Add support for a negative value and
set the entire value to 'bx if an invalid digit is found. A
warning is printed for this case.
Rewrite vpip_dec_str_to_vec4 to ignore embedded "_" characters,
to support a single "x" or "z" constant and to return 'bx if an
invalid digit is found. A warning is printed for this case.
It simplifies the system task/functions error/warning messages.
It removes the signed flag for the bin and dec string conversions.
This was not being used (was always false) and the new negative
value support makes this obsolete.
Add support for a real variable to handle Bin, Oct, Dec and Hex
strings. They are converted into a vvp_vector4_t which is then
converted to a real value.
Add support for setting a bit based value using a real value.
Removed an unneeded rfp signal in vpip_make_reg()
2008-11-13 22:28:19 +01:00
|
|
|
vpi_printf("WARNING: %s:%d: ", vpi_get_str(vpiFile, callh),
|
2008-06-14 05:46:18 +02:00
|
|
|
(int)vpi_get(vpiLineNo, callh));
|
|
|
|
|
vpi_printf("invalid file descriptor (0x%x) given to %s.\n", fd_mcd,
|
|
|
|
|
name);
|
|
|
|
|
val.format = vpiIntVal;
|
|
|
|
|
val.value.integer = EOF;
|
|
|
|
|
vpi_put_value(callh, &val, 0, vpiNoDelay);
|
2007-10-24 19:14:10 +02:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
val.format = vpiIntVal;
|
|
|
|
|
val.value.integer = fseek(fp, offset, oper);
|
|
|
|
|
vpi_put_value(callh, &val, 0 , vpiNoDelay);
|
2007-10-24 19:14:10 +02:00
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
static PLI_INT32 sys_common_fd_calltf(PLI_BYTE8*name)
|
2007-10-24 19:14:10 +02:00
|
|
|
{
|
|
|
|
|
vpiHandle callh = vpi_handle(vpiSysTfCall, 0);
|
|
|
|
|
vpiHandle argv = vpi_iterate(vpiArgument, callh);
|
2008-06-14 05:46:18 +02:00
|
|
|
vpiHandle arg;
|
2007-10-24 19:14:10 +02:00
|
|
|
s_vpi_value val;
|
2008-06-14 05:46:18 +02:00
|
|
|
PLI_UINT32 fd_mcd;
|
2007-10-24 19:14:10 +02:00
|
|
|
FILE *fp;
|
|
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
/* Get the file pointer. */
|
|
|
|
|
arg = vpi_scan(argv);
|
|
|
|
|
vpi_free_object(argv);
|
2007-10-24 19:14:10 +02:00
|
|
|
val.format = vpiIntVal;
|
2008-06-14 05:46:18 +02:00
|
|
|
vpi_get_value(arg, &val);
|
|
|
|
|
fd_mcd = val.value.integer;
|
2007-10-24 19:14:10 +02:00
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
/* Return EOF if this is not a valid fd. */
|
|
|
|
|
fp = vpi_get_file(fd_mcd);
|
|
|
|
|
if (!fp || IS_MCD(fd_mcd)) {
|
Rework $plusarg routines.
This patch addresses a number of issues:
Rewrote the $test$plusargs and $value$plusargs routines to have
better error/warning messages, to support runtime strings, to
correctly load bit based values (truncating, padding, negative
value), added support for the real formats using strtod() and
added "x/X" as an alias for "h/H" to match the other part of
Icarus.
Rewrite the vpip_{bin,oct,hex}_str_to_vec4 routines to ignore
embedded "_" characters. Add support for a negative value and
set the entire value to 'bx if an invalid digit is found. A
warning is printed for this case.
Rewrite vpip_dec_str_to_vec4 to ignore embedded "_" characters,
to support a single "x" or "z" constant and to return 'bx if an
invalid digit is found. A warning is printed for this case.
It simplifies the system task/functions error/warning messages.
It removes the signed flag for the bin and dec string conversions.
This was not being used (was always false) and the new negative
value support makes this obsolete.
Add support for a real variable to handle Bin, Oct, Dec and Hex
strings. They are converted into a vvp_vector4_t which is then
converted to a real value.
Add support for setting a bit based value using a real value.
Removed an unneeded rfp signal in vpip_make_reg()
2008-11-13 22:28:19 +01:00
|
|
|
vpi_printf("WARNING: %s:%d: ", vpi_get_str(vpiFile, callh),
|
2008-06-14 05:46:18 +02:00
|
|
|
(int)vpi_get(vpiLineNo, callh));
|
|
|
|
|
vpi_printf("invalid file descriptor (0x%x) given to %s.\n", fd_mcd,
|
|
|
|
|
name);
|
|
|
|
|
val.format = vpiIntVal;
|
|
|
|
|
val.value.integer = EOF;
|
|
|
|
|
vpi_put_value(callh, &val, 0, vpiNoDelay);
|
2007-10-24 19:14:10 +02:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-14 05:46:18 +02:00
|
|
|
val.format = vpiIntVal;
|
|
|
|
|
switch (name[4]) {
|
2008-06-17 01:25:37 +02:00
|
|
|
case 'l': /* $ftell() */
|
2008-06-14 05:46:18 +02:00
|
|
|
val.value.integer = ftell(fp);
|
|
|
|
|
break;
|
2008-06-17 01:25:37 +02:00
|
|
|
case 'f': /* $feof() is from 1264-2005*/
|
2008-06-14 05:46:18 +02:00
|
|
|
val.value.integer = feof(fp);
|
|
|
|
|
break;
|
2008-06-17 01:25:37 +02:00
|
|
|
case 'i': /* $rewind() */
|
2008-06-14 05:46:18 +02:00
|
|
|
val.value.integer = fseek(fp, 0L, SEEK_SET);
|
|
|
|
|
break;
|
2008-06-17 01:25:37 +02:00
|
|
|
case 't': /* $fgetc() */
|
2008-06-14 05:46:18 +02:00
|
|
|
val.value.integer = fgetc(fp);
|
|
|
|
|
break;
|
2008-06-17 01:25:37 +02:00
|
|
|
default:
|
Rework $plusarg routines.
This patch addresses a number of issues:
Rewrote the $test$plusargs and $value$plusargs routines to have
better error/warning messages, to support runtime strings, to
correctly load bit based values (truncating, padding, negative
value), added support for the real formats using strtod() and
added "x/X" as an alias for "h/H" to match the other part of
Icarus.
Rewrite the vpip_{bin,oct,hex}_str_to_vec4 routines to ignore
embedded "_" characters. Add support for a negative value and
set the entire value to 'bx if an invalid digit is found. A
warning is printed for this case.
Rewrite vpip_dec_str_to_vec4 to ignore embedded "_" characters,
to support a single "x" or "z" constant and to return 'bx if an
invalid digit is found. A warning is printed for this case.
It simplifies the system task/functions error/warning messages.
It removes the signed flag for the bin and dec string conversions.
This was not being used (was always false) and the new negative
value support makes this obsolete.
Add support for a real variable to handle Bin, Oct, Dec and Hex
strings. They are converted into a vvp_vector4_t which is then
converted to a real value.
Add support for setting a bit based value using a real value.
Removed an unneeded rfp signal in vpip_make_reg()
2008-11-13 22:28:19 +01:00
|
|
|
vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh),
|
2008-06-14 05:46:18 +02:00
|
|
|
(int)vpi_get(vpiLineNo, callh));
|
|
|
|
|
vpi_printf("%s cannot be processed with this routine.\n", name);
|
|
|
|
|
assert(0);
|
|
|
|
|
break;
|
2007-10-23 23:37:04 +02:00
|
|
|
}
|
|
|
|
|
vpi_put_value(callh, &val, 0 , vpiNoDelay);
|
2003-10-30 04:43:19 +01:00
|
|
|
|
2007-10-23 23:37:04 +02:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2003-10-30 04:43:19 +01:00
|
|
|
void sys_fileio_register()
|
|
|
|
|
{
|
|
|
|
|
s_vpi_systf_data tf_data;
|
|
|
|
|
|
2008-09-30 03:06:47 +02:00
|
|
|
/*============================== fopen */
|
2008-06-14 05:46:18 +02:00
|
|
|
tf_data.type = vpiSysFunc;
|
|
|
|
|
tf_data.sysfunctype = vpiIntFunc;
|
|
|
|
|
tf_data.tfname = "$fopen";
|
|
|
|
|
tf_data.calltf = sys_fopen_calltf;
|
|
|
|
|
tf_data.compiletf = sys_fopen_compiletf;
|
|
|
|
|
tf_data.sizetf = 0;
|
|
|
|
|
tf_data.user_data = "$fopen";
|
2003-10-30 04:43:19 +01:00
|
|
|
vpi_register_systf(&tf_data);
|
|
|
|
|
|
2008-09-30 03:06:47 +02:00
|
|
|
/*============================== fopenr */
|
2008-06-14 05:46:18 +02:00
|
|
|
tf_data.type = vpiSysFunc;
|
|
|
|
|
tf_data.sysfunctype = vpiIntFunc;
|
|
|
|
|
tf_data.tfname = "$fopenr";
|
|
|
|
|
tf_data.calltf = sys_fopenrwa_calltf;
|
|
|
|
|
tf_data.compiletf = sys_one_string_arg_compiletf;
|
|
|
|
|
tf_data.sizetf = 0;
|
|
|
|
|
tf_data.user_data = "$fopenr";
|
2007-10-11 18:32:23 +02:00
|
|
|
vpi_register_systf(&tf_data);
|
|
|
|
|
|
2008-09-30 03:06:47 +02:00
|
|
|
/*============================== fopenw */
|
2008-06-14 05:46:18 +02:00
|
|
|
tf_data.tfname = "$fopenw";
|
|
|
|
|
tf_data.user_data = "$fopenw";
|
2007-10-11 18:32:23 +02:00
|
|
|
vpi_register_systf(&tf_data);
|
|
|
|
|
|
2008-09-30 03:06:47 +02:00
|
|
|
/*============================== fopena */
|
2008-06-14 05:46:18 +02:00
|
|
|
tf_data.tfname = "$fopena";
|
|
|
|
|
tf_data.user_data = "$fopena";
|
2007-10-11 18:32:23 +02:00
|
|
|
vpi_register_systf(&tf_data);
|
|
|
|
|
|
2008-09-30 03:06:47 +02:00
|
|
|
/*============================== fclose */
|
2003-10-30 04:43:19 +01:00
|
|
|
tf_data.type = vpiSysTask;
|
|
|
|
|
tf_data.tfname = "$fclose";
|
|
|
|
|
tf_data.calltf = sys_fclose_calltf;
|
2008-06-14 05:46:18 +02:00
|
|
|
tf_data.compiletf = sys_one_numeric_arg_compiletf;
|
2003-10-30 04:43:19 +01:00
|
|
|
tf_data.sizetf = 0;
|
|
|
|
|
tf_data.user_data = "$fclose";
|
|
|
|
|
vpi_register_systf(&tf_data);
|
|
|
|
|
|
2008-09-30 03:06:47 +02:00
|
|
|
/*============================== fflush */
|
2003-11-07 20:40:05 +01:00
|
|
|
tf_data.type = vpiSysTask;
|
|
|
|
|
tf_data.tfname = "$fflush";
|
|
|
|
|
tf_data.calltf = sys_fflush_calltf;
|
2008-06-14 05:46:18 +02:00
|
|
|
tf_data.compiletf = sys_one_opt_numeric_arg_compiletf;
|
2003-11-07 20:40:05 +01:00
|
|
|
tf_data.sizetf = 0;
|
|
|
|
|
tf_data.user_data = "$fflush";
|
|
|
|
|
vpi_register_systf(&tf_data);
|
|
|
|
|
|
2008-09-30 03:06:47 +02:00
|
|
|
/*============================== fputc */
|
2003-10-30 04:43:19 +01:00
|
|
|
tf_data.type = vpiSysTask;
|
|
|
|
|
tf_data.tfname = "$fputc";
|
|
|
|
|
tf_data.calltf = sys_fputc_calltf;
|
2008-06-14 05:46:18 +02:00
|
|
|
tf_data.compiletf = sys_two_numeric_args_compiletf;
|
2003-10-30 04:43:19 +01:00
|
|
|
tf_data.sizetf = 0;
|
|
|
|
|
tf_data.user_data = "$fputc";
|
|
|
|
|
vpi_register_systf(&tf_data);
|
|
|
|
|
|
2008-09-30 03:06:47 +02:00
|
|
|
/*============================== fgetc */
|
2003-10-30 04:43:19 +01:00
|
|
|
tf_data.type = vpiSysFunc;
|
2008-06-14 05:46:18 +02:00
|
|
|
tf_data.sysfunctype = vpiIntFunc;
|
2003-10-30 04:43:19 +01:00
|
|
|
tf_data.tfname = "$fgetc";
|
2008-06-14 05:46:18 +02:00
|
|
|
tf_data.calltf = sys_common_fd_calltf;
|
|
|
|
|
tf_data.compiletf = sys_one_numeric_arg_compiletf;
|
|
|
|
|
tf_data.sizetf = 0;
|
2003-10-30 04:43:19 +01:00
|
|
|
tf_data.user_data = "$fgetc";
|
|
|
|
|
vpi_register_systf(&tf_data);
|
|
|
|
|
|
2008-09-30 03:06:47 +02:00
|
|
|
/*============================== fgets */
|
2004-02-19 22:33:13 +01:00
|
|
|
tf_data.type = vpiSysFunc;
|
2008-06-14 05:46:18 +02:00
|
|
|
tf_data.sysfunctype = vpiIntFunc;
|
2004-02-19 22:33:13 +01:00
|
|
|
tf_data.tfname = "$fgets";
|
|
|
|
|
tf_data.calltf = sys_fgets_calltf;
|
|
|
|
|
tf_data.compiletf = sys_fgets_compiletf;
|
|
|
|
|
tf_data.sizetf = 0;
|
|
|
|
|
tf_data.user_data = "$fgets";
|
|
|
|
|
vpi_register_systf(&tf_data);
|
|
|
|
|
|
2008-09-30 03:06:47 +02:00
|
|
|
/*============================== ungetc */
|
2003-10-30 04:43:19 +01:00
|
|
|
tf_data.type = vpiSysFunc;
|
2008-06-14 05:46:18 +02:00
|
|
|
tf_data.sysfunctype = vpiIntFunc;
|
2003-10-30 04:43:19 +01:00
|
|
|
tf_data.tfname = "$ungetc";
|
|
|
|
|
tf_data.calltf = sys_ungetc_calltf;
|
2008-06-14 05:46:18 +02:00
|
|
|
tf_data.compiletf = sys_two_numeric_args_compiletf;
|
|
|
|
|
tf_data.sizetf = 0;
|
2003-10-30 04:43:19 +01:00
|
|
|
tf_data.user_data = "$ungetc";
|
|
|
|
|
vpi_register_systf(&tf_data);
|
|
|
|
|
|
2008-09-30 03:06:47 +02:00
|
|
|
/*============================== ftell */
|
2007-10-24 19:14:10 +02:00
|
|
|
tf_data.type = vpiSysFunc;
|
2008-06-14 05:46:18 +02:00
|
|
|
tf_data.sysfunctype = vpiIntFunc;
|
2007-10-24 19:14:10 +02:00
|
|
|
tf_data.tfname = "$ftell";
|
2008-06-14 05:46:18 +02:00
|
|
|
tf_data.calltf = sys_common_fd_calltf;
|
|
|
|
|
tf_data.compiletf = sys_one_numeric_arg_compiletf;
|
|
|
|
|
tf_data.sizetf = 0;
|
2007-10-24 19:14:10 +02:00
|
|
|
tf_data.user_data = "$ftell";
|
|
|
|
|
vpi_register_systf(&tf_data);
|
|
|
|
|
|
2008-09-30 03:06:47 +02:00
|
|
|
/*============================== fseek */
|
2007-10-24 19:14:10 +02:00
|
|
|
tf_data.type = vpiSysFunc;
|
2008-06-14 05:46:18 +02:00
|
|
|
tf_data.sysfunctype = vpiIntFunc;
|
2007-10-24 19:14:10 +02:00
|
|
|
tf_data.tfname = "$fseek";
|
|
|
|
|
tf_data.calltf = sys_fseek_calltf;
|
|
|
|
|
tf_data.compiletf = sys_fseek_compiletf;
|
2008-06-14 05:46:18 +02:00
|
|
|
tf_data.sizetf = 0;
|
2007-10-24 19:14:10 +02:00
|
|
|
tf_data.user_data = "$fseek";
|
|
|
|
|
vpi_register_systf(&tf_data);
|
|
|
|
|
|
2008-09-30 03:06:47 +02:00
|
|
|
/*============================== rewind */
|
2007-10-24 19:14:10 +02:00
|
|
|
tf_data.type = vpiSysFunc;
|
2008-06-14 05:46:18 +02:00
|
|
|
tf_data.sysfunctype = vpiIntFunc;
|
2007-10-24 19:14:10 +02:00
|
|
|
tf_data.tfname = "$rewind";
|
2008-06-14 05:46:18 +02:00
|
|
|
tf_data.calltf = sys_common_fd_calltf;
|
|
|
|
|
tf_data.compiletf = sys_one_numeric_arg_compiletf;
|
|
|
|
|
tf_data.sizetf = 0;
|
2007-10-24 19:14:10 +02:00
|
|
|
tf_data.user_data = "$rewind";
|
|
|
|
|
vpi_register_systf(&tf_data);
|
|
|
|
|
|
2007-10-23 23:37:04 +02:00
|
|
|
/* $feof() is from 1364-2005. */
|
2008-09-30 03:06:47 +02:00
|
|
|
/*============================== feof */
|
2007-10-23 23:37:04 +02:00
|
|
|
tf_data.type = vpiSysFunc;
|
2008-06-14 05:46:18 +02:00
|
|
|
tf_data.sysfunctype = vpiIntFunc;
|
2007-10-23 23:37:04 +02:00
|
|
|
tf_data.tfname = "$feof";
|
2008-06-14 05:46:18 +02:00
|
|
|
tf_data.calltf = sys_common_fd_calltf;
|
|
|
|
|
tf_data.compiletf = sys_one_numeric_arg_compiletf;
|
|
|
|
|
tf_data.sizetf = 0;
|
2007-10-23 23:37:04 +02:00
|
|
|
tf_data.user_data = "$feof";
|
|
|
|
|
vpi_register_systf(&tf_data);
|
|
|
|
|
|
2003-10-30 04:43:19 +01:00
|
|
|
}
|