diff options
author | Tristan Gingold <tgingold@free.fr> | 2020-03-22 08:21:04 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2020-03-22 08:21:36 +0100 |
commit | e3bac06b441a7e5b95b0a0f662c5e0fce8f57d3c (patch) | |
tree | b9e6def1e57a6380aee8662d7db41d370874aff2 /src | |
parent | 2eef024e6d1e59778c07e6ccc353c7fb96fb8bc5 (diff) | |
download | ghdl-e3bac06b441a7e5b95b0a0f662c5e0fce8f57d3c.tar.gz ghdl-e3bac06b441a7e5b95b0a0f662c5e0fce8f57d3c.tar.bz2 ghdl-e3bac06b441a7e5b95b0a0f662c5e0fce8f57d3c.zip |
netlists: add id_nop gate.
Diffstat (limited to 'src')
-rw-r--r-- | src/synth/ghdlsynth_gates.h | 1 | ||||
-rw-r--r-- | src/synth/netlists-builders.adb | 27 | ||||
-rw-r--r-- | src/synth/netlists-builders.ads | 11 | ||||
-rw-r--r-- | src/synth/netlists-cleanup.adb | 3 | ||||
-rw-r--r-- | src/synth/netlists-disp_vhdl.adb | 2 | ||||
-rw-r--r-- | src/synth/netlists-gates.ads | 3 |
6 files changed, 36 insertions, 11 deletions
diff --git a/src/synth/ghdlsynth_gates.h b/src/synth/ghdlsynth_gates.h index adc1e87b9..77c8c3a69 100644 --- a/src/synth/ghdlsynth_gates.h +++ b/src/synth/ghdlsynth_gates.h @@ -62,6 +62,7 @@ enum Module_Id { Id_Iadff = 59, Id_Mdff = 60, Id_Midff = 61, + Id_Nop = 60, Id_Utrunc = 64, Id_Strunc = 65, Id_Uextend = 66, diff --git a/src/synth/netlists-builders.adb b/src/synth/netlists-builders.adb index 6262295de..78954af95 100644 --- a/src/synth/netlists-builders.adb +++ b/src/synth/netlists-builders.adb @@ -417,10 +417,8 @@ package body Netlists.Builders is procedure Create_Objects_Module (Ctxt : Context_Acc) is Outputs : Port_Desc_Array (0 .. 0); - Inputs : Port_Desc_Array (0 .. 0); Inputs2 : Port_Desc_Array (0 .. 1); begin - Inputs := (0 => Create_Input ("i")); Inputs2 := (0 => Create_Input ("i"), 1 => Create_Input ("init")); Outputs := (0 => Create_Output ("o")); @@ -428,7 +426,7 @@ package body Netlists.Builders is Ctxt.M_Output := New_User_Module (Ctxt.Design, New_Sname_Artificial (Name_Output, No_Sname), Id_Output, 1, 1, 0); - Set_Ports_Desc (Ctxt.M_Output, Inputs, Outputs); + Set_Ports_Desc (Ctxt.M_Output, Inputs2 (0 .. 0), Outputs); Ctxt.M_Ioutput := New_User_Module (Ctxt.Design, @@ -439,7 +437,7 @@ package body Netlists.Builders is Ctxt.M_Signal := New_User_Module (Ctxt.Design, New_Sname_Artificial (Name_Signal, No_Sname), Id_Signal, 1, 1, 0); - Set_Ports_Desc (Ctxt.M_Signal, Inputs, Outputs); + Set_Ports_Desc (Ctxt.M_Signal, Inputs2 (0 .. 0), Outputs); Ctxt.M_Isignal := New_User_Module (Ctxt.Design, @@ -450,7 +448,12 @@ package body Netlists.Builders is Ctxt.M_Port := New_User_Module (Ctxt.Design, New_Sname_Artificial (Name_Port, No_Sname), Id_Port, 1, 1, 0); - Set_Ports_Desc (Ctxt.M_Port, Inputs, Outputs); + Set_Ports_Desc (Ctxt.M_Port, Inputs2 (0 .. 0), Outputs); + + Ctxt.M_Nop := New_User_Module + (Ctxt.Design, New_Sname_Artificial (Get_Identifier ("nop"), No_Sname), + Id_Nop, 1, 1, 0); + Set_Ports_Desc (Ctxt.M_Nop, Inputs2 (0 .. 0), Outputs); end Create_Objects_Module; procedure Create_Dff_Modules (Ctxt : Context_Acc) @@ -1301,6 +1304,19 @@ package body Netlists.Builders is return O; end Build_Port; + function Build_Nop (Ctxt : Context_Acc; I : Net) return Net + is + Wd : constant Width := Get_Width (I); + Inst : Instance; + O : Net; + begin + Inst := New_Internal_Instance (Ctxt, Ctxt.M_Nop); + Connect (Get_Input (Inst, 0), I); + O := Get_Output (Inst, 0); + Set_Width (O, Wd); + return O; + end Build_Nop; + function Build_Dff (Ctxt : Context_Acc; Clk : Net; D : Net) return Net @@ -1522,5 +1538,4 @@ package body Netlists.Builders is Set_Width (O, W); return O; end Build_Formal_Input; - end Netlists.Builders; diff --git a/src/synth/netlists-builders.ads b/src/synth/netlists-builders.ads index b9aa7757c..f686c6390 100644 --- a/src/synth/netlists-builders.ads +++ b/src/synth/netlists-builders.ads @@ -193,10 +193,12 @@ package Netlists.Builders is D : Net; Els : Net) return Net; function Build_Midff (Ctxt : Context_Acc; - Clk : Net; - D : Net; - Els : Net; - Init : Net) return Net; + Clk : Net; + D : Net; + Els : Net; + Init : Net) return Net; + + function Build_Nop (Ctxt : Context_Acc; I : Net) return Net; private type Module_Arr is array (Module_Id range <>) of Module; @@ -220,6 +222,7 @@ private M_Edge : Module; M_Mux2 : Module; M_Mux4 : Module; + M_Nop : Module; M_Output : Module; M_Ioutput : Module; M_Signal : Module; diff --git a/src/synth/netlists-cleanup.adb b/src/synth/netlists-cleanup.adb index 230e61e10..24889cd6c 100644 --- a/src/synth/netlists-cleanup.adb +++ b/src/synth/netlists-cleanup.adb @@ -127,7 +127,8 @@ package body Netlists.Cleanup is case Get_Id (Inst) is when Id_Output | Id_Ioutput - | Id_Port => + | Id_Port + | Id_Nop => declare Inp : Input; In_Drv : Net; diff --git a/src/synth/netlists-disp_vhdl.adb b/src/synth/netlists-disp_vhdl.adb index 423a9ed96..f4e8e49f7 100644 --- a/src/synth/netlists-disp_vhdl.adb +++ b/src/synth/netlists-disp_vhdl.adb @@ -763,6 +763,8 @@ package body Netlists.Disp_Vhdl is Disp_Template (" \o0 <= \i0; -- (isignal)" & NL, Inst); when Id_Port => Disp_Template (" \o0 <= \i0; -- (port)" & NL, Inst); + when Id_Nop => + Disp_Template (" \o0 <= \i0; -- (nop)" & NL, Inst); when Id_Not => Disp_Template (" \o0 <= not \i0;" & NL, Inst); when Id_Neg => diff --git a/src/synth/netlists-gates.ads b/src/synth/netlists-gates.ads index b60420c22..b7577f85c 100644 --- a/src/synth/netlists-gates.ads +++ b/src/synth/netlists-gates.ads @@ -172,6 +172,9 @@ package Netlists.Gates is -- Output: 0: Q Id_Midff : constant Module_Id := 61; + -- Temporary gate, O = I + Id_Nop : constant Module_Id := 60; + -- Width change: truncate or extend. Sign is know in order to possibly -- detect loss of value. Id_Utrunc : constant Module_Id := 64; |