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

Subversion Repositories hdlc

[/] [hdlc/] [trunk/] [CODE/] [RX/] [CORE/] [Rxcont.vhd] - Blame information for rev 17

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 khatib
-------------------------------------------------------------------------------
2
-- Title      :  Rx Controller
3
-- Project    :  HDLC controller
4
-------------------------------------------------------------------------------
5
-- File        : Rxcont.vhd
6
-- Author      : Jamil Khatib  (khatib@ieee.org)
7
-- Organization: OpenIPCore Project
8
-- Created     : 2000/12/30
9 9 khatib
-- Last update: 2001/04/27
10 2 khatib
-- Platform    : 
11
-- Simulators  : Modelsim 5.3XE/Windows98
12
-- Synthesizers: 
13
-- Target      : 
14
-- Dependency  : ieee.std_logic_1164
15
--
16
-------------------------------------------------------------------------------
17
-- Description:  receive Controller
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            :   30 Dec 2000
31
-- Modifier        :   Jamil Khatib (khatib@ieee.org)
32
-- Desccription    :   Created
33
-- ToOptimize      :
34
-- Bugs            :   
35
-------------------------------------------------------------------------------
36 9 khatib
-- Revisions  :
37
-- Revision Number :   2
38
-- Version         :   0.2
39
-- Date            :   27 April 2001
40
-- Modifier        :   Jamil Khatib (khatib@ieee.org)
41
-- Desccription    :   Enable and Available Bugs fixed
42
-- ToOptimize      :
43
-- Bugs            :   
44
-------------------------------------------------------------------------------
45 2 khatib
library ieee;
46
use ieee.std_logic_1164.all;
47
 
48
entity rxcont_ent is
49
 
50
  port (
51
    RxClk        : in  std_logic;       -- Rx Clcok
52
    rst          : in  std_logic;       -- system Reset
53
    RxEn         : in  std_logic;       -- Rx Enable
54
    AbortedFrame : out std_logic;       -- Aborted frame
55
    Abort        : in  std_logic;       -- Abort detected
56
    FlagDetect   : in  std_logic;       -- Flag Detect
57
    ValidFrame   : out std_logic;       -- Valid Frame
58
    FrameError   : out std_logic;       -- Frame Error (Indicates error in the
59
                                        -- next byte at the backend
60
    aval         : in  std_logic;       -- Can accept more data
61
    initzero     : out std_logic;       -- init Zero detect block
62
    enable       : out std_logic);      -- Enable
63
 
64
end rxcont_ent;
65
 
66
architecture rxcont_beh of rxcont_ent is
67
 
68
--  signal validFrame_i : std_logic;    -- Internal Valid Frame signal
69
 
70
begin  -- rxcont_beh
71
-- purpose: Enable controller
72
-- type   : sequential
73
-- inputs : Rxclk, rst
74
-- outputs: 
75
  enable_proc               : process (Rxclk, rst)
76
    variable counter        : integer range 0 to 7;  -- Counter
77
    variable FlagCounter    : integer range 0 to 7;  -- Flag bits counter
78
    variable FrameStatus    : std_logic;  -- Frame Status
79
    variable FlagInit       : std_logic;  -- Init flag counter
80
    variable FrameStatusReg : std_logic_vector(7 downto 0);
81
                                        -- Delay for Frame Status
82
  begin  -- process enable_proc
83
    if rst = '0' then                   -- asynchronous reset (active low)
84
 
85
      enable         <= '0';
86
      FrameStatus    := '0';
87
      ValidFrame     <= '0';
88
      AbortedFrame   <= '0';
89
      Counter        := 0;
90
      FlagInit       := '0';
91
      initzero       <= '0';
92
      FrameStatusReg := (others => '0');
93 5 khatib
                FrameError <= '0';
94
          FlagCounter := 0;
95 2 khatib
 
96
    elsif Rxclk'event and Rxclk = '1' then  -- rising clock edge
97
-------------------------------------------------------------------------------
98
-- This is the Valid frame machine
99
      if FlagDetect = '1' then
100
        FlagInit     := '1';
101
        FrameStatus  := '0';
102
        FlagCounter  := 0;
103
        AbortedFrame <= '0';
104
      end if;
105
 
106
      if FlagInit = '1' then
107
 
108
        if FlagCounter = 7 then
109
          FrameStatus := '1';
110
          FlagCounter := 0;
111
          initzero    <= '1';
112
          FlagInit    := '0';
113
        else
114
          FlagCounter := FlagCounter + 1;
115
          initzero    <= '0';
116
        end if;
117
      else
118
        initzero      <= '0';
119
      end if;
120
 
121
      if Abort = '1' then
122
        FrameStatus  := '0';
123
        AbortedFrame <= '1';
124
      end if;
125
      ValidFrame     <= FrameStatusReg(0);
126
 
127
      FrameStatusReg(7 downto 0) := FrameStatus & FrameStatusReg(7 downto 1);
128
 
129
 
130
 
131
 
132
 
133
 
134
-------------------------------------------------------------------------------
135
-- This is the enable machine
136
      if RxEn = '1' then
137
 
138
        if FrameStatus = '1' then
139
 
140
          if aval = '1' then
141
 
142
            enable     <= '1';
143
            Counter    := 0;
144
            FrameError <= '0';
145
          else
146
 
147
            if counter = 5 then
148
 
149
              enable <= '0';
150 9 khatib
              counter := 0;
151 2 khatib
              FrameError <= '1';
152
 
153
            else
154
 
155
              enable <= '1';
156
 
157
              Counter    := Counter +1;
158
              FrameError <= '0';
159
            end if;  -- counter
160
 
161
          end if;  -- aval
162
        else
163
          FrameError <= '0';
164
          enable     <= '0';
165
--        Counter := 0;
166
 
167
        end if;  -- validframe
168
      else
169
        FrameError <= '0';
170
        enable     <= '0';
171
--      Counter := 0;
172
 
173
      end if;  -- rxen
174
 
175
    end if;  -- clock
176
  end process enable_proc;
177
 
178
-------------------------------------------------------------------------------
179
end rxcont_beh;

powered by: WebSVN 2.1.0

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