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

Subversion Repositories lateq

[/] [lateq/] [trunk/] [hdl_single_type/] [src/] [max_finder_1st.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 wzab
-------------------------------------------------------------------------------
2
-- Title      : Multiinput comparator for finding maximum element - single
3
--              comparator
4
-- Project    : 
5
-------------------------------------------------------------------------------
6
-- File       : max_finder_1st.vhd
7
-- Author     : Wojciech M. Zabolotny ( wzab01<at>gmail.com )
8
-- Company    :
9
-- License    : BSD
10
-- Created    : 2013-11-01
11
-- Last update: 2015-09-24
12
-- Platform   : 
13
-- Standard   : VHDL'93/02
14
-------------------------------------------------------------------------------
15
-- Description: 
16
-------------------------------------------------------------------------------
17
-- Copyright (c) 2013-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
 
27
use IEEE.NUMERIC_STD.all;
28
library work;
29
use work.lateq_pkg.all;
30
use work.ex1_pkg.all;
31
use work.ex1_trees_pkg.all;
32
 
33
 
34
entity max_finder_1st is
35
  port (
36
    dins  : in  T_EX1_CMP_INS;
37
    dout  : out T_USER_DATA_WITH_POS;
38
    clk   : in  std_logic;
39
    rst_p : in  std_logic);
40
end max_finder_1st;
41
 
42
architecture beh of max_finder_1st is
43
 
44
begin
45
 
46
  process (clk, rst_p) is
47
    variable res     : T_USER_DATA_WITH_POS;
48
    variable first : boolean;
49
  begin  -- process
50
    if clk'event and clk = '1' then     -- rising clock edge
51
      if rst_p = '1' then               -- asynchronous reset (active high)
52
        dout <= C_USER_DATA_WITH_POS_INIT;
53
      else
54
        first := true;
55
        res := C_USER_DATA_WITH_POS_INIT;
56
        for i in 0 to EX1_NOF_INS_IN_CMP-1 loop
57
          if dins(i).d.valid then
58
            -- Check only valid inputs
59
            if first then
60
              res := dins(i);
61
              first := false;
62
            else
63
              -- pragma translate_off
64
              assert res.d.lateq_mrk = dins(i).d.lateq_mrk report "in entity:" & max_finder_1st'instance_name &
65
                " different delays between input 0 and input " &
66
                integer'image(i) & ": " & integer'image(res.d.lateq_mrk) & "<>" & integer'image(dins(i).d.lateq_mrk)
67
                severity failure;
68
              -- pragma translate_on
69
              if ex1_cmp_data(dins(i), res) > 0 then
70
                --report "swapped:" & integer'image(dins(i).value) & "<>" & integer'image(res.value) severity note;
71
                res := dins(i);
72
              end if;
73
            end if;
74
          end if;
75
        end loop;  -- i
76
        --report "dout:" & integer'image(res.value) severity note;
77
        dout <= res;
78
      end if;
79
    end if;
80
  end process;
81
 
82
end beh;

powered by: WebSVN 2.1.0

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