diff options
Diffstat (limited to 'src/grt/grt-waves.adb')
-rw-r--r-- | src/grt/grt-waves.adb | 114 |
1 files changed, 70 insertions, 44 deletions
diff --git a/src/grt/grt-waves.adb b/src/grt/grt-waves.adb index d14d2b0c4..11caef838 100644 --- a/src/grt/grt-waves.adb +++ b/src/grt/grt-waves.adb @@ -44,6 +44,8 @@ with Grt.Signals; use Grt.Signals; with System; use System; with Grt.Vstrings; use Grt.Vstrings; with Grt.Ghw; use Grt.Ghw; +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.Rtis_Utils); pragma Elaborate_All (Grt.Table); @@ -911,13 +913,17 @@ package body Grt.Waves is end Write_Hierarchy_El; -- Create a hierarchy block. - procedure Wave_Put_Hierarchy_Block (Inst : VhpiHandleT; Step : Step_Type); + procedure Wave_Put_Hierarchy_Block (Inst : VhpiHandleT; + Step : Step_Type; + Wave_Elem : Wave_Opt_File.Elem_Acc); - procedure Wave_Put_Hierarchy_1 (Inst : VhpiHandleT; Step : Step_Type) + procedure Wave_Put_Hierarchy_1 + (Inst : VhpiHandleT; Step : Step_Type; 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 @@ -934,22 +940,26 @@ package body Grt.Waves is return; end if; - case Vhpi_Get_Kind (Decl) is - when VhpiPortDeclK - | VhpiSigDeclK => - case Step is - when Step_Name => - Create_String_Id (Avhpi_Get_Base_Name (Decl)); - Nbr_Scope_Signals := Nbr_Scope_Signals + 1; - Create_Object_Type (Decl); - when Step_Hierarchy => - Write_Hierarchy_El (Decl); - end case; - --Wave_Put_Name (Decl); - --Wave_Newline; - 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 => + case Step is + when Step_Name => + Create_String_Id (Avhpi_Get_Base_Name (Decl)); + Nbr_Scope_Signals := Nbr_Scope_Signals + 1; + Create_Object_Type (Decl); + when Step_Hierarchy => + Write_Hierarchy_El (Decl); + end case; + --Wave_Put_Name (Decl); + --Wave_Newline; + when others => + null; + end case; + end if; end loop; -- No sub-scopes for packages. @@ -974,30 +984,34 @@ package body Grt.Waves is Nbr_Scopes := Nbr_Scopes + 1; - case Vhpi_Get_Kind (Decl) is - when VhpiIfGenerateK - | VhpiForGenerateK - | VhpiBlockStmtK - | VhpiCompInstStmtK => - Wave_Put_Hierarchy_Block (Decl, Step); - when VhpiProcessStmtK => - case Step is - when Step_Name => - Create_String_Id (Avhpi_Get_Base_Name (Decl)); - when Step_Hierarchy => - Write_Hierarchy_El (Decl); - end case; - when others => - Internal_Error ("wave_put_hierarchy_1"); --- Wave_Put ("unknown "); --- Wave_Put (VhpiClassKindT'Image (Vhpi_Get_Kind (Decl))); --- Wave_Newline; - 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 => + Wave_Put_Hierarchy_Block (Decl, Step, Wave_Elem_Child); + when VhpiProcessStmtK => + case Step is + when Step_Name => + Create_String_Id (Avhpi_Get_Base_Name (Decl)); + when Step_Hierarchy => + Write_Hierarchy_El (Decl); + end case; + when others => + Internal_Error ("wave_put_hierarchy_1"); + -- Wave_Put ("unknown "); + -- Wave_Put (VhpiClassKindT'Image (Vhpi_Get_Kind (Decl))); + -- Wave_Newline; + end case; + end if; end loop; end Wave_Put_Hierarchy_1; - procedure Wave_Put_Hierarchy_Block (Inst : VhpiHandleT; Step : Step_Type) - is + procedure Wave_Put_Hierarchy_Block (Inst : VhpiHandleT; + Step : Step_Type; + Wave_Elem : Wave_Opt_File.Elem_Acc) is begin case Step is when Step_Name => @@ -1009,7 +1023,7 @@ package body Grt.Waves is Write_Hierarchy_El (Inst); end case; - Wave_Put_Hierarchy_1 (Inst, Step); + Wave_Put_Hierarchy_1 (Inst, Step, Wave_Elem); if Step = Step_Hierarchy then Wave_Put_Byte (Ghw_Hie_Eos); @@ -1021,6 +1035,7 @@ package body Grt.Waves is Pack_It : VhpiHandleT; Pack : VhpiHandleT; Error : AvhpiErrorT; + Wave_Elem : Wave_Opt_File.Elem_Acc; begin -- First packages. Get_Package_Inst (Pack_It); @@ -1031,12 +1046,17 @@ package body Grt.Waves is Avhpi_Error (Error); return; end if; - - Wave_Put_Hierarchy_Block (Pack, Step); + Wave_Elem := Get_Top_Cursor (Avhpi_Get_Base_Name (Pack), Pkg); + if Is_Displayed (Wave_Elem) then + Wave_Put_Hierarchy_Block (Pack, Step, Wave_Elem); + end if; end loop; -- Then top entity. - Wave_Put_Hierarchy_Block (Root, Step); + Wave_Elem := Get_Top_Cursor (Avhpi_Get_Base_Name (Root), Entity); + if Is_Displayed (Wave_Elem) then + Wave_Put_Hierarchy_Block (Root, Step, Wave_Elem); + end if; end Wave_Put_Hierarchy; procedure Disp_Str_AVL (Str : AVL_Nid; Indent : Natural) @@ -1557,7 +1577,13 @@ package body Grt.Waves is -- Vcd_Search_Packages; Wave_Put_Hierarchy (Root, Step_Name); - Freeze_Strings; + Wave_Opt_File.Tree_Reading.Check_If_All_Found; + -- TODO : The tree of the wave option file should be deallocated here, + -- but the memory gain shouldn't be significative + + if Str_Table.Last > 0 then + Freeze_Strings; + end if; -- Register_Cycle_Hook (Vcd_Cycle'Access); Write_Strings_Compress; |