aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth/netlists-builders.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-04-16 19:03:15 +0200
committerTristan Gingold <tgingold@free.fr>2019-04-16 19:03:15 +0200
commit6b71fbf805d5534f68b32f3248d8aecf65bb00ec (patch)
treefda845bad7d108ae77410d127d36ba68269e8fa4 /src/synth/netlists-builders.adb
parent5a31efbb82ef8ef34f5052c9c7a43dea97794718 (diff)
downloadghdl-6b71fbf805d5534f68b32f3248d8aecf65bb00ec.tar.gz
ghdl-6b71fbf805d5534f68b32f3248d8aecf65bb00ec.tar.bz2
ghdl-6b71fbf805d5534f68b32f3248d8aecf65bb00ec.zip
synth: add adff, iadff.
Diffstat (limited to 'src/synth/netlists-builders.adb')
-rw-r--r--src/synth/netlists-builders.adb65
1 files changed, 65 insertions, 0 deletions
diff --git a/src/synth/netlists-builders.adb b/src/synth/netlists-builders.adb
index 46b7e015c..d131db121 100644
--- a/src/synth/netlists-builders.adb
+++ b/src/synth/netlists-builders.adb
@@ -247,6 +247,28 @@ package body Netlists.Builders is
1 => Create_Input ("d"),
2 => Create_Input ("init")),
Outputs);
+
+
+ Ctxt.M_Adff := New_User_Module
+ (Ctxt.Design, New_Sname_Artificial (Get_Identifier ("adff")),
+ Id_Adff, 4, 1, 0);
+ Outputs := (0 => Create_Output ("q"));
+ Set_Port_Desc (Ctxt.M_Adff, (0 => Create_Input ("clk", 1),
+ 1 => Create_Input ("d"),
+ 2 => Create_Input ("rst", 1),
+ 3 => Create_Input ("rst_val")),
+ Outputs);
+
+ Ctxt.M_Iadff := New_User_Module
+ (Ctxt.Design, New_Sname_Artificial (Get_Identifier ("iadff")),
+ Id_Iadff, 5, 1, 0);
+ Outputs := (0 => Create_Output ("q"));
+ Set_Port_Desc (Ctxt.M_Iadff, (0 => Create_Input ("clk", 1),
+ 1 => Create_Input ("d"),
+ 2 => Create_Input ("rst"),
+ 3 => Create_Input ("rst_val"),
+ 4 => Create_Input ("init")),
+ Outputs);
end Create_Dff_Modules;
function Build_Builders (Design : Module) return Context_Acc
@@ -629,6 +651,49 @@ package body Netlists.Builders is
return O;
end Build_Idff;
+ function Build_Adff (Ctxt : Context_Acc;
+ Clk : Net;
+ D : Net;
+ Rst : Net; Rst_Val : Net) return Net
+ is
+ Wd : constant Width := Get_Width (D);
+ pragma Assert (Wd /= No_Width);
+ pragma Assert (Get_Width (Clk) = 1);
+ Inst : Instance;
+ O : Net;
+ begin
+ Inst := New_Internal_Instance (Ctxt, Ctxt.M_Adff);
+ O := Get_Output (Inst, 0);
+ Set_Width (O, Wd);
+ Connect (Get_Input (Inst, 0), Clk);
+ Connect (Get_Input (Inst, 1), D);
+ Connect (Get_Input (Inst, 2), Rst);
+ Connect (Get_Input (Inst, 3), Rst_Val);
+ return O;
+ end Build_Adff;
+
+ function Build_Iadff (Ctxt : Context_Acc;
+ Clk : Net;
+ D : Net;
+ Rst : Net; Rst_Val : Net; Init : Net) return Net
+ is
+ Wd : constant Width := Get_Width (D);
+ pragma Assert (Wd /= No_Width);
+ pragma Assert (Get_Width (Clk) = 1);
+ Inst : Instance;
+ O : Net;
+ begin
+ Inst := New_Internal_Instance (Ctxt, Ctxt.M_Iadff);
+ O := Get_Output (Inst, 0);
+ Set_Width (O, Wd);
+ Connect (Get_Input (Inst, 0), Clk);
+ Connect (Get_Input (Inst, 1), D);
+ Connect (Get_Input (Inst, 2), Rst);
+ Connect (Get_Input (Inst, 3), Rst_Val);
+ Connect (Get_Input (Inst, 4), Init);
+ return O;
+ end Build_Iadff;
+
function Build_Slice
(Ctxt : Context_Acc; I : Net; Off, W : Width) return Net
is