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.

(cherry picked from commit d2521878d7)
This commit is contained in:
Martin Whitaker 2021-04-21 09:01:50 +01:00
parent a83a205b06
commit 69cf8d8901
3 changed files with 19 additions and 1 deletions

View File

@ -1,7 +1,7 @@
#ifndef SV_VPI_USER_H
#define SV_VPI_USER_H
/*
* Copyright (c) 2010-2014 Stephen Williams (steve@icarus.com)
* Copyright (c) 2010-2021 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
@ -44,6 +44,8 @@ EXTERN_C_START
/********* OBJECT TYPES ***********/
#define vpiPackage 600
#define vpiInterface 601
#define vpiProgram 602
#define vpiArrayType 606
#define vpiStaticArray 1
#define vpiDynamicArray 2
@ -72,6 +74,9 @@ EXTERN_C_START
/********* Many-to-One ***********/
#define vpiMember 742
/********* One-to-One and One-to-Many ***********/
#define vpiInstance 745
/********* task/function properties **********/
#define vpiOtherFunc 6

View File

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

View File

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