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

Subversion Repositories wishbone_uart_controller

[/] [wishbone_uart_controller/] [branches/] [uartcontroller/] [burst_queue_rev1.vhd] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 themassau
 
2
library IEEE;
3
use IEEE.STD_LOGIC_1164.ALL;
4
 
5
-- Uncomment the following library declaration if using
6
-- arithmetic functions with Signed or Unsigned values
7
use IEEE.NUMERIC_STD.ALL;
8
 
9
-- Uncomment the following library declaration if instantiating
10
-- any Xilinx primitives in this code.
11
--library UNISIM;
12
--use UNISIM.VComponents.all;
13
 
14
entity burst_queue_rev1 is
15
    Port (clk : IN std_logic;
16
                         DBIN : IN std_logic_vector(7 downto 0);
17
                         write_strobe : IN std_logic;
18
                         read_strobe : IN std_logic;
19
                         DBOUT : OUT std_logic_vector(7 downto 0);
20
                         ack: OUT std_logic:='0';
21
                         WR : OUT std_logic:='0');
22
end burst_queue_rev1;
23
 
24
architecture Behavioral of burst_queue_rev1 is
25
type shiftreg is array(0 to 3) of std_logic_vector(7 downto 0);
26
 
27
signal data_buf : shiftreg;
28
 
29
constant width          : integer :=3;
30
signal WR_int                   : std_logic:='0';
31
signal writecount       : integer range 0 to 3:=0;
32
signal readcount                : integer range 0 to 4:=0;
33
signal ack_int                  : std_logic:='0';
34
begin
35
process(clk,write_strobe)
36
 
37
begin
38
        if rising_edge(clk) then
39
 
40
                if write_strobe='1' and ack_int='0' then
41
                        if(readcount< 4 )then
42
                                data_buf(writecount)<=DBIN;
43
                                writecount<=(writecount+1) mod 4;
44
                                ack_int<='1';
45
                                readcount<=readcount+1;
46
                        else
47
                                ack_int<='0';
48
                        end if;
49
                end if;
50
                if WR_int='0' or read_strobe='1' then
51
                        if(readcount>0) then
52
                                DBOUT<=data_buf((writecount-readcount) mod 4);
53
                                if write_strobe = '0' then
54
                                        readcount<=readcount-1;-- laagste teld
55
                                else
56
                                        if(readcount< 4 and ack_int='0')then
57
                                                readcount<=readcount;
58
                                        else
59
                                                readcount<=readcount-1;
60
                                        end if;
61
                                end if;
62
                                WR_int<='1';
63
                        else
64
                                WR_int<='0';
65
                        end if;
66
                end if;
67
 
68
end if;
69
                if write_strobe ='0' then
70
                        ack_int<='0';
71
                end if;
72
end process;
73
WR<=WR_int;
74
ack<=ack_int;
75
end Behavioral;
76
 

powered by: WebSVN 2.1.0

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