diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-04-16 19:03:15 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-04-16 19:03:15 +0200 |
commit | 6b71fbf805d5534f68b32f3248d8aecf65bb00ec (patch) | |
tree | fda845bad7d108ae77410d127d36ba68269e8fa4 /src | |
parent | 5a31efbb82ef8ef34f5052c9c7a43dea97794718 (diff) | |
download | ghdl-6b71fbf805d5534f68b32f3248d8aecf65bb00ec.tar.gz ghdl-6b71fbf805d5534f68b32f3248d8aecf65bb00ec.tar.bz2 ghdl-6b71fbf805d5534f68b32f3248d8aecf65bb00ec.zip |
synth: add adff, iadff.
Diffstat (limited to 'src')
-rw-r--r-- | src/synth/netlists-builders.adb | 65 | ||||
-rw-r--r-- | src/synth/netlists-builders.ads | 9 |
2 files changed, 74 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 diff --git a/src/synth/netlists-builders.ads b/src/synth/netlists-builders.ads index 44f5d1a5e..b439a5351 100644 --- a/src/synth/netlists-builders.ads +++ b/src/synth/netlists-builders.ads @@ -91,6 +91,13 @@ package Netlists.Builders is Clk : Net; D : Net; Init : Net) return Net; + function Build_Adff (Ctxt : Context_Acc; + Clk : Net; + D : Net; Rst : Net; Rst_Val : Net) return Net; + function Build_Iadff (Ctxt : Context_Acc; + Clk : Net; + D : Net; Rst : Net; Rst_Val : Net; + Init : Net) return Net; private type Module_Arr is array (Module_Id range <>) of Module; @@ -113,6 +120,8 @@ private M_Isignal : Module; M_Dff : Module; M_Idff : Module; + M_Adff : Module; + M_Iadff : Module; M_Truncate : Module_Arr (Truncate_Module_Id); M_Extend : Module_Arr (Extend_Module_Id); M_Extract : Module; |