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

Subversion Repositories hdlc

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

Go to most recent revision | 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 4 khatib
-- Last update: 2001/01/10
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
 
37
library ieee;
38
use ieee.std_logic_1164.all;
39
 
40
entity rxcont_ent is
41
 
42
  port (
43
    RxClk        : in  std_logic;       -- Rx Clcok
44
    rst          : in  std_logic;       -- system Reset
45
    RxEn         : in  std_logic;       -- Rx Enable
46
    AbortedFrame : out std_logic;       -- Aborted frame
47
    Abort        : in  std_logic;       -- Abort detected
48
    FlagDetect   : in  std_logic;       -- Flag Detect
49
    ValidFrame   : out std_logic;       -- Valid Frame
50
    FrameError   : out std_logic;       -- Frame Error (Indicates error in the
51
                                        -- next byte at the backend
52
    aval         : in  std_logic;       -- Can accept more data
53
    initzero     : out std_logic;       -- init Zero detect block
54
    enable       : out std_logic);      -- Enable
55
 
56
end rxcont_ent;
57
 
58
architecture rxcont_beh of rxcont_ent is
59
 
60
--  signal validFrame_i : std_logic;    -- Internal Valid Frame signal
61
 
62
begin  -- rxcont_beh
63
-- purpose: Enable controller
64
-- type   : sequential
65
-- inputs : Rxclk, rst
66
-- outputs: 
67
  enable_proc               : process (Rxclk, rst)
68
    variable counter        : integer range 0 to 7;  -- Counter
69
    variable FlagCounter    : integer range 0 to 7;  -- Flag bits counter
70
    variable FrameStatus    : std_logic;  -- Frame Status
71
    variable FlagInit       : std_logic;  -- Init flag counter
72
    variable FrameStatusReg : std_logic_vector(7 downto 0);
73
                                        -- Delay for Frame Status
74
  begin  -- process enable_proc
75
    if rst = '0' then                   -- asynchronous reset (active low)
76
 
77
      enable         <= '0';
78
      FrameStatus    := '0';
79
      ValidFrame     <= '0';
80
      AbortedFrame   <= '0';
81
      Counter        := 0;
82
      FlagInit       := '0';
83
      initzero       <= '0';
84
      FrameStatusReg := (others => '0');
85 5 khatib
                FrameError <= '0';
86
          FlagCounter := 0;
87 2 khatib
 
88
    elsif Rxclk'event and Rxclk = '1' then  -- rising clock edge
89
-------------------------------------------------------------------------------
90
-- This is the Valid frame machine
91
      if FlagDetect = '1' then
92
        FlagInit     := '1';
93
        FrameStatus  := '0';
94
        FlagCounter  := 0;
95
        AbortedFrame <= '0';
96
      end if;
97
 
98
      if FlagInit = '1' then
99
 
100
        if FlagCounter = 7 then
101
          FrameStatus := '1';
102
          FlagCounter := 0;
103
          initzero    <= '1';
104
          FlagInit    := '0';
105
        else
106
          FlagCounter := FlagCounter + 1;
107
          initzero    <= '0';
108
        end if;
109
      else
110
        initzero      <= '0';
111
      end if;
112
 
113
      if Abort = '1' then
114
        FrameStatus  := '0';
115
        AbortedFrame <= '1';
116
      end if;
117
      ValidFrame     <= FrameStatusReg(0);
118
 
119
      FrameStatusReg(7 downto 0) := FrameStatus & FrameStatusReg(7 downto 1);
120
 
121
 
122
 
123
 
124
 
125
 
126
-------------------------------------------------------------------------------
127
-- This is the enable machine
128
      if RxEn = '1' then
129
 
130
        if FrameStatus = '1' then
131
 
132
          if aval = '1' then
133
 
134
            enable     <= '1';
135
            Counter    := 0;
136
            FrameError <= '0';
137
          else
138
 
139
            if counter = 5 then
140
 
141
              enable <= '0';
142 5 khatib
counter := 0;
143 2 khatib
              FrameError <= '1';
144
 
145
            else
146
 
147
              enable <= '1';
148
 
149
              Counter    := Counter +1;
150
              FrameError <= '0';
151
            end if;  -- counter
152
 
153
          end if;  -- aval
154
        else
155
          FrameError <= '0';
156
          enable     <= '0';
157
--        Counter := 0;
158
 
159
        end if;  -- validframe
160
      else
161
        FrameError <= '0';
162
        enable     <= '0';
163
--      Counter := 0;
164
 
165
      end if;  -- rxen
166
 
167
    end if;  -- clock
168
  end process enable_proc;
169
 
170
-------------------------------------------------------------------------------
171
end rxcont_beh;

powered by: WebSVN 2.1.0

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