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

Subversion Repositories e1framerdeframer

[/] [e1framerdeframer/] [web_uploads/] [fas_insert.vhd] - Blame information for rev 6

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 6 root
 -------------------------------------------------------------------
2
-- Entity        : fas_insert
3
-- Description   : Inserts FAS word pattern in serial data
4
-- Input         : indata : serial in data
5
--               : clk : clock 2.048 MHz
6
--                   : reset : Reset
7
-- Output            : outdata out data with FAS word
8
--                   : rd output which indicates data load              
9
------------------------------------------------------------
10
 
11
library ieee;
12
use ieee.std_logic_1164.all;
13
use ieee.std_logic_unsigned.all;
14
use ieee.std_logic_unsigned.all;
15
 
16
entity fas_insert is
17
 port(indata:in std_logic;
18
      TICLK: in std_logic;
19
           reset:in std_logic;
20
           tx_bitcnt:in std_logic_vector(11 downto 0);
21
           outdata:out std_logic
22
          );
23
end fas_insert;
24
 
25
architecture behave of fas_insert is
26
type statetype is (fas,nfas,channel); -- S0= zero time slot (FAS word) generation
27
                       -- S1= reading data channels
28
signal state: statetype;
29
 
30
begin
31
--------process for generating FAS word and reading channel data----------
32
stateproc:process(TICLK,reset)
33
variable reg: std_logic_vector(7 downto 0);
34
variable outInt:std_logic;
35
begin
36
if reset='1' then
37
   state<=fas;
38
 
39
 
40
elsif (TICLK'event and TICLK='1') then --- rising edge 
41
 
42
  case state is
43
       when fas =>
44
                     reg:="11011000"; -- FAS word X0011011
45
                                if (tx_bitcnt(7 downto 0)="00000111") then
46
                            state<=channel;
47
                              end if;
48
                   outInt:=reg(conv_integer(tx_bitcnt(2 downto 0)));
49
 
50
       when channel =>
51
                  outInt:=indata;
52
                  if tx_bitcnt(8 downto 0)="011111111" then
53
                                                  state<=nfas;
54
                                                elsif tx_bitcnt(8 downto 0)="111111111" then
55
                    state<=fas;
56
                                                end if;
57
 
58
       when nfas =>
59
                            reg:="00000010";-- NFAS word bit2 should be '1'
60
                        if (tx_bitcnt(7 downto 0)="00000111") then
61
                           state<=channel;
62
                             end if;
63
                   outInt:=reg(conv_integer(tx_bitcnt(2 downto 0)));
64
 
65
     end case;
66
 
67
        outdata<=outInt;
68
 end if;
69
 end process;
70
 
71
-- clk_out<=intclk;
72
end behave;

powered by: WebSVN 2.1.0

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