diff options
-rw-r--r-- | src/simul/simul-vhdl_simul.adb | 10 | ||||
-rw-r--r-- | src/simul/simul-vhdl_simul.ads | 4 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/simul/simul-vhdl_simul.adb b/src/simul/simul-vhdl_simul.adb index a17488fbf..26c2179ea 100644 --- a/src/simul/simul-vhdl_simul.adb +++ b/src/simul/simul-vhdl_simul.adb @@ -512,7 +512,7 @@ package body Simul.Vhdl_Simul is Get_Caller_Instance (Process.Instance); Resume : Boolean; begin - if not Get_Suspend_Flag (Bod) then + if not Get_Suspend_Flag (Bod) or else not Process.Has_State then Process.Instance := Caller_Inst; -- TODO: free old inst. Stmt := Null_Node; @@ -801,7 +801,8 @@ package body Simul.Vhdl_Simul is Synth.Vhdl_Decls.Synth_Declarations (Sub_Inst, Get_Declaration_Chain (Bod), True); - if Get_Suspend_Flag (Bod) then + if Process.Has_State and then Get_Suspend_Flag (Bod) then + -- The procedure may suspend, in a suspendable process. Next_Stmt := Get_Sequential_Statement_Chain (Bod); if Next_Stmt /= Null_Node then return; @@ -1892,6 +1893,7 @@ package body Simul.Vhdl_Simul is Proc := Processes_Table.Table (I).Proc; Processes_State (I) := (Kind => Kind_Process, + Has_State => False, Top_Instance => Instance, Proc => Proc, Idx => I, @@ -1927,7 +1929,8 @@ package body Simul.Vhdl_Simul is | Iir_Kind_Concurrent_Procedure_Call_Statement => -- As those processes can suspend, they need a dedicated -- stack. - Processes_State (I).Pool := new Areapools.Areapool; + Current_Process.Pool := new Areapools.Areapool; + Current_Process.Has_State := True; if Get_Postponed_Flag (Proc) then Ghdl_Postponed_Process_Register (Instance_Grt, @@ -1942,6 +1945,7 @@ package body Simul.Vhdl_Simul is when Iir_Kind_Psl_Assert_Directive => Processes_State (I) := (Kind => Kind_PSL, + Has_State => False, Top_Instance => Instance, Proc => Proc, Idx => I, diff --git a/src/simul/simul-vhdl_simul.ads b/src/simul/simul-vhdl_simul.ads index f2cf98212..66a032f22 100644 --- a/src/simul/simul-vhdl_simul.ads +++ b/src/simul/simul-vhdl_simul.ads @@ -48,6 +48,10 @@ package Simul.Vhdl_Simul is -- State associed with each process. type Process_State_Type (Kind : Process_Kind := Kind_Process) is record + -- True if the process has a suspend state. + -- (Used for procedure calls) + Has_State : Boolean; + -- The process instance. Top_Instance : Synth_Instance_Acc := null; Proc : Node := Null_Node; |