aboutsummaryrefslogtreecommitdiffstats
path: root/src/grt/grt-vcd.adb
diff options
context:
space:
mode:
Diffstat (limited to 'src/grt/grt-vcd.adb')
-rw-r--r--src/grt/grt-vcd.adb98
1 files changed, 73 insertions, 25 deletions
diff --git a/src/grt/grt-vcd.adb b/src/grt/grt-vcd.adb
index 6c81ec7b1..4795a1879 100644
--- a/src/grt/grt-vcd.adb
+++ b/src/grt/grt-vcd.adb
@@ -23,6 +23,19 @@
-- however invalidate any other reasons why the executable file might be
-- covered by the GNU Public License.
+-------------------------------------------------------------------------------
+
+-- TODO:
+-- * Fix the following issues :
+-- + Currently both the top level signals and signals in packages aren't
+-- visible on the tree view (SST) of gtkwave, but both of them are visible
+-- when no item is selected in the tree view and are mixed together.
+-- (Same issue with FST waves.)
+-- + After calling Vcd_Put_Hierarchy (Pack, Wave_Elem), Avhpi_Error is
+-- raised several times when no signal paths are provided in a wave option
+-- file. It has no consequences other than a printed message.
+-- (Same issue with FST waves.)
+
with System; use System;
with Interfaces;
with Grt.Stdio; use Grt.Stdio;
@@ -36,6 +49,8 @@ with Grt.Rtis; use Grt.Rtis;
with Grt.Rtis_Addr; use Grt.Rtis_Addr;
with Grt.Rtis_Types; use Grt.Rtis_Types;
with Grt.Vstrings;
+with Grt.Wave_Opt_File; use Grt.Wave_Opt_File;
+with Grt.Wave_Opt_File.Tree_Reading; use Grt.Wave_Opt_File.Tree_Reading;
pragma Elaborate_All (Grt.Table);
package body Grt.Vcd is
@@ -516,11 +531,13 @@ package body Grt.Vcd is
end if;
end Add_Signal;
- procedure Vcd_Put_Hierarchy (Inst : VhpiHandleT)
+ procedure Vcd_Put_Hierarchy
+ (Inst : VhpiHandleT; Wave_Elem : Wave_Opt_File.Elem_Acc)
is
Decl_It : VhpiHandleT;
Decl : VhpiHandleT;
Error : AvhpiErrorT;
+ Wave_Elem_Child : Wave_Opt_File.Elem_Acc;
begin
Vhpi_Iterator (VhpiDecls, Inst, Decl_It, Error);
if Error /= AvhpiErrorOk then
@@ -537,13 +554,17 @@ package body Grt.Vcd is
return;
end if;
- case Vhpi_Get_Kind (Decl) is
- when VhpiPortDeclK
- | VhpiSigDeclK =>
- Add_Signal (Decl);
- when others =>
- null;
- end case;
+ Wave_Elem_Child := Get_Cursor
+ (Avhpi_Get_Base_Name (Decl), Wave_Elem, Is_Signal => True);
+ if Is_Displayed (Wave_Elem_Child) then
+ case Vhpi_Get_Kind (Decl) is
+ when VhpiPortDeclK
+ | VhpiSigDeclK =>
+ Add_Signal (Decl);
+ when others =>
+ null;
+ end case;
+ end if;
end loop;
-- Extract sub-scopes.
@@ -560,22 +581,24 @@ package body Grt.Vcd is
Avhpi_Error (Error);
return;
end if;
-
- case Vhpi_Get_Kind (Decl) is
- when VhpiIfGenerateK
- | VhpiForGenerateK
- | VhpiBlockStmtK
- | VhpiCompInstStmtK =>
- Vcd_Put ("$scope module ");
- Vcd_Put_Name (Decl);
- Vcd_Putc (' ');
- Vcd_Put_End;
- Vcd_Put_Hierarchy (Decl);
- Vcd_Put ("$upscope ");
- Vcd_Put_End;
- when others =>
- null;
- end case;
+ Wave_Elem_Child := Get_Cursor (Avhpi_Get_Base_Name (Decl), Wave_Elem);
+ if Is_Displayed (Wave_Elem_Child) then
+ case Vhpi_Get_Kind (Decl) is
+ when VhpiIfGenerateK
+ | VhpiForGenerateK
+ | VhpiBlockStmtK
+ | VhpiCompInstStmtK =>
+ Vcd_Put ("$scope module ");
+ Vcd_Put_Name (Decl);
+ Vcd_Putc (' ');
+ Vcd_Put_End;
+ Vcd_Put_Hierarchy (Decl, Wave_Elem_Child);
+ Vcd_Put ("$upscope ");
+ Vcd_Put_End;
+ when others =>
+ null;
+ end case;
+ end if;
end loop;
end Vcd_Put_Hierarchy;
@@ -841,7 +864,11 @@ package body Grt.Vcd is
-- Called after elaboration.
procedure Vcd_Start
is
+ Pack_It : VhpiHandleT;
+ Pack : VhpiHandleT;
+ Error : AvhpiErrorT;
Root : VhpiHandleT;
+ Wave_Elem : Wave_Opt_File.Elem_Acc;
begin
-- Do nothing if there is no VCD file to generate.
if Vcd_Close = null then
@@ -852,8 +879,29 @@ package body Grt.Vcd is
Search_Types_RTI;
-- Put hierarchy.
+
+ -- First packages.
+ Get_Package_Inst (Pack_It);
+ loop
+ Vhpi_Scan (Pack_It, Pack, Error);
+ exit when Error = AvhpiErrorIteratorEnd;
+ if Error /= AvhpiErrorOk then
+ Avhpi_Error (Error);
+ return;
+ end if;
+ Wave_Elem := Get_Top_Cursor (Avhpi_Get_Base_Name (Pack), Pkg);
+ if Is_Displayed (Wave_Elem) then
+ Vcd_Put_Hierarchy (Pack, Wave_Elem);
+ end if;
+ end loop;
+
+ -- Then top entity.
Get_Root_Inst (Root);
- Vcd_Put_Hierarchy (Root);
+ Wave_Elem := Get_Top_Cursor (Avhpi_Get_Base_Name (Root), Entity);
+ if Is_Displayed (Wave_Elem) then
+ Vcd_Put_Hierarchy (Root, Wave_Elem);
+ end if;
+ Wave_Opt_File.Tree_Reading.Check_If_All_Found;
-- End of header.
Vcd_Put ("$enddefinitions ");