diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/synth/netlists-builders.adb | 30 | ||||
| -rw-r--r-- | src/synth/netlists-builders.ads | 3 | ||||
| -rw-r--r-- | src/synth/netlists-gates.ads | 7 | 
3 files changed, 38 insertions, 2 deletions
| diff --git a/src/synth/netlists-builders.adb b/src/synth/netlists-builders.adb index d0d4b20be..d3eaf6a0a 100644 --- a/src/synth/netlists-builders.adb +++ b/src/synth/netlists-builders.adb @@ -566,6 +566,20 @@ package body Netlists.Builders is                        Outputs);     end Create_Dff_Modules; +   procedure Create_Latch_Modules (Ctxt : Context_Acc) +   is +      Outputs : Port_Desc_Array (0 .. 0); +   begin +      Ctxt.M_Dlatch := New_User_Module +        (Ctxt.Design, +         New_Sname_Artificial (Get_Identifier ("dlatch"), No_Sname), +         Id_Dlatch, 2, 1, 0); +      Outputs := (0 => Create_Output ("q")); +      Set_Ports_Desc (Ctxt.M_Dlatch, (0 => Create_Input ("d"), +                                      1 => Create_Input ("en", 1)), +                      Outputs); +   end Create_Latch_Modules; +     procedure Create_Assert_Assume_Cover (Ctxt : Context_Acc)     is        Outputs : Port_Desc_Array (1 .. 0); @@ -758,6 +772,7 @@ package body Netlists.Builders is        Create_Mux_Modules (Res);        Create_Objects_Module (Res);        Create_Dff_Modules (Res); +      Create_Latch_Modules (Res);        Create_Assert_Assume_Cover (Res); @@ -1589,6 +1604,21 @@ package body Netlists.Builders is        return O;     end Build_Midff; +   function Build_Dlatch (Ctxt : Context_Acc; En : Net; D : Net) return Net +   is +      Wd : constant Width := Get_Width (D); +      pragma Assert (Get_Width (En) = 1); +      Inst : Instance; +      O : Net; +   begin +      Inst := New_Internal_Instance (Ctxt, Ctxt.M_Dlatch); +      O := Get_Output (Inst, 0); +      Set_Width (O, Wd); +      Connect (Get_Input (Inst, 0), D); +      Connect (Get_Input (Inst, 1), En); +      return O; +   end Build_Dlatch; +     function Build_Tri (Ctxt : Context_Acc; En : Net; D : Net) return Net     is        Wd : constant Width := Get_Width (D); diff --git a/src/synth/netlists-builders.ads b/src/synth/netlists-builders.ads index 6111d045f..135b4544f 100644 --- a/src/synth/netlists-builders.ads +++ b/src/synth/netlists-builders.ads @@ -212,6 +212,8 @@ package Netlists.Builders is                           Els : Net;                           Init : Net) return Net; +   function Build_Dlatch (Ctxt : Context_Acc; En : Net; D : Net) return Net; +     function Build_Tri (Ctxt : Context_Acc; En : Net; D : Net) return Net;     function Build_Resolver (Ctxt : Context_Acc; L, R : Net) return Net; @@ -257,6 +259,7 @@ private        M_Iadff : Module;        M_Mdff : Module;        M_Midff : Module; +      M_Dlatch : Module;        M_Tri : Module;        M_Resolver : Module;        M_Truncate : Module_Arr (Truncate_Module_Id); diff --git a/src/synth/netlists-gates.ads b/src/synth/netlists-gates.ads index 305bd5158..5f09ccafa 100644 --- a/src/synth/netlists-gates.ads +++ b/src/synth/netlists-gates.ads @@ -201,8 +201,11 @@ package Netlists.Gates is     --  Output:  0: Q     Id_Midff : constant Module_Id := 69; -   --  Reserved. -   Id_Latch : constant Module_Id := 70; +   --  Gated D Latch +   --  Inputs:  0: D +   --           1: EN +   --  Outputs: 0: Q +   Id_Dlatch : constant Module_Id := 70;     --  Tri state buffer.     --  Inputs:  0: D | 
