diff options
author | Tristan Gingold <tgingold@free.fr> | 2022-09-02 02:50:33 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2022-09-02 02:50:33 +0200 |
commit | dc9a84dbd3ae94978708d236cd54712ed7c80314 (patch) | |
tree | 7b4af2314ee495cf2c889a93b2d444b7dc0f96b9 /src | |
parent | a259712ccb53a2b59fc66e01646db9ce95167ab1 (diff) | |
download | ghdl-dc9a84dbd3ae94978708d236cd54712ed7c80314.tar.gz ghdl-dc9a84dbd3ae94978708d236cd54712ed7c80314.tar.bz2 ghdl-dc9a84dbd3ae94978708d236cd54712ed7c80314.zip |
synth: extract synth-ieee-utils from synth-ieee-numeric_std
Diffstat (limited to 'src')
-rw-r--r-- | src/synth/synth-ieee-numeric_std.adb | 22 | ||||
-rw-r--r-- | src/synth/synth-ieee-utils.ads | 45 |
2 files changed, 46 insertions, 21 deletions
diff --git a/src/synth/synth-ieee-numeric_std.adb b/src/synth/synth-ieee-numeric_std.adb index 19fa1145d..8ec10fdd9 100644 --- a/src/synth/synth-ieee-numeric_std.adb +++ b/src/synth/synth-ieee-numeric_std.adb @@ -21,29 +21,9 @@ with Types_Utils; use Types_Utils; with Elab.Memtype; use Elab.Memtype; with Synth.Errors; use Synth.Errors; +with Synth.Ieee.Utils; use Synth.Ieee.Utils; package body Synth.Ieee.Numeric_Std is - subtype Sl_01 is Std_Ulogic range '0' .. '1'; - subtype Sl_X01 is Std_Ulogic range 'X' .. '1'; - - type Carry_Array is array (Sl_01, Sl_01, Sl_01) of Sl_01; - Compute_Carry : constant Carry_Array := - ('0' => ('0' => ('0' => '0', '1' => '0'), - '1' => ('0' => '0', '1' => '1')), - '1' => ('0' => ('0' => '0', '1' => '1'), - '1' => ('0' => '1', '1' => '1'))); - Compute_Sum : constant Carry_Array := - ('0' => ('0' => ('0' => '0', '1' => '1'), - '1' => ('0' => '1', '1' => '0')), - '1' => ('0' => ('0' => '1', '1' => '0'), - '1' => ('0' => '0', '1' => '1'))); - - type Sl_To_X01_Array is array (Std_Ulogic) of Sl_X01; - Sl_To_X01 : constant Sl_To_X01_Array := - ('0' | 'L' => '0', '1' | 'H' => '1', others => 'X'); - - type Uns_To_01_Array is array (Uns64 range 0 .. 1) of Sl_X01; - Uns_To_01 : constant Uns_To_01_Array := (0 => '0', 1 => '1'); function Create_Res_Type (Otyp : Type_Acc; Len : Uns32) return Type_Acc is begin diff --git a/src/synth/synth-ieee-utils.ads b/src/synth/synth-ieee-utils.ads new file mode 100644 index 000000000..d2fe7d5b4 --- /dev/null +++ b/src/synth/synth-ieee-utils.ads @@ -0,0 +1,45 @@ +-- Simple logic utilities for ieee.std_logic +-- Copyright (C) 2019 Tristan Gingold +-- +-- This file is part of GHDL. +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see <gnu.org/licenses>. + +with Types; use Types; + +with Synth.Ieee.Std_Logic_1164; use Synth.Ieee.Std_Logic_1164; + +package Synth.Ieee.Utils is + subtype Sl_01 is Std_Ulogic range '0' .. '1'; + subtype Sl_X01 is Std_Ulogic range 'X' .. '1'; + + type Carry_Array is array (Sl_01, Sl_01, Sl_01) of Sl_01; + Compute_Carry : constant Carry_Array := + ('0' => ('0' => ('0' => '0', '1' => '0'), + '1' => ('0' => '0', '1' => '1')), + '1' => ('0' => ('0' => '0', '1' => '1'), + '1' => ('0' => '1', '1' => '1'))); + Compute_Sum : constant Carry_Array := + ('0' => ('0' => ('0' => '0', '1' => '1'), + '1' => ('0' => '1', '1' => '0')), + '1' => ('0' => ('0' => '1', '1' => '0'), + '1' => ('0' => '0', '1' => '1'))); + + type Sl_To_X01_Array is array (Std_Ulogic) of Sl_X01; + Sl_To_X01 : constant Sl_To_X01_Array := + ('0' | 'L' => '0', '1' | 'H' => '1', others => 'X'); + + type Uns_To_01_Array is array (Uns64 range 0 .. 1) of Sl_X01; + Uns_To_01 : constant Uns_To_01_Array := (0 => '0', 1 => '1'); +end Synth.Ieee.Utils; |