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

Subversion Repositories pc_fpga_com

[/] [pc_fpga_com/] [trunk/] [PC_FPGA_PLATFPORM/] [HARDWARE/] [MATCH_CMD.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 NikosAl
----------------------------------------------------------------------------------
2
-- Company: 
3
-- Engineer: 
4
-- 
5
-- Create Date:    11:01:28 01/18/2011 
6
-- Design Name: 
7
-- Module Name:    MATCH_CMD - Behavioral 
8
-- Project Name: 
9
-- Target Devices: 
10
-- Tool versions: 
11
-- Description: 
12
--
13
-- Dependencies: 
14
--
15
-- Revision: 
16
-- Revision 0.01 - File Created
17
-- Additional Comments: 
18
--
19
----------------------------------------------------------------------------------
20
library IEEE;
21
use IEEE.STD_LOGIC_1164.ALL;
22
use IEEE.STD_LOGIC_ARITH.ALL;
23
use IEEE.STD_LOGIC_UNSIGNED.ALL;
24
 
25
---- Uncomment the following library declaration if instantiating
26
---- any Xilinx primitives in this code.
27
--library UNISIM;
28
--use UNISIM.VComponents.all;
29
 
30
entity MATCH_CMD is
31
    Port ( rst : in  STD_LOGIC;
32
           clk : in  STD_LOGIC;
33
           sof : in  STD_LOGIC;
34
           vld_i : in  STD_LOGIC;
35
           val_i : in  STD_LOGIC_VECTOR (7 downto 0);
36
                          cmd_to_match : in  STD_LOGIC_VECTOR(7 downto 0);
37
           cmd_match : out  STD_LOGIC);
38
end MATCH_CMD;
39
 
40
architecture Behavioral of MATCH_CMD is
41
 
42
TYPE state is (rst_state,
43
                                        idle_state,
44
                                        header_state
45
                                );
46
 
47
signal current_st,next_st: state;
48
 
49
signal allow_match, match_s: std_logic;
50
signal allow_match_v, val_i_to_match: std_logic_vector(7 downto 0);
51
 
52
begin
53
 
54
process(clk)
55
begin
56
if (rst='1') then
57
        current_st<= rst_state;
58
elsif (clk'event and clk='1') then
59
        current_st <= next_st;
60
end if;
61
end process;
62
 
63
process(current_st,sof,vld_i)
64
begin
65
case current_st is
66
 
67
when rst_state =>
68
 
69
        allow_match<='0';
70
 
71
        next_st<=idle_state;
72
 
73
when idle_state =>
74
 
75
        allow_match<='0';
76
 
77
        if sof='0' then
78
                next_st <= header_state;
79
        else
80
                next_st <= idle_state;
81
        end if;
82
 
83
when header_state =>
84
 
85
        if vld_i='1' then
86
                allow_match<='1';
87
                next_st <= rst_state;
88
        else
89
                allow_match<='0';
90
                next_st <= header_state;
91
        end if;
92
 
93
end case;
94
end process;
95
 
96
allow_match_v <=(others=>allow_match);
97
val_i_to_match <= val_i and allow_match_v;
98
 
99
process(clk)
100
begin
101
if clk'event and clk='1' then
102
        if val_i_to_match =  cmd_to_match then
103
                cmd_match <='1';
104
        else
105
                cmd_match <='0';
106
        end if;
107
end if;
108
end process;
109
 
110
end Behavioral;
111
 

powered by: WebSVN 2.1.0

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