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/] [write_address_decoder.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: write_address_decoder - Behavioral 
23
-- Project Name: Wizardry
24
-- Target Devices: Virtex 4 ML401
25
-- Description: Behavioral description for write address decoder.
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 write_address_decoder is
42
    Port (      clock : std_logic;
43
                                ports_in : memory_access_port_in;
44
                                burst_addresses : v_adr_i;
45
                                write_enable_in : in  STD_LOGIC_VECTOR (num_of_ports downto 0);
46
                                decoded_write_address : out  STD_LOGIC_VECTOR (physical_address_width -1 downto 0);
47
                                write_enable_out : out  STD_LOGIC_VECTOR (num_of_ports downto 0);
48
                                write_error_out : out STD_LOGIC_VECTOR (num_of_ports downto 0)
49
                                );
50
end write_address_decoder;
51
 
52
architecture Behavioral of write_address_decoder is
53
signal decoded_addresses : v_adr_i;
54
 
55
begin
56
decode_write_addresses : process(clock,ports_in.adr_i)
57
variable decoded_addresses_v : v_adr_i;
58
begin
59
        if(clock'event and clock = '1') then
60
                for i in 0 to (num_of_ports) loop
61
                        decoded_addresses_v(i) := burst_addresses(i);
62
                end loop;
63
        decoded_addresses <= decoded_addresses_v;
64
        end if;
65
end process;
66
 
67
--transmit_write_enables : process(clock,ports_in.adr_i,write_enable_in)
68
--variable write_enable_out_v : STD_LOGIC_VECTOR (8 downto 0);
69
--begin
70
--      if(clock'event and clock = '1') then
71
--              for i in 0 to (num_of_ports -1) loop
72
--                      if(ports_in.adr_i(i) < "0111110000000000000000" AND write_enable_in(i) = '1') then
73
--                              write_enable_out_v(i) := '1';
74
--                      else
75
--                              write_enable_out_v(i) := '0';
76
--                      end if;
77
--              end loop;
78
--              if(ports_in.adr_i(num_of_ports) < "0010000000000000000000" AND write_enable_in(num_of_ports) = '1') then
79
--                              write_enable_out_v(num_of_ports) := '1';
80
--                      else
81
--                              write_enable_out_v(num_of_ports) := '0';
82
--              end if;
83
----            write_enable_out <= write_enable_out_v;
84
--      end if;
85
--      write_enable_out <= write_enable_out_v;
86
--end process;
87
 
88
transmit_write_enables : process(clock,burst_addresses,write_enable_in)
89
variable write_enable_out_v : STD_LOGIC_VECTOR (8 downto 0);
90
begin
91
        if(clock'event and clock = '1') then
92
                if(write_enable_in(0) = '1') then
93
                        if(decoded_addresses(0)(20 downto 18) < "111") then
94
                                write_enable_out_v(0) := '1';
95
                        end if;
96
 
97
                elsif(write_enable_in(1) = '1') then
98
                        if(decoded_addresses(1)(20 downto 18) < "111") then
99
                                write_enable_out_v(1) := '1';
100
                        end if;
101
                elsif(write_enable_in(2) = '1') then
102
                        if(decoded_addresses(2)(20 downto 18) < "111") then
103
                                write_enable_out_v(2) := '1';
104
                        end if;
105
                elsif(write_enable_in(3) = '1') then
106
                        if(decoded_addresses(3)(20 downto 18) < "111") then
107
                                write_enable_out_v(3) := '1';
108
                        end if;
109
                elsif(write_enable_in(4) = '1') then
110
                        if(decoded_addresses(4)(20 downto 18) < "111") then
111
                                write_enable_out_v(4) := '1';
112
                        end if;
113
                elsif(write_enable_in(5) = '1') then
114
                        if(decoded_addresses(5)(20 downto 18) < "111") then
115
                                write_enable_out_v(5) := '1';
116
                        end if;
117
                elsif(write_enable_in(6) = '1') then
118
                        if(decoded_addresses(6)(20 downto 18) < "111") then
119
                                write_enable_out_v(6) := '1';
120
                        end if;
121
                elsif(write_enable_in(7) = '1') then
122
                        if(decoded_addresses(7)(20 downto 18) < "111") then
123
                                write_enable_out_v(7) := '1';
124
                        end if;
125
 
126
                elsif(write_enable_in(8) = '1') then
127
--                      if(burst_addresses(num_of_ports) < "0010000000000000000000") then
128
                                write_enable_out_v(8) := '1';
129
--                      else
130
--                              write_enable_out_v(8) := '0';
131
--                      end if;
132
                else
133
                        write_enable_out_v := "000000000";
134
                end if;
135
 
136
--              if(burst_addresses(num_of_ports) < "0010000000000000000000" AND write_enable_in(num_of_ports) = '1') then
137
--                              write_enable_out_v(num_of_ports) := '1';
138
--                      else
139
--                              write_enable_out_v(num_of_ports) := '0';
140
--              end if;
141
                write_enable_out <= write_enable_out_v;
142
        end if;
143
--      write_enable_out <= write_enable_out_v;
144
end process;
145
 
146
select_write_enable : process(clock,write_enable_in,decoded_addresses)
147
begin
148
if(clock'event and clock = '1') then
149
        if(write_enable_in < "100000000") then
150
                case write_enable_in is
151
                        when "000000001" => decoded_write_address <= "000" & decoded_addresses(0)(20 downto 0);
152
                        when "000000010" => decoded_write_address <= "001" & decoded_addresses(1)(20 downto 0);
153
                        when "000000100" => decoded_write_address <= "010" & decoded_addresses(2)(20 downto 0);
154
                        when "000001000" => decoded_write_address <= "011" & decoded_addresses(3)(20 downto 0);
155
                        when "000010000" => decoded_write_address <= "100" & decoded_addresses(4)(20 downto 0);
156
                        when "000100000" => decoded_write_address <= "101" & decoded_addresses(5)(20 downto 0);
157
                        when "001000000" => decoded_write_address <= "110" & decoded_addresses(6)(20 downto 0);
158
                        when "010000000" => decoded_write_address <= "111" & decoded_addresses(7)(20 downto 0);
159
                        when others => decoded_write_address <= "000000000000000000000000";
160
                end case;
161
        else
162
                case (decoded_addresses(8)(18 downto 16)) is
163
                        when "000" => decoded_write_address <= "00011" & decoded_addresses(num_of_ports)(18 downto 0);
164
                        when "001" => decoded_write_address <= "00111" & decoded_addresses(num_of_ports)(18 downto 0);
165
                        when "010" => decoded_write_address <= "01011" & decoded_addresses(num_of_ports)(18 downto 0);
166
                        when "011" => decoded_write_address <= "01111" & decoded_addresses(num_of_ports)(18 downto 0);
167
                        when "100" => decoded_write_address <= "10011" & decoded_addresses(num_of_ports)(18 downto 0);
168
                        when "101" => decoded_write_address <= "10111" & decoded_addresses(num_of_ports)(18 downto 0);
169
                        when "110" => decoded_write_address <= "11011" & decoded_addresses(num_of_ports)(18 downto 0);
170
                        when "111" => decoded_write_address <= "11111" & decoded_addresses(num_of_ports)(18 downto 0);
171
                        when others => decoded_write_address <= "000000000000000000000000";
172
                end case;
173
        end if;
174
end if;
175
end process select_write_enable;
176
 
177
transmit_errors : process(clock,write_enable_in,decoded_addresses)
178
begin
179
if(clock'event and clock = '1') then
180
        for i in 0 to (num_of_ports -1) loop
181
                if(write_enable_in(i) = '1') then
182
                        if(decoded_addresses(i)(20 downto 18) = "111") then
183
                                write_error_out(i) <= '1';
184
                        end if;
185
                else
186
                                write_error_out(i) <= '0';
187
                end if;
188
        end loop;
189
        write_error_out(num_of_ports) <= '0';
190
end if;
191
end process transmit_errors;
192
 
193
end Behavioral;
194
 

powered by: WebSVN 2.1.0

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