diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-07-21 10:16:48 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-07-22 07:32:57 +0200 |
commit | 1bbec5cda2fcebd9190b1cdb05a102f40dee87c3 (patch) | |
tree | 50df402f4c268cfcb4e751400eb6921b885cdddb /src | |
parent | 666522908fb607d867c0bfff49a3b042d7f64314 (diff) | |
download | ghdl-1bbec5cda2fcebd9190b1cdb05a102f40dee87c3.tar.gz ghdl-1bbec5cda2fcebd9190b1cdb05a102f40dee87c3.tar.bz2 ghdl-1bbec5cda2fcebd9190b1cdb05a102f40dee87c3.zip |
synth: rework names.
Diffstat (limited to 'src')
-rw-r--r-- | src/synth/netlists-builders.adb | 5 | ||||
-rw-r--r-- | src/synth/netlists-builders.ads | 3 | ||||
-rw-r--r-- | src/synth/netlists-disp_vhdl.adb | 28 | ||||
-rw-r--r-- | src/synth/netlists-dump.adb | 4 | ||||
-rw-r--r-- | src/synth/synth-insts.adb | 2 | ||||
-rw-r--r-- | src/synth/synth-stmts.adb | 7 |
6 files changed, 25 insertions, 24 deletions
diff --git a/src/synth/netlists-builders.adb b/src/synth/netlists-builders.adb index 27a45470d..5457a8514 100644 --- a/src/synth/netlists-builders.adb +++ b/src/synth/netlists-builders.adb @@ -461,11 +461,12 @@ package body Netlists.Builders is Ctxt.Parent := Parent; end Set_Parent; - function New_Internal_Name (Ctxt : Context_Acc) return Sname + function New_Internal_Name (Ctxt : Context_Acc; Prefix : Sname := No_Sname) + return Sname is Name : Sname; begin - Name := New_Sname_Version (Get_Name (Ctxt.Parent), Ctxt.Num); + Name := New_Sname_Version (Prefix, Ctxt.Num); Ctxt.Num := Ctxt.Num + 1; return Name; end New_Internal_Name; diff --git a/src/synth/netlists-builders.ads b/src/synth/netlists-builders.ads index 67d200ead..3dbced990 100644 --- a/src/synth/netlists-builders.ads +++ b/src/synth/netlists-builders.ads @@ -24,7 +24,8 @@ package Netlists.Builders is type Context is private; type Context_Acc is access Context; - function New_Internal_Name (Ctxt : Context_Acc) return Sname; + function New_Internal_Name (Ctxt : Context_Acc; Prefix : Sname := No_Sname) + return Sname; -- Create a builder for Design. Must be called once. function Build_Builders (Design : Module) return Context_Acc; diff --git a/src/synth/netlists-disp_vhdl.adb b/src/synth/netlists-disp_vhdl.adb index 4e180d7f7..1ae79721a 100644 --- a/src/synth/netlists-disp_vhdl.adb +++ b/src/synth/netlists-disp_vhdl.adb @@ -84,27 +84,18 @@ package body Netlists.Disp_Vhdl is end if; Prefix := Get_Sname_Prefix (N); + if Prefix /= No_Sname then + Put_Name_1 (Prefix); + Put ("_"); + end if; case Get_Sname_Kind (N) is when Sname_User => - if Prefix = No_Sname then - Put ("\"); - else - Put_Name_1 (Prefix); - Put ("."); - end if; Put_Id (Get_Sname_Suffix (N)); when Sname_Artificial => - if Prefix = No_Sname then - Put ("$"); - else - Put_Name_1 (Prefix); - Put ("."); - end if; Put (Image (Get_Sname_Suffix (N))); when Sname_Version => - Put_Name_1 (Prefix); - Put ("%"); + Put ("n"); Put_Name_Version (N); end case; end Put_Name_1; @@ -206,15 +197,14 @@ package body Netlists.Disp_Vhdl is Put_Name (Get_Input_Desc (Get_Module (Inst), Idx).Name); else Inst_Name := Get_Name (Inst); - Port_Name := Get_Output_Desc (Get_Module (Inst), Idx).Name; + Put_Name (Inst_Name); case Get_Sname_Kind (Inst_Name) is when Sname_Version => - Put ("n"); - Put_Name_Version (Inst_Name); + Port_Name := Get_Output_Desc (Get_Module (Inst), Idx).Name; Put ("_"); Put_Interface_Name (Port_Name); when Sname_User => - Put_Id (Get_Sname_Suffix (Inst_Name)); + null; when others => raise Internal_Error; end case; @@ -501,6 +491,8 @@ package body Netlists.Disp_Vhdl is Disp_Template (" \o0 <= \i0; -- (output)" & NL, Inst); when Id_Signal => Disp_Template (" \o0 <= \i0; -- (signal)" & NL, Inst); + when Id_Isignal => + Disp_Template (" \o0 <= \i0; -- (isignal)" & NL, Inst); when Id_Port => null; when Id_Not => diff --git a/src/synth/netlists-dump.adb b/src/synth/netlists-dump.adb index 9e04570ff..e6bb8517e 100644 --- a/src/synth/netlists-dump.adb +++ b/src/synth/netlists-dump.adb @@ -71,7 +71,9 @@ package body Netlists.Dump is end if; Put (Image (Get_Sname_Suffix (N))); when Sname_Version => - Dump_Name (Prefix); + if Prefix /= No_Sname then + Dump_Name (Prefix); + end if; Put ("%"); Put_Trim (Uns32'Image (Get_Sname_Version (N))); end case; diff --git a/src/synth/synth-insts.adb b/src/synth/synth-insts.adb index f1ff14348..0adb9f28b 100644 --- a/src/synth/synth-insts.adb +++ b/src/synth/synth-insts.adb @@ -178,7 +178,7 @@ package body Synth.Insts is -- Create the instance. Syn_Inst := Make_Instance (Global_Instance, Get_Info (Imp)); Syn_Inst.Block_Scope := Get_Info (Decl); - Syn_Inst.Name := New_Sname_User (Get_Identifier (Decl)); + Syn_Inst.Name := No_Sname; -- Copy values for generics. Inter := Get_Generic_Chain (Decl); diff --git a/src/synth/synth-stmts.adb b/src/synth/synth-stmts.adb index 6dad2fbad..494d16773 100644 --- a/src/synth/synth-stmts.adb +++ b/src/synth/synth-stmts.adb @@ -1158,6 +1158,7 @@ package body Synth.Stmts is (Syn_Inst : Synth_Instance_Acc; Proc : Node) is use Areapools; + Label : constant Name_Id := Get_Identifier (Proc); Info : constant Sim_Info_Acc := Get_Info (Proc); Decls_Chain : constant Node := Get_Declaration_Chain (Proc); Prev_Instance_Pool : constant Areapool_Acc := Instance_Pool; @@ -1169,7 +1170,11 @@ package body Synth.Stmts is Instance_Pool := Proc_Pool'Access; if Is_Valid (Decls_Chain) then - Proc_Inst.Name := New_Sname (Syn_Inst.Name, Get_Identifier (Proc)); + if Label = Null_Identifier then + Proc_Inst.Name := New_Internal_Name (Build_Context, Syn_Inst.Name); + else + Proc_Inst.Name := New_Sname (Syn_Inst.Name, Label); + end if; Synth_Declarations (Proc_Inst, Decls_Chain); end if; |