]> rtime.felk.cvut.cz Git - fpga/lx-cpu1/lx-rocon.git/blob - hw/lx_rocon_pkg.vhd
Put up with tumbl changes and custom binutils / gcc / newlib
[fpga/lx-cpu1/lx-rocon.git] / hw / lx_rocon_pkg.vhd
1 library ieee;
2 use ieee.std_logic_1164.all;
3 use ieee.std_logic_arith.all;
4 use ieee.std_logic_unsigned.all;
5 use ieee.numeric_std.all;
6 use work.mbl_Pkg.all;
7
8 -- Entities within lx_rocon
9
10 package lx_rocon_pkg is
11
12         -- IRC register
13         component irc_register
14         port
15         (
16                 clk      : in std_logic;
17                 reset    : in std_logic;
18                 a0, b0   : in std_logic;
19                 index0   : in std_logic;
20                 mark0    : in std_logic;
21                 data_in  : in std_logic;
22                 data_out : out std_logic_vector(31 downto 0);
23                 ce       : in std_logic_vector(1 downto 0);
24                 rd       : in std_logic;
25                 ta       : out std_logic;
26                 wr       : in std_logic
27         );
28         end component;
29
30         -- BCD counter
31         component bcd
32         generic
33         (
34                 width      : integer
35         );
36         port
37         (
38                 reset      : in std_logic;
39                 en         : in std_logic;
40                 clk        : in std_logic;
41                 value      : out std_logic_vector((width-1) downto 0)
42         );
43         end component;
44
45         -- Quadcount
46         component qcounter
47         port
48         (
49                 clk          : in std_logic;
50                 reset        : in std_logic;
51                 a0, b0       : in std_logic;
52                 index0       : in std_logic;
53
54                 a_rise       : out std_logic;
55                 a_fall       : out std_logic;
56                 b_rise       : out std_logic;
57                 b_fall       : out std_logic;
58
59                 qcount       : out std_logic_vector (31 downto 0);
60                 qcount_index : out std_logic_vector (31 downto 0);
61                 ab_event     : out std_logic;
62                 ab_error     : out std_logic
63         );
64         end component;
65
66         -- D sampler
67         component dff
68         port
69         (
70                 clk   : in std_logic;
71                 reset : in std_logic;
72                 d     : in std_logic;
73                 q     : out std_logic
74         );
75   end component;
76
77         -- D sampler (filtered)
78         component dff2
79         port
80         (
81                 clk   : in std_logic;
82                 reset : in std_logic;
83                 d     : in std_logic;
84                 q     : out std_logic
85         );
86   end component;
87
88         --------------------------------------------------------------------------------
89         -- TUMBL
90         --------------------------------------------------------------------------------
91
92         component lx_rocon_tumbl
93         generic
94         (
95                 IMEM_ABITS_g : positive := 12;
96                 DMEM_ABITS_g : positive := 12;
97                 --
98                 USE_HW_MUL_g :  boolean := true;
99                 USE_BARREL_g :  boolean := true;
100                 COMPATIBILITY_MODE_g :  boolean := false
101         );
102         port
103         (
104                 clk_i        :  in std_logic;
105                 rst_i        :  in std_logic;
106                 halt_i       :  in std_logic;
107                 int_i        :  in std_logic;
108                 trace_i      :  in std_logic;
109                 trace_kick_i :  in std_logic;
110                 pc_o         :  out std_logic_vector(31 downto 0);
111                 halted_o     : out std_logic;
112                 halt_code_o  : out std_logic_vector(4 downto 0);
113                 imem_clk  : in std_logic;
114     imem_en   : in std_logic;
115     imem_we   : in std_logic_vector(3 downto 0);
116     imem_addr : in std_logic_vector(8 downto 0);
117     imem_din  : in std_logic_vector(31 downto 0);
118     imem_dout : out std_logic_vector(31 downto 0);
119                 dmem_clk  : in std_logic;
120     dmem_en   : in std_logic;
121     dmem_we   : in std_logic_vector(3 downto 0);
122     dmem_addr : in std_logic_vector(9 downto 0);
123     dmem_din  : in std_logic_vector(31 downto 0);
124     dmem_dout : out std_logic_vector(31 downto 0);
125                 XMEMB_sel_o :  out std_logic;
126                 XMEMB_i     :  in DMEMB2CORE_Type;
127                 XMEMB_o     :  out CORE2DMEMB_Type;
128                 bad_op_o    :  out std_logic
129         );
130         end component;
131
132         component lx_rocon_imem
133         port
134         (
135                 clk_i : in std_logic;
136                 cs_i  : in std_logic;
137                 adr_i : in std_logic_vector(10 downto 2);
138                 dat_o : out std_logic_vector(31 downto 0);
139                 clk_m  : in std_logic;
140     en_m   : in std_logic;
141     we_m   : in std_logic_vector(3 downto 0);
142     addr_m : in std_logic_vector(8 downto 0);
143     din_m  : in std_logic_vector(31 downto 0);
144     dout_m : out std_logic_vector(31 downto 0)
145
146         );
147         end component;
148
149         component lx_rocon_dmem
150         port
151         (
152                 clk_i  : in std_logic;
153                 ce_i   : in std_logic;
154                 adr_i  : in std_logic_vector(11 downto 2);
155                 wre_i  : in std_logic;
156                 bsel_i : in std_logic_vector(3 downto 0);
157                 dat_i  : in std_logic_vector(31 downto 0);
158                 dat_o  : out std_logic_vector(31 downto 0);
159                 clk_m  : in std_logic;
160     en_m   : in std_logic;
161     we_m   : in std_logic_vector(3 downto 0);
162     addr_m : in std_logic_vector(9 downto 0);
163     din_m  : in std_logic_vector(31 downto 0);
164     dout_m : out std_logic_vector(31 downto 0)
165         );
166         end component;
167
168         component lx_rocon_gprf_abd
169         port
170         (
171                 clk_i        :  in std_logic;
172                 rst_i        :  in std_logic;
173                 clken_i      :  in std_logic;
174                 ID2GPRF_i    :  in ID2GPRF_Type;
175                 MEM_WRB_i    :  in WRB_Type;
176                 GPRF2EX_o    :  out GPRF2EX_Type
177         );
178         end component;
179
180         --------------------------------------------------------------------------------
181         -- MEMORY BUS
182         --------------------------------------------------------------------------------
183
184         -- Calibration read register
185         component calibration_read_register
186         generic
187         (
188                 id          : std_logic_vector(31 downto 0)
189         );
190         port
191         (
192                 data_out    : out std_logic_vector(31 downto 0);
193                 rd          : in std_logic;
194                 ta          : out std_logic
195         );
196         end component;
197
198         -- Calibration write register
199         component calibration_write_register
200         port
201         (
202                 clk         : in std_logic;
203                 reset       : in std_logic;
204                 ce          : in std_logic;
205                 data_in     : in std_logic_vector(31 downto 0);
206                 data_out    : out std_logic_vector(31 downto 0);
207                 rd          : in std_logic;
208                 bls         : in std_logic_vector(3 downto 0);
209                 ta          : out std_logic
210         );
211         end component;
212
213         -- Calibration interconnect
214         component bus_calibration
215         port
216         (
217                 clk         : in std_logic;
218                 reset       : in std_logic;
219                 ce          : in std_logic;
220                 address     : in std_logic_vector(1 downto 0);
221                 data_in     : in std_logic_vector(31 downto 0);
222                 data_out    : out std_logic_vector(31 downto 0);
223                 rd          : in std_logic;
224                 bls         : in std_logic_vector(3 downto 0);
225                 ta          : out std_logic
226         );
227         end component;
228
229         -- IRC interconnect
230         component bus_irc
231         port
232         (
233                 clk         : in std_logic;
234                 reset       : in std_logic;
235
236                 address     : in std_logic_vector(3 downto 0);
237                 ce          : in std_logic;
238
239                 data_in     : in std_logic;
240                 data_out    : out std_logic_vector(31 downto 0);
241
242                 rd          : in std_logic;
243                 wr          : in std_logic;
244                 ta          : out std_logic;
245
246                 irc1_a      : in std_logic;
247                 irc1_b      : in std_logic;
248                 irc1_index  : in std_logic;
249                 irc1_mark   : in std_logic;
250
251                 irc2_a      : in std_logic;
252                 irc2_b      : in std_logic;
253                 irc2_index  : in std_logic;
254                 irc2_mark   : in std_logic;
255
256                 irc3_a      : in std_logic;
257                 irc3_b      : in std_logic;
258                 irc3_index  : in std_logic;
259                 irc3_mark   : in std_logic;
260
261                 irc4_a      : in std_logic;
262                 irc4_b      : in std_logic;
263                 irc4_index  : in std_logic;
264                 irc4_mark   : in std_logic
265         );
266         end component;
267
268         -- BCD interconnect
269         component bus_bcd
270         port
271         (
272                 reset      : in std_logic;
273                 en         : in std_logic;
274                 clk        : in std_logic;
275                 data_out   : out std_logic_vector(31 downto 0);
276                 rd         : in std_logic;
277                 ta         : out std_logic
278         );
279         end component;
280
281         -- Tumbl interconnect
282         component bus_tumbl
283         port
284         (
285                 clk_100m : in std_logic;
286                 clk_50m  : in std_logic;
287                 ce       : in std_logic;
288                 reset    : in std_logic;
289     rd       : in std_logic;
290     bls      : in std_logic_vector(3 downto 0);
291     address  : in std_logic_vector(11 downto 0);
292     data_in  : in std_logic_vector(31 downto 0);
293     data_out : out std_logic_vector(31 downto 0);
294                 ta       : out std_logic;
295                 XMEMB_sel_o :  out std_logic;
296                 XMEMB_i     :  in DMEMB2CORE_Type;
297                 XMEMB_o     :  out CORE2DMEMB_Type
298   );
299         end component;
300
301         --------------------------------------------------------------------------------
302         -- BRAM
303         --------------------------------------------------------------------------------
304
305         component xilinx_dualport_bram
306         generic
307         (
308                 byte_width : positive := 8;
309                 address_width : positive := 8;
310                 we_width : positive := 4
311         );
312         port
313         (
314                 clka : in std_logic;
315                 rsta : in std_logic;
316                 ena : in std_logic;
317                 wea : in std_logic_vector((we_width-1) downto 0);
318                 addra : in std_logic_vector((address_width-1) downto 0);
319                 dina : in std_logic_vector(((byte_width*we_width)-1) downto 0);
320                 douta : out std_logic_vector(((byte_width*we_width)-1) downto 0);
321                 clkb : in std_logic;
322                 rstb : in std_logic;
323                 enb : in std_logic;
324                 web : in std_logic_vector((we_width-1) downto 0);
325                 addrb : in std_logic_vector((address_width-1) downto 0);
326                 dinb : in std_logic_vector(((byte_width*we_width)-1) downto 0);
327                 doutb : out std_logic_vector(((byte_width*we_width)-1) downto 0)
328         );
329         end component;
330
331 end lx_rocon_pkg;
332
333 package body lx_rocon_pkg is
334
335
336 end lx_rocon_pkg;