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

Subversion Repositories xucpu

[/] [xucpu/] [trunk/] [VHDL/] [queue_2/] [queue.vhdl] - Blame information for rev 25

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 lcdsgmtr
-- Copyright 2015, Jürgen Defurne
2
--
3
-- This file is part of the Experimental Unstable CPU System.
4
--
5
-- The Experimental Unstable CPU System Is free software: you can redistribute
6
-- it and/or modify it under the terms of the GNU Lesser General Public License
7
-- as published by the Free Software Foundation, either version 3 of the
8
-- License, or (at your option) any later version.
9
--
10
-- The Experimental Unstable CPU System is distributed in the hope that it will
11
-- be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
12
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
13
-- General Public License for more details.
14
--
15
-- You should have received a copy of the GNU Lesser General Public License
16
-- along with Experimental Unstable CPU System. If not, see
17
-- http://www.gnu.org/licenses/lgpl.txt.
18
 
19
 
20
LIBRARY ieee;
21
USE ieee.std_logic_1164.ALL;
22
USE ieee.numeric_std.ALL;
23
 
24
ENTITY queue IS
25
 
26
  GENERIC (
27
    w_data : NATURAL := 16);
28
  PORT (
29
    rst   : IN  STD_LOGIC;
30
    clk   : IN  STD_LOGIC;
31
    we    : IN  STD_LOGIC;
32
    sh    : IN  STD_LOGIC;
33
    clear : IN  STD_LOGIC;
34
    full  : OUT STD_LOGIC;
35
    empty : OUT STD_LOGIC;
36
    d     : IN  STD_LOGIC_VECTOR(w_data - 1 DOWNTO 0);
37
    q     : OUT STD_LOGIC_VECTOR(w_data - 1 DOWNTO 0));
38
 
39
END queue;
40
 
41
ARCHITECTURE Behavioral OF queue IS
42
 
43
  COMPONENT reg IS
44
    GENERIC (
45
      w_data : NATURAL := w_data);
46
    PORT (D   : IN  STD_LOGIC_VECTOR(w_data - 1 DOWNTO 0);
47
          E   : IN  STD_LOGIC;
48
          CLK : IN  STD_LOGIC;
49
          RST : IN  STD_LOGIC;
50
          Q   : OUT STD_LOGIC_VECTOR(w_data - 1 DOWNTO 0));
51
  END COMPONENT reg;
52
 
53
  COMPONENT qreg IS
54
    GENERIC (
55
      w_data : NATURAL := w_data);
56
    PORT (D0  : IN  STD_LOGIC_VECTOR(w_data - 1 DOWNTO 0);
57
          D1  : IN  STD_LOGIC_VECTOR(w_data - 1 DOWNTO 0);
58
          S   : IN  STD_LOGIC;
59
          EN  : IN  STD_LOGIC;
60
          CLK : IN  STD_LOGIC;
61
          RST : IN  STD_LOGIC;
62
          Q   : OUT STD_LOGIC_VECTOR(w_data - 1 DOWNTO 0));
63
  END COMPONENT qreg;
64
 
65
  COMPONENT qctrl IS
66
    PORT (CLK   : IN  STD_LOGIC;
67
          RST   : IN  STD_LOGIC;
68
          WR    : IN  STD_LOGIC;
69
          SH    : IN  STD_LOGIC;
70
          CLEAR : IN  STD_LOGIC;
71
          FULL  : OUT STD_LOGIC;
72
          EMPTY : OUT STD_LOGIC;
73
          EN    : OUT STD_LOGIC_VECTOR (3 DOWNTO 0);
74
          SEL   : OUT STD_LOGIC_VECTOR (2 DOWNTO 0));
75
  END COMPONENT qctrl;
76
 
77
  TYPE q_t IS ARRAY (0 TO 3) OF STD_LOGIC_VECTOR(w_data - 1 DOWNTO 0);
78
 
79
  SIGNAL en  : STD_LOGIC_VECTOR(3 DOWNTO 0);
80
  SIGNAL sel : STD_LOGIC_VECTOR(2 DOWNTO 0);
81
  SIGNAL rq  : q_t;
82
 
83
BEGIN
84
 
85
  CTR1 : qctrl PORT MAP (
86
    CLK   => clk,
87
    RST   => rst,
88
    WR    => we,
89
    SH    => sh,
90
    EN    => en,
91
    CLEAR => clear,
92
    FULL  => full,
93
    EMPTY => empty,
94
    SEL   => sel);
95
 
96
  R3 : reg PORT MAP (
97
    D   => d,
98
    E   => en(3),
99
    CLK => clk,
100
    RST => rst,
101
    Q   => rq(2));
102
 
103
  R2 : qreg PORT MAP (
104
    D0  => rq(2),
105
    D1  => d,
106
    S   => sel(2),
107
    EN  => en(2),
108
    CLK => clk,
109
    RST => rst,
110
    Q   => rq(1));
111
 
112
  R1 : qreg PORT MAP (
113
    D0  => rq(1),
114
    D1  => d,
115
    S   => sel(1),
116
    EN  => en(1),
117
    CLK => clk,
118
    RST => rst,
119
    Q   => rq(0));
120
 
121
  R0 : qreg PORT MAP (
122
    D0  => rq(0),
123
    D1  => d,
124
    S   => sel(0),
125
    EN  => en(0),
126
    CLK => clk,
127
    RST => rst,
128
    Q   => q);
129
 
130
END Behavioral;

powered by: WebSVN 2.1.0

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