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

Subversion Repositories usb_fpga_2_13

[/] [usb_fpga_2_13/] [trunk/] [examples/] [usb-fpga-2.01/] [2.01b/] [intraffic/] [fpga/] [intraffic.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 ZTEX
library ieee;
2
use IEEE.std_logic_1164.all;
3
use IEEE.std_logic_arith.all;
4
use IEEE.std_logic_unsigned.all;
5
 
6
 
7
entity intraffic is
8
    port(
9
        RESET         : in std_logic;
10
        CONT          : in std_logic;
11
        IFCLK         : in std_logic;
12
 
13
        FD            : out std_logic_vector(15 downto 0);
14
 
15
        SLOE          : out std_logic;
16
        SLRD          : out std_logic;
17
        SLWR          : out std_logic;
18
        FIFOADR0      : out std_logic;
19
        FIFOADR1      : out std_logic;
20
        PKTEND        : out std_logic;
21
 
22
        FLAGB         : in std_logic
23
    );
24
end intraffic;
25
 
26
architecture RTL of intraffic is
27
 
28
----------------------------
29
-- test pattern generator --
30
----------------------------
31
-- 30 bit counter
32
signal GEN_CNT : std_logic_vector(29 downto 0);
33
signal INT_CNT : std_logic_vector(6 downto 0);
34
 
35
signal FIFO_WORD : std_logic;
36
 
37
begin
38
 
39
    SLOE <= '1';
40
    SLRD <= '1';
41
    FIFOADR0 <= '0';
42
    FIFOADR1 <= '0';
43
    PKTEND <= '1';              -- no data alignment
44
 
45
    dpIFCLK: process (IFCLK, RESET)
46
    begin
47
-- reset
48
        if RESET = '1'
49
        then
50
            GEN_CNT <= ( others => '0' );
51
            INT_CNT <= ( others => '0' );
52
            FIFO_WORD <= '0';
53
            SLWR <= '1';
54
-- IFCLK
55
        elsif IFCLK'event and IFCLK = '1'
56
        then
57
 
58
            if CONT = '1' or FLAGB = '1'
59
            then
60
                if FIFO_WORD = '0'
61
                then
62
                    FD(14 downto 0) <= GEN_CNT(14 downto 0);
63
                else
64
                    FD(14 downto 0) <= GEN_CNT(29 downto 15);
65
                end if;
66
                FD(15) <= FIFO_WORD;
67
 
68
                if FIFO_WORD = '1'
69
                then
70
                    GEN_CNT <= GEN_CNT + '1';
71
                    if INT_CNT = conv_std_logic_vector(99,7)
72
                    then
73
                        INT_CNT <= ( others => '0' );
74
                    else
75
                        INT_CNT <= INT_CNT + '1';
76
                    end if;
77
                end if;
78
                FIFO_WORD <= not FIFO_WORD;
79
            end if;
80
 
81
            if ( INT_CNT >= conv_std_logic_vector(90,7) ) and ( CONT = '0' )
82
            then
83
                SLWR <= '1';
84
            else
85
                SLWR <= '0';
86
            end if;
87
 
88
        end if;
89
    end process dpIFCLK;
90
 
91
end RTL;

powered by: WebSVN 2.1.0

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