Skip to content
Snippets Groups Projects
Select Git revision
  • 8a8e0d4e6afafda4b192e442e724f68f29b7bb67
  • master default protected
  • L2SDP-LIFT
  • L2SDP-1137
  • L2SDP-1113
  • HPR-158
6 results

common_pkg.vhd

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    common_pkg.vhd 121.39 KiB
    -------------------------------------------------------------------------------
    --
    -- Copyright (C) 2019
    -- ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/>
    -- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
    --
    -- 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 3 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 <http://www.gnu.org/licenses/>.
    --
    -------------------------------------------------------------------------------
    
    -- Author:
    -- . Eric Kooistra
    -- Purpose:
    -- . Collection of commonly used base funtions
    -- Interface:
    -- . [n/a]
    -- Description:
    -- . This is a package containing generic constants and functions.
    -- . More information can be found in the comments near the code.
    
    LIBRARY IEEE;
    USE IEEE.STD_LOGIC_1164.ALL;
    USE IEEE.NUMERIC_STD.ALL;
    USE IEEE.MATH_REAL.ALL;
    
    PACKAGE common_pkg IS
    
      -- CONSTANT DECLARATIONS ----------------------------------------------------
    
      -- some integers
      CONSTANT c_0                    : NATURAL := 0;
      CONSTANT c_zero                 : NATURAL := 0;
      CONSTANT c_1                    : NATURAL := 1;
      CONSTANT c_one                  : NATURAL := 1;
      CONSTANT c_2                    : NATURAL := 2;
      CONSTANT c_4                    : NATURAL := 4;
      CONSTANT c_quad                 : NATURAL := 4;
      CONSTANT c_8                    : NATURAL := 8;
      CONSTANT c_16                   : NATURAL := 16;
      CONSTANT c_32                   : NATURAL := 32;
      CONSTANT c_48                   : NATURAL := 48;
      CONSTANT c_64                   : NATURAL := 64;
      CONSTANT c_128                  : NATURAL := 128;
      CONSTANT c_256                  : NATURAL := 256;
      
      -- widths and sizes
      CONSTANT c_halfword_sz          : NATURAL := 2;
      CONSTANT c_word_sz              : NATURAL := 4;
      CONSTANT c_longword_sz          : NATURAL := 8;
      CONSTANT c_nibble_w             : NATURAL := 4;
      CONSTANT c_byte_w               : NATURAL := 8;
      CONSTANT c_octet_w              : NATURAL := 8;
      CONSTANT c_halfword_w           : NATURAL := c_byte_w*c_halfword_sz;
      CONSTANT c_word_w               : NATURAL := c_byte_w*c_word_sz;
      CONSTANT c_integer_w            : NATURAL := 32;              -- unfortunately VHDL integer type is limited to 32 bit values
      CONSTANT c_natural_w            : NATURAL := c_integer_w-1;   -- unfortunately VHDL natural type is limited to 31 bit values (0 and the positive subset of the VHDL integer type0
      CONSTANT c_longword_w           : NATURAL := c_byte_w*c_longword_sz;
      
      -- logic