OpenCores
URL https://opencores.org/ocsvn/lateq/lateq/trunk

Subversion Repositories lateq

[/] [lateq/] [trunk/] [hdl_single_type/] [src/] [ex1_pkg.vhd] - Rev 3

Go to most recent revision | Compare with Previous | Blame | View Log

-------------------------------------------------------------------------------
-- Title      : ex1_pkg package
-- Project    : 
-------------------------------------------------------------------------------
-- File       : ex1_pkg.vhd
-- Author     : Wojciech M. Zabolotny ( wzab01<at>gmail.com )
-- Company    :
-- License    : BSD
-- Created    : 2013-11-01
-- Last update: 2015-09-24
-- Platform   : 
-- Standard   : VHDL'93/02
-------------------------------------------------------------------------------
-- Description: Package with definitions for the simple system
--              demonstrating a method of latency balancing
-------------------------------------------------------------------------------
-- Copyright (c) 2015
-------------------------------------------------------------------------------
-- Revisions  :
-- Date        Version  Author  Description
-- 2013-11-01  1.0      WZab    Created
-------------------------------------------------------------------------------
 
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use std.textio.all;
use IEEE.math_real.all;
 
library work;
use work.lateq_pkg.all;
 
package ex1_pkg is
 
  -- Constants describing the demo signal processor
  constant C_N_CHANNELS   : integer := 64;
  constant C_N_SIDE_CHANS : integer := 3;  -- number of neighbouring channels
 
-- User data without time marker
constant C_USER_DATA_WIDTH : integer := 18;
subtype T_USER_DATA is signed(C_USER_DATA_WIDTH-1 downto 0);
constant C_USER_DATA_INIT : T_USER_DATA := (others => '0');
 
-- User data with time marker and validity marker
type T_USER_DATA_MRK is record
  data : T_USER_DATA;
  valid : boolean;
  -- pragma translate_off
  lateq_mrk  : T_LATEQ_MRK;
  -- pragma translate_on
end record T_USER_DATA_MRK;
 
constant C_USER_DATA_MRK_INIT : T_USER_DATA_MRK := (
  data => C_USER_DATA_INIT,
  -- pragma translate_off
  lateq_mrk => C_LATEQ_MRK_INIT,
  -- pragma translate_on
  valid => false
  );
 
-- Vector of marked user data
type T_USER_DATA_SET is array (integer range <>) of T_USER_DATA_MRK;
 
  -- In the max_finder internally we have to work with a type, which holds the data value
  -- the validity marker and the position 
  type T_USER_DATA_WITH_POS is record
    d : T_USER_DATA_MRK;
    p : integer;
  end record T_USER_DATA_WITH_POS;
 
  constant C_USER_DATA_WITH_POS_INIT : T_USER_DATA_WITH_POS := (
    d => C_USER_DATA_MRK_INIT,
    p => 0
    );
 
  -- Function comparing the data used in max_finder
  function ex1_cmp_data (
    constant v1, v2 : T_USER_DATA_WITH_POS)
    return integer;
 
 
  -- Vector with all input data
  type T_INPUT_DATA is array (0 to C_N_CHANNELS-1) of T_USER_DATA;
  constant C_INPUT_DATA_INIT : T_INPUT_DATA := (others => C_USER_DATA_INIT);
 
end package ex1_pkg;
 
package body ex1_pkg is
 
  function ex1_cmp_data (
    constant v1, v2 : T_USER_DATA_WITH_POS)
    return integer is
  begin  -- function ex1_cmp_data
    if v1.d.data > v2.d.data then
      return 1;
    elsif v2.d.data > v1.d.data then
      return -1;
    else
      return 0;
    end if;
  end function ex1_cmp_data;
 
end package body ex1_pkg;
 

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.