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

Subversion Repositories hdlc

[/] [hdlc/] [trunk/] [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 5 khatib
-- Last update: 2001/01/12
10 2 khatib
-- 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 4 khatib
-- Revisions  :
36
-- Revision Number :   2
37
-- Version         :   0.2
38
-- Date            :   10 Jan 2001
39
-- Modifier        :   Jamil Khatib (khatib@ieee.org)
40
-- Desccription    :   Code clean
41
--
42
-------------------------------------------------------------------------------
43 5 khatib
-- Revisions  :
44
-- Revision Number :   3
45
-- Version         :   0.3
46
-- Date            :   12 Jan 2001
47
-- Modifier        :   Jamil Khatib (khatib@ieee.org)
48
-- Desccription    :   RXEN bug fixed
49
--
50
-------------------------------------------------------------------------------
51 2 khatib
library ieee;
52
use ieee.std_logic_1164.all;
53
 
54
entity FlagDetect_ent is
55
 
56
  port (
57
    Rxclk      : in  std_logic;         -- Rx clock
58
    rst        : in  std_logic;         -- system reset
59
    FlagDetect : out std_logic;         -- Flag detected
60
    Abort      : out std_logic;         -- Abort signal detected
61 5 khatib
    RxEn       : in  std_logic;         -- RX enable
62
    RXEn_O     : out std_logic;         -- RXEN output signal
63 2 khatib
    RXD        : out std_logic;         -- RXD output
64
    RX         : in  std_logic);        -- RX signal
65
 
66
end FlagDetect_ent;
67
 
68
architecture FlagDetect_beh of FlagDetect_ent is
69
 
70
  signal ShiftReg : std_logic_vector(7 downto 0);  -- Shift Register
71
 
72
begin  -- FlagDetect_beh
73
 
74
  -- purpose: Flag detection
75
  -- type   : sequential
76
  -- inputs : RXclk, rst
77
  -- outputs: 
78 5 khatib
  bitstreem_proc : process (RXclk, rst)
79 4 khatib
 
80 5 khatib
    variable FlagVar    : std_logic;    -- Flag detected variable
81
    variable Enable_Reg : std_logic_vector(7 downto 0);  -- Enable Register
82
 
83 2 khatib
  begin  -- process bitstreem_proc
84
    if rst = '0' then                   -- asynchronous reset (active low)
85
 
86
      FlagDetect <= '0';
87
      Abort      <= '0';
88
 
89
      RXD <= '0';
90
 
91
      FlagVar := '0';
92
 
93
      ShiftReg <= (others => '0');
94
 
95 5 khatib
      RXEN_O     <= '1';
96
      Enable_Reg := (others => '1');
97
 
98 2 khatib
    elsif RXclk'event and RXclk = '1' then  -- rising clock edge
99
 
100
      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);
101
 
102
      FlagDetect <= FlagVar;
103
 
104
      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);
105
 
106
 
107
      ShiftReg(7 downto 0) <= RX & ShiftReg(7 downto 1);
108
      RXD                  <= ShiftReg(0);
109
 
110 5 khatib
      RXEN_O <= Enable_Reg(0);
111 2 khatib
 
112 5 khatib
      Enable_Reg(7 downto 0) := RXEN & Enable_Reg(7 downto 1);
113
 
114 2 khatib
    end if;
115
  end process bitstreem_proc;
116
 
117
end FlagDetect_beh;

powered by: WebSVN 2.1.0

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