diff options
| author | Tristan Gingold <tgingold@free.fr> | 2019-09-15 06:31:30 +0200 | 
|---|---|---|
| committer | Tristan Gingold <tgingold@free.fr> | 2019-09-15 06:31:30 +0200 | 
| commit | 7376ea33d44f4ba2318582888f53bfb069f72bed (patch) | |
| tree | 91d5de2a621f926ba024a5f783e4d888929c9a10 /src | |
| parent | 1ff70cdd479751f646b7da61287bc15859563fe0 (diff) | |
| download | ghdl-7376ea33d44f4ba2318582888f53bfb069f72bed.tar.gz ghdl-7376ea33d44f4ba2318582888f53bfb069f72bed.tar.bz2 ghdl-7376ea33d44f4ba2318582888f53bfb069f72bed.zip | |
synth: add build2_const_vec
Diffstat (limited to 'src')
| -rw-r--r-- | src/synth/netlists-builders.adb | 18 | ||||
| -rw-r--r-- | src/synth/netlists-builders.ads | 9 | 
2 files changed, 27 insertions, 0 deletions
| diff --git a/src/synth/netlists-builders.adb b/src/synth/netlists-builders.adb index f8c28eb01..0dbf202f4 100644 --- a/src/synth/netlists-builders.adb +++ b/src/synth/netlists-builders.adb @@ -711,6 +711,24 @@ package body Netlists.Builders is        end if;     end Build2_Const_Uns; +   function Build2_Const_Vec (Ctxt : Context_Acc; W : Width; V : Uns32_Arr) +                             return Net is +   begin +      if W <= 32 then +         return Build_Const_UB32 (Ctxt, V (V'First), W); +      else +         declare +            Inst : Instance; +         begin +            Inst := Build_Const_Bit (Ctxt, W); +            for I in V'Range loop +               Set_Param_Uns32 (Inst, Param_Idx (I - V'First), V (I)); +            end loop; +            return Get_Output (Inst, 0); +         end; +      end if; +   end Build2_Const_Vec; +     function Build2_Const_Int (Ctxt : Context_Acc; Val : Int64; W : Width)                               return Net is     begin diff --git a/src/synth/netlists-builders.ads b/src/synth/netlists-builders.ads index 1493ed194..7cf9a3058 100644 --- a/src/synth/netlists-builders.ads +++ b/src/synth/netlists-builders.ads @@ -18,12 +18,18 @@  --  Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,  --  MA 02110-1301, USA. +with Ada.Unchecked_Deallocation;  with Netlists.Gates; use Netlists.Gates;  package Netlists.Builders is     type Context is private;     type Context_Acc is access Context; +   type Uns32_Arr is array (Natural range <>) of Uns32; +   type Uns32_Arr_Acc is access Uns32_Arr; +   procedure Unchecked_Deallocate is new Ada.Unchecked_Deallocation +     (Uns32_Arr, Uns32_Arr_Acc); +     function New_Internal_Name (Ctxt : Context_Acc; Prefix : Sname := No_Sname)                                return Sname; @@ -78,6 +84,9 @@ package Netlists.Builders is     function Build2_Const_Int (Ctxt : Context_Acc; Val : Int64; W : Width)                               return Net; +   function Build2_Const_Vec (Ctxt : Context_Acc; W : Width; V : Uns32_Arr) +                             return Net; +     --  Large constants.     --  Bit means only 0 or 1.     --  Log means 0/1/Z/X.  Parameters 2N are aval, 2N+1 are bval. | 
