aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth/netlists-builders.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-02-17 18:37:09 +0100
committerTristan Gingold <tgingold@free.fr>2020-02-17 18:37:09 +0100
commit5b9ccf680b139a94bd164bd0fba57b1e4a5535d3 (patch)
tree8acf2ea3071bbd873c358f5a51752d6d229de358 /src/synth/netlists-builders.adb
parent4284956d63b11db7e6b003f9c5ca81ea6eb234ff (diff)
downloadghdl-5b9ccf680b139a94bd164bd0fba57b1e4a5535d3.tar.gz
ghdl-5b9ccf680b139a94bd164bd0fba57b1e4a5535d3.tar.bz2
ghdl-5b9ccf680b139a94bd164bd0fba57b1e4a5535d3.zip
synth: add mdff.
Diffstat (limited to 'src/synth/netlists-builders.adb')
-rw-r--r--src/synth/netlists-builders.adb30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/synth/netlists-builders.adb b/src/synth/netlists-builders.adb
index c591c38a8..99080d9ae 100644
--- a/src/synth/netlists-builders.adb
+++ b/src/synth/netlists-builders.adb
@@ -487,7 +487,15 @@ package body Netlists.Builders is
2 => Create_Input ("rst"),
3 => Create_Input ("rst_val"),
4 => Create_Input ("init")),
- Outputs);
+ Outputs);
+
+ Ctxt.M_Mdff := New_User_Module
+ (Ctxt.Design, New_Sname_Artificial (Get_Identifier ("mdff"), No_Sname),
+ Id_Mdff, 3, 1, 0);
+ Set_Ports_Desc (Ctxt.M_Mdff, (0 => Create_Input ("clk", 1),
+ 1 => Create_Input ("d"),
+ 2 => Create_Input ("els")),
+ Outputs);
end Create_Dff_Modules;
procedure Create_Assert_Assume_Cover (Ctxt : Context_Acc)
@@ -1338,6 +1346,26 @@ package body Netlists.Builders is
return O;
end Build_Iadff;
+ function Build_Mdff (Ctxt : Context_Acc;
+ Clk : Net;
+ D : Net;
+ Els : Net) return Net
+ is
+ Wd : constant Width := Get_Width (D);
+ pragma Assert (Get_Width (Clk) = 1);
+ pragma Assert (Get_Width (Els) = Wd);
+ Inst : Instance;
+ O : Net;
+ begin
+ Inst := New_Internal_Instance (Ctxt, Ctxt.M_Mdff);
+ 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), Els);
+ return O;
+ end Build_Mdff;
+
function Build_Extract
(Ctxt : Context_Acc; I : Net; Off, W : Width) return Net
is