-- $Id: xilinx.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/18
|
|
-- 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 xilinx is
|
entity xilinx is
|
port (
|
port (
|
clock : in bit;
|
clock : in bit;
|
clear : in bit;
|
clear : in bit;
|
start : out bit;
|
start : out bit;
|
rom_pos : out integer;
|
rom_pos : out integer;
|
y0d : out bit;
|
y0d : out bit;
|
y1d : out bit;
|
y1d : out bit;
|
y2d : out bit;
|
y2d : out bit;
|
y3d : out bit;
|
y3d : out bit;
|
senddata : out bit_vector (3 downto 0);
|
senddata : out bit_vector (3 downto 0);
|
match : out bit_vector (3 downto 0);
|
match : out bit_vector (3 downto 0);
|
bit_error : out integer
|
bit_error : out integer
|
);
|
);
|
end xilinx;
|
end xilinx;
|
|
|
architecture structural of xilinx is
|
architecture structural of xilinx is
|
|
|
component product_code
|
component product_code
|
port (
|
port (
|
clock : in bit;
|
clock : in bit;
|
start : in bit;
|
start : in bit;
|
rxin : in bit_vector (07 downto 00);
|
rxin : in bit_vector (07 downto 00);
|
y0d : out bit;
|
y0d : out bit;
|
y1d : out bit;
|
y1d : out bit;
|
y2d : out bit;
|
y2d : out bit;
|
y3d : out bit
|
y3d : out bit
|
);
|
);
|
end component;
|
end component;
|
|
|
component input
|
component input
|
port (
|
port (
|
clock : in bit;
|
clock : in bit;
|
clear : in bit;
|
clear : in bit;
|
start : out bit;
|
start : out bit;
|
rom_pos : out integer;
|
rom_pos : out integer;
|
rxin : out bit_vector (07 downto 00)
|
rxin : out bit_vector (07 downto 00)
|
);
|
);
|
end component;
|
end component;
|
|
|
component reference
|
component reference
|
port (
|
port (
|
clear : in bit;
|
clear : in bit;
|
start : in bit;
|
start : in bit;
|
y0 : in bit;
|
y0 : in bit;
|
y1 : in bit;
|
y1 : in bit;
|
y2 : in bit;
|
y2 : in bit;
|
y3 : in bit;
|
y3 : in bit;
|
senddata : out bit_vector (3 downto 0);
|
senddata : out bit_vector (3 downto 0);
|
match : out bit_vector (3 downto 0)
|
match : out bit_vector (3 downto 0)
|
);
|
);
|
end component;
|
end component;
|
|
|
component analyze
|
component analyze
|
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 component;
|
end component;
|
|
|
signal str : bit;
|
signal str : bit;
|
signal y0 : bit;
|
signal y0 : bit;
|
signal y1 : bit;
|
signal y1 : bit;
|
signal y2 : bit;
|
signal y2 : bit;
|
signal y3 : bit;
|
signal y3 : bit;
|
signal rxin : bit_vector (07 downto 00);
|
signal rxin : bit_vector (07 downto 00);
|
signal mtch : bit_vector (03 downto 00);
|
signal mtch : bit_vector (03 downto 00);
|
signal col_0 : integer;
|
signal col_0 : integer;
|
signal col_1 : integer;
|
signal col_1 : integer;
|
signal col_2 : integer;
|
signal col_2 : integer;
|
signal col_3 : integer;
|
signal col_3 : integer;
|
|
|
begin
|
begin
|
|
|
start <= str;
|
start <= str;
|
match <= mtch;
|
match <= mtch;
|
y0d <= y0;
|
y0d <= y0;
|
y1d <= y1;
|
y1d <= y1;
|
y2d <= y2;
|
y2d <= y2;
|
y3d <= y3;
|
y3d <= y3;
|
|
|
my_product_code : product_code
|
my_product_code : product_code
|
port map (
|
port map (
|
clock => clock,
|
clock => clock,
|
start => str,
|
start => str,
|
rxin => rxin,
|
rxin => rxin,
|
y0d => y0,
|
y0d => y0,
|
y1d => y1,
|
y1d => y1,
|
y2d => y2,
|
y2d => y2,
|
y3d => y3
|
y3d => y3
|
);
|
);
|
|
|
my_input : input
|
my_input : input
|
port map (
|
port map (
|
clock => clock,
|
clock => clock,
|
clear => clear,
|
clear => clear,
|
start => str,
|
start => str,
|
rom_pos => rom_pos,
|
rom_pos => rom_pos,
|
rxin => rxin
|
rxin => rxin
|
);
|
);
|
|
|
my_senddata: reference
|
my_senddata: reference
|
port map (
|
port map (
|
clear => clear,
|
clear => clear,
|
start => str,
|
start => str,
|
y0 => y0,
|
y0 => y0,
|
y1 => y1,
|
y1 => y1,
|
y2 => y2,
|
y2 => y2,
|
y3 => y3,
|
y3 => y3,
|
senddata=> senddata,
|
senddata=> senddata,
|
match => mtch
|
match => mtch
|
);
|
);
|
my_analyzer: analyze
|
my_analyzer: analyze
|
port map (
|
port map (
|
clear => clear,
|
clear => clear,
|
start => str,
|
start => str,
|
match => mtch,
|
match => mtch,
|
col_0 => col_0,
|
col_0 => col_0,
|
col_1 => col_1,
|
col_1 => col_1,
|
col_2 => col_2,
|
col_2 => col_2,
|
col_3 => col_3,
|
col_3 => col_3,
|
result => bit_error
|
result => bit_error
|
);
|
);
|
|
|
end structural;
|
end structural;
|
|
|