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

Subversion Repositories hdlc

[/] [hdlc/] [trunk/] [CODE/] [TX/] [core/] [flag_ins.vhd] - Blame information for rev 17

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 8 khatib
-------------------------------------------------------------------------------
2
-- Title      :  Flag insertion block
3
-- Project    :  HDLC controller
4
-------------------------------------------------------------------------------
5
-- File        : flag_ins.vhd
6
-- Author      : Jamil Khatib  (khatib@ieee.org)
7
-- Organization: OpenIPCore Project
8
-- Created     :2001/01/11
9
-- Last update: 2001/01/26
10
-- Platform    : 
11
-- Simulators  : Modelsim 5.3XE/Windows98
12
-- Synthesizers: 
13
-- Target      : 
14
-- Dependency  : ieee.std_logic_1164
15
--
16
-------------------------------------------------------------------------------
17
-- Description:  Transmit and insert flag and idle patterns
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            :   11 Jan 2001
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 flag_ins_ent is
41
 
42
  port (
43
    TXclk      : in  std_logic;         -- TX clock
44
    rst_n      : in  std_logic;         -- system reset
45
    TX         : out std_logic;         -- TX data
46
    TXEN       : in  std_logic;         -- TX enable
47
    TXD        : in  std_logic;         -- TX input data
48
    AbortFrame : in  std_logic;         -- Abort Current Frame
49
    Frame      : in  std_logic);        -- Valid Frame
50
 
51
end flag_ins_ent;
52
 
53
 
54
architecture flag_ins_beh of flag_ins_ent is
55
 
56
begin  -- flag_ins_beh
57
 
58
  -- purpose: Tranmit process
59
  -- type   : sequential
60
  -- inputs : TXclk, rst_n
61
  -- outputs: 
62
  process (TXclk, rst_n)
63
 
64
    variable transmit_reg : std_logic_vector(7 downto 0);  -- Transmit Register
65
    variable state        : std_logic;                     -- Internal state
66
 
67
  begin  -- process
68
    if rst_n = '0' then                 -- asynchronous reset (active low)
69
 
70
      transmit_reg := (others => '1');
71
      state        := '0';
72
      TX           <= '1';
73
 
74
    elsif TXclk'event and TXclk = '1' then  -- rising clock edge
75
 
76
      if TXEN = '1' then
77
 
78
        case state is
79
          -- idle state
80
          when '0' =>
81
 
82
            TX <= transmit_reg(0);
83
 
84
            transmit_reg(7 downto 0) := '1' & transmit_reg(7 downto 1);
85
 
86
            if Frame = '1' and AbortFrame = '0' then
87
              state        := '1';
88
              transmit_reg := "01111110";
89
            end if;
90
 
91
            -- Normal operation
92
          when '1' =>
93
 
94
            TX <= transmit_reg(0);
95
 
96
            transmit_reg(7 downto 0) := TXD & transmit_reg(7 downto 1);
97
 
98
            if AbortFrame = '1' then
99
 
100
              transmit_reg := "11111110";
101
              state        := '0';
102
 
103
            elsif Frame = '0' then
104
 
105
              transmit_reg := "01111110";
106
              state        := '0';
107
 
108
            end if;
109
 
110
          when others => null;
111
 
112
        end case;
113
 
114
      else
115
 
116
        TX <= '1';
117
 
118
      end if;  -- end TXEN
119
    end if;  -- end TXclk
120
  end process;
121
 
122
end flag_ins_beh;

powered by: WebSVN 2.1.0

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