From 9c0f109f935d7db6893df89c86bdbf56472c60b1 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Tue, 22 Oct 2019 21:17:48 +0200 Subject: synth: add support for declarations in vunits. --- src/synth/synth-decls.ads | 3 +++ src/synth/synth-stmts.adb | 28 ++++++++++++++++++++++++---- 2 files changed, 27 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/synth/synth-decls.ads b/src/synth/synth-decls.ads index ddcb43cf6..02bf5c865 100644 --- a/src/synth/synth-decls.ads +++ b/src/synth/synth-decls.ads @@ -37,6 +37,9 @@ package Synth.Decls is procedure Synth_Declaration_Type (Syn_Inst : Synth_Instance_Acc; Decl : Node); + procedure Synth_Declaration + (Syn_Inst : Synth_Instance_Acc; Decl : Node; Is_Subprg : Boolean); + procedure Synth_Declarations (Syn_Inst : Synth_Instance_Acc; Decls : Iir; Is_Subprg : Boolean := False); diff --git a/src/synth/synth-stmts.adb b/src/synth/synth-stmts.adb index 5977c978e..c8b0e1f2c 100644 --- a/src/synth/synth-stmts.adb +++ b/src/synth/synth-stmts.adb @@ -2608,25 +2608,45 @@ package body Synth.Stmts is procedure Synth_Verification_Unit (Syn_Inst : Synth_Instance_Acc; Unit : Node) is + use Areapools; + Prev_Instance_Pool : constant Areapool_Acc := Instance_Pool; + Unit_Inst : Synth_Instance_Acc; + Unit_Sname : Sname; + M : Areapools.Mark_Type; Item : Node; begin + Unit_Sname := New_Sname (Get_Sname (Syn_Inst), Get_Identifier (Unit)); + Unit_Inst := Make_Instance (Syn_Inst, Unit, Unit_Sname); + Mark (M, Proc_Pool); + Instance_Pool := Proc_Pool'Access; + Item := Get_Vunit_Item_Chain (Unit); while Item /= Null_Node loop case Get_Kind (Item) is when Iir_Kind_Psl_Default_Clock => null; when Iir_Kind_Psl_Assert_Directive => - Synth_Psl_Assert_Directive (Syn_Inst, Item); + Synth_Psl_Assert_Directive (Unit_Inst, Item); when Iir_Kind_Psl_Assume_Directive => - Synth_Psl_Assume_Directive (Syn_Inst, Item); + Synth_Psl_Assume_Directive (Unit_Inst, Item); when Iir_Kind_Psl_Restrict_Directive => - Synth_Psl_Restrict_Directive (Syn_Inst, Item); + Synth_Psl_Restrict_Directive (Unit_Inst, Item); when Iir_Kind_Psl_Cover_Directive => - Synth_Psl_Cover_Directive (Syn_Inst, Item); + Synth_Psl_Cover_Directive (Unit_Inst, Item); + when Iir_Kind_Signal_Declaration + | Iir_Kind_Function_Declaration + | Iir_Kind_Procedure_Declaration + | Iir_Kind_Function_Body + | Iir_Kind_Procedure_Body => + Synth_Declaration (Unit_Inst, Item, False); when others => Error_Kind ("synth_verification_unit", Item); end case; Item := Get_Chain (Item); end loop; + + Free_Instance (Unit_Inst); + Release (M, Proc_Pool); + Instance_Pool := Prev_Instance_Pool; end Synth_Verification_Unit; end Synth.Stmts; -- cgit v1.2.3