-- $Id: analyze.vhdl,v 1.1 2006-01-16 03:40:22 arif_endro Exp $
|
-- ------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
|
-- Title :
|
|
-- Project :
|
|
-------------------------------------------------------------------------------
|
|
-- File :
|
|
-- Author : "Arif E. Nugroho" <arif_endro@yahoo.com>
|
|
-- Created : 2005/12/19
|
|
-- Last update :
|
|
-- Simulators :
|
|
-- Synthesizers: ISE Xilinx 6.3i
|
|
-- Target :
|
|
-------------------------------------------------------------------------------
|
|
-- Description :
|
|
-------------------------------------------------------------------------------
|
|
-- Copyright (C) 2005 Arif Endro Nugroho
|
-- Copyright (C) 2005 Arif Endro Nugroho
|
-------------------------------------------------------------------------------
|
-- All rights reserved.
|
--
|
--
|
-- THIS SOURCE FILE MAY BE USED AND DISTRIBUTED WITHOUT RESTRICTION
|
-- Redistribution and use in source and binary forms, with or without
|
-- PROVIDED THAT THIS COPYRIGHT STATEMENT IS NOT REMOVED FROM THE FILE AND THAT
|
-- modification, are permitted provided that the following conditions
|
-- ANY DERIVATIVE WORK CONTAINS THE ORIGINAL COPYRIGHT NOTICE AND THE
|
-- are met:
|
-- ASSOCIATED DISCLAIMER.
|
|
--
|
--
|
-------------------------------------------------------------------------------
|
-- 1. Redistributions of source code must retain the above copyright
|
|
-- notice, this list of conditions and the following disclaimer.
|
|
-- 2. Redistributions in binary form must reproduce the above copyright
|
|
-- notice, this list of conditions and the following disclaimer in the
|
|
-- documentation and/or other materials provided with the distribution.
|
--
|
--
|
-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
-- THIS SOFTWARE IS PROVIDED BY ARIF ENDRO NUGROHO "AS IS" AND ANY EXPRESS
|
-- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
-- OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
-- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
-- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
-- EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
-- DISCLAIMED. IN NO EVENT SHALL ARIF ENDRO NUGROHO BE LIABLE FOR ANY
|
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
-- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
-- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
-- OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
-- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
-- OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
-- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
-- ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
-- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
-- POSSIBILITY OF SUCH DAMAGE.
|
--
|
--
|
-------------------------------------------------------------------------------
|
-- End Of License.
|
|
-- ------------------------------------------------------------------------
|
|
|
library ieee;
|
library ieee;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_arith.all;
|
use ieee.std_logic_arith.all;
|
use ieee.std_logic_unsigned.all;
|
use ieee.std_logic_unsigned.all;
|
|
|
entity analyze is
|
entity analyze is
|
port (
|
port (
|
clear : in bit;
|
clear : in bit;
|
start : in bit;
|
start : in bit;
|
match : in bit_vector (3 downto 0);
|
match : in bit_vector (3 downto 0);
|
col_0 : out integer;
|
col_0 : out integer;
|
col_1 : out integer;
|
col_1 : out integer;
|
col_2 : out integer;
|
col_2 : out integer;
|
col_3 : out integer;
|
col_3 : out integer;
|
result : out integer
|
result : out integer
|
);
|
);
|
end analyze;
|
end analyze;
|
|
|
architecture analyzer of analyze is
|
architecture analyzer of analyze is
|
|
|
signal col_0_int : integer range 0 to 19999;
|
signal col_0_int : integer range 0 to 19999;
|
signal col_1_int : integer range 0 to 19999;
|
signal col_1_int : integer range 0 to 19999;
|
signal col_2_int : integer range 0 to 19999;
|
signal col_2_int : integer range 0 to 19999;
|
signal col_3_int : integer range 0 to 19999;
|
signal col_3_int : integer range 0 to 19999;
|
signal result_int : integer range 0 to 19999;
|
signal result_int : integer range 0 to 19999;
|
|
|
begin
|
begin
|
|
|
process (start,clear)
|
process (start,clear)
|
begin
|
begin
|
|
|
if (clear = '1') then
|
if (clear = '1') then
|
col_0_int <= 0;
|
col_0_int <= 0;
|
col_1_int <= 0;
|
col_1_int <= 0;
|
col_2_int <= 0;
|
col_2_int <= 0;
|
col_3_int <= 0;
|
col_3_int <= 0;
|
result_int <= 0;
|
result_int <= 0;
|
-- sample at rising edge then show the result at falling edge.
|
-- sample at rising edge then show the result at falling edge.
|
elsif (start = '1' and start'event) then
|
elsif (start = '1' and start'event) then
|
if (match(0) = '0') then
|
if (match(0) = '0') then
|
if (col_0_int < 19999) then
|
if (col_0_int < 19999) then
|
col_0_int <= col_0_int + 1;
|
col_0_int <= col_0_int + 1;
|
else
|
else
|
col_0_int <= 0;
|
col_0_int <= 0;
|
end if;
|
end if;
|
end if;
|
end if;
|
if (match(1) = '0') then
|
if (match(1) = '0') then
|
if (col_1_int < 19999) then
|
if (col_1_int < 19999) then
|
col_1_int <= col_1_int + 1;
|
col_1_int <= col_1_int + 1;
|
else
|
else
|
col_1_int <= 0;
|
col_1_int <= 0;
|
end if;
|
end if;
|
end if;
|
end if;
|
if (match(2) = '0') then
|
if (match(2) = '0') then
|
if (col_2_int < 19999) then
|
if (col_2_int < 19999) then
|
col_2_int <= col_2_int + 1;
|
col_2_int <= col_2_int + 1;
|
else
|
else
|
col_2_int <= 0;
|
col_2_int <= 0;
|
end if;
|
end if;
|
end if;
|
end if;
|
if (match(3) = '0') then
|
if (match(3) = '0') then
|
if (col_3_int < 19999) then
|
if (col_3_int < 19999) then
|
col_3_int <= col_3_int + 1;
|
col_3_int <= col_3_int + 1;
|
else
|
else
|
col_3_int <= 0;
|
col_3_int <= 0;
|
end if;
|
end if;
|
end if;
|
end if;
|
end if;
|
end if;
|
|
|
result_int <= col_0_int + col_1_int + col_2_int + col_3_int;
|
result_int <= col_0_int + col_1_int + col_2_int + col_3_int;
|
|
|
end process;
|
end process;
|
|
|
result <= result_int;
|
result <= result_int;
|
col_0 <= col_0_int;
|
col_0 <= col_0_int;
|
col_1 <= col_1_int;
|
col_1 <= col_1_int;
|
col_2 <= col_2_int;
|
col_2 <= col_2_int;
|
col_3 <= col_3_int;
|
col_3 <= col_3_int;
|
|
|
end analyzer;
|
end analyzer;
|
|
|