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-1.15y/] [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
        CS            : in std_logic;
11
        CONT          : in std_logic;
12
        IFCLK         : in std_logic;
13
 
14
        FD            : out std_logic_vector(15 downto 0);
15
 
16
        SLOE          : out std_logic;
17
        SLRD          : out std_logic;
18
        SLWR          : out std_logic;
19
        FIFOADR0      : out std_logic;
20
        FIFOADR1      : out std_logic;
21
        PKTEND        : out std_logic;
22
 
23
        FLAGB         : in std_logic
24
 
25
--        SCL         : in std_logic;
26
--        SDA         : in std_logic
27
    );
28
end intraffic;
29
 
30
architecture RTL of intraffic is
31
 
32
----------------------------
33
-- test pattern generator --
34
----------------------------
35
-- 30 bit counter
36
signal GEN_CNT : std_logic_vector(29 downto 0);
37
signal INT_CNT : std_logic_vector(6 downto 0);
38
 
39
signal FIFO_WORD : std_logic;
40
signal SLWR_R : std_logic;
41
signal FD_R : std_logic_vector(15 downto 0);
42
 
43
begin
44
 
45
    SLOE <= '1' when CS = '1' else 'Z';
46
    SLRD <= '1' when CS = '1' else 'Z';
47
    SLWR <= SLWR_R when CS = '1' else 'Z';
48
    FIFOADR0 <= '0' when CS = '1' else 'Z';
49
    FIFOADR1 <= '0' when CS = '1' else 'Z';
50
    PKTEND <= '1' when CS = '1' else 'Z';               -- no data alignment
51
    FD <= FD_R when CS = '1' else (others => 'Z');
52
 
53
    dpIFCLK: process (IFCLK, RESET)
54
    begin
55
-- reset
56
        if RESET = '1'
57
        then
58
            GEN_CNT <= ( others => '0' );
59
            INT_CNT <= ( others => '0' );
60
            FIFO_WORD <= '0';
61
            SLWR_R <= '1';
62
-- IFCLK
63
        elsif IFCLK'event and IFCLK = '1'
64
        then
65
 
66
            if CONT = '1' or FLAGB = '1'
67
            then
68
                if FIFO_WORD = '0'
69
                then
70
                    FD_R(14 downto 0) <= GEN_CNT(14 downto 0);
71
                else
72
                    FD_R(14 downto 0) <= GEN_CNT(29 downto 15);
73
                end if;
74
                FD_R(15) <= FIFO_WORD;
75
 
76
                if FIFO_WORD = '1'
77
                then
78
                    GEN_CNT <= GEN_CNT + '1';
79
                    if INT_CNT = conv_std_logic_vector(99,7)
80
                    then
81
                        INT_CNT <= ( others => '0' );
82
                    else
83
                        INT_CNT <= INT_CNT + '1';
84
                    end if;
85
                end if;
86
                FIFO_WORD <= not FIFO_WORD;
87
            end if;
88
 
89
            if ( INT_CNT >= conv_std_logic_vector(90,7) ) and ( CONT = '0' )
90
            then
91
                SLWR_R <= '1';
92
            else
93
                SLWR_R <= '0';
94
            end if;
95
 
96
        end if;
97
    end process dpIFCLK;
98
 
99
end RTL;

powered by: WebSVN 2.1.0

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