aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/synth/netlists-builders.adb141
-rw-r--r--src/synth/netlists.adb21
-rw-r--r--src/synth/netlists.ads7
-rw-r--r--src/synth/synth-context.adb2
-rw-r--r--src/synth/synth-decls.adb3
-rw-r--r--src/synth/synth-disp_vhdl.adb2
-rw-r--r--src/synth/synth-insts.adb36
-rw-r--r--src/synth/synth-stmts.adb18
8 files changed, 129 insertions, 101 deletions
diff --git a/src/synth/netlists-builders.adb b/src/synth/netlists-builders.adb
index fea58c988..1e16a0e4b 100644
--- a/src/synth/netlists-builders.adb
+++ b/src/synth/netlists-builders.adb
@@ -25,14 +25,14 @@ with Std_Names; use Std_Names;
package body Netlists.Builders is
function Create_Input (Id : String; W : Width := 0) return Port_Desc is
begin
- return (Name => New_Sname_Artificial (Get_Identifier (Id)),
+ return (Name => New_Sname_Artificial (Get_Identifier (Id), No_Sname),
W => W,
Dir => Port_In);
end Create_Input;
function Create_Output (Id : String; W : Width := 0) return Port_Desc is
begin
- return (Name => New_Sname_Artificial (Get_Identifier (Id)),
+ return (Name => New_Sname_Artificial (Get_Identifier (Id), No_Sname),
W => W,
Dir => Port_Out);
end Create_Output;
@@ -45,7 +45,7 @@ package body Netlists.Builders is
Inputs : Port_Desc_Array (0 .. 1);
Outputs : Port_Desc_Array (0 .. 0);
begin
- Res := New_User_Module (Design, New_Sname_Artificial (Name),
+ Res := New_User_Module (Design, New_Sname_Artificial (Name, No_Sname),
Id, 2, 1, 0);
Inputs := (0 => Create_Input ("a"),
1 => Create_Input ("b"));
@@ -61,7 +61,7 @@ package body Netlists.Builders is
Inputs : Port_Desc_Array (0 .. 0);
Outputs : Port_Desc_Array (0 .. 0);
begin
- Res := New_User_Module (Design, New_Sname_Artificial (Name),
+ Res := New_User_Module (Design, New_Sname_Artificial (Name, No_Sname),
Id, 1, 1, 0);
Inputs := (0 => Create_Input ("i"));
Outputs := (0 => Create_Output ("o"));
@@ -76,7 +76,7 @@ package body Netlists.Builders is
Inputs : Port_Desc_Array (0 .. 1);
Outputs : Port_Desc_Array (0 .. 0);
begin
- Res := New_User_Module (Design, New_Sname_Artificial (Name),
+ Res := New_User_Module (Design, New_Sname_Artificial (Name, No_Sname),
Id, 2, 1, 0);
Inputs := (0 => Create_Input ("a"),
1 => Create_Input ("b"));
@@ -97,30 +97,34 @@ package body Netlists.Builders is
Outputs := (0 => Create_Output ("o"));
Res := New_User_Module
- (Ctxt.Design, New_Sname_Artificial (Get_Identifier ("concat2")),
+ (Ctxt.Design,
+ New_Sname_Artificial (Get_Identifier ("concat2"), No_Sname),
Id_Concat2, 2, 1, 0);
Ctxt.M_Concat (Id_Concat2) := Res;
Set_Port_Desc (Res, Inputs (0 .. 1), Outputs);
Res := New_User_Module
- (Ctxt.Design, New_Sname_Artificial (Get_Identifier ("concat3")),
+ (Ctxt.Design,
+ New_Sname_Artificial (Get_Identifier ("concat3"), No_Sname),
Id_Concat3, 3, 1, 0);
Ctxt.M_Concat (Id_Concat3) := Res;
Set_Port_Desc (Res, Inputs (0 .. 2), Outputs);
Res := New_User_Module
- (Ctxt.Design, New_Sname_Artificial (Get_Identifier ("concat4")),
+ (Ctxt.Design,
+ New_Sname_Artificial (Get_Identifier ("concat4"), No_Sname),
Id_Concat4, 4, 1, 0);
Ctxt.M_Concat (Id_Concat4) := Res;
Set_Port_Desc (Res, Inputs (0 .. 3), Outputs);
Res := New_User_Module
- (Ctxt.Design, New_Sname_Artificial (Get_Identifier ("concatn")),
+ (Ctxt.Design,
+ New_Sname_Artificial (Get_Identifier ("concatn"), No_Sname),
Id_Concatn, 0, 1, 1);
Ctxt.M_Concatn := Res;
Set_Port_Desc (Res, Inputs (1 .. 0), Outputs);
Set_Param_Desc
- (Res, (0 => (New_Sname_Artificial (Get_Identifier ("n")),
+ (Res, (0 => (New_Sname_Artificial (Get_Identifier ("n"), No_Sname),
Typ => Param_Uns32)));
end Create_Concat_Modules;
@@ -130,59 +134,66 @@ package body Netlists.Builders is
Res : Module;
begin
Res := New_User_Module
- (Ctxt.Design, New_Sname_Artificial (Get_Identifier ("const_UB32")),
+ (Ctxt.Design,
+ New_Sname_Artificial (Get_Identifier ("const_UB32"), No_Sname),
Id_Const_UB32, 0, 1, 1);
Ctxt.M_Const_UB32 := Res;
Outputs := (0 => Create_Output ("o"));
Set_Port_Desc (Res, Port_Desc_Array'(1 .. 0 => <>), Outputs);
Set_Param_Desc
- (Res, (0 => (New_Sname_Artificial (Get_Identifier ("val")),
+ (Res, (0 => (New_Sname_Artificial (Get_Identifier ("val"), No_Sname),
Typ => Param_Uns32)));
Res := New_User_Module
- (Ctxt.Design, New_Sname_Artificial (Get_Identifier ("const_SB32")),
+ (Ctxt.Design,
+ New_Sname_Artificial (Get_Identifier ("const_SB32"), No_Sname),
Id_Const_SB32, 0, 1, 1);
Ctxt.M_Const_SB32 := Res;
Outputs := (0 => Create_Output ("o"));
Set_Port_Desc (Res, Port_Desc_Array'(1 .. 0 => <>), Outputs);
Set_Param_Desc
- (Res, (0 => (New_Sname_Artificial (Get_Identifier ("val")),
+ (Res, (0 => (New_Sname_Artificial (Get_Identifier ("val"), No_Sname),
Typ => Param_Uns32)));
Res := New_User_Module
- (Ctxt.Design, New_Sname_Artificial (Get_Identifier ("const_UL32")),
+ (Ctxt.Design,
+ New_Sname_Artificial (Get_Identifier ("const_UL32"), No_Sname),
Id_Const_UL32, 0, 1, 2);
Ctxt.M_Const_UL32 := Res;
Set_Port_Desc (Res, Port_Desc_Array'(1 .. 0 => <>), Outputs);
Set_Param_Desc
- (Res, (0 => (New_Sname_Artificial (Get_Identifier ("val")),
+ (Res, (0 => (New_Sname_Artificial (Get_Identifier ("val"), No_Sname),
Typ => Param_Uns32),
- 1 => (New_Sname_Artificial (Get_Identifier ("xz")),
+ 1 => (New_Sname_Artificial (Get_Identifier ("xz"), No_Sname),
Typ => Param_Uns32)));
Res := New_User_Module
- (Ctxt.Design, New_Sname_Artificial (Get_Identifier ("const_Z")),
+ (Ctxt.Design,
+ New_Sname_Artificial (Get_Identifier ("const_Z"), No_Sname),
Id_Const_Z, 0, 1, 0);
Ctxt.M_Const_Z := Res;
Outputs := (0 => Create_Output ("o"));
Set_Port_Desc (Res, Port_Desc_Array'(1 .. 0 => <>), Outputs);
Res := New_User_Module
- (Ctxt.Design, New_Sname_Artificial (Get_Identifier ("const_X")),
+ (Ctxt.Design,
+ New_Sname_Artificial (Get_Identifier ("const_X"), No_Sname),
Id_Const_X, 0, 1, 0);
Ctxt.M_Const_X := Res;
Outputs := (0 => Create_Output ("o"));
Set_Port_Desc (Res, Port_Desc_Array'(1 .. 0 => <>), Outputs);
Res := New_User_Module
- (Ctxt.Design, New_Sname_Artificial (Get_Identifier ("const_bit")),
+ (Ctxt.Design,
+ New_Sname_Artificial (Get_Identifier ("const_bit"), No_Sname),
Id_Const_Bit, 0, 1, 0);
Ctxt.M_Const_Bit := Res;
Outputs := (0 => Create_Output ("o"));
Set_Port_Desc (Res, Port_Desc_Array'(1 .. 0 => <>), Outputs);
Res := New_User_Module
- (Ctxt.Design, New_Sname_Artificial (Get_Identifier ("const_log")),
+ (Ctxt.Design,
+ New_Sname_Artificial (Get_Identifier ("const_log"), No_Sname),
Id_Const_Log, 0, 1, 0);
Ctxt.M_Const_Log := Res;
Outputs := (0 => Create_Output ("o"));
@@ -196,14 +207,16 @@ package body Netlists.Builders is
Res : Module;
begin
Res := New_User_Module
- (Ctxt.Design, New_Sname_Artificial (Get_Identifier ("extract")),
+ (Ctxt.Design,
+ New_Sname_Artificial (Get_Identifier ("extract"), No_Sname),
Id_Extract, 1, 1, 1);
Ctxt.M_Extract := Res;
Outputs := (0 => Create_Output ("o"));
Inputs := (0 => Create_Input ("i"));
Set_Port_Desc (Res, Inputs, Outputs);
Set_Param_Desc
- (Res, (0 => (New_Sname_Artificial (Get_Identifier ("offset")),
+ (Res, (0 => (New_Sname_Artificial (Get_Identifier ("offset"),
+ No_Sname),
Typ => Param_Uns32)));
end Create_Extract_Module;
@@ -214,7 +227,8 @@ package body Netlists.Builders is
Res : Module;
begin
Res := New_User_Module
- (Ctxt.Design, New_Sname_Artificial (Get_Identifier ("dyn_extract")),
+ (Ctxt.Design,
+ New_Sname_Artificial (Get_Identifier ("dyn_extract"), No_Sname),
Id_Dyn_Extract, 2, 1, 1);
Ctxt.M_Dyn_Extract := Res;
Outputs := (0 => Create_Output ("o"));
@@ -222,7 +236,8 @@ package body Netlists.Builders is
1 => Create_Input ("i"));
Set_Port_Desc (Res, Inputs, Outputs);
Set_Param_Desc
- (Res, (0 => (New_Sname_Artificial (Get_Identifier ("offset")),
+ (Res, (0 => (New_Sname_Artificial (Get_Identifier ("offset"),
+ No_Sname),
Typ => Param_Uns32)));
end Create_Dyn_Extract_Module;
@@ -233,7 +248,8 @@ package body Netlists.Builders is
Res : Module;
begin
Res := New_User_Module
- (Ctxt.Design, New_Sname_Artificial (Get_Identifier ("dyn_insert")),
+ (Ctxt.Design,
+ New_Sname_Artificial (Get_Identifier ("dyn_insert"), No_Sname),
Id_Dyn_Insert, 3, 1, 1);
Ctxt.M_Dyn_Insert := Res;
Outputs := (0 => Create_Output ("o"));
@@ -243,16 +259,19 @@ package body Netlists.Builders is
3 => Create_Input ("en"));
Set_Port_Desc (Res, Inputs (0 .. 2), Outputs);
Set_Param_Desc
- (Res, (0 => (New_Sname_Artificial (Get_Identifier ("offset")),
+ (Res, (0 => (New_Sname_Artificial (Get_Identifier ("offset"),
+ No_Sname),
Typ => Param_Uns32)));
Res := New_User_Module
- (Ctxt.Design, New_Sname_Artificial (Get_Identifier ("dyn_insert_en")),
+ (Ctxt.Design,
+ New_Sname_Artificial (Get_Identifier ("dyn_insert_en"), No_Sname),
Id_Dyn_Insert_En, 4, 1, 1);
Ctxt.M_Dyn_Insert_En := Res;
Set_Port_Desc (Res, Inputs (0 .. 3), Outputs);
Set_Param_Desc
- (Res, (0 => (New_Sname_Artificial (Get_Identifier ("offset")),
+ (Res, (0 => (New_Sname_Artificial (Get_Identifier ("offset"),
+ No_Sname),
Typ => Param_Uns32)));
end Create_Dyn_Insert_Modules;
@@ -263,16 +282,17 @@ package body Netlists.Builders is
Res : Module;
begin
Res := New_User_Module
- (Ctxt.Design, New_Sname_Artificial (Get_Identifier ("memidx")),
+ (Ctxt.Design,
+ New_Sname_Artificial (Get_Identifier ("memidx"), No_Sname),
Id_Memidx, 1, 1, 2);
Ctxt.M_Memidx := Res;
Outputs := (0 => Create_Output ("o"));
Inputs (0) := Create_Input ("i");
Set_Port_Desc (Res, Inputs (0 .. 0), Outputs);
Set_Param_Desc
- (Res, (0 => (New_Sname_Artificial (Get_Identifier ("step")),
+ (Res, (0 => (New_Sname_Artificial (Get_Identifier ("step"), No_Sname),
Typ => Param_Uns32),
- 1 => (New_Sname_Artificial (Get_Identifier ("max")),
+ 1 => (New_Sname_Artificial (Get_Identifier ("max"), No_Sname),
Typ => Param_Uns32)));
end Create_Memidx_Module;
@@ -283,7 +303,8 @@ package body Netlists.Builders is
Res : Module;
begin
Res := New_User_Module
- (Ctxt.Design, New_Sname_Artificial (Get_Identifier ("addidx")),
+ (Ctxt.Design,
+ New_Sname_Artificial (Get_Identifier ("addidx"), No_Sname),
Id_Addidx, 2, 1, 0);
Ctxt.M_Addidx := Res;
Outputs := (0 => Create_Output ("o"));
@@ -299,14 +320,16 @@ package body Netlists.Builders is
Res : Module;
begin
Res := New_User_Module
- (Ctxt.Design, New_Sname_Artificial (Get_Identifier ("memory")),
+ (Ctxt.Design,
+ New_Sname_Artificial (Get_Identifier ("memory"), No_Sname),
Id_Memory, 0, 1, 0);
Ctxt.M_Memory := Res;
Outputs (0 .. 0) := (0 => Create_Output ("ports"));
Set_Port_Desc (Res, Port_Desc_Array'(1 .. 0 => <>), Outputs (0 .. 0));
Res := New_User_Module
- (Ctxt.Design, New_Sname_Artificial (Get_Identifier ("memory_init")),
+ (Ctxt.Design,
+ New_Sname_Artificial (Get_Identifier ("memory_init"), No_Sname),
Id_Memory_Init, 1, 1, 0);
Ctxt.M_Memory_Init := Res;
Outputs (0 .. 0) := (0 => Create_Output ("ports"));
@@ -314,7 +337,8 @@ package body Netlists.Builders is
Set_Port_Desc (Res, Inputs (0 .. 0), Outputs (0 .. 0));
Res := New_User_Module
- (Ctxt.Design, New_Sname_Artificial (Get_Identifier ("mem_rd")),
+ (Ctxt.Design,
+ New_Sname_Artificial (Get_Identifier ("mem_rd"), No_Sname),
Id_Mem_Rd, 2, 2, 0);
Ctxt.M_Mem_Rd := Res;
Inputs (0 .. 1) := (0 => Create_Input ("pport"),
@@ -324,7 +348,8 @@ package body Netlists.Builders is
Set_Port_Desc (Res, Inputs (0 .. 1), Outputs (0 .. 1));
Res := New_User_Module
- (Ctxt.Design, New_Sname_Artificial (Get_Identifier ("mem_rd_sync")),
+ (Ctxt.Design,
+ New_Sname_Artificial (Get_Identifier ("mem_rd_sync"), No_Sname),
Id_Mem_Rd_Sync, 3, 2, 0);
Ctxt.M_Mem_Rd_Sync := Res;
Inputs (0 .. 2) := (0 => Create_Input ("pport"),
@@ -335,7 +360,8 @@ package body Netlists.Builders is
Set_Port_Desc (Res, Inputs (0 .. 2), Outputs (0 .. 1));
Res := New_User_Module
- (Ctxt.Design, New_Sname_Artificial (Get_Identifier ("mem_wr_sync")),
+ (Ctxt.Design,
+ New_Sname_Artificial (Get_Identifier ("mem_wr_sync"), No_Sname),
Id_Mem_Wr_Sync, 5, 1, 0);
Ctxt.M_Mem_Wr_Sync := Res;
Inputs := (0 => Create_Input ("pport"),
@@ -356,7 +382,7 @@ package body Netlists.Builders is
Inputs : Port_Desc_Array (0 .. 0);
begin
Res := New_User_Module
- (Ctxt.Design, New_Sname_Artificial (Name), Id_Edge, 1, 1, 0);
+ (Ctxt.Design, New_Sname_Artificial (Name, No_Sname), Id_Edge, 1, 1, 0);
Inputs := (0 => Create_Input ("i", 1));
Outputs := (0 => Create_Output ("o", 1));
Set_Port_Desc (Res, Inputs, Outputs);
@@ -375,13 +401,14 @@ package body Netlists.Builders is
Outputs := (0 => Create_Output ("o"));
Ctxt.M_Mux2 := New_User_Module
- (Ctxt.Design, New_Sname_Artificial (Get_Identifier ("mux2")),
+ (Ctxt.Design,
+ New_Sname_Artificial (Get_Identifier ("mux2"), No_Sname),
Id_Mux2, 3, 1, 0);
Set_Port_Desc (Ctxt.M_Mux2, Inputs (0 .. 2), Outputs);
Inputs (0).W := 2;
Ctxt.M_Mux4 := New_User_Module
- (Ctxt.Design, New_Sname_Artificial (Get_Identifier ("mux4")),
+ (Ctxt.Design, New_Sname_Artificial (Get_Identifier ("mux4"), No_Sname),
Id_Mux4, 5, 1, 0);
Set_Port_Desc (Ctxt.M_Mux4, Inputs (0 .. 4), Outputs);
end Create_Mux_Modules;
@@ -396,24 +423,25 @@ package body Netlists.Builders is
Outputs := (0 => Create_Output ("o"));
Ctxt.M_Output := New_User_Module
- (Ctxt.Design, New_Sname_Artificial (Name_Output),
+ (Ctxt.Design, New_Sname_Artificial (Name_Output, No_Sname),
Id_Output, 1, 1, 0);
Set_Port_Desc (Ctxt.M_Output, Inputs, Outputs);
Ctxt.M_Signal := New_User_Module
- (Ctxt.Design, New_Sname_Artificial (Name_Signal),
+ (Ctxt.Design, New_Sname_Artificial (Name_Signal, No_Sname),
Id_Signal, 1, 1, 0);
Set_Port_Desc (Ctxt.M_Signal, Inputs, Outputs);
Inputs2 := (0 => Create_Input ("i"),
1 => Create_Input ("init"));
Ctxt.M_Isignal := New_User_Module
- (Ctxt.Design, New_Sname_Artificial (Get_Identifier ("isignal")),
+ (Ctxt.Design,
+ New_Sname_Artificial (Get_Identifier ("isignal"), No_Sname),
Id_Isignal, 2, 1, 0);
Set_Port_Desc (Ctxt.M_Isignal, Inputs2, Outputs);
Ctxt.M_Port := New_User_Module
- (Ctxt.Design, New_Sname_Artificial (Name_Port),
+ (Ctxt.Design, New_Sname_Artificial (Name_Port, No_Sname),
Id_Port, 1, 1, 0);
Set_Port_Desc (Ctxt.M_Port, Inputs, Outputs);
end Create_Objects_Module;
@@ -423,7 +451,7 @@ package body Netlists.Builders is
Outputs : Port_Desc_Array (0 .. 0);
begin
Ctxt.M_Dff := New_User_Module
- (Ctxt.Design, New_Sname_Artificial (Get_Identifier ("dff")),
+ (Ctxt.Design, New_Sname_Artificial (Get_Identifier ("dff"), No_Sname),
Id_Dff, 2, 1, 0);
Outputs := (0 => Create_Output ("q"));
Set_Port_Desc (Ctxt.M_Dff, (0 => Create_Input ("clk", 1),
@@ -431,7 +459,7 @@ package body Netlists.Builders is
Outputs);
Ctxt.M_Idff := New_User_Module
- (Ctxt.Design, New_Sname_Artificial (Get_Identifier ("idff")),
+ (Ctxt.Design, New_Sname_Artificial (Get_Identifier ("idff"), No_Sname),
Id_Idff, 3, 1, 0);
Set_Port_Desc (Ctxt.M_Idff, (0 => Create_Input ("clk", 1),
1 => Create_Input ("d"),
@@ -440,7 +468,8 @@ package body Netlists.Builders is
Ctxt.M_Adff := New_User_Module
- (Ctxt.Design, New_Sname_Artificial (Get_Identifier ("adff")),
+ (Ctxt.Design,
+ New_Sname_Artificial (Get_Identifier ("adff"), No_Sname),
Id_Adff, 4, 1, 0);
Outputs := (0 => Create_Output ("q"));
Set_Port_Desc (Ctxt.M_Adff, (0 => Create_Input ("clk", 1),
@@ -450,7 +479,8 @@ package body Netlists.Builders is
Outputs);
Ctxt.M_Iadff := New_User_Module
- (Ctxt.Design, New_Sname_Artificial (Get_Identifier ("iadff")),
+ (Ctxt.Design,
+ New_Sname_Artificial (Get_Identifier ("iadff"), No_Sname),
Id_Iadff, 5, 1, 0);
Outputs := (0 => Create_Output ("q"));
Set_Port_Desc (Ctxt.M_Iadff, (0 => Create_Input ("clk", 1),
@@ -466,25 +496,26 @@ package body Netlists.Builders is
Outputs : Port_Desc_Array (1 .. 0);
begin
Ctxt.M_Assert := New_User_Module
- (Ctxt.Design, New_Sname_Artificial (Name_Assert), Id_Assert,
+ (Ctxt.Design, New_Sname_Artificial (Name_Assert, No_Sname), Id_Assert,
1, 0, 0);
Set_Port_Desc (Ctxt.M_Assert, (0 => Create_Input ("cond", 1)),
Outputs);
Ctxt.M_Assume := New_User_Module
- (Ctxt.Design, New_Sname_Artificial (Name_Assume), Id_Assume,
+ (Ctxt.Design, New_Sname_Artificial (Name_Assume, No_Sname), Id_Assume,
1, 0, 0);
Set_Port_Desc (Ctxt.M_Assume, (0 => Create_Input ("cond", 1)),
Outputs);
Ctxt.M_Cover := New_User_Module
- (Ctxt.Design, New_Sname_Artificial (Name_Cover), Id_Cover,
+ (Ctxt.Design, New_Sname_Artificial (Name_Cover, No_Sname), Id_Cover,
1, 0, 0);
Set_Port_Desc (Ctxt.M_Cover, (0 => Create_Input ("cond", 1)),
Outputs);
Ctxt.M_Assert_Cover := New_User_Module
- (Ctxt.Design, New_Sname_Artificial (Get_Identifier ("assert_cover")),
+ (Ctxt.Design,
+ New_Sname_Artificial (Get_Identifier ("assert_cover"), No_Sname),
Id_Assert_Cover, 1, 0, 0);
Set_Port_Desc (Ctxt.M_Assert_Cover, (0 => Create_Input ("cond", 1)),
Outputs);
@@ -497,7 +528,7 @@ package body Netlists.Builders is
Res : Module;
begin
Res := New_User_Module
- (Ctxt.Design, New_Sname_Artificial (Name), Id, 0, 1, 0);
+ (Ctxt.Design, New_Sname_Artificial (Name, No_Sname), Id, 0, 1, 0);
Ctxt.M_Formal_Input (Id) := Res;
Outputs := (0 => Create_Output ("o"));
Set_Port_Desc (Res, Port_Desc_Array'(1 .. 0 => <>), Outputs);
@@ -650,7 +681,7 @@ package body Netlists.Builders is
is
Name : Sname;
begin
- Name := New_Sname_Version (Prefix, Ctxt.Num);
+ Name := New_Sname_Version (Ctxt.Num, Prefix);
Ctxt.Num := Ctxt.Num + 1;
return Name;
end New_Internal_Name;
diff --git a/src/synth/netlists.adb b/src/synth/netlists.adb
index b2188e822..cc5210f64 100644
--- a/src/synth/netlists.adb
+++ b/src/synth/netlists.adb
@@ -34,31 +34,23 @@ package body Netlists is
Table_Low_Bound => 0,
Table_Initial => 1024);
- function New_Sname_User (Id : Name_Id) return Sname is
+ function New_Sname_User (Id : Name_Id; Prefix : Sname) return Sname is
begin
Snames_Table.Append ((Kind => Sname_User,
- Prefix => No_Sname,
+ Prefix => Prefix,
Suffix => Uns32 (Id)));
return Snames_Table.Last;
end New_Sname_User;
- function New_Sname_Artificial (Id : Name_Id) return Sname is
+ function New_Sname_Artificial (Id : Name_Id; Prefix : Sname) return Sname is
begin
Snames_Table.Append ((Kind => Sname_Artificial,
- Prefix => No_Sname,
+ Prefix => Prefix,
Suffix => Uns32 (Id)));
return Snames_Table.Last;
end New_Sname_Artificial;
- function New_Sname (Prefix : Sname; Suffix : Name_Id) return Sname is
- begin
- Snames_Table.Append ((Kind => Sname_User,
- Prefix => Prefix,
- Suffix => Uns32 (Suffix)));
- return Snames_Table.Last;
- end New_Sname;
-
- function New_Sname_Version (Prefix : Sname; Ver : Uns32) return Sname is
+ function New_Sname_Version (Ver : Uns32; Prefix : Sname) return Sname is
begin
Snames_Table.Append ((Kind => Sname_Version,
Prefix => Prefix,
@@ -897,7 +889,8 @@ begin
pragma Assert (Modules_Table.Last = No_Module);
Modules_Table.Append ((Parent => No_Module,
- Name => New_Sname_Artificial (Std_Names.Name_None),
+ Name => New_Sname_Artificial (Std_Names.Name_None,
+ No_Sname),
Id => Id_Free,
First_Port_Desc => No_Port_Desc_Idx,
Nbr_Inputs => 0,
diff --git a/src/synth/netlists.ads b/src/synth/netlists.ads
index 7d2b2824d..08297a9f2 100644
--- a/src/synth/netlists.ads
+++ b/src/synth/netlists.ads
@@ -56,10 +56,9 @@ package Netlists is
-- There is no unification: these routines always create a new name. There
-- is no check that the name already exists, so these routines may create
-- a duplicate name. Callers must ensure they create uniq names.
- function New_Sname_User (Id : Name_Id) return Sname;
- function New_Sname_Artificial (Id : Name_Id) return Sname;
- function New_Sname (Prefix : Sname; Suffix : Name_Id) return Sname;
- function New_Sname_Version (Prefix : Sname; Ver : Uns32) return Sname;
+ function New_Sname_User (Id : Name_Id; Prefix : Sname) return Sname;
+ function New_Sname_Artificial (Id : Name_Id; Prefix : Sname) return Sname;
+ function New_Sname_Version (Ver : Uns32; Prefix : Sname) return Sname;
-- Read the content of an Sname.
function Get_Sname_Kind (Name : Sname) return Sname_Kind;
diff --git a/src/synth/synth-context.adb b/src/synth/synth-context.adb
index e02059f9e..91f73b484 100644
--- a/src/synth/synth-context.adb
+++ b/src/synth/synth-context.adb
@@ -48,7 +48,7 @@ package body Synth.Context is
Res : Synth_Instance_Acc;
begin
Top_Module :=
- New_Design (New_Sname_Artificial (Get_Identifier ("top")));
+ New_Design (New_Sname_Artificial (Get_Identifier ("top"), No_Sname));
pragma Assert (Build_Context = null);
Build_Context := Build_Builders (Top_Module);
diff --git a/src/synth/synth-decls.adb b/src/synth/synth-decls.adb
index 4d520e578..737af2110 100644
--- a/src/synth/synth-decls.adb
+++ b/src/synth/synth-decls.adb
@@ -56,7 +56,8 @@ package body Synth.Decls is
when Value_Wire =>
-- FIXME: get the width directly from the wire ?
W := Get_Type_Width (Val.Typ);
- Name := New_Sname (Get_Sname (Syn_Inst), Get_Identifier (Decl));
+ Name := New_Sname_User (Get_Identifier (Decl),
+ Get_Sname (Syn_Inst));
if Init /= null then
Ival := Get_Net (Init);
pragma Assert (Get_Width (Ival) = W);
diff --git a/src/synth/synth-disp_vhdl.adb b/src/synth/synth-disp_vhdl.adb
index 6d14e95d9..e2687d04d 100644
--- a/src/synth/synth-disp_vhdl.adb
+++ b/src/synth/synth-disp_vhdl.adb
@@ -429,7 +429,7 @@ package body Synth.Disp_Vhdl is
Name_Wrap := Name_Table.Get_Identifier ("wrap");
for P of Ports_Desc (Main) loop
pragma Assert (Get_Sname_Prefix (P.Name) = No_Sname);
- Set_Sname_Prefix (P.Name, New_Sname_User (Name_Wrap));
+ Set_Sname_Prefix (P.Name, New_Sname_User (Name_Wrap, No_Sname));
end loop;
Put_Line ("library ieee;");
diff --git a/src/synth/synth-insts.adb b/src/synth/synth-insts.adb
index d2f5aea23..c0277b569 100644
--- a/src/synth/synth-insts.adb
+++ b/src/synth/synth-insts.adb
@@ -72,7 +72,7 @@ package body Synth.Insts is
Val : constant Value_Acc := Get_Value (Syn_Inst, Inter);
Name : Sname;
begin
- Name := New_Sname_User (Get_Identifier (Inter));
+ Name := New_Sname_User (Get_Identifier (Inter), No_Sname);
return (Name => Name,
W => Get_Type_Width (Val.Typ),
Dir => Dir);
@@ -210,9 +210,10 @@ package body Synth.Insts is
-- Declare module.
-- Build it now because it may be referenced for instantiations before
-- being synthetized.
- Cur_Module := New_User_Module (Get_Top_Module (Root_Instance),
- New_Sname_User (Get_Identifier (Decl)),
- Id_User_None, Nbr_Inputs, Nbr_Outputs, 0);
+ Cur_Module := New_User_Module
+ (Get_Top_Module (Root_Instance),
+ New_Sname_User (Get_Identifier (Decl), No_Sname),
+ Id_User_None, Nbr_Inputs, Nbr_Outputs, 0);
-- Add ports to module.
declare
@@ -602,7 +603,7 @@ package body Synth.Insts is
begin
-- Elaborate generic + map aspect
Sub_Inst := Make_Instance
- (Syn_Inst, Ent, New_Sname_User (Get_Identifier (Ent)));
+ (Syn_Inst, Ent, New_Sname_User (Get_Identifier (Ent), No_Sname));
Synth_Generics_Association (Sub_Inst, Syn_Inst,
Get_Generic_Chain (Ent),
@@ -662,10 +663,10 @@ package body Synth.Insts is
-- TODO: free sub_inst.
- Inst := New_Instance (Get_Instance_Module (Syn_Inst),
- Inst_Obj.M,
- New_Sname (Get_Sname (Syn_Inst),
- Get_Identifier (Stmt)));
+ Inst := New_Instance
+ (Get_Instance_Module (Syn_Inst),
+ Inst_Obj.M,
+ New_Sname_User (Get_Identifier (Stmt), Get_Sname (Syn_Inst)));
Set_Location (Inst, Stmt);
Synth_Instantiate_Module
@@ -725,7 +726,8 @@ package body Synth.Insts is
Val.W := Alloc_Wire (Wire_Output, Inter);
W := Get_Type_Width (Val.Typ);
Value := Builders.Build_Signal
- (Build_Context, New_Sname (No_Sname, Get_Identifier (Inter)), W);
+ (Build_Context,
+ New_Sname_User (Get_Identifier (Inter), No_Sname), W);
Set_Wire_Gate (Val.W, Value);
when others =>
raise Internal_Error;
@@ -754,8 +756,9 @@ package body Synth.Insts is
-- Create the sub-instance for the component
-- Elaborate generic + map aspect
- Comp_Inst := Make_Instance (Syn_Inst, Component,
- New_Sname_User (Get_Identifier (Component)));
+ Comp_Inst := Make_Instance
+ (Syn_Inst, Component,
+ New_Sname_User (Get_Identifier (Component), No_Sname));
Synth_Generics_Association (Comp_Inst, Syn_Inst,
Get_Generic_Chain (Component),
@@ -822,7 +825,7 @@ package body Synth.Insts is
-- Elaborate generic + map aspect
Sub_Inst := Make_Instance
- (Comp_Inst, Ent, New_Sname_User (Get_Identifier (Ent)));
+ (Comp_Inst, Ent, New_Sname_User (Get_Identifier (Ent), No_Sname));
Synth_Generics_Association (Sub_Inst, Comp_Inst,
Get_Generic_Chain (Ent),
Get_Generic_Map_Aspect_Chain (Bind));
@@ -841,7 +844,7 @@ package body Synth.Insts is
Inst := New_Instance (Get_Instance_Module (Syn_Inst),
Inst_Obj.M,
- New_Sname_User (Get_Identifier (Stmt)));
+ New_Sname_User (Get_Identifier (Stmt), No_Sname));
Synth_Instantiate_Module
(Comp_Inst, Inst, Inst_Obj, Get_Port_Map_Aspect_Chain (Bind));
@@ -969,8 +972,9 @@ package body Synth.Insts is
Synth_Dependencies (Global_Instance, Get_Design_Unit (Entity));
Synth_Dependencies (Global_Instance, Get_Design_Unit (Arch));
- Syn_Inst := Make_Instance (Global_Instance, Arch,
- New_Sname_User (Get_Identifier (Entity)));
+ Syn_Inst := Make_Instance
+ (Global_Instance, Arch,
+ New_Sname_User (Get_Identifier (Entity), No_Sname));
-- Compute generics.
Inter := Get_Generic_Chain (Entity);
diff --git a/src/synth/synth-stmts.adb b/src/synth/synth-stmts.adb
index 5b400843b..6e3a5d0c8 100644
--- a/src/synth/synth-stmts.adb
+++ b/src/synth/synth-stmts.adb
@@ -1348,7 +1348,7 @@ package body Synth.Stmts is
if Label = Null_Identifier then
return No_Sname;
else
- return New_Sname_User (Label);
+ return New_Sname_User (Label, No_Sname);
end if;
end Synth_Label;
@@ -2468,7 +2468,7 @@ package body Synth.Stmts is
if Label = Null_Identifier then
C_Sname := New_Internal_Name (Build_Context, Get_Sname (Syn_Inst));
else
- C_Sname := New_Sname (Get_Sname (Syn_Inst), Label);
+ C_Sname := New_Sname_User (Label, Get_Sname (Syn_Inst));
end if;
C := (Mode => Mode_Dynamic,
Inst => Make_Instance (Syn_Inst, Proc, C_Sname),
@@ -2569,7 +2569,7 @@ package body Synth.Stmts is
raise Internal_Error;
end if;
- Blk_Sname := New_Sname (Get_Sname (Syn_Inst), Get_Identifier (Blk));
+ Blk_Sname := New_Sname_User (Get_Identifier (Blk), Get_Sname (Syn_Inst));
Blk_Inst := Make_Instance (Syn_Inst, Blk, Blk_Sname);
Mark (M, Proc_Pool);
Instance_Pool := Proc_Pool'Access;
@@ -2837,7 +2837,7 @@ package body Synth.Stmts is
Active := Get_Active_State (NFA);
if Active /= No_State then
if Lab /= No_Sname then
- Lab := New_Sname (Lab, Std_Names.Name_Cover);
+ Lab := New_Sname_User (Std_Names.Name_Cover, Lab);
end if;
Inst := Build_Assert_Cover
(Get_Build (Syn_Inst), Lab,
@@ -2888,8 +2888,7 @@ package body Synth.Stmts is
Name : Sname;
begin
Gen := Stmt;
- Name := New_Sname (Get_Sname (Syn_Inst),
- Get_Identifier (Stmt));
+ Name := New_Sname_User (Get_Identifier (Stmt), Get_Sname (Syn_Inst));
loop
Cond := Synth_Expression (Syn_Inst, Get_Condition (Gen));
pragma Assert (Cond.Kind = Value_Discrete);
@@ -2926,7 +2925,7 @@ package body Synth.Stmts is
It_Rng := Get_Value_Type (Syn_Inst, Get_Type (Iterator));
Val := Create_Value_Discrete (It_Rng.Drange.Left, It_Rng);
- Name := New_Sname (Get_Sname (Syn_Inst), Get_Identifier (Stmt));
+ Name := New_Sname_User (Get_Identifier (Stmt), Get_Sname (Syn_Inst));
while In_Range (It_Rng.Drange, Val.Scal) loop
-- Find and apply the config block.
@@ -2951,7 +2950,7 @@ package body Synth.Stmts is
end;
-- FIXME: get position ?
- Lname := New_Sname_Version (Name, Uns32 (Val.Scal));
+ Lname := New_Sname_Version (Uns32 (Val.Scal), Name);
Synth_Generate_Statement_Body (Syn_Inst, Bod, Lname, Iterator, Val);
Update_Index (It_Rng.Drange, Val.Scal);
@@ -3126,7 +3125,8 @@ package body Synth.Stmts is
M : Areapools.Mark_Type;
Item : Node;
begin
- Unit_Sname := New_Sname (Get_Sname (Syn_Inst), Get_Identifier (Unit));
+ Unit_Sname := New_Sname_User (Get_Identifier (Unit),
+ Get_Sname (Syn_Inst));
Unit_Inst := Make_Instance (Syn_Inst, Unit, Unit_Sname);
Mark (M, Proc_Pool);
Instance_Pool := Proc_Pool'Access;