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

Subversion Repositories the_wizardry_project

[/] [the_wizardry_project/] [trunk/] [Wizardry/] [VHDL/] [Wizardry Top Level/] [Memory Design/] [MIG_top_00/] [MIG_user_interface_0/] [MIG_rd_data_0/] [MIG_pattern_compare8.vhd] - Blame information for rev 24

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 24 mcwaccent
-------------------------------------------------------------------------------
2
-- Copyright (c) 2005-2007 Xilinx, Inc.
3
-- This design is confidential and proprietary of Xilinx, All Rights Reserved.
4
-------------------------------------------------------------------------------
5
--   ____  ____
6
--  /   /\/   /
7
-- /___/  \  /   Vendor             : Xilinx
8
-- \   \   \/    Version            : $Name: i+IP+131489 $
9
--  \   \        Application        : MIG
10
--  /   /        Filename           : MIG_pattern_compare8.vhd
11
-- /___/   /\    Date Last Modified : $Date: 2007/09/21 15:23:24 $
12
-- \   \  /  \   Date Created       : Mon May 2 2005
13
--  \___\/\___\
14
--
15
-- Device      : Virtex-4
16
-- Design Name : DDR SDRAM
17
-- Description: Compares the IOB output 8 bit data of one bank that is read
18
--              data during the intilaization to get the delay for the data
19
--              with respect to the command issued.
20
-------------------------------------------------------------------------------
21
 
22
library ieee;
23
use ieee.std_logic_1164.all;
24
use ieee.std_logic_unsigned.all;
25
library UNISIM;
26
use UNISIM.vcomponents.all;
27
 
28
entity MIG_pattern_compare8 is
29
  port(
30
    clk            : in  std_logic;
31
    rst            : in  std_logic;
32
    ctrl_rden      : in  std_logic;
33
    rd_data_rise   : in  std_logic_vector(7 downto 0);
34
    rd_data_fall   : in  std_logic_vector(7 downto 0);
35
    comp_done      : out std_logic;
36
    first_rising   : out std_logic;
37
    rise_clk_count : out std_logic_vector(2 downto 0);
38
    fall_clk_count : out std_logic_vector(2 downto 0)
39
    );
40
end MIG_pattern_compare8;
41
 
42
architecture arch of MIG_pattern_compare8 is
43
 
44
  constant IDLE        : std_logic_vector(1 downto 0) := "00";
45
  constant FIRST_DATA  : std_logic_vector(1 downto 0) := "01";
46
  constant SECOND_DATA : std_logic_vector(1 downto 0) := "10";
47
  constant COMP_OVER   : std_logic_vector(1 downto 0) := "11";
48
 
49
  signal state_rise      : std_logic_vector(1 downto 0);
50
  signal state_fall      : std_logic_vector(1 downto 0);
51
  signal next_state_rise : std_logic_vector(1 downto 0);
52
  signal next_state_fall : std_logic_vector(1 downto 0);
53
  signal rise_clk_cnt    : std_logic_vector(2 downto 0);
54
  signal fall_clk_cnt    : std_logic_vector(2 downto 0);
55
  signal ctrl_rden_r     : std_logic;
56
  signal pattern_rise1   : std_logic_vector(7 downto 0);
57
  signal pattern_fall1   : std_logic_vector(7 downto 0);
58
  signal pattern_rise2   : std_logic_vector(7 downto 0);
59
  signal pattern_fall2   : std_logic_vector(7 downto 0);
60
  signal rd_data_rise_r2 : std_logic_vector(7 downto 0);
61
  signal rd_data_fall_r2 : std_logic_vector(7 downto 0);
62
  signal rst_r           : std_logic;
63
begin
64
 
65
  pattern_rise1 <= X"AA";
66
  pattern_fall1 <= X"55";
67
  pattern_rise2 <= X"99";
68
  pattern_fall2 <= X"66";
69
 
70
  process(clk)
71
  begin
72
    if(clk'event and clk = '1') then
73
      rst_r <= rst;
74
    end if;
75
  end process;
76
 
77
  process(clk)
78
  begin
79
    if(clk'event and clk = '1') then
80
      if(rst_r = '1') then
81
        state_rise <= IDLE;
82
      else
83
        state_rise <= next_state_rise;
84
      end if;
85
    end if;
86
  end process;
87
 
88
  process(clk)
89
  begin
90
    if(clk'event and clk = '1') then
91
      if(rst_r = '1') then
92
        state_fall <= IDLE;
93
      else
94
        state_fall <= next_state_fall;
95
      end if;
96
    end if;
97
  end process;
98
 
99
  process(clk)
100
  begin
101
    if(clk'event and clk = '1') then
102
      if(rst_r = '1') then
103
        ctrl_rden_r <= '0';
104
      else
105
        ctrl_rden_r <= ctrl_rden;
106
      end if;
107
    end if;
108
  end process;
109
 
110
  process(clk)
111
  begin
112
    if(clk'event and clk = '1') then
113
      if(rst_r = '1') then
114
        rise_clk_cnt <= "000";
115
      elsif((state_rise = FIRST_DATA) or (state_rise = SECOND_DATA)) then
116
        rise_clk_cnt <= rise_clk_cnt + '1';
117
      end if;
118
    end if;
119
  end process;
120
 
121
  rise_clk_count <= rise_clk_cnt when (state_rise = COMP_OVER) else "000";
122
 
123
  comp_done <= '1' when ((state_rise = COMP_OVER) and (state_fall = COMP_OVER))
124
               else '0';
125
 
126
  process(clk)
127
  begin
128
    if(clk'event and clk = '1') then
129
      if(rst_r = '1') then
130
        fall_clk_cnt <= "000";
131
      elsif((state_fall = FIRST_DATA) or (state_fall = SECOND_DATA)) then
132
        fall_clk_cnt <= fall_clk_cnt + '1';
133
      end if;
134
    end if;
135
  end process;
136
 
137
  fall_clk_count <= fall_clk_cnt when (state_fall = COMP_OVER) else "000";
138
 
139
  process(clk)
140
  begin
141
    if (clk = '1' and clk'event) then
142
      if (rst_r = '1') then
143
        first_rising <= '0';
144
      elsif(state_rise = SECOND_DATA and rd_data_rise = pattern_fall2
145
           and rd_data_rise_r2 = pattern_fall1) then
146
        first_rising <= '1';
147
      end if;
148
    end if;
149
  end process;
150
 
151
  process(clk)
152
  begin
153
    if (clk = '1' and clk'event) then
154
      if (rst_r = '1') then
155
        rd_data_rise_r2 <= (others => '0');
156
        rd_data_fall_r2 <= (others => '0');
157
      else
158
        rd_data_rise_r2 <= rd_data_rise;
159
        rd_data_fall_r2 <= rd_data_fall;
160
      end if;
161
    end if;
162
  end process;
163
 
164
  process(ctrl_rden_r, state_rise, rd_data_rise, rd_data_rise_r2, pattern_rise1,
165
          pattern_fall1, pattern_rise2, pattern_fall2, rst_r)
166
  begin
167
    if(rst_r = '1') then
168
      next_state_rise <= IDLE;
169
    else
170
      case state_rise is
171
        when IDLE =>
172
          if(ctrl_rden_r = '1') then
173
            next_state_rise <= FIRST_DATA;
174
          else
175
            next_state_rise <= IDLE;
176
          end if;
177
 
178
        when FIRST_DATA =>
179
          if((rd_data_rise = pattern_rise1) or (rd_data_rise = pattern_fall1)) then
180
            next_state_rise <= SECOND_DATA;
181
          else
182
            next_state_rise <= FIRST_DATA;
183
          end if;
184
 
185
        when SECOND_DATA =>
186
          if(((rd_data_rise=pattern_rise2) and (rd_data_rise_r2=pattern_rise1)) or
187
             ((rd_data_rise=pattern_fall2) and (rd_data_rise_r2=pattern_fall1))) then
188
            next_state_rise <= COMP_OVER;
189
          else
190
            next_state_rise <= SECOND_DATA;
191
          end if;
192
 
193
        when COMP_OVER =>
194
          next_state_rise <= COMP_OVER;
195
 
196
        when others =>
197
          next_state_rise <= IDLE;
198
      end case;
199
    end if;
200
  end process;
201
 
202
  process(ctrl_rden_r, state_fall, rd_data_fall, rd_data_fall_r2, pattern_rise1,
203
          pattern_fall1, pattern_rise2, pattern_fall2, rst_r)
204
  begin
205
    if(rst_r = '1') then
206
      next_state_fall <= IDLE;
207
    else
208
      case state_fall is
209
        when IDLE =>
210
          if(ctrl_rden_r = '1') then
211
            next_state_fall <= FIRST_DATA;
212
          else
213
            next_state_fall <= IDLE;
214
          end if;
215
 
216
        when FIRST_DATA =>
217
          if((rd_data_fall = pattern_rise1) or (rd_data_fall = pattern_fall1)) then
218
            next_state_fall <= SECOND_DATA;
219
          else
220
            next_state_fall <= FIRST_DATA;
221
          end if;
222
 
223
        when SECOND_DATA =>
224
          if(((rd_data_fall=pattern_rise2) and (rd_data_fall_r2=pattern_rise1)) or
225
             ((rd_data_fall=pattern_fall2) and (rd_data_fall_r2=pattern_fall1))) then
226
            next_state_fall <= COMP_OVER;
227
          else
228
            next_state_fall <= SECOND_DATA;
229
          end if;
230
 
231
        when COMP_OVER =>
232
          next_state_fall <= COMP_OVER;
233
 
234
        when others =>
235
          next_state_fall <= IDLE;
236
      end case;
237
    end if;
238
  end process;
239
 
240
 
241
end arch;

powered by: WebSVN 2.1.0

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