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

Subversion Repositories hwlu

[/] [hwlu/] [trunk/] [rtl/] [vhdl/] [hw_loops5_top.vhd] - Blame information for rev 17

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 17 kavi
----==============================================================----
2
----                                                              ----
3
---- Filename: hw_loops5_top.vhd                                  ----
4
---- Module description: Top-level file for the hw_looping unit.  ----
5
----                     Also implements input and output         ----
6
----                     wrapping operations.                     ----
7
----                                                              ----
8
---- Author: Nikolaos Kavvadias                                   ----
9
----         nkavv@physics.auth.gr                                ----
10
----                                                              ----
11
----                                                              ----
12
---- Part of the hwlu OPENCORES project generated automatically   ----
13
---- with the use of the "gen_hw_looping" tool                    ----
14
----                                                              ----
15
---- To Do:                                                       ----
16
----         Considered stable for the time being                 ----
17
----                                                              ----
18
---- Author: Nikolaos Kavvadias                                   ----
19
----         nkavv@physics.auth.gr                                ----
20
----                                                              ----
21
----==============================================================----
22
----                                                              ----
23
---- Copyright (C) 2004-2010   Nikolaos Kavvadias                 ----
24
----                    nkavv@uop.gr                              ----
25
----                    nkavv@physics.auth.gr                     ----
26
----                    nikolaos.kavvadias@gmail.com              ----
27
----                                                              ----
28
---- This source file may be used and distributed without         ----
29
---- restriction provided that this copyright statement is not    ----
30
---- removed from the file and that any derivative work contains  ----
31
---- the original copyright notice and the associated disclaimer. ----
32
----                                                              ----
33
---- This source file is free software; you can redistribute it   ----
34
---- and/or modify it under the terms of the GNU Lesser General   ----
35
---- Public License as published by the Free Software Foundation; ----
36
---- either version 2.1 of the License, or (at your option) any   ----
37
---- later version.                                               ----
38
----                                                              ----
39
---- This source is distributed in the hope that it will be       ----
40
---- useful, but WITHOUT ANY WARRANTY; without even the implied   ----
41
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ----
42
---- PURPOSE. See the GNU Lesser General Public License for more  ----
43
---- details.                                                     ----
44
----                                                              ----
45
---- You should have received a copy of the GNU Lesser General    ----
46
---- Public License along with this source; if not, download it   ----
47
---- from <http://www.opencores.org/lgpl.shtml>                   ----
48
----                                                              ----
49
----==============================================================----
50
--
51
-- CVS Revision History
52
--
53
 
54
library IEEE;
55
use IEEE.std_logic_1164.all;
56
 
57
entity hw_looping is
58
        generic (
59
                NLP : integer := 5;
60
                DW  : integer := 8
61
        );
62
        port (
63
                clk            : in std_logic;
64
                reset          : in std_logic;
65
                task_loop5_end : in std_logic;
66
                loop1_count    : in std_logic_vector(DW-1 downto 0);
67
                loop2_count    : in std_logic_vector(DW-1 downto 0);
68
                loop3_count    : in std_logic_vector(DW-1 downto 0);
69
                loop4_count    : in std_logic_vector(DW-1 downto 0);
70
                loop5_count    : in std_logic_vector(DW-1 downto 0);
71
                index1         : out std_logic_vector(DW-1 downto 0);
72
                index2         : out std_logic_vector(DW-1 downto 0);
73
                index3         : out std_logic_vector(DW-1 downto 0);
74
                index4         : out std_logic_vector(DW-1 downto 0);
75
                index5         : out std_logic_vector(DW-1 downto 0);
76
                loops_end      : out std_logic
77
        );
78
end hw_looping;
79
 
80
architecture structural of hw_looping is
81
--
82
-- Component declarations
83
component cmpeq
84
        generic (
85
                DW : integer := 8
86
        );
87
        port (
88
                a      : in std_logic_vector(DW-1 downto 0);
89
                b      : in std_logic_vector(DW-1 downto 0);
90
                reset  : in std_logic;
91
                a_eq_b : out std_logic
92
        );
93
end component;
94
--
95
component index_inc
96
        generic (
97
                DW : integer := 8
98
        );
99
        port (
100
                clk            : in std_logic;
101
                reset          : in std_logic;
102
                inc_en         : in std_logic;
103
                index_plus_one : out std_logic_vector(DW-1 downto 0);
104
                index_out      : out std_logic_vector(DW-1 downto 0)
105
        );
106
end component;
107
--
108
component priority_encoder
109
        generic (
110
                NLP : integer := 5
111
        );
112
        port (
113
                flag           : in std_logic_vector(NLP-1 downto 0);
114
                task_loop5_end : in std_logic;
115
                incl           : out std_logic_vector(NLP-1 downto 0);
116
                reset_vct      : out std_logic_vector(NLP-1 downto 0);
117
                loops_end      : out std_logic
118
        );
119
end component;
120
--
121
-- Signal declarations
122
signal flag                : std_logic_vector(NLP-1 downto 0);
123
signal incl                : std_logic_vector(NLP-1 downto 0);
124
signal temp_loop_count     : std_logic_vector(NLP*DW-1 downto 0);
125
signal temp_index          : std_logic_vector(NLP*DW-1 downto 0);
126
signal temp_index_plus_one : std_logic_vector(NLP*DW-1 downto 0);
127
signal reset_vct_penc      : std_logic_vector(NLP-1 downto 0);
128
signal reset_vct_ix        : std_logic_vector(NLP-1 downto 0);
129
--
130
begin
131
 
132
        temp_loop_count( ((NLP-0)*DW-1) downto ((NLP-1)*DW) ) <= loop1_count;
133
        temp_loop_count( ((NLP-1)*DW-1) downto ((NLP-2)*DW) ) <= loop2_count;
134
        temp_loop_count( ((NLP-2)*DW-1) downto ((NLP-3)*DW) ) <= loop3_count;
135
        temp_loop_count( ((NLP-3)*DW-1) downto ((NLP-4)*DW) ) <= loop4_count;
136
        temp_loop_count( ((NLP-4)*DW-1) downto ((NLP-5)*DW) ) <= loop5_count;
137
 
138
        GEN_COMPARATORS: for i in 0 to NLP-1 generate
139
                U_cmp : cmpeq
140
                        generic map (
141
                                DW => DW
142
                        )
143
                        port map (
144
                                a => temp_index_plus_one( ((i+1)*DW-1) downto (i*DW) ),
145
                                b => temp_loop_count( ((i+1)*DW-1) downto (i*DW) ),
146
                                reset => reset,
147
                                a_eq_b => flag(i)
148
                        );
149
        end generate GEN_COMPARATORS;
150
 
151
        U_priority_enc : priority_encoder
152
                generic map (
153
                        NLP => NLP
154
                )
155
                port map (
156
                        flag => flag,
157
                        task_loop5_end => task_loop5_end,
158
                        incl => incl,
159
                        reset_vct => reset_vct_penc,
160
                        loops_end => loops_end
161
                );
162
 
163
        GEN_RESET_SEL: for i in 0 to NLP-1 generate
164
                reset_vct_ix(i) <= reset_vct_penc(i) or reset;
165
        end generate GEN_RESET_SEL;
166
 
167
        GEN_INC_IX: for i in 0 to NLP-1 generate
168
                U_inc_ix1 : index_inc
169
                        generic map (
170
                                DW => DW
171
                        )
172
                        port map (
173
                                clk => clk,
174
                                reset => reset_vct_ix(i),
175
                                inc_en => incl(i),
176
                                index_plus_one => temp_index_plus_one( ((i+1)*DW-1) downto (i*DW) ),
177
                                index_out => temp_index( ((i+1)*DW-1) downto (i*DW) )
178
                        );
179
        end generate GEN_INC_IX;
180
 
181
        index1 <= temp_index( ((NLP-0)*DW-1) downto ((NLP-1)*DW) );
182
        index2 <= temp_index( ((NLP-1)*DW-1) downto ((NLP-2)*DW) );
183
        index3 <= temp_index( ((NLP-2)*DW-1) downto ((NLP-3)*DW) );
184
        index4 <= temp_index( ((NLP-3)*DW-1) downto ((NLP-4)*DW) );
185
        index5 <= temp_index( ((NLP-4)*DW-1) downto ((NLP-5)*DW) );
186
 
187
end structural;

powered by: WebSVN 2.1.0

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