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

Subversion Repositories the_wizardry_project

[/] [the_wizardry_project/] [trunk/] [Wizardry/] [VHDL/] [Wizardry Top Level/] [Address Generation/] [RDIC/] [Data_Fetch.vhd] - Blame information for rev 21

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 21 mcwaccent
----------------------------------------------------------------------------------
2
--
3
--  This file is a part of Technica Corporation Wizardry Project
4
--
5
--  Copyright (C) 2004-2009, Technica Corporation  
6
--
7
--  This program is free software: you can redistribute it and/or modify
8
--  it under the terms of the GNU General Public License as published by
9
--  the Free Software Foundation, either version 3 of the License, or
10
--  (at your option) any later version.
11
--
12
--  This program is distributed in the hope that it will be useful,
13
--  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
--  GNU General Public License for more details.
16
--
17
--  You should have received a copy of the GNU General Public License
18
--  along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
--
20
----------------------------------------------------------------------------------
21
----------------------------------------------------------------------------------
22
-- Module Name: Burst_write_data_fetcher - Behavioral 
23
-- Project Name: Wizardry
24
-- Target Devices: Virtex 4 ML401
25
-- Description: Behavioral description for writing data to memory.
26
-- Revision: 1.0
27
-- Additional Comments: 
28
--
29
----------------------------------------------------------------------------------
30
library IEEE;
31
use IEEE.STD_LOGIC_1164.ALL;
32
use IEEE.STD_LOGIC_ARITH.ALL;
33
use IEEE.STD_LOGIC_UNSIGNED.ALL;
34
use work.MAC_Constants.all;
35
 
36
---- Uncomment the following library declaration if instantiating
37
---- any Xilinx primitives in this code.
38
--library UNISIM;
39
--use UNISIM.VComponents.all;
40
 
41
entity burst_data_fetch is
42
    Port (      reset : in std_logic;
43
                                clock : in  STD_LOGIC;
44
                                buffer_empty : in  STD_LOGIC_VECTOR (num_of_ports downto 0);
45
                                write_enable_in : in  STD_LOGIC_VECTOR (num_of_ports downto 0);
46
                                pop_o : out  STD_LOGIC_VECTOR (num_of_ports downto 0);
47
                                burst_write_enable : out STD_LOGIC_VECTOR (num_of_ports downto 0);
48
                                reset_pop_count : out STD_LOGIC_VECTOR (num_of_ports downto 0)
49
                                );
50
end burst_data_fetch;
51
 
52
architecture Behavioral of burst_data_fetch is
53
type StateType is (reset_state,idle_0,enable_burst_write,pop_0,wait_0,clear_pop_count);
54
signal CurrentState,NextState: StateType;
55
signal index_i : integer range 0 to num_of_ports;
56
signal pop_s : STD_LOGIC_VECTOR (num_of_ports downto 0);
57
signal count : integer range 0 to burst_length;
58
signal inc_count,reset_count,stop : std_logic;
59
begin
60
 
61
store_index_value : process(clock,write_enable_in) --(clock,store_index) --reset_index,store_index)
62
--variable index_i_v_v : integer range 0 to num_of_ports;
63
--variable read_enable_in_v : STD_LOGIC_VECTOR (num_of_ports -1 downto 0);
64
begin
65
--      if(clock'event and clock = '1') then
66
        if(rising_edge(clock)) then
67
                if(reset = '1') then
68
                        index_i <= 0;
69
                        pop_s <= "000000000";
70
                elsif(write_enable_in = "000000001") then
71
                        index_i <= 0;
72
                        pop_s <= "000000001";
73
                elsif(write_enable_in = "000000010") then
74
                        index_i <= 1;
75
                        pop_s <= "000000010";
76
                elsif(write_enable_in = "000000100") then
77
                        index_i <= 2;
78
                        pop_s <= "000000100";
79
                elsif(write_enable_in = "000001000") then
80
                        index_i <= 3;
81
                        pop_s <= "000001000";
82
                elsif(write_enable_in = "000010000") then
83
                        index_i <= 4;
84
                        pop_s <= "000010000";
85
                elsif(write_enable_in = "000100000") then
86
                        index_i <= 5;
87
                        pop_s <= "000100000";
88
                elsif(write_enable_in = "001000000") then
89
                        index_i <= 6;
90
                        pop_s <= "001000000";
91
                elsif(write_enable_in = "010000000") then
92
                        index_i <= 7;
93
                        pop_s <= "010000000";
94
                elsif(write_enable_in = "100000000") then
95
                        index_i <= 8;
96
                        pop_s <= "100000000";
97
                else
98
                        index_i <= index_i;
99
                        pop_s <= pop_s;
100
                end if;
101
        end if;
102
end process;
103
 
104
counter : process(clock,inc_count) --(clock,store_index) --reset_index,store_index)
105
--variable index_i_v_v : integer range 0 to num_of_ports;
106
--variable read_enable_in_v : STD_LOGIC_VECTOR (num_of_ports -1 downto 0);
107
begin
108
--      if(clock'event and clock = '1') then
109
        if(rising_edge(clock)) then
110
                if(reset_count = '1') then
111
                        count <= 0;
112
                elsif(inc_count = '0') then
113
                        count <= count;
114
                elsif(inc_count = '1') then
115
                        count <= count + 1;
116
                else
117
                        count <= count;
118
                end if;
119
        end if;
120
end process;
121
 
122
burst_access_process: process(CurrentState,write_enable_in,stop,pop_s)--,Memory_access_in)
123
variable index_i : integer;
124
   begin
125
                case (CurrentState) is
126
                        when reset_state =>
127
                                        NextState <= idle_0;
128
 
129
                                reset_count <= '1';
130
                                pop_o <= "000000000";
131
                                inc_count <= '0';
132
                                burst_write_enable <= "000000000";
133
                                reset_pop_count <= (others => '0');
134
 
135
                        when idle_0 =>
136
                                if(write_enable_in = "000000000") then
137
                                        NextState <= idle_0;
138
                                else
139
                                        NextState <= enable_burst_write;
140
                                end if;
141
 
142
                                reset_count <= '0';
143
                                pop_o <= "000000000";
144
                                inc_count <= '0';
145
                                burst_write_enable <= "000000000";
146
                                reset_pop_count <= (others => '0');
147
 
148
 
149
                        when enable_burst_write =>
150
                                                NextState <= wait_0;
151
 
152
                                reset_count <= '0';
153
                                pop_o <= pop_s;
154
                                inc_count <= '1';
155
                                burst_write_enable <= pop_s;
156
                                reset_pop_count <= (others => '0');
157
 
158
--                      when pop_0 =>                   
159
--                                              NextState <= wait_0;
160
--                                              
161
--                              reset_count <= '0';
162
--                              pop_o <= pop_s;
163
--                              inc_count <= '1';
164
--                              burst_write_enable <= "000000000";
165
 
166
                        when wait_0 =>
167
                                if(stop = '1') then
168
                                                NextState <= clear_pop_count;
169
                                else
170
                                                NextState <= enable_burst_write;
171
                                end if;
172
 
173
                                reset_count <= '0';
174
                                pop_o <= "000000000";
175
                                inc_count <= '0';
176
                                burst_write_enable <= "000000000";
177
                                reset_pop_count <= (others => '0');
178
 
179
                        when clear_pop_count =>
180
                                                NextState <= reset_state;
181
 
182
                                reset_count <= '0';
183
                                pop_o <= "000000000";
184
                                inc_count <= '0';
185
                                burst_write_enable <= "000000000";
186
                                reset_pop_count <= pop_s;
187
 
188
                        when others =>
189
                                                NextState <= reset_state;
190
 
191
                                reset_count <= '0';
192
                                pop_o <= "000000000";
193
                                inc_count <= '0';
194
                                burst_write_enable <= "000000000";
195
                                reset_pop_count <= (others => '0');
196
                        end case;
197
        end process burst_access_process;
198
 
199
        nextstatelogic: process
200
        begin
201
                        wait until clock'EVENT and clock = '1'; --WAIT FOR RISING EDGE
202
                        if (Reset = '1') then
203
                                CurrentState <= reset_state;
204
                        else
205
                                CurrentState <= NextState;
206
                        end if;
207
end process nextstatelogic;
208
 
209
stop <=  '1'when buffer_empty(index_i) = '1' else '0';
210
 
211
end Behavioral;
212
 

powered by: WebSVN 2.1.0

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