URL
https://opencores.org/ocsvn/lateq/lateq/trunk
Subversion Repositories lateq
[/] [lateq/] [trunk/] [hdl_single_type/] [src/] [max_finder_1st.vhd] - Rev 2
Compare with Previous | Blame | View Log
------------------------------------------------------------------------------- -- Title : Multiinput comparator for finding maximum element - single -- comparator -- Project : ------------------------------------------------------------------------------- -- File : max_finder_1st.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: ------------------------------------------------------------------------------- -- Copyright (c) 2013-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; library work; use work.lateq_pkg.all; use work.ex1_pkg.all; use work.ex1_trees_pkg.all; entity max_finder_1st is port ( dins : in T_EX1_CMP_INS; dout : out T_USER_DATA_WITH_POS; clk : in std_logic; rst_p : in std_logic); end max_finder_1st; architecture beh of max_finder_1st is begin process (clk, rst_p) is variable res : T_USER_DATA_WITH_POS; variable first : boolean; begin -- process if clk'event and clk = '1' then -- rising clock edge if rst_p = '1' then -- asynchronous reset (active high) dout <= C_USER_DATA_WITH_POS_INIT; else first := true; res := C_USER_DATA_WITH_POS_INIT; for i in 0 to EX1_NOF_INS_IN_CMP-1 loop if dins(i).d.valid then -- Check only valid inputs if first then res := dins(i); first := false; else -- pragma translate_off assert res.d.lateq_mrk = dins(i).d.lateq_mrk report "in entity:" & max_finder_1st'instance_name & " different delays between input 0 and input " & integer'image(i) & ": " & integer'image(res.d.lateq_mrk) & "<>" & integer'image(dins(i).d.lateq_mrk) severity failure; -- pragma translate_on if ex1_cmp_data(dins(i), res) > 0 then --report "swapped:" & integer'image(dins(i).value) & "<>" & integer'image(res.value) severity note; res := dins(i); end if; end if; end if; end loop; -- i --report "dout:" & integer'image(res.value) severity note; dout <= res; end if; end if; end process; end beh;