Fully remove the __vpirt structure
All the methods that this structure supported are now pulled into the __vpiHandle class as virtual methods. This includes the vpi_free_object_ method, which required some extra trickery.
This commit is contained in:
parent
c07c4509e4
commit
d6dba0456c
139
vvp/array.cc
139
vvp/array.cc
|
|
@ -116,6 +116,7 @@ struct __vpiArrayIterator : public __vpiHandle {
|
|||
int vpi_get(int code);
|
||||
char* vpi_get_str(int code);
|
||||
vpiHandle vpi_index(int idx);
|
||||
free_object_fun_t free_object_fun(void);
|
||||
|
||||
struct __vpiArray*array;
|
||||
unsigned next;
|
||||
|
|
@ -128,6 +129,7 @@ struct __vpiArrayIndex : public __vpiHandle {
|
|||
char* vpi_get_str(int code);
|
||||
vpiHandle vpi_iterate(int code);
|
||||
vpiHandle vpi_index(int idx);
|
||||
free_object_fun_t free_object_fun(void);
|
||||
|
||||
struct __vpiDecConst *index;
|
||||
unsigned done;
|
||||
|
|
@ -289,8 +291,6 @@ struct __vpiArrayWord {
|
|||
struct as_index_t : public __vpiHandle {
|
||||
as_index_t();
|
||||
int get_type_code(void) const;
|
||||
int vpi_get(int code);
|
||||
char*vpi_get_str(int code);
|
||||
void vpi_get_value(p_vpi_value val);
|
||||
} as_index;
|
||||
|
||||
|
|
@ -331,23 +331,8 @@ static int vpi_array_vthr_APV_get(int code, vpiHandle);
|
|||
static char*vpi_array_vthr_APV_get_str(int code, vpiHandle);
|
||||
static void vpi_array_vthr_APV_get_value(vpiHandle ref, p_vpi_value vp);
|
||||
|
||||
static const struct __vpirt vpip_arraymem_rt = {
|
||||
vpiMemory,
|
||||
0, //vpi_array_get,
|
||||
0, //vpi_array_get_str,
|
||||
0,
|
||||
0,
|
||||
0, //vpi_array_get_handle,
|
||||
0, //vpi_array_iterate,
|
||||
0, //vpi_array_index,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
inline __vpiArray::__vpiArray()
|
||||
: __vpiHandle(&vpip_arraymem_rt)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
int __vpiArray::get_type_code(void) const
|
||||
{ return vpiMemory; }
|
||||
|
|
@ -367,24 +352,8 @@ vpiHandle __vpiArray::vpi_iterate(int code)
|
|||
vpiHandle __vpiArray::vpi_index(int idx)
|
||||
{ return vpi_array_index(this, idx); }
|
||||
|
||||
static const struct __vpirt vpip_array_iterator_rt = {
|
||||
vpiIterator,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0, //array_iterator_scan,
|
||||
&array_iterator_free_object,
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
||||
inline __vpiArrayIterator::__vpiArrayIterator()
|
||||
: __vpiHandle(&vpip_array_iterator_rt)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
int __vpiArrayIterator::get_type_code(void) const
|
||||
{ return vpiIterator; }
|
||||
|
|
@ -398,27 +367,11 @@ char* __vpiArrayIterator::vpi_get_str(int)
|
|||
vpiHandle __vpiArrayIterator::vpi_index(int code)
|
||||
{ return array_iterator_scan(this, code); }
|
||||
|
||||
/* This should look a bit odd since it provides a fake iteration on
|
||||
* this object. This trickery is used to implement the two forms of
|
||||
* index access, simple handle access and iteration access. */
|
||||
static const struct __vpirt vpip_array_index_rt = {
|
||||
vpiIterator,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0, //array_index_iterate,
|
||||
0, //array_index_scan,
|
||||
array_index_free_object,
|
||||
0,
|
||||
0
|
||||
};
|
||||
__vpiHandle::free_object_fun_t __vpiArrayIterator::free_object_fun(void)
|
||||
{ return &array_iterator_free_object; }
|
||||
|
||||
inline __vpiArrayIndex::__vpiArrayIndex()
|
||||
: __vpiHandle(&vpip_array_index_rt)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
int __vpiArrayIndex::get_type_code(void) const
|
||||
{ return vpiIterator; }
|
||||
|
|
@ -435,23 +388,11 @@ vpiHandle __vpiArrayIndex::vpi_iterate(int code)
|
|||
vpiHandle __vpiArrayIndex::vpi_index(int idx)
|
||||
{ return array_index_scan(this, idx); }
|
||||
|
||||
static const struct __vpirt vpip_array_var_word_rt = {
|
||||
vpiMemoryWord,
|
||||
0, //&vpi_array_var_word_get,
|
||||
0, //&vpi_array_var_word_get_str,
|
||||
0, //&vpi_array_var_word_get_value,
|
||||
0, //&vpi_array_var_word_put_value,
|
||||
0, //&vpi_array_var_word_get_handle,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
__vpiHandle::free_object_fun_t __vpiArrayIndex::free_object_fun(void)
|
||||
{ return &array_index_free_object; }
|
||||
|
||||
inline __vpiArrayWord::as_word_t::as_word_t()
|
||||
: __vpiHandle(&vpip_array_var_word_rt)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
int __vpiArrayWord::as_word_t::get_type_code(void) const
|
||||
{ return vpiMemoryWord; }
|
||||
|
|
@ -471,54 +412,17 @@ vpiHandle __vpiArrayWord::as_word_t::vpi_put_value(p_vpi_value val, int flags)
|
|||
vpiHandle __vpiArrayWord::as_word_t::vpi_handle(int code)
|
||||
{ return vpi_array_var_word_get_handle(code, this); }
|
||||
|
||||
static const struct __vpirt vpip_array_var_index_rt = {
|
||||
vpiIndex,
|
||||
0,
|
||||
0,
|
||||
&vpi_array_var_index_get_value,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
inline __vpiArrayWord::as_index_t::as_index_t()
|
||||
: __vpiHandle(&vpip_array_var_index_rt)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
int __vpiArrayWord::as_index_t::get_type_code(void) const
|
||||
{ return vpiIndex; }
|
||||
|
||||
int __vpiArrayWord::as_index_t::vpi_get(int)
|
||||
{ return vpiUndefined; }
|
||||
|
||||
char* __vpiArrayWord::as_index_t::vpi_get_str(int)
|
||||
{ return 0; }
|
||||
|
||||
void __vpiArrayWord::as_index_t::vpi_get_value(p_vpi_value val)
|
||||
{ vpi_array_var_index_get_value(this, val); }
|
||||
|
||||
static const struct __vpirt vpip_array_vthr_A_rt = {
|
||||
vpiMemoryWord,
|
||||
0, //&vpi_array_vthr_A_get,
|
||||
0, //&vpi_array_vthr_A_get_str,
|
||||
0, //&vpi_array_vthr_A_get_value,
|
||||
0, //&vpi_array_vthr_A_put_value,
|
||||
0, //&vpi_array_vthr_A_get_handle,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
||||
inline __vpiArrayVthrA::__vpiArrayVthrA()
|
||||
: __vpiHandle(&vpip_array_vthr_A_rt)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
int __vpiArrayVthrA::get_type_code(void) const
|
||||
{ return vpiMemoryWord; }
|
||||
|
|
@ -538,24 +442,9 @@ vpiHandle __vpiArrayVthrA::vpi_put_value(p_vpi_value val, int flags)
|
|||
vpiHandle __vpiArrayVthrA::vpi_handle(int code)
|
||||
{ return vpi_array_vthr_A_get_handle(code, this); }
|
||||
|
||||
static const struct __vpirt vpip_array_vthr_APV_rt = {
|
||||
vpiMemoryWord,
|
||||
0, //&vpi_array_vthr_APV_get,
|
||||
0, //&vpi_array_vthr_APV_get_str,
|
||||
0, //&vpi_array_vthr_APV_get_value,
|
||||
0, //&vpi_array_vthr_A_put_value,
|
||||
0, //&vpi_array_vthr_A_get_handle,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
||||
inline __vpiArrayVthrAPV::__vpiArrayVthrAPV()
|
||||
: __vpiHandle(&vpip_array_vthr_APV_rt)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
int __vpiArrayVthrAPV::get_type_code(void) const
|
||||
{ return vpiMemoryWord; }
|
||||
|
|
|
|||
37
vvp/delay.cc
37
vvp/delay.cc
|
|
@ -971,24 +971,8 @@ static vpiHandle pathterm_get_handle(int code, vpiHandle ref)
|
|||
* vpiModPath object. The __vpiModPath structure contains items that
|
||||
* are common to a bunch of modpaths, including the destination term.
|
||||
*/
|
||||
static const struct __vpirt vpip_modpath_src_rt = {
|
||||
vpiModPath,
|
||||
0, //modpath_src_get,
|
||||
0, /* vpi_get_str */
|
||||
0, //modpath_src_get_value,
|
||||
0, //modpath_src_put_value,
|
||||
0, //modpath_src_get_handle,
|
||||
0, //modpath_src_iterate,
|
||||
0, //modpath_src_index,
|
||||
modpath_src_free_object,
|
||||
0, //modpath_src_get_delays,
|
||||
0, //modpath_src_put_delays
|
||||
};
|
||||
|
||||
inline __vpiModPathSrc::__vpiModPathSrc()
|
||||
: __vpiHandle(&vpip_modpath_src_rt)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
int __vpiModPathSrc::get_type_code(void) const
|
||||
{ return vpiModPath; }
|
||||
|
|
@ -1017,25 +1001,12 @@ void __vpiModPathSrc::vpi_get_delays(p_vpi_delay del)
|
|||
void __vpiModPathSrc::vpi_put_delays(p_vpi_delay del)
|
||||
{ modpath_src_put_delays(this, del); }
|
||||
|
||||
__vpiHandle::free_object_fun_t __vpiModPathSrc::free_object_fun(void)
|
||||
{ return &modpath_src_free_object; }
|
||||
|
||||
static const struct __vpirt vpip_modpath_term_rt = {
|
||||
vpiPathTerm,
|
||||
0,
|
||||
0, // vpi_get_str
|
||||
0, // vpi_get_value,
|
||||
0, // vpi_put_value,
|
||||
0, //pathterm_get_handle,
|
||||
0, // vpi_iterate,
|
||||
0, // vpi_index,
|
||||
0, // vpi_free_object,
|
||||
0, // vpi_get_delays,
|
||||
0 // vpi_put_delays
|
||||
};
|
||||
|
||||
inline __vpiModPathTerm::__vpiModPathTerm()
|
||||
: __vpiHandle(&vpip_modpath_term_rt)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
int __vpiModPathTerm::get_type_code(void) const
|
||||
{ return vpiPathTerm; }
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ struct __vpiEnumTypespec : public __vpiHandle {
|
|||
__vpiEnumTypespec();
|
||||
int get_type_code(void) const;
|
||||
int vpi_get(int code);
|
||||
char*vpi_get_str(int code);
|
||||
vpiHandle vpi_iterate(int code);
|
||||
|
||||
std::vector<enumconst_s> names;
|
||||
|
|
@ -93,24 +92,9 @@ static vpiHandle enum_type_iterate(int code, vpiHandle obj)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static const struct __vpirt enum_type_rt = {
|
||||
vpiEnumTypespec,
|
||||
0, //enum_type_get,
|
||||
0, //enum_type_get_str,
|
||||
0, //enum_type_get_value,
|
||||
0, //enum_type_put_value,
|
||||
0, //enum_type_handle,
|
||||
0, //enum_type_iterate,
|
||||
0, //enum_type_index,
|
||||
0, //enum_type_free_object,
|
||||
0, //enum_type_get_delays,
|
||||
0, //enum_type_put_delays
|
||||
};
|
||||
|
||||
inline __vpiEnumTypespec::__vpiEnumTypespec()
|
||||
: __vpiHandle(&enum_type_rt)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
int __vpiEnumTypespec::get_type_code(void) const
|
||||
{ return vpiEnumTypespec; }
|
||||
|
|
@ -118,9 +102,6 @@ int __vpiEnumTypespec::get_type_code(void) const
|
|||
int __vpiEnumTypespec::vpi_get(int code)
|
||||
{ return enum_type_get(code, this); }
|
||||
|
||||
char* __vpiEnumTypespec::vpi_get_str(int)
|
||||
{ return 0; }
|
||||
|
||||
vpiHandle __vpiEnumTypespec::vpi_iterate(int code)
|
||||
{ return enum_type_iterate(code, this); }
|
||||
|
||||
|
|
@ -161,24 +142,8 @@ static void enum_name_get_value(vpiHandle obj, p_vpi_value value)
|
|||
vpip_vec2_get_value(ref->val2, ref->val2.size(), false, value);
|
||||
}
|
||||
|
||||
static const struct __vpirt enum_name_rt = {
|
||||
vpiEnumConst,
|
||||
0, //enum_name_get,
|
||||
0, //enum_name_get_str,
|
||||
0, //enum_name_get_value,
|
||||
0, //enum_name_put_value,
|
||||
0, //enum_name_handle,
|
||||
0, //enum_name_iterate,
|
||||
0, //enum_name_index,
|
||||
0, //enum_name_free_object,
|
||||
0, //enum_name_get_delays,
|
||||
0, //enum_name_put_delays
|
||||
};
|
||||
|
||||
inline enumconst_s::enumconst_s()
|
||||
: __vpiHandle(&enum_name_rt)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
int enumconst_s::get_type_code(void) const
|
||||
{ return vpiEnumConst; }
|
||||
|
|
|
|||
|
|
@ -63,24 +63,8 @@ static char *file_line_get_str(int type, vpiHandle ref)
|
|||
}
|
||||
}
|
||||
|
||||
static const struct __vpirt vpip_file_line_rt = {
|
||||
_vpiFileLine,
|
||||
0, //file_line_get,
|
||||
0, //file_line_get_str,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
||||
inline __vpiFileLine::__vpiFileLine()
|
||||
: __vpiHandle(&vpip_file_line_rt)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
int __vpiFileLine::get_type_code(void) const
|
||||
{ return _vpiFileLine; }
|
||||
|
|
|
|||
|
|
@ -47,27 +47,15 @@ static int free_simple_callback(vpiHandle)
|
|||
return 1;
|
||||
}
|
||||
|
||||
const struct __vpirt callback_rt = {
|
||||
vpiCallback,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
&free_simple_callback,
|
||||
0,
|
||||
0
|
||||
};
|
||||
inline __vpiCallback::__vpiCallback()
|
||||
: __vpiHandle(&callback_rt)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
int __vpiCallback::get_type_code(void) const
|
||||
{ return vpiCallback; }
|
||||
|
||||
__vpiHandle::free_object_fun_t __vpiCallback::free_object_fun(void)
|
||||
{ return &free_simple_callback; }
|
||||
|
||||
|
||||
/*
|
||||
* Callback handles are created when the VPI function registers a
|
||||
|
|
|
|||
179
vvp/vpi_const.cc
179
vvp/vpi_const.cc
|
|
@ -166,23 +166,8 @@ static void string_value(vpiHandle ref, p_vpi_value vp)
|
|||
}
|
||||
}
|
||||
|
||||
static const struct __vpirt vpip_string_rt = {
|
||||
vpiConstant,
|
||||
0,
|
||||
0,
|
||||
0, //string_value,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
inline __vpiStringConst::__vpiStringConst()
|
||||
: __vpiHandle(&vpip_string_rt)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
int __vpiStringConst::get_type_code(void) const
|
||||
{ return vpiConstant; }
|
||||
|
|
@ -216,6 +201,7 @@ void __vpiStringConst::vpi_put_delays(p_vpi_delay)
|
|||
|
||||
struct __vpiStringConstTEMP : public __vpiStringConst {
|
||||
__vpiStringConstTEMP();
|
||||
free_object_fun_t free_object_fun(void);
|
||||
};
|
||||
|
||||
static int free_temp_string(vpiHandle obj)
|
||||
|
|
@ -227,24 +213,11 @@ static int free_temp_string(vpiHandle obj)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static const struct __vpirt vpip_string_temp_rt = {
|
||||
vpiConstant, // Inherit from __vpiStringConst
|
||||
0, // Inherit from __vpiStringConst
|
||||
0, // Inherit from __vpiStringConst
|
||||
0, // Inherit from __vpiStringConst: string_value,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
free_temp_string,
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
||||
inline __vpiStringConstTEMP::__vpiStringConstTEMP()
|
||||
: __vpiStringConst(&vpip_string_temp_rt)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
__vpiHandle::free_object_fun_t __vpiStringConstTEMP::free_object_fun(void)
|
||||
{ return &free_temp_string; }
|
||||
|
||||
/*
|
||||
* Strings are described at the level of the vvp source as a string
|
||||
|
|
@ -344,24 +317,9 @@ static vpiHandle string_param_handle(int code, vpiHandle obj)
|
|||
}
|
||||
}
|
||||
|
||||
static const struct __vpirt vpip_string_param_rt = {
|
||||
vpiParameter,
|
||||
0,
|
||||
0,
|
||||
0, // Inherit from __vpiStringConst string_value,
|
||||
0,
|
||||
0, //string_param_handle,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
||||
inline __vpiStringParam::__vpiStringParam()
|
||||
: __vpiStringConst(&vpip_string_param_rt)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
int __vpiStringParam::get_type_code(void) const
|
||||
{ return vpiParameter; }
|
||||
|
|
@ -453,24 +411,9 @@ static void binary_value(vpiHandle ref, p_vpi_value vp)
|
|||
}
|
||||
}
|
||||
|
||||
static const struct __vpirt vpip_binary_rt = {
|
||||
vpiConstant,
|
||||
0,
|
||||
0,
|
||||
0, //binary_value,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
||||
inline __vpiBinaryConst::__vpiBinaryConst()
|
||||
: __vpiHandle(&vpip_binary_rt)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
int __vpiBinaryConst::get_type_code(void) const
|
||||
{ return vpiConstant; }
|
||||
|
|
@ -603,23 +546,8 @@ static vpiHandle binary_param_handle(int code, vpiHandle obj)
|
|||
}
|
||||
}
|
||||
|
||||
static const struct __vpirt vpip_binary_param_rt = {
|
||||
vpiParameter,
|
||||
0,
|
||||
0,
|
||||
0, //Inherit from __vpiBinaryConst: binary_value,
|
||||
0,
|
||||
0, //binary_param_handle,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
inline __vpiBinaryParam::__vpiBinaryParam()
|
||||
: __vpiBinaryConst(&vpip_binary_param_rt)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
int __vpiBinaryParam::get_type_code(void) const
|
||||
{ return vpiParameter; }
|
||||
|
|
@ -730,21 +658,7 @@ static void dec_value(vpiHandle ref, p_vpi_value vp)
|
|||
}
|
||||
}
|
||||
|
||||
static const struct __vpirt vpip_dec_rt = {
|
||||
vpiConstant,
|
||||
0,
|
||||
0,
|
||||
0, //dec_value,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
__vpiDecConst::__vpiDecConst(int val)
|
||||
: __vpiHandle(&vpip_dec_rt)
|
||||
{
|
||||
value = val;
|
||||
}
|
||||
|
|
@ -755,30 +669,9 @@ int __vpiDecConst::get_type_code(void) const
|
|||
int __vpiDecConst::vpi_get(int code)
|
||||
{ return dec_get(code, this); }
|
||||
|
||||
char* __vpiDecConst::vpi_get_str(int)
|
||||
{ return 0; }
|
||||
|
||||
void __vpiDecConst::vpi_get_value(p_vpi_value val)
|
||||
{ dec_value(this, val); }
|
||||
|
||||
vpiHandle __vpiDecConst::vpi_put_value(p_vpi_value, int)
|
||||
{ return 0; }
|
||||
|
||||
vpiHandle __vpiDecConst::vpi_handle(int)
|
||||
{ return 0; }
|
||||
|
||||
vpiHandle __vpiDecConst::vpi_iterate(int)
|
||||
{ return 0; }
|
||||
|
||||
vpiHandle __vpiDecConst::vpi_index(int)
|
||||
{ return 0; }
|
||||
|
||||
void __vpiDecConst::vpi_get_delays(p_vpi_delay)
|
||||
{ }
|
||||
|
||||
void __vpiDecConst::vpi_put_delays(p_vpi_delay)
|
||||
{ }
|
||||
|
||||
static int real_get(int code, vpiHandle)
|
||||
{
|
||||
|
||||
|
|
@ -817,23 +710,8 @@ static void real_value(vpiHandle ref, p_vpi_value vp)
|
|||
vpip_real_get_value(rfp->value, vp);
|
||||
}
|
||||
|
||||
static const struct __vpirt vpip_real_rt = {
|
||||
vpiConstant,
|
||||
0,
|
||||
0,
|
||||
0, //real_value,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
inline __vpiRealConst::__vpiRealConst()
|
||||
: __vpiHandle(&vpip_real_rt)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
int __vpiRealConst::get_type_code(void) const
|
||||
{ return vpiConstant; }
|
||||
|
|
@ -841,30 +719,9 @@ int __vpiRealConst::get_type_code(void) const
|
|||
int __vpiRealConst::vpi_get(int code)
|
||||
{ return real_get(code, this); }
|
||||
|
||||
char* __vpiRealConst::vpi_get_str(int)
|
||||
{ return 0; }
|
||||
|
||||
void __vpiRealConst::vpi_get_value(p_vpi_value val)
|
||||
{ real_value(this, val); }
|
||||
|
||||
vpiHandle __vpiRealConst::vpi_put_value(p_vpi_value, int)
|
||||
{ return 0; }
|
||||
|
||||
vpiHandle __vpiRealConst::vpi_handle(int)
|
||||
{ return 0; }
|
||||
|
||||
vpiHandle __vpiRealConst::vpi_iterate(int)
|
||||
{ return 0; }
|
||||
|
||||
vpiHandle __vpiRealConst::vpi_index(int)
|
||||
{ return 0; }
|
||||
|
||||
void __vpiRealConst::vpi_get_delays(p_vpi_delay)
|
||||
{ }
|
||||
|
||||
void __vpiRealConst::vpi_put_delays(p_vpi_delay)
|
||||
{ }
|
||||
|
||||
vpiHandle vpip_make_real_const(double value)
|
||||
{
|
||||
struct __vpiRealConst*obj = new __vpiRealConst;
|
||||
|
|
@ -923,23 +780,9 @@ static vpiHandle real_param_handle(int code, vpiHandle obj)
|
|||
}
|
||||
}
|
||||
|
||||
static const struct __vpirt vpip_real_param_rt = {
|
||||
vpiParameter,
|
||||
0,
|
||||
0,
|
||||
0, //Inherited from __vpiRealConst: real_value,
|
||||
0,
|
||||
0, //real_param_handle,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
||||
inline __vpiRealParam::__vpiRealParam()
|
||||
: __vpiRealConst(&vpip_real_param_rt)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
int __vpiRealParam::get_type_code(void) const
|
||||
{ return vpiParameter; }
|
||||
|
|
|
|||
|
|
@ -66,24 +66,8 @@ static vpiHandle named_event_get_handle(int code, vpiHandle ref)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static const struct __vpirt vpip_named_event_rt = {
|
||||
vpiNamedEvent,
|
||||
|
||||
0, //named_event_get,
|
||||
0, //named_event_get_str,
|
||||
0,
|
||||
0,
|
||||
0, //named_event_get_handle,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
inline __vpiNamedEvent::__vpiNamedEvent()
|
||||
: __vpiHandle(&vpip_named_event_rt)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
int __vpiNamedEvent::get_type_code(void) const
|
||||
{ return vpiNamedEvent; }
|
||||
|
|
|
|||
|
|
@ -38,27 +38,15 @@ static int iterator_free_object(vpiHandle ref)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static const struct __vpirt vpip_iterator_rt = {
|
||||
vpiIterator,
|
||||
0, // vpi_get_
|
||||
0, // vpi_get_str_
|
||||
0, // vpi_get_value_
|
||||
0, // vpi_put_value_
|
||||
0, // handle_
|
||||
0, // iterate_
|
||||
0, // index_
|
||||
&iterator_free_object,
|
||||
0, // vpi_get_delay
|
||||
0 // vpi_put_delay
|
||||
};
|
||||
inline __vpiIterator::__vpiIterator()
|
||||
: __vpiHandle(&vpip_iterator_rt)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
int __vpiIterator::get_type_code(void) const
|
||||
{ return vpiIterator; }
|
||||
|
||||
__vpiHandle::free_object_fun_t __vpiIterator::free_object_fun(void)
|
||||
{ return &iterator_free_object; }
|
||||
|
||||
vpiHandle vpip_make_iterator(unsigned nargs, vpiHandle*args,
|
||||
bool free_args_flag)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -64,6 +64,8 @@ void __vpiHandle::vpi_get_delays(p_vpi_delay)
|
|||
void __vpiHandle::vpi_put_delays(p_vpi_delay)
|
||||
{ }
|
||||
|
||||
__vpiHandle::free_object_fun_t __vpiHandle::free_object_fun(void)
|
||||
{ return 0; }
|
||||
|
||||
/*
|
||||
* The vpip_string function creates a constant string from the pass
|
||||
|
|
@ -231,7 +233,11 @@ PLI_INT32 vpi_free_object(vpiHandle ref)
|
|||
}
|
||||
|
||||
assert(ref);
|
||||
rtn = __vpiHandle::vpi_free_object(ref);
|
||||
__vpiHandle::free_object_fun_t fun = ref->free_object_fun();
|
||||
if (fun)
|
||||
rtn = fun (ref);
|
||||
else
|
||||
rtn = 1;
|
||||
|
||||
if (vpi_trace)
|
||||
fprintf(vpi_trace, " --> %d\n", rtn);
|
||||
|
|
|
|||
|
|
@ -83,36 +83,6 @@ enum vpi_mode_t {
|
|||
};
|
||||
extern vpi_mode_t vpi_mode_flag;
|
||||
|
||||
/*
|
||||
* Objects with this structure are used to represent a type of
|
||||
* vpiHandle. A specific object becomes of this type by holding a
|
||||
* pointer to an instance of this structure.
|
||||
*/
|
||||
struct __vpirt {
|
||||
int type_code_X;
|
||||
|
||||
/* These methods extract information from the handle. */
|
||||
int (*vpi_get_)(int, vpiHandle);
|
||||
char* (*vpi_get_str_)(int, vpiHandle);
|
||||
void (*vpi_get_value_)(vpiHandle, p_vpi_value);
|
||||
vpiHandle (*vpi_put_value_)(vpiHandle, p_vpi_value, int flags);
|
||||
|
||||
/* These methods follow references. */
|
||||
vpiHandle (*handle_)(int, vpiHandle);
|
||||
vpiHandle (*iterate_)(int, vpiHandle);
|
||||
vpiHandle (*index_)(vpiHandle, int);
|
||||
|
||||
/* This implements the vpi_free_object method. */
|
||||
int (*vpi_free_object_)(vpiHandle);
|
||||
|
||||
/*
|
||||
These two methods are used to read/write delay
|
||||
values from/into modpath records
|
||||
*/
|
||||
void (*vpi_get_delays_)(vpiHandle, p_vpi_delay);
|
||||
void (*vpi_put_delays_)(vpiHandle, p_vpi_delay);
|
||||
};
|
||||
|
||||
/*
|
||||
* This structure is the very base of a vpiHandle. Every handle
|
||||
* structure is derived from this class so that the library can
|
||||
|
|
@ -120,8 +90,8 @@ struct __vpirt {
|
|||
*/
|
||||
class __vpiHandle {
|
||||
public:
|
||||
inline __vpiHandle(const struct __vpirt *tp) : vpi_type_(tp) { }
|
||||
// The descructor is virtual so that dynamic types will work.
|
||||
inline __vpiHandle() { }
|
||||
// The destructor is virtual so that dynamic types will work.
|
||||
virtual ~__vpiHandle();
|
||||
|
||||
virtual int get_type_code(void) const =0;
|
||||
|
|
@ -136,11 +106,12 @@ class __vpiHandle {
|
|||
virtual void vpi_get_delays(p_vpi_delay del);
|
||||
virtual void vpi_put_delays(p_vpi_delay del);
|
||||
|
||||
static inline int vpi_free_object(vpiHandle ref)
|
||||
{ return ref->vpi_type_->vpi_free_object_? ref->vpi_type_->vpi_free_object_(ref) : 1; }
|
||||
|
||||
private:
|
||||
const struct __vpirt *vpi_type_;
|
||||
// Objects may have destroyer functions of their own. If so,
|
||||
// then this virtual method will return a POINTER to that
|
||||
// function. The pointer is used to "delete" the object, which
|
||||
// is why the function itself cannot be a method.
|
||||
typedef int (*free_object_fun_t)(vpiHandle);
|
||||
virtual free_object_fun_t free_object_fun(void);
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -158,6 +129,7 @@ class __vpiHandle {
|
|||
struct __vpiIterator : public __vpiHandle {
|
||||
__vpiIterator();
|
||||
int get_type_code(void) const;
|
||||
free_object_fun_t free_object_fun(void);
|
||||
|
||||
vpiHandle *args;
|
||||
unsigned nargs;
|
||||
|
|
@ -176,6 +148,7 @@ extern vpiHandle vpip_make_iterator(unsigned nargs, vpiHandle*args,
|
|||
struct __vpiCallback : public __vpiHandle {
|
||||
__vpiCallback();
|
||||
int get_type_code(void) const;
|
||||
free_object_fun_t free_object_fun(void);
|
||||
|
||||
// user supplied callback data
|
||||
struct t_cb_data cb_data;
|
||||
|
|
@ -210,8 +183,6 @@ struct __vpiSystemTime : public __vpiHandle {
|
|||
void vpi_put_delays(p_vpi_delay del);
|
||||
|
||||
struct __vpiScope*scope;
|
||||
protected:
|
||||
inline __vpiSystemTime(const struct __vpirt*rt) : __vpiHandle(rt) { }
|
||||
};
|
||||
|
||||
struct __vpiScopedTime : public __vpiSystemTime {
|
||||
|
|
@ -275,8 +246,7 @@ struct __vpiScope : public __vpiHandle {
|
|||
signed int time_precision :8;
|
||||
|
||||
protected:
|
||||
__vpiScope(const struct __vpirt*rt) : __vpiHandle(rt) { }
|
||||
|
||||
inline __vpiScope() { }
|
||||
};
|
||||
|
||||
extern struct __vpiScope* vpip_peek_current_scope(void);
|
||||
|
|
@ -325,7 +295,7 @@ struct __vpiSignal : public __vpiHandle {
|
|||
static void*operator new(std::size_t size);
|
||||
static void operator delete(void*); // not implemented
|
||||
protected:
|
||||
inline __vpiSignal(const struct __vpirt*rt) : __vpiHandle(rt) { }
|
||||
inline __vpiSignal() { }
|
||||
private: // Not implemented
|
||||
static void*operator new[] (std::size_t size);
|
||||
static void operator delete[](void*);
|
||||
|
|
@ -393,6 +363,7 @@ struct __vpiModPathSrc : public __vpiHandle {
|
|||
vpiHandle vpi_index(int idx);
|
||||
void vpi_get_delays(p_vpi_delay del);
|
||||
void vpi_put_delays(p_vpi_delay del);
|
||||
free_object_fun_t free_object_fun(void);
|
||||
|
||||
struct __vpiModPath *dest;
|
||||
int type;
|
||||
|
|
@ -534,7 +505,6 @@ extern struct __vpiUserSystf* vpip_find_systf(const char*name);
|
|||
|
||||
|
||||
struct __vpiSysTaskCall : public __vpiHandle {
|
||||
__vpiSysTaskCall(const struct __vpirt*rt) : __vpiHandle(rt) { }
|
||||
|
||||
struct __vpiScope* scope;
|
||||
struct __vpiUserSystf*defn;
|
||||
|
|
@ -549,6 +519,8 @@ struct __vpiSysTaskCall : public __vpiHandle {
|
|||
unsigned file_idx;
|
||||
unsigned lineno;
|
||||
bool put_value;
|
||||
protected:
|
||||
inline __vpiSysTaskCall() { }
|
||||
};
|
||||
|
||||
extern struct __vpiSysTaskCall*vpip_cur_task;
|
||||
|
|
@ -576,8 +548,6 @@ struct __vpiStringConst : public __vpiHandle {
|
|||
|
||||
char*value;
|
||||
size_t value_len;
|
||||
protected:
|
||||
inline __vpiStringConst(const struct __vpirt*rt) : __vpiHandle(rt) { }
|
||||
};
|
||||
|
||||
vpiHandle vpip_make_string_const(char*text, bool persistent =true);
|
||||
|
|
@ -602,8 +572,6 @@ struct __vpiBinaryConst : public __vpiHandle {
|
|||
int signed_flag :1;
|
||||
/* TRUE if this constant has an explicit size (i.e. 19'h0 vs. 'h0) */
|
||||
int sized_flag :1;
|
||||
protected:
|
||||
inline __vpiBinaryConst(const struct __vpirt*rt) : __vpiHandle(rt) { }
|
||||
};
|
||||
|
||||
vpiHandle vpip_make_binary_const(unsigned wid, const char*bits);
|
||||
|
|
@ -615,14 +583,7 @@ struct __vpiDecConst : public __vpiHandle {
|
|||
__vpiDecConst(int val =0);
|
||||
int get_type_code(void) const;
|
||||
int vpi_get(int code);
|
||||
char* vpi_get_str(int code);
|
||||
void vpi_get_value(p_vpi_value val);
|
||||
vpiHandle vpi_put_value(p_vpi_value val, int flags);
|
||||
vpiHandle vpi_handle(int code);
|
||||
vpiHandle vpi_iterate(int code);
|
||||
vpiHandle vpi_index(int idx);
|
||||
void vpi_get_delays(p_vpi_delay del);
|
||||
void vpi_put_delays(p_vpi_delay del);
|
||||
|
||||
int value;
|
||||
};
|
||||
|
|
@ -631,18 +592,9 @@ struct __vpiRealConst : public __vpiHandle {
|
|||
__vpiRealConst();
|
||||
int get_type_code(void) const;
|
||||
int vpi_get(int code);
|
||||
char*vpi_get_str(int code);
|
||||
void vpi_get_value(p_vpi_value val);
|
||||
vpiHandle vpi_put_value(p_vpi_value val, int flags);
|
||||
vpiHandle vpi_handle(int code);
|
||||
vpiHandle vpi_iterate(int code);
|
||||
vpiHandle vpi_index(int idx);
|
||||
void vpi_get_delays(p_vpi_delay del);
|
||||
void vpi_put_delays(p_vpi_delay del);
|
||||
|
||||
double value;
|
||||
protected:
|
||||
inline __vpiRealConst(const struct __vpirt*rt) : __vpiHandle(rt) { }
|
||||
};
|
||||
|
||||
vpiHandle vpip_make_real_const(double value);
|
||||
|
|
|
|||
|
|
@ -135,25 +135,8 @@ static vpiHandle real_var_put_value(vpiHandle ref, p_vpi_value vp, int)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static const struct __vpirt vpip_real_var_rt = {
|
||||
vpiRealVar,
|
||||
|
||||
0, //real_var_get,
|
||||
0, //real_var_get_str,
|
||||
0, //real_var_get_value,
|
||||
0, //real_var_put_value,
|
||||
|
||||
0, //real_var_get_handle,
|
||||
0, //real_var_iterate,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
inline __vpiRealVar::__vpiRealVar()
|
||||
: __vpiHandle(&vpip_real_var_rt)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
int __vpiRealVar::get_type_code(void) const
|
||||
{ return vpiRealVar; }
|
||||
|
|
|
|||
|
|
@ -318,98 +318,29 @@ vpiHandle __vpiScope::vpi_handle(int code)
|
|||
vpiHandle __vpiScope::vpi_iterate(int code)
|
||||
{ return module_iter(code, this); }
|
||||
|
||||
static const struct __vpirt vpip_scope_module_rt = {
|
||||
vpiModule,
|
||||
0, // Inherit from__vpiScope: scope_get,
|
||||
0, // Inherit from __vpiScope: scope_get_str,
|
||||
0,
|
||||
0,
|
||||
0, // Inherit from__vpiScope: scope_get_handle,
|
||||
0, // Inherit from__vpiScope: module_iter,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
||||
struct vpiScopeModule : public __vpiScope {
|
||||
inline vpiScopeModule() : __vpiScope(&vpip_scope_module_rt) { }
|
||||
inline vpiScopeModule() { }
|
||||
int get_type_code(void) const { return vpiModule; }
|
||||
};
|
||||
|
||||
static const struct __vpirt vpip_scope_task_rt = {
|
||||
vpiTask,
|
||||
0, // Inherit from__vpiScope: scope_get,
|
||||
0, // Inherit from __vpiScope: scope_get_str,
|
||||
0,
|
||||
0,
|
||||
0, // Inherit from__vpiScope: scope_get_handle,
|
||||
0, // Inherit from__vpiScope: module_iter,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
||||
struct vpiScopeTask : public __vpiScope {
|
||||
inline vpiScopeTask() : __vpiScope(&vpip_scope_task_rt) { }
|
||||
inline vpiScopeTask() { }
|
||||
int get_type_code(void) const { return vpiTask; }
|
||||
};
|
||||
|
||||
static const struct __vpirt vpip_scope_function_rt = {
|
||||
vpiFunction,
|
||||
0, // Inherit from__vpiScope: scope_get,
|
||||
0, // Inherit from __vpiScope: scope_get_str,
|
||||
0,
|
||||
0,
|
||||
0, // Inherit from__vpiScope: scope_get_handle,
|
||||
0, // Inherit from__vpiScope: module_iter,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
||||
struct vpiScopeFunction : public __vpiScope {
|
||||
inline vpiScopeFunction() : __vpiScope(&vpip_scope_function_rt) { }
|
||||
inline vpiScopeFunction() { }
|
||||
int get_type_code(void) const { return vpiFunction; }
|
||||
};
|
||||
|
||||
static const struct __vpirt vpip_scope_begin_rt = {
|
||||
vpiNamedBegin,
|
||||
0, // Inherit from__vpiScope: scope_get,
|
||||
0, // Inherit from __vpiScope: scope_get_str,
|
||||
0,
|
||||
0,
|
||||
0, // Inherit from__vpiScope: scope_get_handle,
|
||||
0, // Inherit from__vpiScope: module_iter,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
||||
struct vpiScopeBegin : public __vpiScope {
|
||||
inline vpiScopeBegin() : __vpiScope(&vpip_scope_begin_rt) { }
|
||||
inline vpiScopeBegin() { }
|
||||
int get_type_code(void) const { return vpiNamedBegin; }
|
||||
};
|
||||
|
||||
static const struct __vpirt vpip_scope_fork_rt = {
|
||||
vpiNamedFork,
|
||||
0, // Inherit from__vpiScope: scope_get,
|
||||
0, // Inherit from __vpiScope: scope_get_str,
|
||||
0,
|
||||
0,
|
||||
0, // Inherit from__vpiScope: scope_get_handle,
|
||||
0, // Inherit from__vpiScope: module_iter,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
||||
struct vpiScopeFork : public __vpiScope {
|
||||
inline vpiScopeFork() : __vpiScope(&vpip_scope_fork_rt) { }
|
||||
inline vpiScopeFork() { }
|
||||
int get_type_code(void) const { return vpiNamedFork; }
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -878,147 +878,43 @@ vpiHandle __vpiSignal::vpi_handle(int code)
|
|||
vpiHandle __vpiSignal::vpi_iterate(int code)
|
||||
{ return signal_iterate(code, this); }
|
||||
|
||||
static const struct __vpirt vpip_reg_rt = {
|
||||
vpiReg,
|
||||
0, //Inherit from __vpiSignal: signal_get,
|
||||
0, //Inherit from __vpiSignal: signal_get_str,
|
||||
0, //Inherit from __vpiSignal: signal_get_value,
|
||||
0, //Inherit from __vpiSignal: signal_put_value,
|
||||
0, //Inherit from __vpiSignal: signal_get_handle,
|
||||
0, //Inherit from __vpiSignal: signal_iterate,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
struct signal_reg : public __vpiSignal {
|
||||
inline signal_reg() : __vpiSignal(&vpip_reg_rt) { }
|
||||
inline signal_reg() { }
|
||||
int get_type_code(void) const { return vpiReg; }
|
||||
};
|
||||
|
||||
static const struct __vpirt vpip_integer_rt = {
|
||||
vpiIntegerVar,
|
||||
0, //Inherit from __vpiSignal: signal_get,
|
||||
0, //Inherit from __vpiSignal: signal_get_str,
|
||||
0, //Inherit from __vpiSignal: signal_get_value,
|
||||
0, //Inherit from __vpiSignal: signal_put_value,
|
||||
0, //Inherit from __vpiSignal: signal_get_handle,
|
||||
0, //Inherit from __vpiSignal: signal_iterate,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
struct signal_integer : public __vpiSignal {
|
||||
inline signal_integer() : __vpiSignal(&vpip_integer_rt) { }
|
||||
inline signal_integer() { }
|
||||
int get_type_code(void) const { return vpiIntegerVar; }
|
||||
};
|
||||
|
||||
static const struct __vpirt vpip_net_rt = {
|
||||
vpiNet,
|
||||
0, //Inherit from __vpiSignal: signal_get,
|
||||
0, //Inherit from __vpiSignal: signal_get_str,
|
||||
0, //Inherit from __vpiSignal: signal_get_value,
|
||||
0, //Inherit from __vpiSignal: signal_put_value,
|
||||
0, //Inherit from __vpiSignal: signal_get_handle,
|
||||
0, //Inherit from __vpiSignal: signal_iterate,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
struct signal_net : public __vpiSignal {
|
||||
inline signal_net() : __vpiSignal(&vpip_net_rt) { }
|
||||
inline signal_net() { }
|
||||
int get_type_code(void) const { return vpiNet; }
|
||||
};
|
||||
|
||||
static const struct __vpirt vpip_byte_rt = {
|
||||
vpiByteVar,
|
||||
0, //Inherit from __vpiSignal: signal_get,
|
||||
0, //Inherit from __vpiSignal: signal_get_str,
|
||||
0, //Inherit from __vpiSignal: signal_get_value,
|
||||
0, //Inherit from __vpiSignal: signal_put_value,
|
||||
0, //Inherit from __vpiSignal: signal_get_handle,
|
||||
0, //Inherit from __vpiSignal: signal_iterate,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
struct signal_byte : public __vpiSignal {
|
||||
inline signal_byte() : __vpiSignal(&vpip_byte_rt) { }
|
||||
inline signal_byte() { }
|
||||
int get_type_code(void) const { return vpiByteVar; }
|
||||
};
|
||||
|
||||
static const struct __vpirt vpip_bitvar_rt = {
|
||||
vpiBitVar,
|
||||
0, //Inherit from __vpiSignal: signal_get,
|
||||
0, //Inherit from __vpiSignal: signal_get_str,
|
||||
0, //Inherit from __vpiSignal: signal_get_value,
|
||||
0, //Inherit from __vpiSignal: signal_put_value,
|
||||
0, //Inherit from __vpiSignal: signal_get_handle,
|
||||
0, //Inherit from __vpiSignal: signal_iterate,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
struct signal_bitvar : public __vpiSignal {
|
||||
inline signal_bitvar() : __vpiSignal(&vpip_bitvar_rt) { }
|
||||
inline signal_bitvar() { }
|
||||
int get_type_code(void) const { return vpiBitVar; }
|
||||
};
|
||||
|
||||
static const struct __vpirt vpip_shortint_rt = {
|
||||
vpiShortIntVar,
|
||||
0, //Inherit from __vpiSignal: signal_get,
|
||||
0, //Inherit from __vpiSignal: signal_get_str,
|
||||
0, //Inherit from __vpiSignal: signal_get_value,
|
||||
0, //Inherit from __vpiSignal: signal_put_value,
|
||||
0, //Inherit from __vpiSignal: signal_get_handle,
|
||||
0, //Inherit from __vpiSignal: signal_iterate,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
struct signal_shortint : public __vpiSignal {
|
||||
inline signal_shortint() : __vpiSignal(&vpip_shortint_rt) { }
|
||||
inline signal_shortint() { }
|
||||
int get_type_code(void) const { return vpiShortIntVar; }
|
||||
};
|
||||
|
||||
static const struct __vpirt vpip_int_rt = {
|
||||
vpiIntVar,
|
||||
0, //Inherit from __vpiSignal: signal_get,
|
||||
0, //Inherit from __vpiSignal: signal_get_str,
|
||||
0, //Inherit from __vpiSignal: signal_get_value,
|
||||
0, //Inherit from __vpiSignal: signal_put_value,
|
||||
0, //Inherit from __vpiSignal: signal_get_handle,
|
||||
0, //Inherit from __vpiSignal: signal_iterate,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
struct signal_int : public __vpiSignal {
|
||||
inline signal_int() : __vpiSignal(&vpip_int_rt) { }
|
||||
inline signal_int() { }
|
||||
int get_type_code(void) const { return vpiIntVar; }
|
||||
};
|
||||
|
||||
static const struct __vpirt vpip_longint_rt = {
|
||||
vpiLongIntVar,
|
||||
0, //Inherit from __vpiSignal: signal_get,
|
||||
0, //Inherit from __vpiSignal: signal_get_str,
|
||||
0, //Inherit from __vpiSignal: signal_get_value,
|
||||
0, //Inherit from __vpiSignal: signal_put_value,
|
||||
0, //Inherit from __vpiSignal: signal_get_handle,
|
||||
0, //Inherit from __vpiSignal: signal_iterate,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
struct signal_longint : public __vpiSignal {
|
||||
inline signal_longint() : __vpiSignal(&vpip_longint_rt) { }
|
||||
inline signal_longint() { }
|
||||
int get_type_code(void) const { return vpiLongIntVar; }
|
||||
};
|
||||
|
||||
|
|
@ -1446,23 +1342,8 @@ static vpiHandle PV_get_handle(int code, vpiHandle ref)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static const struct __vpirt vpip_PV_rt = {
|
||||
vpiPartSelect,
|
||||
0, //PV_get,
|
||||
0, //PV_get_str,
|
||||
0, //PV_get_value,
|
||||
0, //PV_put_value,
|
||||
0, //PV_get_handle,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
inline __vpiPV::__vpiPV()
|
||||
: __vpiHandle(&vpip_PV_rt)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
int __vpiPV::get_type_code(void) const
|
||||
{ return vpiPartSelect; }
|
||||
|
|
|
|||
129
vvp/vpi_tasks.cc
129
vvp/vpi_tasks.cc
|
|
@ -35,24 +35,8 @@
|
|||
# include <cassert>
|
||||
# include "ivl_alloc.h"
|
||||
|
||||
static const struct __vpirt vpip_systf_def_rt = {
|
||||
vpiUserSystf,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
||||
inline __vpiUserSystf::__vpiUserSystf()
|
||||
: __vpiHandle(&vpip_systf_def_rt)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
int __vpiUserSystf::get_type_code(void) const
|
||||
{ return vpiUserSystf; }
|
||||
|
|
@ -154,21 +138,8 @@ static vpiHandle systask_iter(int, vpiHandle ref)
|
|||
return vpip_make_iterator(rfp->nargs, rfp->args, false);
|
||||
}
|
||||
|
||||
static const struct __vpirt vpip_systask_rt = {
|
||||
vpiSysTaskCall,
|
||||
0, //systask_get,
|
||||
0, //systask_get_str,
|
||||
0,
|
||||
0,
|
||||
0, //systask_handle,
|
||||
0, //systask_iter,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
struct systask_def : public __vpiSysTaskCall {
|
||||
inline systask_def() : __vpiSysTaskCall(&vpip_systask_rt) { }
|
||||
inline systask_def() { }
|
||||
int get_type_code(void) const { return vpiSysTaskCall; }
|
||||
int vpi_get(int code) { return systask_get(code, this); }
|
||||
char*vpi_get_str(int code) { return systask_get_str(code, this); }
|
||||
|
|
@ -469,21 +440,8 @@ static vpiHandle sysfunc_put_no_value(vpiHandle, p_vpi_value, int)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static const struct __vpirt vpip_sysfunc_rt = {
|
||||
vpiSysFuncCall,
|
||||
0, //sysfunc_get,
|
||||
0, //systask_get_str,
|
||||
0,
|
||||
0, //sysfunc_put_value,
|
||||
0, //systask_handle,
|
||||
0, //systask_iter,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
struct sysfunc_def : public __vpiSysTaskCall {
|
||||
inline sysfunc_def() : __vpiSysTaskCall(&vpip_sysfunc_rt) { }
|
||||
inline sysfunc_def() { }
|
||||
int get_type_code(void) const { return vpiSysFuncCall; }
|
||||
int vpi_get(int code) { return sysfunc_get(code, this); }
|
||||
char* vpi_get_str(int code) { return systask_get_str(code, this); }
|
||||
|
|
@ -495,21 +453,8 @@ struct sysfunc_def : public __vpiSysTaskCall {
|
|||
{ return systask_iter(code, this); }
|
||||
};
|
||||
|
||||
static const struct __vpirt vpip_sysfunc_real_rt = {
|
||||
vpiSysFuncCall,
|
||||
0, //sysfunc_get,
|
||||
0, //systask_get_str,
|
||||
0,
|
||||
0, //sysfunc_put_real_value,
|
||||
0, //systask_handle,
|
||||
0, //systask_iter,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
struct sysfunc_real : public __vpiSysTaskCall {
|
||||
inline sysfunc_real() : __vpiSysTaskCall(&vpip_sysfunc_real_rt) { }
|
||||
inline sysfunc_real() { }
|
||||
int get_type_code(void) const { return vpiSysFuncCall; }
|
||||
int vpi_get(int code) { return sysfunc_get(code, this); }
|
||||
char* vpi_get_str(int code) { return systask_get_str(code, this); }
|
||||
|
|
@ -521,21 +466,8 @@ struct sysfunc_real : public __vpiSysTaskCall {
|
|||
{ return systask_iter(code, this); }
|
||||
};
|
||||
|
||||
static const struct __vpirt vpip_sysfunc_4net_rt = {
|
||||
vpiSysFuncCall,
|
||||
0, //sysfunc_get,
|
||||
0, //systask_get_str,
|
||||
0,
|
||||
0, //sysfunc_put_4net_value,
|
||||
0, //systask_handle,
|
||||
0, //systask_iter,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
struct sysfunc_4net : public __vpiSysTaskCall {
|
||||
inline sysfunc_4net() : __vpiSysTaskCall(&vpip_sysfunc_4net_rt) { }
|
||||
inline sysfunc_4net() { }
|
||||
int get_type_code(void) const { return vpiSysFuncCall; }
|
||||
int vpi_get(int code) { return sysfunc_get(code, this); }
|
||||
char* vpi_get_str(int code) { return systask_get_str(code, this); }
|
||||
|
|
@ -547,21 +479,8 @@ struct sysfunc_4net : public __vpiSysTaskCall {
|
|||
{ return systask_iter(code, this); }
|
||||
};
|
||||
|
||||
static const struct __vpirt vpip_sysfunc_rnet_rt = {
|
||||
vpiSysFuncCall,
|
||||
0, //sysfunc_get,
|
||||
0, //systask_get_str,
|
||||
0,
|
||||
0, //sysfunc_put_rnet_value,
|
||||
0, //systask_handle,
|
||||
0, //systask_iter,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
struct sysfunc_rnet : public __vpiSysTaskCall {
|
||||
inline sysfunc_rnet() : __vpiSysTaskCall(&vpip_sysfunc_rnet_rt) { }
|
||||
inline sysfunc_rnet() { }
|
||||
int get_type_code(void) const { return vpiSysFuncCall; }
|
||||
int vpi_get(int code) { return sysfunc_get(code, this); }
|
||||
char* vpi_get_str(int code) { return systask_get_str(code, this); }
|
||||
|
|
@ -573,21 +492,8 @@ struct sysfunc_rnet : public __vpiSysTaskCall {
|
|||
{ return systask_iter(code, this); }
|
||||
};
|
||||
|
||||
static const struct __vpirt vpip_sysfunc_no_rt = {
|
||||
vpiSysFuncCall,
|
||||
0, //sysfunc_get,
|
||||
0, //systask_get_str,
|
||||
0,
|
||||
sysfunc_put_no_value,
|
||||
systask_handle,
|
||||
systask_iter,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
struct sysfunc_no : public __vpiSysTaskCall {
|
||||
inline sysfunc_no() : __vpiSysTaskCall(&vpip_sysfunc_no_rt) { }
|
||||
inline sysfunc_no() { }
|
||||
int get_type_code(void) const { return vpiSysFuncCall; }
|
||||
int vpi_get(int code) { return sysfunc_get(code, this); }
|
||||
char* vpi_get_str(int code) { return systask_get_str(code, this); }
|
||||
|
|
@ -648,6 +554,7 @@ struct __vpiSystfIterator : public __vpiHandle {
|
|||
__vpiSystfIterator();
|
||||
int get_type_code(void) const;
|
||||
vpiHandle vpi_index(int idx);
|
||||
free_object_fun_t free_object_fun(void);
|
||||
|
||||
unsigned next;
|
||||
};
|
||||
|
|
@ -681,23 +588,8 @@ static int systf_iterator_free_object(vpiHandle ref)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static const struct __vpirt vpip_systf_iterator_rt = {
|
||||
vpiIterator,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0, //systf_iterator_scan,
|
||||
systf_iterator_free_object,
|
||||
0,
|
||||
0
|
||||
};
|
||||
inline __vpiSystfIterator::__vpiSystfIterator()
|
||||
: __vpiHandle(&vpip_systf_iterator_rt)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
int __vpiSystfIterator::get_type_code(void) const
|
||||
{ return vpiIterator; }
|
||||
|
|
@ -705,6 +597,9 @@ int __vpiSystfIterator::get_type_code(void) const
|
|||
vpiHandle __vpiSystfIterator::vpi_index(int idx)
|
||||
{ return systf_iterator_scan(this, idx); }
|
||||
|
||||
__vpiHandle::free_object_fun_t __vpiSystfIterator::free_object_fun(void)
|
||||
{ return &systf_iterator_free_object; }
|
||||
|
||||
vpiHandle vpip_make_systf_iterator(void)
|
||||
{
|
||||
/* Check to see if there are any user defined functions. */
|
||||
|
|
|
|||
|
|
@ -311,23 +311,8 @@ static void timevar_get_rvalue(vpiHandle ref, s_vpi_value*vp)
|
|||
timevar_get_value(ref, vp, false, false);
|
||||
}
|
||||
|
||||
static const struct __vpirt vpip_system_time_rt = {
|
||||
vpiSysFuncCall,
|
||||
0,
|
||||
0, //timevar_time_get_str,
|
||||
0, //timevar_get_ivalue,
|
||||
0,
|
||||
0, //Inherit from __vpiSystemTime: timevar_handle,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
__vpiScopedTime::__vpiScopedTime()
|
||||
: __vpiSystemTime(&vpip_system_time_rt)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
int __vpiScopedTime::vpi_get(int code)
|
||||
{ return timevar_time_get(code, this); }
|
||||
|
|
@ -338,23 +323,9 @@ char* __vpiScopedTime::vpi_get_str(int code)
|
|||
void __vpiScopedTime::vpi_get_value(p_vpi_value val)
|
||||
{ timevar_get_ivalue(this, val); }
|
||||
|
||||
static const struct __vpirt vpip_system_stime_rt = {
|
||||
vpiSysFuncCall,
|
||||
0,
|
||||
0,
|
||||
0, //timevar_get_svalue,
|
||||
0,
|
||||
0, //Inherit from __vpiSystemTime: timevar_handle,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
||||
__vpiScopedSTime::__vpiScopedSTime()
|
||||
: __vpiSystemTime(&vpip_system_stime_rt)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
int __vpiScopedSTime::vpi_get(int code)
|
||||
{ return timevar_stime_get(code, this); }
|
||||
|
|
@ -365,21 +336,7 @@ char* __vpiScopedSTime::vpi_get_str(int code)
|
|||
void __vpiScopedSTime::vpi_get_value(p_vpi_value val)
|
||||
{ timevar_get_svalue(this, val); }
|
||||
|
||||
static const struct __vpirt vpip_system_simtime_rt = {
|
||||
vpiSysFuncCall,
|
||||
0,
|
||||
0,
|
||||
0, //timevar_get_ivalue,
|
||||
0,
|
||||
0, //timevar_handle,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
__vpiSystemTime::__vpiSystemTime()
|
||||
: __vpiHandle(&vpip_system_simtime_rt)
|
||||
{
|
||||
scope = 0;
|
||||
}
|
||||
|
|
@ -414,23 +371,8 @@ void __vpiSystemTime::vpi_get_delays(p_vpi_delay)
|
|||
void __vpiSystemTime::vpi_put_delays(p_vpi_delay)
|
||||
{ }
|
||||
|
||||
static const struct __vpirt vpip_system_realtime_rt = {
|
||||
vpiSysFuncCall,
|
||||
0,
|
||||
0,
|
||||
0, //timevar_get_rvalue,
|
||||
0,
|
||||
0, //Inherit from __vpiSystemTime: timevar_handle,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
__vpiScopedRealtime::__vpiScopedRealtime()
|
||||
: __vpiSystemTime(&vpip_system_realtime_rt)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
int __vpiScopedRealtime::vpi_get(int code)
|
||||
{ return timevar_realtime_get(code, this); }
|
||||
|
|
|
|||
|
|
@ -438,23 +438,8 @@ static vpiHandle vthr_vec_put_value(vpiHandle ref, s_vpi_value*vp, int)
|
|||
// The code fully supports vpiReg, vpi_Net, but we do not
|
||||
// create such things, yet. Lacking a name, for example.
|
||||
|
||||
static const struct __vpirt vpip_vthr_const_rt = {
|
||||
vpiConstant,
|
||||
0, //vthr_vec_get,
|
||||
0, //vthr_vec_get_str,
|
||||
0, //vthr_vec_get_value,
|
||||
0, //vthr_vec_put_value,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
inline __vpiVThrVec::__vpiVThrVec()
|
||||
: __vpiHandle(&vpip_vthr_const_rt)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
int __vpiVThrVec::get_type_code(void) const
|
||||
{ return vpiConstant; }
|
||||
|
|
@ -603,23 +588,8 @@ static void vthr_real_get_value(vpiHandle ref, s_vpi_value*vp)
|
|||
}
|
||||
}
|
||||
|
||||
static const struct __vpirt vpip_vthr_const_real_rt = {
|
||||
vpiConstant,
|
||||
0, //vthr_word_get,
|
||||
0,
|
||||
0, //vthr_real_get_value,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
inline __vpiVThrWord::__vpiVThrWord()
|
||||
: __vpiHandle(&vpip_vthr_const_real_rt)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
int __vpiVThrWord::get_type_code(void) const
|
||||
{ return vpiConstant; }
|
||||
|
|
|
|||
Loading…
Reference in New Issue