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

Subversion Repositories wishbone_uart_controller

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 themassau
----------------------------------------------------------------------------------
2
-- Company: 
3
-- Engineer: 
4
-- 
5
-- Create Date:    19:32:29 04/17/2013 
6
-- Design Name: 
7
-- Module Name:    burst_slave - Behavioral 
8
-- Project Name: 
9
-- Target Devices: 
10
-- Tool versions: 
11
-- Description: 
12
--
13
-- Dependencies: 
14
--
15
-- Revision: 
16
-- Revision 0.01 - File Created
17
-- Additional Comments: 
18
--
19
----------------------------------------------------------------------------------
20
library IEEE;
21
use IEEE.STD_LOGIC_1164.ALL;
22
 
23
-- Uncomment the following library declaration if using
24
-- arithmetic functions with Signed or Unsigned values
25
use IEEE.NUMERIC_STD.ALL;
26
 
27
-- Uncomment the following library declaration if instantiating
28
-- any Xilinx primitives in this code.
29
--library UNISIM;
30
--use UNISIM.VComponents.all;
31
 
32
entity queue  is
33
         generic(adress : integer :=5;
34
                                depth  : integer :=3);
35
    Port (
36
 
37
                                ACK_O:  out std_logic; --The acknowledge input 
38
            ADR_I:  in std_logic_vector (7  downto 0 ); --adres output
39
            CLK_I:  in  std_logic;
40
                                DAT_I:  in  std_logic_vector( 7 downto 0 );--data in
41
            DAT_O:  out std_logic_vector( 7 downto 0 ):=X"00";--data out
42
            RST_I:  in  std_logic;--reset in
43
            --SEL_O:  out std_logic;--deze input dient voor het selecteren van de poort word echter niet gebruikt als er maar met 8 bit word gewerkt
44
            STB_I:   in std_logic;--The strobe 
45
            WE_I :      in std_logic;--write enable  
46
 
47
                        --- non wishbone
48
                         input: in  STD_LOGIC_VECTOR (7 downto 0);
49
                         OutputReady:in std_logic;
50
                         busfull: out std_logic;--- is er nog plaats in de bus? '1' is nee '0' is ja. 
51
                         --als er toch geschreven word zal dit een data overwrite geven
52
                         read_ack       : out std_logic
53
                         );
54
end queue;
55
 
56
architecture Behavioral of queue is
57
 
58
type shiftreg is array(0 to depth) of std_logic_vector(7 downto 0);
59
 
60
signal read_buf : shiftreg;
61
 
62
 
63
signal writecount       : integer range 0 to depth:=0;
64
signal readcount                : integer range 0 to depth:=0;
65
signal ACK_O_int : std_logic:='0';
66
signal read_ack_int :std_logic:='0';
67
begin
68
 
69
process(CLK_I,STB_I,OutputReady)
70
begin
71
        if rising_edge(CLK_I) then
72
        if RST_I='1' then
73
                readcount<=0;
74
        else
75
                -------------write
76
                if OutputReady='1' and read_ack_int='0' then
77
                        read_buf(writecount)<=input;
78
                        read_ack_int<='1';
79
                        if writecount= depth then
80
                                writecount<=0;
81
                        else
82
                                writecount<=writecount+1;
83
                        end if;
84
                end if;
85
 
86
                if WE_I='0' and STB_I ='1' and adress=to_integer(unsigned(ADR_I))and ACK_O_int='0' then
87
                        ACK_O_int<='1';
88
                        DAT_O<=read_buf(readcount);-- zet data klaar
89
                        if readcount= depth then
90
                                readcount<=0;
91
                        else
92
                                readcount<=readcount+1;
93
                        end if;
94
                end if;
95
                ------check is de queue vol ? code moet nog bedacht worden
96
                --if writecount=readcount then
97
        end if;
98
        end if;
99
 
100
        if STB_I= '0' then
101
                ACK_O_int<='0';
102
        end if;
103
        if OutputReady='0' then
104
                read_ack_int<='0';
105
        end if;
106
end process;
107
                ACK_O<=ACK_O_int;
108
                read_ack<=read_ack_int;
109
end Behavioral;
110
 

powered by: WebSVN 2.1.0

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