aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-08-20 20:45:59 +0200
committerTristan Gingold <tgingold@free.fr>2019-08-20 20:45:59 +0200
commit50b5866f2bfe11656c59ff87df002f29a5e50b43 (patch)
tree3e9de6afb274120073d7be793c71f92b18f0d9d4
parent84e4acdf3a9c817fbd0ca89d380c788ab6f58052 (diff)
downloadghdl-50b5866f2bfe11656c59ff87df002f29a5e50b43.tar.gz
ghdl-50b5866f2bfe11656c59ff87df002f29a5e50b43.tar.bz2
ghdl-50b5866f2bfe11656c59ff87df002f29a5e50b43.zip
synth: set name to assert/assume gates.
-rw-r--r--src/synth/netlists-builders.adb21
-rw-r--r--src/synth/netlists-builders.ads6
-rw-r--r--src/synth/netlists-disp_vhdl.adb10
-rw-r--r--src/synth/synth-stmts.adb19
4 files changed, 44 insertions, 12 deletions
diff --git a/src/synth/netlists-builders.adb b/src/synth/netlists-builders.adb
index 608b72acf..2e682197e 100644
--- a/src/synth/netlists-builders.adb
+++ b/src/synth/netlists-builders.adb
@@ -1008,20 +1008,33 @@ package body Netlists.Builders is
return Build_Extract (Ctxt, I, Off, 1);
end Build_Extract_Bit;
- function Build_Assert (Ctxt : Context_Acc; Cond : Net) return Instance
+ function Name_Or_Internal (Name : Sname; Ctxt : Context_Acc) return Sname is
+ begin
+ if Name = No_Sname then
+ return New_Internal_Name (Ctxt);
+ else
+ return Name;
+ end if;
+ end Name_Or_Internal;
+
+ function Build_Assert (Ctxt : Context_Acc; Name : Sname; Cond : Net)
+ return Instance
is
Inst : Instance;
begin
- Inst := New_Internal_Instance (Ctxt, Ctxt.M_Assert);
+ Inst := New_Instance (Ctxt.Parent, Ctxt.M_Assert,
+ Name_Or_Internal (Name, Ctxt));
Connect (Get_Input (Inst, 0), Cond);
return Inst;
end Build_Assert;
- function Build_Assume (Ctxt : Context_Acc; Cond : Net) return Instance
+ function Build_Assume (Ctxt : Context_Acc; Name : Sname; Cond : Net)
+ return Instance
is
Inst : Instance;
begin
- Inst := New_Internal_Instance (Ctxt, Ctxt.M_Assume);
+ Inst := New_Instance (Ctxt.Parent, Ctxt.M_Assume,
+ Name_Or_Internal (Name, Ctxt));
Connect (Get_Input (Inst, 0), Cond);
return Inst;
end Build_Assume;
diff --git a/src/synth/netlists-builders.ads b/src/synth/netlists-builders.ads
index c9ad7da77..20580aaba 100644
--- a/src/synth/netlists-builders.ads
+++ b/src/synth/netlists-builders.ads
@@ -113,8 +113,10 @@ package Netlists.Builders is
return Net;
function Build_Port (Ctxt : Context_Acc; N : Net) return Net;
- function Build_Assert (Ctxt : Context_Acc; Cond : Net) return Instance;
- function Build_Assume (Ctxt : Context_Acc; Cond : Net) return Instance;
+ function Build_Assert (Ctxt : Context_Acc; Name : Sname; Cond : Net)
+ return Instance;
+ function Build_Assume (Ctxt : Context_Acc; Name : Sname; Cond : Net)
+ return Instance;
-- A simple flip-flop.
function Build_Dff (Ctxt : Context_Acc;
diff --git a/src/synth/netlists-disp_vhdl.adb b/src/synth/netlists-disp_vhdl.adb
index 54d65b7b5..1203b0048 100644
--- a/src/synth/netlists-disp_vhdl.adb
+++ b/src/synth/netlists-disp_vhdl.adb
@@ -432,6 +432,10 @@ package body Netlists.Disp_Vhdl is
when Conv_Signed =>
Put_Int32 (To_Int32 (V));
end case;
+ when 'l' =>
+ pragma Assert (Idx = 0);
+ pragma Assert (Conv = Conv_None);
+ Put_Name (Get_Instance_Name (Inst));
when others =>
raise Internal_Error;
end case;
@@ -721,10 +725,12 @@ package body Netlists.Disp_Vhdl is
end if;
end;
when Id_Assert =>
- Disp_Template (" assert \i0 = '1' severity error;" & NL, Inst);
+ Disp_Template
+ (" \l0: assert \i0 = '1' severity error;" & NL, Inst);
when Id_Assume =>
Disp_Template
- (" assert \i0 = '1' severity warning; -- assume" & NL, Inst);
+ (" \l0: assert \i0 = '1' severity warning; -- assume" & NL,
+ Inst);
when others =>
Disp_Instance_Gate (Inst);
end case;
diff --git a/src/synth/synth-stmts.adb b/src/synth/synth-stmts.adb
index 0d2c8bf9f..96efdca72 100644
--- a/src/synth/synth-stmts.adb
+++ b/src/synth/synth-stmts.adb
@@ -1010,6 +1010,17 @@ package body Synth.Stmts is
end loop;
end Synth_Subprogram_Back_Association;
+ function Synth_Label (Stmt : Node) return Sname
+ is
+ Label : constant Name_Id := Get_Label (Stmt);
+ begin
+ if Label = Null_Identifier then
+ return No_Sname;
+ else
+ return New_Sname_User (Label);
+ end if;
+ end Synth_Label;
+
procedure Synth_Procedure_Call
(Syn_Inst : Synth_Instance_Acc; Stmt : Node)
is
@@ -1238,7 +1249,7 @@ package body Synth.Stmts is
end if;
return;
end if;
- Inst := Build_Assert (Build_Context, Get_Net (Val));
+ Inst := Build_Assert (Build_Context, Synth_Label (Stmt), Get_Net (Val));
Set_Location (Inst, Get_Location (Stmt));
end Synth_Concurrent_Assertion_Statement;
@@ -1395,7 +1406,7 @@ package body Synth.Stmts is
-- (If we assume on States, then the first cycle is ignored).
Res := Synth_Psl_Sequence_Directive (Syn_Inst, Stmt);
if Res /= No_Net then
- Inst := Build_Assume (Build_Context, Res);
+ Inst := Build_Assume (Build_Context, Synth_Label (Stmt), Res);
Set_Location (Inst, Get_Location (Stmt));
end if;
end Synth_Psl_Restrict_Directive;
@@ -1455,7 +1466,7 @@ package body Synth.Stmts is
-- (If we assume on States, then the first cycle is ignored).
Res := Synth_Psl_Property_Directive (Syn_Inst, Stmt);
if Res /= No_Net then
- Inst := Build_Assume (Build_Context, Res);
+ Inst := Build_Assume (Build_Context, Synth_Label (Stmt), Res);
Set_Location (Inst, Get_Location (Stmt));
end if;
end Synth_Psl_Assume_Directive;
@@ -1471,7 +1482,7 @@ package body Synth.Stmts is
-- (If we assert on States, then the first cycle is ignored).
Res := Synth_Psl_Property_Directive (Syn_Inst, Stmt);
if Res /= No_Net then
- Inst := Build_Assert (Build_Context, Res);
+ Inst := Build_Assert (Build_Context, Synth_Label (Stmt), Res);
Set_Location (Inst, Get_Location (Stmt));
end if;
end Synth_Psl_Assert_Directive;