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

Subversion Repositories lateq

[/] [lateq/] [trunk/] [hdl_single_type/] [src/] [ex1_pkg.vhd] - Blame information for rev 4

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

Line No. Rev Author Line
1 2 wzab
-------------------------------------------------------------------------------
2
-- Title      : ex1_pkg package
3
-- Project    : 
4
-------------------------------------------------------------------------------
5
-- File       : ex1_pkg.vhd
6
-- Author     : Wojciech M. Zabolotny ( wzab01<at>gmail.com )
7
-- Company    :
8
-- License    : BSD
9
-- Created    : 2013-11-01
10
-- Last update: 2015-09-24
11
-- Platform   : 
12
-- Standard   : VHDL'93/02
13
-------------------------------------------------------------------------------
14
-- Description: Package with definitions for the simple system
15
--              demonstrating a method of latency balancing
16
-------------------------------------------------------------------------------
17
-- Copyright (c) 2015
18
-------------------------------------------------------------------------------
19
-- Revisions  :
20
-- Date        Version  Author  Description
21
-- 2013-11-01  1.0      WZab    Created
22
-------------------------------------------------------------------------------
23
 
24
library ieee;
25
use ieee.std_logic_1164.all;
26
use ieee.numeric_std.all;
27
use std.textio.all;
28
use IEEE.math_real.all;
29
 
30
library work;
31
use work.lateq_pkg.all;
32
 
33
package ex1_pkg is
34
 
35
  -- Constants describing the demo signal processor
36
  constant C_N_CHANNELS   : integer := 64;
37
  constant C_N_SIDE_CHANS : integer := 3;  -- number of neighbouring channels
38
 
39
-- User data without time marker
40
constant C_USER_DATA_WIDTH : integer := 18;
41
subtype T_USER_DATA is signed(C_USER_DATA_WIDTH-1 downto 0);
42
constant C_USER_DATA_INIT : T_USER_DATA := (others => '0');
43
 
44
-- User data with time marker and validity marker
45
type T_USER_DATA_MRK is record
46
  data : T_USER_DATA;
47
  valid : boolean;
48
  -- pragma translate_off
49
  lateq_mrk  : T_LATEQ_MRK;
50
  -- pragma translate_on
51
end record T_USER_DATA_MRK;
52
 
53
constant C_USER_DATA_MRK_INIT : T_USER_DATA_MRK := (
54
  data => C_USER_DATA_INIT,
55
  -- pragma translate_off
56
  lateq_mrk => C_LATEQ_MRK_INIT,
57
  -- pragma translate_on
58
  valid => false
59
  );
60
 
61
-- Vector of marked user data
62
type T_USER_DATA_SET is array (integer range <>) of T_USER_DATA_MRK;
63
 
64
  -- In the max_finder internally we have to work with a type, which holds the data value
65
  -- the validity marker and the position 
66
  type T_USER_DATA_WITH_POS is record
67
    d : T_USER_DATA_MRK;
68
    p : integer;
69
  end record T_USER_DATA_WITH_POS;
70
 
71
  constant C_USER_DATA_WITH_POS_INIT : T_USER_DATA_WITH_POS := (
72
    d => C_USER_DATA_MRK_INIT,
73
    p => 0
74
    );
75
 
76
  -- Function comparing the data used in max_finder
77
  function ex1_cmp_data (
78
    constant v1, v2 : T_USER_DATA_WITH_POS)
79
    return integer;
80
 
81
 
82
  -- Vector with all input data
83
  type T_INPUT_DATA is array (0 to C_N_CHANNELS-1) of T_USER_DATA;
84
  constant C_INPUT_DATA_INIT : T_INPUT_DATA := (others => C_USER_DATA_INIT);
85
 
86
end package ex1_pkg;
87
 
88
package body ex1_pkg is
89
 
90
  function ex1_cmp_data (
91
    constant v1, v2 : T_USER_DATA_WITH_POS)
92
    return integer is
93
  begin  -- function ex1_cmp_data
94
    if v1.d.data > v2.d.data then
95
      return 1;
96
    elsif v2.d.data > v1.d.data then
97
      return -1;
98
    else
99
      return 0;
100
    end if;
101
  end function ex1_cmp_data;
102
 
103
end package body ex1_pkg;

powered by: WebSVN 2.1.0

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