diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-08-19 21:19:51 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-08-20 04:13:12 +0200 |
commit | c76c3172dd65971161ca926536b07d7134a8c500 (patch) | |
tree | ea0c06ea154565cdbde2f8e2f511cd32c5b4fcb5 | |
parent | fcd68928a4366c35748f488f949d5eada82998dd (diff) | |
download | ghdl-c76c3172dd65971161ca926536b07d7134a8c500.tar.gz ghdl-c76c3172dd65971161ca926536b07d7134a8c500.tar.bz2 ghdl-c76c3172dd65971161ca926536b07d7134a8c500.zip |
synth: set location on assume/assert gates.
-rw-r--r-- | src/synth/netlists-builders.adb | 6 | ||||
-rw-r--r-- | src/synth/netlists-builders.ads | 4 | ||||
-rw-r--r-- | src/synth/synth-stmts.adb | 17 |
3 files changed, 19 insertions, 8 deletions
diff --git a/src/synth/netlists-builders.adb b/src/synth/netlists-builders.adb index a35159e77..608b72acf 100644 --- a/src/synth/netlists-builders.adb +++ b/src/synth/netlists-builders.adb @@ -1008,20 +1008,22 @@ package body Netlists.Builders is return Build_Extract (Ctxt, I, Off, 1); end Build_Extract_Bit; - procedure Build_Assert (Ctxt : Context_Acc; Cond : Net) + function Build_Assert (Ctxt : Context_Acc; Cond : Net) return Instance is Inst : Instance; begin Inst := New_Internal_Instance (Ctxt, Ctxt.M_Assert); Connect (Get_Input (Inst, 0), Cond); + return Inst; end Build_Assert; - procedure Build_Assume (Ctxt : Context_Acc; Cond : Net) + function Build_Assume (Ctxt : Context_Acc; Cond : Net) return Instance is Inst : Instance; begin Inst := New_Internal_Instance (Ctxt, Ctxt.M_Assume); Connect (Get_Input (Inst, 0), Cond); + return Inst; end Build_Assume; end Netlists.Builders; diff --git a/src/synth/netlists-builders.ads b/src/synth/netlists-builders.ads index 8a5a0bd39..c9ad7da77 100644 --- a/src/synth/netlists-builders.ads +++ b/src/synth/netlists-builders.ads @@ -113,8 +113,8 @@ package Netlists.Builders is return Net; function Build_Port (Ctxt : Context_Acc; N : Net) return Net; - procedure Build_Assert (Ctxt : Context_Acc; Cond : Net); - procedure Build_Assume (Ctxt : Context_Acc; Cond : Net); + function Build_Assert (Ctxt : Context_Acc; Cond : Net) return Instance; + function Build_Assume (Ctxt : Context_Acc; Cond : Net) return Instance; -- A simple flip-flop. function Build_Dff (Ctxt : Context_Acc; diff --git a/src/synth/synth-stmts.adb b/src/synth/synth-stmts.adb index 3f31dddb1..339c0a823 100644 --- a/src/synth/synth-stmts.adb +++ b/src/synth/synth-stmts.adb @@ -49,6 +49,7 @@ with Netlists; use Netlists; with Netlists.Builders; use Netlists.Builders; with Netlists.Gates; with Netlists.Utils; +with Netlists.Locations; use Netlists.Locations; package body Synth.Stmts is function Synth_Waveform (Syn_Inst : Synth_Instance_Acc; @@ -1228,6 +1229,7 @@ package body Synth.Stmts is is Cond : constant Node := Get_Assertion_Condition (Stmt); Val : Value_Acc; + Inst : Instance; begin Val := Synth_Expression (Syn_Inst, Cond); if Is_Const (Val) then @@ -1236,7 +1238,8 @@ package body Synth.Stmts is end if; return; end if; - Build_Assert (Build_Context, Get_Net (Val)); + Inst := Build_Assert (Build_Context, Get_Net (Val)); + Set_Location (Inst, Get_Location (Stmt)); end Synth_Concurrent_Assertion_Statement; function Synth_PSL_Expression @@ -1385,13 +1388,15 @@ package body Synth.Stmts is (Syn_Inst : Synth_Instance_Acc; Stmt : Node) is Res : Net; + Inst : Instance; begin -- Build assume gate. -- Note: for synthesis, we assume the next state will be correct. -- (If we assume on States, then the first cycle is ignored). Res := Synth_Psl_Sequence_Directive (Syn_Inst, Stmt); if Res /= No_Net then - Build_Assume (Build_Context, Res); + Inst := Build_Assume (Build_Context, Res); + Set_Location (Inst, Get_Location (Stmt)); end if; end Synth_Psl_Restrict_Directive; @@ -1443,13 +1448,15 @@ package body Synth.Stmts is (Syn_Inst : Synth_Instance_Acc; Stmt : Node) is Res : Net; + Inst : Instance; begin -- Build assume gate. -- Note: for synthesis, we assume the next state will be correct. -- (If we assume on States, then the first cycle is ignored). Res := Synth_Psl_Property_Directive (Syn_Inst, Stmt); if Res /= No_Net then - Build_Assume (Build_Context, Res); + Inst := Build_Assume (Build_Context, Res); + Set_Location (Inst, Get_Location (Stmt)); end if; end Synth_Psl_Assume_Directive; @@ -1457,13 +1464,15 @@ package body Synth.Stmts is (Syn_Inst : Synth_Instance_Acc; Stmt : Node) is Res : Net; + Inst : Instance; begin -- Build assert gate. -- Note: for synthesis, we assume the next state will be correct. -- (If we assert on States, then the first cycle is ignored). Res := Synth_Psl_Property_Directive (Syn_Inst, Stmt); if Res /= No_Net then - Build_Assert (Build_Context, Res); + Inst := Build_Assert (Build_Context, Res); + Set_Location (Inst, Get_Location (Stmt)); end if; end Synth_Psl_Assert_Directive; |