diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/synth/netlists-builders.adb | 33 | ||||
-rw-r--r-- | src/synth/netlists-builders.ads | 6 | ||||
-rw-r--r-- | src/synth/netlists-gates.ads | 8 |
3 files changed, 47 insertions, 0 deletions
diff --git a/src/synth/netlists-builders.adb b/src/synth/netlists-builders.adb index 99080d9ae..b07786fa5 100644 --- a/src/synth/netlists-builders.adb +++ b/src/synth/netlists-builders.adb @@ -496,6 +496,16 @@ package body Netlists.Builders is 1 => Create_Input ("d"), 2 => Create_Input ("els")), Outputs); + + Ctxt.M_Midff := New_User_Module + (Ctxt.Design, + New_Sname_Artificial (Get_Identifier ("midff"), No_Sname), + Id_Midff, 4, 1, 0); + Set_Ports_Desc (Ctxt.M_Midff, (0 => Create_Input ("clk", 1), + 1 => Create_Input ("d"), + 2 => Create_Input ("els"), + 3 => Create_Input ("init")), + Outputs); end Create_Dff_Modules; procedure Create_Assert_Assume_Cover (Ctxt : Context_Acc) @@ -1366,6 +1376,29 @@ package body Netlists.Builders is return O; end Build_Mdff; + function Build_Midff (Ctxt : Context_Acc; + Clk : Net; + D : Net; + Els : Net; + Init : Net) return Net + is + Wd : constant Width := Get_Width (D); + pragma Assert (Get_Width (Clk) = 1); + pragma Assert (Get_Width (Els) = Wd); + pragma Assert (Get_Width (Init) = Wd); + Inst : Instance; + O : Net; + begin + Inst := New_Internal_Instance (Ctxt, Ctxt.M_Midff); + 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); + Connect (Get_Input (Inst, 3), Init); + return O; + end Build_Midff; + function Build_Extract (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 de2a9da3c..02f616a8f 100644 --- a/src/synth/netlists-builders.ads +++ b/src/synth/netlists-builders.ads @@ -191,6 +191,11 @@ package Netlists.Builders is Clk : Net; D : Net; Els : Net) return Net; + function Build_Midff (Ctxt : Context_Acc; + Clk : Net; + D : Net; + Els : Net; + Init : Net) return Net; private type Module_Arr is array (Module_Id range <>) of Module; @@ -223,6 +228,7 @@ private M_Adff : Module; M_Iadff : Module; M_Mdff : Module; + M_Midff : Module; M_Truncate : Module_Arr (Truncate_Module_Id); M_Extend : Module_Arr (Extend_Module_Id); M_Reduce : Module_Arr (Reduce_Module_Id); diff --git a/src/synth/netlists-gates.ads b/src/synth/netlists-gates.ads index 848c7a10f..1816bc8eb 100644 --- a/src/synth/netlists-gates.ads +++ b/src/synth/netlists-gates.ads @@ -158,6 +158,14 @@ package Netlists.Gates is -- Output: 0: Q Id_Mdff : constant Module_Id := 54; + -- Multi clock dff with initial value. ELSE is the output of the next DFF. + -- Inputs: 0: CLK + -- 1: D + -- 2: ELSE + -- 3: Init + -- Output: 0: Q + Id_Midff : constant Module_Id := 55; + -- Width change: truncate or extend. Sign is know in order to possibly -- detect loss of value. Id_Utrunc : constant Module_Id := 64; |