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

Subversion Repositories hdlc

[/] [hdlc/] [tags/] [init/] [CODE/] [RX/] [CORE/] [flag_detect.vhd] - Blame information for rev 17

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 khatib
-------------------------------------------------------------------------------
2
-- Title      :  HDLC flag detection
3
-- Project    :  HDLC controller
4
-------------------------------------------------------------------------------
5
-- File        : flag_detect.vhd
6
-- Author      : Jamil Khatib  (khatib@ieee.org)
7
-- Organization: OpenIPCore Project
8
-- Created     : 2000/12/28
9
-- Last update: 2001/01/05
10
-- Platform    : 
11
-- Simulators  : Modelsim 5.3XE/Windows98
12
-- Synthesizers: 
13
-- Target      : 
14
-- Dependency  : ieee.std_logic_1164
15
--
16
-------------------------------------------------------------------------------
17
-- Description:  Flag detection
18
-------------------------------------------------------------------------------
19
-- Copyright (c) 2000 Jamil Khatib
20
-- 
21
-- This VHDL design file is an open design; you can redistribute it and/or
22
-- modify it and/or implement it after contacting the author
23
-- You can check the draft license at
24
-- http://www.opencores.org/OIPC/license.shtml
25
 
26
-------------------------------------------------------------------------------
27
-- Revisions  :
28
-- Revision Number :   1
29
-- Version         :   0.1
30
-- Date            :   28 Dec 2000
31
-- Modifier        :   Jamil Khatib (khatib@ieee.org)
32
-- Desccription    :   Created
33
--
34
-------------------------------------------------------------------------------
35
 
36
library ieee;
37
use ieee.std_logic_1164.all;
38
 
39
entity FlagDetect_ent is
40
 
41
  port (
42
    Rxclk      : in  std_logic;         -- Rx clock
43
    rst        : in  std_logic;         -- system reset
44
    FlagDetect : out std_logic;         -- Flag detected
45
    Abort      : out std_logic;         -- Abort signal detected
46
    RXD        : out std_logic;         -- RXD output
47
    RX         : in  std_logic);        -- RX signal
48
 
49
end FlagDetect_ent;
50
 
51
architecture FlagDetect_beh of FlagDetect_ent is
52
  type states_typ is (IDLE, ZERO, ONE1, ONE2, ONE3, ONE4, ONE5, ONE6);
53
                                        -- State machine states
54
 
55
  signal ShiftReg : std_logic_vector(7 downto 0);  -- Shift Register
56
 
57
begin  -- FlagDetect_beh
58
 
59
  -- purpose: Flag detection
60
  -- type   : sequential
61
  -- inputs : RXclk, rst
62
  -- outputs: 
63
  bitstreem_proc     : process (RXclk, rst)
64
    variable state   : states_typ;      -- System State
65
    variable FlagVar : std_logic;       -- Flag detected variable
66
  begin  -- process bitstreem_proc
67
    if rst = '0' then                   -- asynchronous reset (active low)
68
 
69
--      state      := IDLE;
70
      FlagDetect <= '0';
71
      Abort      <= '0';
72
 
73
      RXD <= '0';
74
 
75
      FlagVar := '0';
76
 
77
      ShiftReg <= (others => '0');
78
 
79
    elsif RXclk'event and RXclk = '1' then  -- rising clock edge
80
 
81
      FlagVar := not ShiftReg(0) and ShiftReg(1) and ShiftReg(2) and ShiftReg(3) and ShiftReg(4) and ShiftReg(5) and ShiftReg(6) and not ShiftReg(7);
82
 
83
      FlagDetect <= FlagVar;
84
 
85
      Abort <= not ShiftReg(0) and ShiftReg(1) and ShiftReg(2) and ShiftReg(3) and ShiftReg(4) and ShiftReg(5) and ShiftReg(6) and ShiftReg(7);
86
 
87
 
88
      ShiftReg(7 downto 0) <= RX & ShiftReg(7 downto 1);
89
      RXD                  <= ShiftReg(0);
90
 
91
--      case state is
92
 
93
--        when IDLE =>
94
--          if RX = '0' then
95
--            state := ZERO;
96
--          else
97
--            state := IDLE;
98
--          end if;
99
 
100
--          FlagDetect <= '0';
101
--          Abort      <= '0';
102
---------------------------------------------------------------------------------
103
 
104
--        when ZERO =>
105
--          if RX = '0' then
106
--            state := ZERO;
107
--          else
108
--            state := ONE1;
109
--          end if;
110
 
111
--          FlagDetect <= '0';
112
--          Abort      <= '0';
113
---------------------------------------------------------------------------------
114
 
115
--        when ONE1 =>
116
--          if RX = '0' then
117
--            state := ZERO;
118
--          else
119
--            state := ONE2;
120
--          end if;
121
 
122
--          FlagDetect <= '0';
123
--          Abort      <= '0';
124
---------------------------------------------------------------------------------
125
--        when ONE2 =>
126
--          if RX = '0' then
127
--            state    := ZERO;
128
--          else
129
--            state    := ONE3;
130
--          end if;
131
 
132
--          FlagDetect <= '0';
133
--          Abort      <= '0';
134
---------------------------------------------------------------------------------
135
--        when ONE3 =>
136
--          if RX = '0' then
137
--            state    := ZERO;
138
--          else
139
--            state    := ONE4;
140
--          end if;
141
 
142
--          FlagDetect <= '0';
143
--          Abort      <= '0';
144
---------------------------------------------------------------------------------
145
--        when ONE4 =>
146
--          if RX = '0' then
147
--            state    := ZERO;
148
--          else
149
--            state    := ONE5;
150
--          end if;
151
 
152
--          FlagDetect <= '0';
153
--          Abort      <= '0';
154
---------------------------------------------------------------------------------
155
--        when ONE5 =>
156
--          if RX = '0' then
157
--            state    := ZERO;
158
--          else
159
--            state    := ONE6;
160
--          end if;
161
 
162
--          FlagDetect   <= '0';
163
--          Abort        <= '0';
164
---------------------------------------------------------------------------------
165
--        when ONE6 =>
166
--          if RX = '0' then
167
--            FlagDetect <= '1';
168
--            Abort      <= '0';
169
--          else
170
 
171
--            FlagDetect <= '0';
172
--            Abort      <= '1';
173
--          end if;
174
--          state        := ZERO;
175
 
176
---------------------------------------------------------------------------------
177
--          when others =>
178
--            state    := IDLE;
179
--          FlagDetect <= '0';
180
--          Abort      <= '0';
181
 
182
--      end case;
183
 
184
--      RXD <= RX;
185
 
186
    end if;
187
  end process bitstreem_proc;
188
 
189
end FlagDetect_beh;

powered by: WebSVN 2.1.0

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