Add support for vpiInstance as the type code in calls to vpi_iterate().

This is needed for the waveform dumpers now that vpi_iterate(vpiModule, NULL)
has been ficed to only return modules.

This includes recognising vpiProgram and vpiInterface, although the compiler
and vvp currently incorrectly classify them as modules.
This commit is contained in:
Martin Whitaker 2021-04-21 09:01:50 +01:00
parent 7d7aa0604c
commit d2521878d7
3 changed files with 19 additions and 1 deletions

View File

@ -1,7 +1,7 @@
#ifndef SV_VPI_USER_H #ifndef SV_VPI_USER_H
#define SV_VPI_USER_H #define SV_VPI_USER_H
/* /*
* Copyright (c) 2010-2020 Stephen Williams (steve@icarus.com) * Copyright (c) 2010-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -44,6 +44,8 @@ EXTERN_C_START
/********* OBJECT TYPES ***********/ /********* OBJECT TYPES ***********/
#define vpiPackage 600 #define vpiPackage 600
#define vpiInterface 601
#define vpiProgram 602
#define vpiArrayType 606 #define vpiArrayType 606
#define vpiStaticArray 1 #define vpiStaticArray 1
#define vpiDynamicArray 2 #define vpiDynamicArray 2
@ -72,6 +74,9 @@ EXTERN_C_START
/********* Many-to-One ***********/ /********* Many-to-One ***********/
#define vpiMember 742 #define vpiMember 742
/********* One-to-One and One-to-Many ***********/
#define vpiInstance 745
/********* generic object properties ***********/ /********* generic object properties ***********/
#define vpiNullConst 11 #define vpiNullConst 11

View File

@ -1240,8 +1240,14 @@ static vpiHandle vpip_make_udp_iterator()
static vpiHandle vpi_iterate_global(int type) static vpiHandle vpi_iterate_global(int type)
{ {
switch (type) { switch (type) {
case vpiInstance:
// fallthrough
case vpiModule: case vpiModule:
// fallthrough // fallthrough
case vpiProgram:
// fallthrough
case vpiInterface:
// fallthrough
case vpiPackage: case vpiPackage:
return vpip_make_root_iterator(type); return vpip_make_root_iterator(type);

View File

@ -278,6 +278,13 @@ static int compare_types(int code, int type)
type == vpiNamedFork) ) type == vpiNamedFork) )
return 1; return 1;
if ( code == vpiInstance &&
(type == vpiModule ||
type == vpiProgram ||
type == vpiInterface ||
type == vpiPackage) )
return 1;
if ( code == vpiVariables && if ( code == vpiVariables &&
(type == vpiIntegerVar || (type == vpiIntegerVar ||
type == vpiBitVar || type == vpiBitVar ||