From d2521878d7074d4b1aadae5b7933c1f0e6653a27 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Wed, 21 Apr 2021 09:01:50 +0100 Subject: [PATCH] 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. --- sv_vpi_user.h | 7 ++++++- vvp/vpi_priv.cc | 6 ++++++ vvp/vpi_scope.cc | 7 +++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/sv_vpi_user.h b/sv_vpi_user.h index 1cd64a4a5..2765212b2 100644 --- a/sv_vpi_user.h +++ b/sv_vpi_user.h @@ -1,7 +1,7 @@ #ifndef 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 * 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 + /********* generic object properties ***********/ #define vpiNullConst 11 diff --git a/vvp/vpi_priv.cc b/vvp/vpi_priv.cc index 3baea6416..51d9a1473 100644 --- a/vvp/vpi_priv.cc +++ b/vvp/vpi_priv.cc @@ -1240,8 +1240,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); diff --git a/vvp/vpi_scope.cc b/vvp/vpi_scope.cc index ba17b127a..7acbc98c1 100644 --- a/vvp/vpi_scope.cc +++ b/vvp/vpi_scope.cc @@ -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 ||