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/] [MAC_constants.vhd] - Blame information for rev 21

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 21 mcwaccent
--      Package Filea Template
2
--
3
--      Purpose: This package defines supplemental types, subtypes, 
4
--               constants, and functions 
5
 
6
 
7
library IEEE;
8
use IEEE.STD_LOGIC_1164.all;
9
--use work.mem_interface_top_parameters_0.all;
10
 
11
package MAC_Constants is
12
 
13
constant max_burst_length : integer := 8;
14
constant burst_length : integer := 4;
15
--constant burst_data_width integer := 
16
constant num_of_ports : integer := 8;
17
constant virtual_address_width : integer := 22;
18
constant physical_address_width : integer := 24;
19
constant data_width : integer := 32;
20
constant data_resolution : integer := 4;
21
constant ID_width : integer := 5;
22
constant priority_width : integer := 8;
23
constant stack_depth : integer := 4;
24
constant cmd_width : integer := 2;
25
constant WR_FIFO_witdh : integer := (physical_address_width + data_width + cmd_width);
26
constant dummy_data : std_logic_vector(data_width -1 downto 0) := (others => '0');
27
constant read_cmd : std_logic_vector(1 downto 0) := "01";
28
constant write_cmd : std_logic_vector(1 downto 0) := "10";
29
constant data_delimiter : integer := data_width + 1;
30
constant address_delimiter : integer := data_width + physical_address_width + 1;
31
constant read_write_delimiter : integer := 2;
32
 
33
 
34
type ID_type is
35
        array (0 to num_of_ports -1) of  std_logic_vector(ID_width -1 downto 0);
36
 
37
type priority_type is
38
        array (0 to num_of_ports) of  std_logic_vector(priority_width -1 downto 0);
39
 
40
type v_adr_i is
41
        array (0 to num_of_ports) of  std_logic_vector(virtual_address_width -1 downto 0);
42
 
43
--type v_adr_i_0 is
44
--      array (0 to num_of_ports -1) of  std_logic_vector(virtual_address_width -2 downto 0);
45
 
46
type v_data_i is
47
        array (0 to num_of_ports) of  std_logic_vector(data_width -1 downto 0);
48
 
49
type burst_data_o is
50
        array (0 to burst_length -1) of  std_logic_vector(data_width -1 downto 0);
51
 
52
type v_sel_i is
53
        array (0 to num_of_ports -1) of  std_logic_vector(data_resolution -1 downto 0);
54
 
55
type Burst_Data_Array is
56
        array (0 to burst_length -1) of std_logic_vector((data_width + virtual_address_width) -1 downto 0);
57
 
58
type Data_out_Array is
59
        array (0 to num_of_ports) of std_logic_vector((data_width + virtual_address_width) -1 downto 0);
60
 
61
type burst_read_data_array is
62
        array (0 to burst_length -1) of  std_logic_vector(data_width -1 downto 0);
63
 
64
type read_data_array is
65
        array (0 to num_of_ports) of  std_logic_vector(data_width -1 downto 0);
66
 
67
 
68
type Memory_Access_Port_in is
69
    record
70
      adr_i             :     v_adr_i;
71
                dat_i           :     v_data_i;
72
                we_i            :     std_logic_vector(num_of_ports downto 0);
73
                sel_i           :     v_sel_i;
74
                stb_i           :     std_logic_vector(num_of_ports downto 0);
75
                cyc_i           :     std_logic_vector(num_of_ports downto 0);
76
                ID_i            :     ID_type;
77
                priority_i :    priority_type;
78
                push_i  :               std_logic_vector(num_of_ports downto 0);
79
                lock_i   :  std_logic_vector(num_of_ports downto 0);
80
                end record;
81
 
82
type port_avail is
83
        record
84
                id_avail : boolean;
85
                return_port : integer range 0 to num_of_ports -1;
86
        end record;
87
 
88
type Memory_Access_Port_out is
89
        record
90
                err_o           :     std_logic_vector(num_of_ports downto 0);
91
                ack_o           :     std_logic_vector(num_of_ports downto 0);
92
                burst_full :  std_logic_vector(num_of_ports downto 0);
93
                burst_empty :  std_logic_vector(num_of_ports downto 0);
94
                dat_o           :     v_data_i;
95
    end record;
96
 
97
type Preprocessor_Interface_Port_out is
98
        record
99
                write_data_out          :     std_logic_vector(data_width -1 downto 0);
100
                address_out                     :     std_logic_vector(physical_address_width -1 downto 0);
101
                write_enable_out        :     std_logic;
102
                read_enable_out :     std_logic;
103
                FIFO_empty_out  :     std_logic;
104
    end record;
105
 
106
type Preprocessor_Interface_Port_in is
107
        record
108
                Acknowledge_read_data_in                :     std_logic;
109
                ack_access_in                   : std_logic;
110
                Read_data_in                    :     std_logic_vector(data_width -1 downto 0);
111
    end record;
112
 
113
function find_high_bit (signal l : in STD_LOGIC_VECTOR (num_of_ports downto 0)) return integer;
114
function check_ID (signal l : in v_adr_i; signal n : in integer range 0 to num_of_ports; signal m : in ID_type) return port_avail;
115
end MAC_Constants;
116
 
117
 
118
package body MAC_Constants is
119
 
120
function find_high_bit (signal l : in STD_LOGIC_VECTOR (num_of_ports downto 0)) return integer is
121
          variable return_v : integer range 0 to num_of_ports;
122
                begin
123
                for i in 0 to num_of_ports loop
124
                        if(l(i) = '1') then
125
                                return_v := i ;
126
                                exit;
127
                        end if;
128
                end loop;
129
                return return_v;
130
        end find_high_bit;
131
 
132
function check_ID (signal l : in v_adr_i; signal n : in integer range 0 to num_of_ports; signal m : in ID_type) return port_avail is
133
                variable return_v : port_avail;
134
--        variable return_v : boolean;
135
--        variable return_port : integer range 0 to num_of_ports -1;
136
                begin
137
                for i in 0 to num_of_ports -1 loop
138
                        if(l(n)(20 downto 16) = m(i)) then
139
                                return_v.id_avail := true;
140
                                return_v.return_port := i;
141
                                exit;
142
                        else
143
                                return_v.id_avail := false;
144
                                return_v.return_port := 0;
145
                        end if;
146
                end loop;
147
                return return_v;
148
        end check_ID;
149
 
150
--function decode_a (signal l : in v_adr_i; signal n : in integer range 0 to num_of_ports -1; signal m : in ID_type) return port_avail is
151
--              variable return_v : port_avail;
152
----      variable return_v : boolean;
153
----      variable return_port : integer range 0 to num_of_ports -1;
154
--              begin  
155
--              for i in 0 to num_of_ports -1 loop
156
--                      if(l(n)(20 downto 16) = m(i)) then
157
--                              return_v.id_avail := true;
158
--                              return_v.return_port := i;
159
--                              exit;
160
--                      else
161
--                              return_v.id_avail := false;
162
--                              return_v.return_port := 0;
163
--                      end if;
164
--              end loop;
165
--              return return_v;
166
--      end check_ID;
167
 
168
--function translate_ID (signal l : in integer; signal n : in integer range 0 to num_of_ports -1; signal m : in ID_type) return boolean is
169
--        variable return_v : boolean;
170
--              begin  
171
--              for i in 0 to num_of_ports -1 loop
172
--                      if(l(n)(20 downto 16) = m(i)) then
173
--                              return_v := true;
174
--                              exit;
175
--                      else
176
--                              return_v := false;
177
--                      end if;
178
--              end loop;
179
--              return return_v;
180
--      end check_ID;
181
 
182
--      if(check_ID(adr_i,index_i_v, id_i) then
183
 
184
--function decode (signal l : in std_logic_vector; signal m : in ID_type) return boolean is
185
--        variable return_v : boolean;
186
--              begin  
187
--              for i in 0 to num_of_ports -1 loop
188
--                      if(m(i) = l) then
189
--                              return_v := true;
190
--                              exit;
191
--                      end if;
192
--              end loop;
193
--              return return_v;
194
--      end check_ID;
195
 
196
end MAC_Constants;

powered by: WebSVN 2.1.0

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