Add ability to put a string value to a SV string (from plusargs)

This commit is contained in:
Cary R 2015-02-25 19:15:44 -08:00
parent 3c38b2972d
commit ae629f8c41
3 changed files with 15 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002-2014 Stephen Williams (steve@icarus.com)
* Copyright (c) 2002-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
@ -118,6 +118,7 @@ static PLI_INT32 sys_value_plusargs_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name)
case vpiLongIntVar:
case vpiRealVar:
case vpiTimeVar:
case vpiStringVar:
break;
default:

View File

@ -1,7 +1,7 @@
#ifndef IVL_vpi_priv_H
#define IVL_vpi_priv_H
/*
* Copyright (c) 2001-2014 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-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
@ -531,6 +531,7 @@ class __vpiStringVar : public __vpiBaseVar {
int get_type_code(void) const;
int vpi_get(int code);
void vpi_get_value(p_vpi_value val);
vpiHandle vpi_put_value(p_vpi_value val, int flags);
};
extern vpiHandle vpip_make_string_var(const char*name, vvp_net_t*net);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2014 Stephen Williams (steve@icarus.com)
* Copyright (c) 2012-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
@ -79,6 +79,16 @@ void __vpiStringVar::vpi_get_value(p_vpi_value val)
val->format = vpiSuppressVal;
}
vpiHandle __vpiStringVar::vpi_put_value(p_vpi_value val, int)
{
vvp_fun_signal_string*fun = dynamic_cast<vvp_fun_signal_string*> (get_net()->fun);
assert(fun);
assert(val->format == vpiStringVal);
vvp_net_ptr_t dest (get_net(), 0);
vvp_send_string(dest, val->value.str, vthread_get_wt_context());
return 0;
}
vpiHandle vpip_make_string_var(const char*name, vvp_net_t*net)
{
struct __vpiScope*scope = vpip_peek_current_scope();