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

Subversion Repositories avr_hp

[/] [avr_hp/] [trunk/] [rtl/] [rtl_s3_cm3/] [reg_file.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 tobil
--**********************************************************************************************
2
--  General purpose register file for the AVR Core
3
--  Version 1.4 (Special version for the JTAG OCD)
4
--  Modified 22.04.2004
5
--  Designed by Ruslan Lepetenok
6
--**********************************************************************************************
7
 
8
library IEEE;
9
use IEEE.std_logic_1164.all;
10
use IEEE.std_logic_unsigned.all;
11
 
12
use WORK.SynthCtrlPack.all; -- Synthesis control
13
 
14
entity reg_file_cm3 is port (
15
                cp2_cml_1 : in std_logic;
16
                cp2_cml_2 : in std_logic;
17
 
18
                                                  --Clock and reset
19
                                              cp2         : in  std_logic;
20
                                                  cp2en       : in  std_logic;
21
                          ireset      : in  std_logic;
22
 
23
                          reg_rd_in   : in  std_logic_vector(7 downto 0);
24
                          reg_rd_out  : out std_logic_vector(7 downto 0);
25
                          reg_rd_out_int  : out std_logic_vector(7 downto 0);
26
                          reg_rd_adr  : in  std_logic_vector(4 downto 0);
27
                          reg_rd_adr_int      : in std_logic_vector  (4 downto 0);
28
                          reg_rr_out  : out std_logic_vector(7 downto 0);
29
                          reg_rr_adr  : in  std_logic_vector(4 downto 0);
30
                          reg_rd_wr   : in  std_logic;
31
 
32
                          post_inc    : in  std_logic; -- POST INCREMENT FOR LD/ST INSTRUCTIONS
33
                          pre_dec     : in  std_logic; -- PRE DECREMENT FOR LD/ST INSTRUCTIONS
34
                          reg_h_wr    : in  std_logic;
35
                          reg_h_out   : out std_logic_vector(15 downto 0);
36
                          reg_h_adr   : in  std_logic_vector(2 downto 0);  -- x,y,z
37
                                  reg_z_out   : out std_logic_vector(15 downto 0) -- OUTPUT OF R31:R30 FOR LPM/ELPM/IJMP INSTRUCTIONS
38
                          );
39
end reg_file_cm3;
40
 
41
architecture RTL of reg_file_cm3 is
42
 
43
type register_file_type is array(0 to 25) of std_logic_vector(7 downto 0);
44
type register_mux_type is array(0 to 31) of std_logic_vector(7 downto 0);
45
signal register_file : register_file_type;
46
signal r26h : std_logic_vector(7 downto 0);
47
signal r27h : std_logic_vector(7 downto 0);
48
signal r28h : std_logic_vector(7 downto 0);
49
signal r29h : std_logic_vector(7 downto 0);
50
signal r30h : std_logic_vector(7 downto 0);
51
signal r31h : std_logic_vector(7 downto 0);
52
 
53
signal register_wr_en  : std_logic_vector(31 downto 0);
54
 
55
signal sg_rd_decode   : std_logic_vector (31 downto 0);
56
signal sg_rd_decode_int   : std_logic_vector (31 downto 0);
57
signal sg_rr_decode   : std_logic_vector (31 downto 0);
58
 
59
--signal sg_tmp_rd_data : register_mux_type;
60
signal sg_tmp_rd_data_0 : std_logic_vector(7 downto 0);
61
signal sg_tmp_rd_data_1 : std_logic_vector(7 downto 0);
62
signal sg_tmp_rd_data_2 : std_logic_vector(7 downto 0);
63
signal sg_tmp_rd_data_3 : std_logic_vector(7 downto 0);
64
signal sg_tmp_rd_data_4 : std_logic_vector(7 downto 0);
65
signal sg_tmp_rd_data_5 : std_logic_vector(7 downto 0);
66
signal sg_tmp_rd_data_6 : std_logic_vector(7 downto 0);
67
signal sg_tmp_rd_data_7 : std_logic_vector(7 downto 0);
68
signal sg_tmp_rd_data_8 : std_logic_vector(7 downto 0);
69
signal sg_tmp_rd_data_9 : std_logic_vector(7 downto 0);
70
signal sg_tmp_rd_data_10 : std_logic_vector(7 downto 0);
71
signal sg_tmp_rd_data_11 : std_logic_vector(7 downto 0);
72
signal sg_tmp_rd_data_12 : std_logic_vector(7 downto 0);
73
signal sg_tmp_rd_data_13 : std_logic_vector(7 downto 0);
74
signal sg_tmp_rd_data_14 : std_logic_vector(7 downto 0);
75
signal sg_tmp_rd_data_15 : std_logic_vector(7 downto 0);
76
signal sg_tmp_rd_data_16 : std_logic_vector(7 downto 0);
77
signal sg_tmp_rd_data_17 : std_logic_vector(7 downto 0);
78
signal sg_tmp_rd_data_18 : std_logic_vector(7 downto 0);
79
signal sg_tmp_rd_data_19 : std_logic_vector(7 downto 0);
80
signal sg_tmp_rd_data_20 : std_logic_vector(7 downto 0);
81
signal sg_tmp_rd_data_21 : std_logic_vector(7 downto 0);
82
signal sg_tmp_rd_data_22 : std_logic_vector(7 downto 0);
83
signal sg_tmp_rd_data_23 : std_logic_vector(7 downto 0);
84
signal sg_tmp_rd_data_24 : std_logic_vector(7 downto 0);
85
signal sg_tmp_rd_data_25 : std_logic_vector(7 downto 0);
86
signal sg_tmp_rd_data_26 : std_logic_vector(7 downto 0);
87
signal sg_tmp_rd_data_27 : std_logic_vector(7 downto 0);
88
signal sg_tmp_rd_data_28 : std_logic_vector(7 downto 0);
89
signal sg_tmp_rd_data_29 : std_logic_vector(7 downto 0);
90
signal sg_tmp_rd_data_30 : std_logic_vector(7 downto 0);
91
signal sg_tmp_rd_data_31 : std_logic_vector(7 downto 0);
92
signal sg_tmp_rd_data_0_int : std_logic_vector(7 downto 0);
93
signal sg_tmp_rd_data_1_int : std_logic_vector(7 downto 0);
94
signal sg_tmp_rd_data_2_int : std_logic_vector(7 downto 0);
95
signal sg_tmp_rd_data_3_int : std_logic_vector(7 downto 0);
96
signal sg_tmp_rd_data_4_int : std_logic_vector(7 downto 0);
97
signal sg_tmp_rd_data_5_int : std_logic_vector(7 downto 0);
98
signal sg_tmp_rd_data_6_int : std_logic_vector(7 downto 0);
99
signal sg_tmp_rd_data_7_int : std_logic_vector(7 downto 0);
100
signal sg_tmp_rd_data_8_int : std_logic_vector(7 downto 0);
101
signal sg_tmp_rd_data_9_int : std_logic_vector(7 downto 0);
102
signal sg_tmp_rd_data_10_int : std_logic_vector(7 downto 0);
103
signal sg_tmp_rd_data_11_int : std_logic_vector(7 downto 0);
104
signal sg_tmp_rd_data_12_int : std_logic_vector(7 downto 0);
105
signal sg_tmp_rd_data_13_int : std_logic_vector(7 downto 0);
106
signal sg_tmp_rd_data_14_int : std_logic_vector(7 downto 0);
107
signal sg_tmp_rd_data_15_int : std_logic_vector(7 downto 0);
108
signal sg_tmp_rd_data_16_int : std_logic_vector(7 downto 0);
109
signal sg_tmp_rd_data_17_int : std_logic_vector(7 downto 0);
110
signal sg_tmp_rd_data_18_int : std_logic_vector(7 downto 0);
111
signal sg_tmp_rd_data_19_int : std_logic_vector(7 downto 0);
112
signal sg_tmp_rd_data_20_int : std_logic_vector(7 downto 0);
113
signal sg_tmp_rd_data_21_int : std_logic_vector(7 downto 0);
114
signal sg_tmp_rd_data_22_int : std_logic_vector(7 downto 0);
115
signal sg_tmp_rd_data_23_int : std_logic_vector(7 downto 0);
116
signal sg_tmp_rd_data_24_int : std_logic_vector(7 downto 0);
117
signal sg_tmp_rd_data_25_int : std_logic_vector(7 downto 0);
118
signal sg_tmp_rd_data_26_int : std_logic_vector(7 downto 0);
119
signal sg_tmp_rd_data_27_int : std_logic_vector(7 downto 0);
120
signal sg_tmp_rd_data_28_int : std_logic_vector(7 downto 0);
121
signal sg_tmp_rd_data_29_int : std_logic_vector(7 downto 0);
122
signal sg_tmp_rd_data_30_int : std_logic_vector(7 downto 0);
123
signal sg_tmp_rd_data_31_int : std_logic_vector(7 downto 0);
124
--signal sg_tmp_rr_data : register_mux_type;
125
signal sg_tmp_rr_data_0 : std_logic_vector(7 downto 0);
126
signal sg_tmp_rr_data_1 : std_logic_vector(7 downto 0);
127
signal sg_tmp_rr_data_2 : std_logic_vector(7 downto 0);
128
signal sg_tmp_rr_data_3 : std_logic_vector(7 downto 0);
129
signal sg_tmp_rr_data_4 : std_logic_vector(7 downto 0);
130
signal sg_tmp_rr_data_5 : std_logic_vector(7 downto 0);
131
signal sg_tmp_rr_data_6 : std_logic_vector(7 downto 0);
132
signal sg_tmp_rr_data_7 : std_logic_vector(7 downto 0);
133
signal sg_tmp_rr_data_8 : std_logic_vector(7 downto 0);
134
signal sg_tmp_rr_data_9 : std_logic_vector(7 downto 0);
135
signal sg_tmp_rr_data_10 : std_logic_vector(7 downto 0);
136
signal sg_tmp_rr_data_11 : std_logic_vector(7 downto 0);
137
signal sg_tmp_rr_data_12 : std_logic_vector(7 downto 0);
138
signal sg_tmp_rr_data_13 : std_logic_vector(7 downto 0);
139
signal sg_tmp_rr_data_14 : std_logic_vector(7 downto 0);
140
signal sg_tmp_rr_data_15 : std_logic_vector(7 downto 0);
141
signal sg_tmp_rr_data_16 : std_logic_vector(7 downto 0);
142
signal sg_tmp_rr_data_17 : std_logic_vector(7 downto 0);
143
signal sg_tmp_rr_data_18 : std_logic_vector(7 downto 0);
144
signal sg_tmp_rr_data_19 : std_logic_vector(7 downto 0);
145
signal sg_tmp_rr_data_20 : std_logic_vector(7 downto 0);
146
signal sg_tmp_rr_data_21 : std_logic_vector(7 downto 0);
147
signal sg_tmp_rr_data_22 : std_logic_vector(7 downto 0);
148
signal sg_tmp_rr_data_23 : std_logic_vector(7 downto 0);
149
signal sg_tmp_rr_data_24 : std_logic_vector(7 downto 0);
150
signal sg_tmp_rr_data_25 : std_logic_vector(7 downto 0);
151
signal sg_tmp_rr_data_26 : std_logic_vector(7 downto 0);
152
signal sg_tmp_rr_data_27 : std_logic_vector(7 downto 0);
153
signal sg_tmp_rr_data_28 : std_logic_vector(7 downto 0);
154
signal sg_tmp_rr_data_29 : std_logic_vector(7 downto 0);
155
signal sg_tmp_rr_data_30 : std_logic_vector(7 downto 0);
156
signal sg_tmp_rr_data_31 : std_logic_vector(7 downto 0);
157
 
158
signal sg_adr16_postinc : std_logic_vector (15 downto 0);
159
signal sg_adr16_predec  : std_logic_vector (15 downto 0);
160
signal reg_h_in         : std_logic_vector  (15 downto 0);
161
 
162
signal sg_tmp_h_data    : std_logic_vector  (15 downto 0);
163
 
164
signal reg_rd_adr_cml_2 :  std_logic_vector ( 4 downto 0 );
165
signal reg_rd_adr_cml_1 :  std_logic_vector ( 4 downto 0 );
166
signal reg_h_adr_cml_2 :  std_logic_vector ( 2 downto 0 );
167
signal register_file_cml_2 :  register_file_type;
168
signal register_file_cml_1 :  register_file_type;
169
signal r26h_cml_2 :  std_logic_vector ( 7 downto 0 );
170
signal r26h_cml_1 :  std_logic_vector ( 7 downto 0 );
171
signal r27h_cml_2 :  std_logic_vector ( 7 downto 0 );
172
signal r27h_cml_1 :  std_logic_vector ( 7 downto 0 );
173
signal r28h_cml_2 :  std_logic_vector ( 7 downto 0 );
174
signal r28h_cml_1 :  std_logic_vector ( 7 downto 0 );
175
signal r29h_cml_2 :  std_logic_vector ( 7 downto 0 );
176
signal r29h_cml_1 :  std_logic_vector ( 7 downto 0 );
177
signal reg_z_out_cml_out :  std_logic_vector ( 15 downto 0 );
178
signal r30h_cml_2 :  std_logic_vector ( 7 downto 0 );
179
signal r30h_cml_1 :  std_logic_vector ( 7 downto 0 );
180
signal r31h_cml_2 :  std_logic_vector ( 7 downto 0 );
181
signal r31h_cml_1 :  std_logic_vector ( 7 downto 0 );
182
signal sg_rd_decode_cml_1 :  std_logic_vector ( 31 downto 0 );
183
signal sg_tmp_rd_data_7_cml_1 :  std_logic_vector ( 7 downto 0 );
184
signal reg_h_out_cml_out :  std_logic_vector ( 15 downto 0 );
185
signal sg_tmp_h_data_cml_2 :  std_logic_vector ( 15 downto 0 );
186
 
187
begin
188
 
189
 
190
 
191
process(cp2_cml_1) begin
192
if (cp2_cml_1 = '1' and cp2_cml_1'event) then
193
        reg_rd_adr_cml_1 <= reg_rd_adr;
194
        register_file_cml_1 <= register_file;
195
        r26h_cml_1 <= r26h;
196
        r27h_cml_1 <= r27h;
197
        r28h_cml_1 <= r28h;
198
        r29h_cml_1 <= r29h;
199
        r30h_cml_1 <= r30h;
200
        r31h_cml_1 <= r31h;
201
        sg_rd_decode_cml_1 <= sg_rd_decode;
202
        sg_tmp_rd_data_7_cml_1 <= sg_tmp_rd_data_7;
203
end if;
204
end process;
205
 
206
process(cp2_cml_2) begin
207
if (cp2_cml_2 = '1' and cp2_cml_2'event) then
208
        reg_rd_adr_cml_2 <= reg_rd_adr_cml_1;
209
        reg_h_adr_cml_2 <= reg_h_adr;
210
        register_file_cml_2 <= register_file_cml_1;
211
        r26h_cml_2 <= r26h_cml_1;
212
        r27h_cml_2 <= r27h_cml_1;
213
        r28h_cml_2 <= r28h_cml_1;
214
        r29h_cml_2 <= r29h_cml_1;
215
        r30h_cml_2 <= r30h_cml_1;
216
        r31h_cml_2 <= r31h_cml_1;
217
        sg_tmp_h_data_cml_2 <= sg_tmp_h_data;
218
end if;
219
end process;
220
reg_z_out <= reg_z_out_cml_out;
221
reg_h_out <= reg_h_out_cml_out;
222
 
223
 
224
write_decode: for i in 0 to 31 generate
225
-- SynEDA CoreMultiplier
226
-- assignment(s): register_wr_en
227
-- replace(s): reg_rd_adr
228
 
229
register_wr_en(i) <= '1' when (i=reg_rd_adr_cml_2 and reg_rd_wr='1') else '0';
230
end generate;
231
 
232
rd_mux_decode: for i in 0 to 31 generate
233
sg_rd_decode(i) <= '1' when (reg_rd_adr=i) else '0';
234
end generate;
235
 
236
rd_mux_decode_int: for i in 0 to 31 generate
237
sg_rd_decode_int(i) <= '1' when (reg_rd_adr_int=i) else '0';
238
end generate;
239
 
240
rr_mux_decode: for i in 0 to 31 generate
241
sg_rr_decode(i) <= '1' when (reg_rr_adr=i) else '0';
242
end generate;
243
 
244
-- SynEDA CoreMultiplier
245
-- assignment(s): reg_z_out
246
-- replace(s): r30h, r31h
247
 
248
reg_z_out_cml_out <= r31h_cml_2&r30h_cml_2; -- R31:R30 OUTPUT FOR LPM/ELPM INSTRUCTIONS 
249
 
250
--sg_tmp_rd_data(0) <= register_file(0) when sg_rd_decode(0)='1' else (others=>'0');
251
--read_rd_mux: for i in 1 to 25 generate
252
--sg_tmp_rd_data(i) <= register_file(i) when sg_rd_decode(i)='1' else sg_tmp_rd_data(i-1);
253
--end generate;
254
--sg_tmp_rd_data(26) <= r26h when sg_rd_decode(26)='1' else sg_tmp_rd_data(25);
255
--sg_tmp_rd_data(27) <= r27h when sg_rd_decode(27)='1' else sg_tmp_rd_data(26);
256
--sg_tmp_rd_data(28) <= r28h when sg_rd_decode(28)='1' else sg_tmp_rd_data(27);
257
--sg_tmp_rd_data(29) <= r29h when sg_rd_decode(29)='1' else sg_tmp_rd_data(28);
258
--sg_tmp_rd_data(30) <= r30h when sg_rd_decode(30)='1' else sg_tmp_rd_data(29);
259
--sg_tmp_rd_data(31) <= r31h when sg_rd_decode(31)='1' else sg_tmp_rd_data(30); 
260
--reg_rd_out <= sg_tmp_rd_data(31); 
261
 
262
sg_tmp_rd_data_0 <= register_file(0) when sg_rd_decode(0)='1' else (others=>'0');
263
sg_tmp_rd_data_1 <= register_file(1) when sg_rd_decode(1)='1' else sg_tmp_rd_data_0;
264
sg_tmp_rd_data_2 <= register_file(2) when sg_rd_decode(2)='1' else sg_tmp_rd_data_1;
265
sg_tmp_rd_data_3 <= register_file(3) when sg_rd_decode(3)='1' else sg_tmp_rd_data_2;
266
sg_tmp_rd_data_4 <= register_file(4) when sg_rd_decode(4)='1' else sg_tmp_rd_data_3;
267
sg_tmp_rd_data_5 <= register_file(5) when sg_rd_decode(5)='1' else sg_tmp_rd_data_4;
268
sg_tmp_rd_data_6 <= register_file(6) when sg_rd_decode(6)='1' else sg_tmp_rd_data_5;
269
sg_tmp_rd_data_7 <= register_file(7) when sg_rd_decode(7)='1' else sg_tmp_rd_data_6;
270
-- SynEDA CoreMultiplier
271
-- assignment(s): sg_tmp_rd_data_8
272
-- replace(s): register_file, sg_rd_decode, sg_tmp_rd_data_7
273
 
274
sg_tmp_rd_data_8 <= register_file_cml_1(8) when sg_rd_decode_cml_1(8)='1' else sg_tmp_rd_data_7_cml_1;
275
-- SynEDA CoreMultiplier
276
-- assignment(s): sg_tmp_rd_data_9
277
-- replace(s): register_file, sg_rd_decode
278
 
279
sg_tmp_rd_data_9 <= register_file_cml_1(9) when sg_rd_decode_cml_1(9)='1' else sg_tmp_rd_data_8;
280
-- SynEDA CoreMultiplier
281
-- assignment(s): sg_tmp_rd_data_10
282
-- replace(s): register_file, sg_rd_decode
283
 
284
sg_tmp_rd_data_10 <= register_file_cml_1(10) when sg_rd_decode_cml_1(10)='1' else sg_tmp_rd_data_9;
285
-- SynEDA CoreMultiplier
286
-- assignment(s): sg_tmp_rd_data_11
287
-- replace(s): register_file, sg_rd_decode
288
 
289
sg_tmp_rd_data_11 <= register_file_cml_1(11) when sg_rd_decode_cml_1(11)='1' else sg_tmp_rd_data_10;
290
-- SynEDA CoreMultiplier
291
-- assignment(s): sg_tmp_rd_data_12
292
-- replace(s): register_file, sg_rd_decode
293
 
294
sg_tmp_rd_data_12 <= register_file_cml_1(12) when sg_rd_decode_cml_1(12)='1' else sg_tmp_rd_data_11;
295
-- SynEDA CoreMultiplier
296
-- assignment(s): sg_tmp_rd_data_13
297
-- replace(s): register_file, sg_rd_decode
298
 
299
sg_tmp_rd_data_13 <= register_file_cml_1(13) when sg_rd_decode_cml_1(13)='1' else sg_tmp_rd_data_12;
300
-- SynEDA CoreMultiplier
301
-- assignment(s): sg_tmp_rd_data_14
302
-- replace(s): register_file, sg_rd_decode
303
 
304
sg_tmp_rd_data_14 <= register_file_cml_1(14) when sg_rd_decode_cml_1(14)='1' else sg_tmp_rd_data_13;
305
-- SynEDA CoreMultiplier
306
-- assignment(s): sg_tmp_rd_data_15
307
-- replace(s): register_file, sg_rd_decode
308
 
309
sg_tmp_rd_data_15 <= register_file_cml_1(15) when sg_rd_decode_cml_1(15)='1' else sg_tmp_rd_data_14;
310
-- SynEDA CoreMultiplier
311
-- assignment(s): sg_tmp_rd_data_16
312
-- replace(s): register_file, sg_rd_decode
313
 
314
sg_tmp_rd_data_16 <= register_file_cml_1(16) when sg_rd_decode_cml_1(16)='1' else sg_tmp_rd_data_15;
315
-- SynEDA CoreMultiplier
316
-- assignment(s): sg_tmp_rd_data_17
317
-- replace(s): register_file, sg_rd_decode
318
 
319
sg_tmp_rd_data_17 <= register_file_cml_1(17) when sg_rd_decode_cml_1(17)='1' else sg_tmp_rd_data_16;
320
-- SynEDA CoreMultiplier
321
-- assignment(s): sg_tmp_rd_data_18
322
-- replace(s): register_file, sg_rd_decode
323
 
324
sg_tmp_rd_data_18 <= register_file_cml_1(18) when sg_rd_decode_cml_1(18)='1' else sg_tmp_rd_data_17;
325
-- SynEDA CoreMultiplier
326
-- assignment(s): sg_tmp_rd_data_19
327
-- replace(s): register_file, sg_rd_decode
328
 
329
sg_tmp_rd_data_19 <= register_file_cml_1(19) when sg_rd_decode_cml_1(19)='1' else sg_tmp_rd_data_18;
330
-- SynEDA CoreMultiplier
331
-- assignment(s): sg_tmp_rd_data_20
332
-- replace(s): register_file, sg_rd_decode
333
 
334
sg_tmp_rd_data_20 <= register_file_cml_1(20) when sg_rd_decode_cml_1(20)='1' else sg_tmp_rd_data_19;
335
-- SynEDA CoreMultiplier
336
-- assignment(s): sg_tmp_rd_data_21
337
-- replace(s): register_file, sg_rd_decode
338
 
339
sg_tmp_rd_data_21 <= register_file_cml_1(21) when sg_rd_decode_cml_1(21)='1' else sg_tmp_rd_data_20;
340
-- SynEDA CoreMultiplier
341
-- assignment(s): sg_tmp_rd_data_22
342
-- replace(s): register_file, sg_rd_decode
343
 
344
sg_tmp_rd_data_22 <= register_file_cml_1(22) when sg_rd_decode_cml_1(22)='1' else sg_tmp_rd_data_21;
345
-- SynEDA CoreMultiplier
346
-- assignment(s): sg_tmp_rd_data_23
347
-- replace(s): register_file, sg_rd_decode
348
 
349
sg_tmp_rd_data_23 <= register_file_cml_1(23) when sg_rd_decode_cml_1(23)='1' else sg_tmp_rd_data_22;
350
-- SynEDA CoreMultiplier
351
-- assignment(s): sg_tmp_rd_data_24
352
-- replace(s): register_file, sg_rd_decode
353
 
354
sg_tmp_rd_data_24 <= register_file_cml_1(24) when sg_rd_decode_cml_1(24)='1' else sg_tmp_rd_data_23;
355
-- SynEDA CoreMultiplier
356
-- assignment(s): sg_tmp_rd_data_25
357
-- replace(s): register_file, sg_rd_decode
358
 
359
sg_tmp_rd_data_25 <= register_file_cml_1(25) when sg_rd_decode_cml_1(25)='1' else sg_tmp_rd_data_24;
360
-- SynEDA CoreMultiplier
361
-- assignment(s): sg_tmp_rd_data_26
362
-- replace(s): r26h, sg_rd_decode
363
 
364
sg_tmp_rd_data_26 <= r26h_cml_1 when sg_rd_decode_cml_1(26)='1' else sg_tmp_rd_data_25;
365
-- SynEDA CoreMultiplier
366
-- assignment(s): sg_tmp_rd_data_27
367
-- replace(s): r27h, sg_rd_decode
368
 
369
sg_tmp_rd_data_27 <= r27h_cml_1 when sg_rd_decode_cml_1(27)='1' else sg_tmp_rd_data_26;
370
-- SynEDA CoreMultiplier
371
-- assignment(s): sg_tmp_rd_data_28
372
-- replace(s): r28h, sg_rd_decode
373
 
374
sg_tmp_rd_data_28 <= r28h_cml_1 when sg_rd_decode_cml_1(28)='1' else sg_tmp_rd_data_27;
375
-- SynEDA CoreMultiplier
376
-- assignment(s): sg_tmp_rd_data_29
377
-- replace(s): r29h, sg_rd_decode
378
 
379
sg_tmp_rd_data_29 <= r29h_cml_1 when sg_rd_decode_cml_1(29)='1' else sg_tmp_rd_data_28;
380
-- SynEDA CoreMultiplier
381
-- assignment(s): sg_tmp_rd_data_30
382
-- replace(s): r30h, sg_rd_decode
383
 
384
sg_tmp_rd_data_30 <= r30h_cml_1 when sg_rd_decode_cml_1(30)='1' else sg_tmp_rd_data_29;
385
-- SynEDA CoreMultiplier
386
-- assignment(s): sg_tmp_rd_data_31
387
-- replace(s): r31h, sg_rd_decode
388
 
389
sg_tmp_rd_data_31 <= r31h_cml_1 when sg_rd_decode_cml_1(31)='1' else sg_tmp_rd_data_30;
390
reg_rd_out <= sg_tmp_rd_data_31;
391
 
392
sg_tmp_rd_data_0_int <= register_file(0) when sg_rd_decode_int(0)='1' else (others=>'0');
393
sg_tmp_rd_data_1_int <= register_file(1) when sg_rd_decode_int(1)='1' else sg_tmp_rd_data_0_int;
394
sg_tmp_rd_data_2_int <= register_file(2) when sg_rd_decode_int(2)='1' else sg_tmp_rd_data_1_int;
395
sg_tmp_rd_data_3_int <= register_file(3) when sg_rd_decode_int(3)='1' else sg_tmp_rd_data_2_int;
396
sg_tmp_rd_data_4_int <= register_file(4) when sg_rd_decode_int(4)='1' else sg_tmp_rd_data_3_int;
397
sg_tmp_rd_data_5_int <= register_file(5) when sg_rd_decode_int(5)='1' else sg_tmp_rd_data_4_int;
398
sg_tmp_rd_data_6_int <= register_file(6) when sg_rd_decode_int(6)='1' else sg_tmp_rd_data_5_int;
399
sg_tmp_rd_data_7_int <= register_file(7) when sg_rd_decode_int(7)='1' else sg_tmp_rd_data_6_int;
400
sg_tmp_rd_data_8_int <= register_file(8) when sg_rd_decode_int(8)='1' else sg_tmp_rd_data_7_int;
401
sg_tmp_rd_data_9_int <= register_file(9) when sg_rd_decode_int(9)='1' else sg_tmp_rd_data_8_int;
402
sg_tmp_rd_data_10_int <= register_file(10) when sg_rd_decode_int(10)='1' else sg_tmp_rd_data_9_int;
403
sg_tmp_rd_data_11_int <= register_file(11) when sg_rd_decode_int(11)='1' else sg_tmp_rd_data_10_int;
404
sg_tmp_rd_data_12_int <= register_file(12) when sg_rd_decode_int(12)='1' else sg_tmp_rd_data_11_int;
405
sg_tmp_rd_data_13_int <= register_file(13) when sg_rd_decode_int(13)='1' else sg_tmp_rd_data_12_int;
406
sg_tmp_rd_data_14_int <= register_file(14) when sg_rd_decode_int(14)='1' else sg_tmp_rd_data_13_int;
407
sg_tmp_rd_data_15_int <= register_file(15) when sg_rd_decode_int(15)='1' else sg_tmp_rd_data_14_int;
408
sg_tmp_rd_data_16_int <= register_file(16) when sg_rd_decode_int(16)='1' else sg_tmp_rd_data_15_int;
409
sg_tmp_rd_data_17_int <= register_file(17) when sg_rd_decode_int(17)='1' else sg_tmp_rd_data_16_int;
410
sg_tmp_rd_data_18_int <= register_file(18) when sg_rd_decode_int(18)='1' else sg_tmp_rd_data_17_int;
411
sg_tmp_rd_data_19_int <= register_file(19) when sg_rd_decode_int(19)='1' else sg_tmp_rd_data_18_int;
412
sg_tmp_rd_data_20_int <= register_file(20) when sg_rd_decode_int(20)='1' else sg_tmp_rd_data_19_int;
413
sg_tmp_rd_data_21_int <= register_file(21) when sg_rd_decode_int(21)='1' else sg_tmp_rd_data_20_int;
414
sg_tmp_rd_data_22_int <= register_file(22) when sg_rd_decode_int(22)='1' else sg_tmp_rd_data_21_int;
415
sg_tmp_rd_data_23_int <= register_file(23) when sg_rd_decode_int(23)='1' else sg_tmp_rd_data_22_int;
416
sg_tmp_rd_data_24_int <= register_file(24) when sg_rd_decode_int(24)='1' else sg_tmp_rd_data_23_int;
417
sg_tmp_rd_data_25_int <= register_file(25) when sg_rd_decode_int(25)='1' else sg_tmp_rd_data_24_int;
418
sg_tmp_rd_data_26_int <= r26h when sg_rd_decode_int(26)='1' else sg_tmp_rd_data_25_int;
419
sg_tmp_rd_data_27_int <= r27h when sg_rd_decode_int(27)='1' else sg_tmp_rd_data_26_int;
420
sg_tmp_rd_data_28_int <= r28h when sg_rd_decode_int(28)='1' else sg_tmp_rd_data_27_int;
421
sg_tmp_rd_data_29_int <= r29h when sg_rd_decode_int(29)='1' else sg_tmp_rd_data_28_int;
422
sg_tmp_rd_data_30_int <= r30h when sg_rd_decode_int(30)='1' else sg_tmp_rd_data_29_int;
423
sg_tmp_rd_data_31_int <= r31h when sg_rd_decode_int(31)='1' else sg_tmp_rd_data_30_int;
424
reg_rd_out_int <= sg_tmp_rd_data_31_int;
425
 
426
--sg_tmp_rr_data(0) <= register_file(0) when sg_rr_decode(0)='1' else (others=>'0');
427
--read_rr_mux: for i in 1 to 25 generate
428
--sg_tmp_rr_data(i) <= register_file(i) when sg_rr_decode(i)='1' else sg_tmp_rr_data(i-1);
429
--end generate;
430
--sg_tmp_rr_data() <= register_file() when sg_rr_decode()='1' else sg_tmp_rr_data();
431
--sg_tmp_rr_data(26) <= r26h when sg_rr_decode(26)='1' else sg_tmp_rr_data(25);
432
--sg_tmp_rr_data(27) <= r27h when sg_rr_decode(27)='1' else sg_tmp_rr_data(26);
433
--sg_tmp_rr_data(28) <= r28h when sg_rr_decode(28)='1' else sg_tmp_rr_data(27);
434
--sg_tmp_rr_data(29) <= r29h when sg_rr_decode(29)='1' else sg_tmp_rr_data(28);
435
--sg_tmp_rr_data(30) <= r30h when sg_rr_decode(30)='1' else sg_tmp_rr_data(29);
436
--sg_tmp_rr_data(31) <= r31h when sg_rr_decode(31)='1' else sg_tmp_rr_data(30);
437
--reg_rr_out <= sg_tmp_rr_data(31);
438
 
439
 
440
sg_tmp_rr_data_0 <= register_file(0) when sg_rr_decode(0)='1' else (others=>'0');
441
sg_tmp_rr_data_1 <= register_file(1) when sg_rr_decode(1)='1' else sg_tmp_rr_data_0;
442
sg_tmp_rr_data_2 <= register_file(2) when sg_rr_decode(2)='1' else sg_tmp_rr_data_1;
443
sg_tmp_rr_data_3 <= register_file(3) when sg_rr_decode(3)='1' else sg_tmp_rr_data_2;
444
sg_tmp_rr_data_4 <= register_file(4) when sg_rr_decode(4)='1' else sg_tmp_rr_data_3;
445
sg_tmp_rr_data_5 <= register_file(5) when sg_rr_decode(5)='1' else sg_tmp_rr_data_4;
446
sg_tmp_rr_data_6 <= register_file(6) when sg_rr_decode(6)='1' else sg_tmp_rr_data_5;
447
sg_tmp_rr_data_7 <= register_file(7) when sg_rr_decode(7)='1' else sg_tmp_rr_data_6;
448
sg_tmp_rr_data_8 <= register_file(8) when sg_rr_decode(8)='1' else sg_tmp_rr_data_7;
449
sg_tmp_rr_data_9 <= register_file(9) when sg_rr_decode(9)='1' else sg_tmp_rr_data_8;
450
sg_tmp_rr_data_10 <= register_file(10) when sg_rr_decode(10)='1' else sg_tmp_rr_data_9;
451
sg_tmp_rr_data_11 <= register_file(11) when sg_rr_decode(11)='1' else sg_tmp_rr_data_10;
452
sg_tmp_rr_data_12 <= register_file(12) when sg_rr_decode(12)='1' else sg_tmp_rr_data_11;
453
sg_tmp_rr_data_13 <= register_file(13) when sg_rr_decode(13)='1' else sg_tmp_rr_data_12;
454
sg_tmp_rr_data_14 <= register_file(14) when sg_rr_decode(14)='1' else sg_tmp_rr_data_13;
455
sg_tmp_rr_data_15 <= register_file(15) when sg_rr_decode(15)='1' else sg_tmp_rr_data_14;
456
sg_tmp_rr_data_16 <= register_file(16) when sg_rr_decode(16)='1' else sg_tmp_rr_data_15;
457
sg_tmp_rr_data_17 <= register_file(17) when sg_rr_decode(17)='1' else sg_tmp_rr_data_16;
458
sg_tmp_rr_data_18 <= register_file(18) when sg_rr_decode(18)='1' else sg_tmp_rr_data_17;
459
sg_tmp_rr_data_19 <= register_file(19) when sg_rr_decode(19)='1' else sg_tmp_rr_data_18;
460
sg_tmp_rr_data_20 <= register_file(20) when sg_rr_decode(20)='1' else sg_tmp_rr_data_19;
461
sg_tmp_rr_data_21 <= register_file(21) when sg_rr_decode(21)='1' else sg_tmp_rr_data_20;
462
sg_tmp_rr_data_22 <= register_file(22) when sg_rr_decode(22)='1' else sg_tmp_rr_data_21;
463
sg_tmp_rr_data_23 <= register_file(23) when sg_rr_decode(23)='1' else sg_tmp_rr_data_22;
464
sg_tmp_rr_data_24 <= register_file(24) when sg_rr_decode(24)='1' else sg_tmp_rr_data_23;
465
sg_tmp_rr_data_25 <= register_file(25) when sg_rr_decode(25)='1' else sg_tmp_rr_data_24;
466
sg_tmp_rr_data_26 <= r26h when sg_rr_decode(26)='1' else sg_tmp_rr_data_25;
467
sg_tmp_rr_data_27 <= r27h when sg_rr_decode(27)='1' else sg_tmp_rr_data_26;
468
sg_tmp_rr_data_28 <= r28h when sg_rr_decode(28)='1' else sg_tmp_rr_data_27;
469
sg_tmp_rr_data_29 <= r29h when sg_rr_decode(29)='1' else sg_tmp_rr_data_28;
470
sg_tmp_rr_data_30 <= r30h when sg_rr_decode(30)='1' else sg_tmp_rr_data_29;
471
sg_tmp_rr_data_31 <= r31h when sg_rr_decode(31)='1' else sg_tmp_rr_data_30;
472
reg_rr_out <= sg_tmp_rr_data_31;
473
 
474
 
475
h_dat_mux_l:for i in 0 to 7 generate
476
sg_tmp_h_data(i) <= (r26h_cml_1(i) and reg_h_adr(0)) or (r28h_cml_1(i) and reg_h_adr(1)) or (r30h_cml_1(i) and reg_h_adr(2));
477
end generate;
478
h_dat_mux_h:for i in 8 to 15 generate
479
-- SynEDA CoreMultiplier
480
-- assignment(s): sg_tmp_h_data
481
-- replace(s): r26h, r27h, r28h, r29h, r30h, r31h
482
 
483
sg_tmp_h_data(i) <= (r27h_cml_1(i-8) and reg_h_adr(0)) or (r29h_cml_1(i-8) and reg_h_adr(1)) or (r31h_cml_1(i-8) and reg_h_adr(2));
484
end generate;
485
 
486
 
487
-- SynEDA CoreMultiplier
488
-- assignment(s): sg_adr16_postinc
489
-- replace(s): sg_tmp_h_data
490
 
491
sg_adr16_postinc <= sg_tmp_h_data_cml_2 +1;
492
-- SynEDA CoreMultiplier
493
-- assignment(s): sg_adr16_predec
494
-- replace(s): sg_tmp_h_data
495
 
496
sg_adr16_predec  <= sg_tmp_h_data_cml_2 -1;
497
-- SynEDA CoreMultiplier
498
-- assignment(s): reg_h_out
499
-- replace(s): sg_tmp_h_data
500
 
501
-- OUTPUT TO THE ADDRESS BUS
502
reg_h_out_cml_out <= sg_adr16_predec when (pre_dec='1') else           -- PREDECREMENT
503
             sg_tmp_h_data_cml_2;            -- NO PREDECREMENT
504
 
505
-- TO REGISTERS
506
reg_h_in  <= sg_adr16_postinc when (post_inc='1') else         -- POST INC 
507
             sg_adr16_predec;                                  -- PRE DEC
508
 
509
-- Register file with global reset (for simulation)
510
 
511
RegFileWithRst:if CResetRegFile generate
512
 
513
-- SynEDA CoreMultiplier
514
-- assignment(s): register_file
515
-- replace(s): register_file
516
 
517
R0_R25:process(cp2,ireset)
518
begin
519
 if ireset='0' then
520
  for i in 0 to 25 loop
521
   register_file(i) <= (others =>'0');
522
  end loop;
523
 elsif (cp2='1' and cp2'event) then register_file <= register_file_cml_2;
524
  if (cp2en='1') then                                                     -- Clock enable        
525
   for i in 0 to 25 loop
526
    if register_wr_en(i)='1' then
527
     register_file(i) <= reg_rd_in;
528
    end if;
529
   end loop;
530
  end if;
531
 end if;
532
end process;
533
 
534
 
535
-- SynEDA CoreMultiplier
536
-- assignment(s): r26h
537
-- replace(s): reg_h_adr, r26h
538
 
539
-- R26 (LOW)
540
R26:process(cp2,ireset)
541
begin
542
 if ireset='0' then
543
  r26h <= (others =>'0');
544
 elsif (cp2='1' and cp2'event) then r26h <= r26h_cml_2;
545
  if (cp2en='1') then                                                     -- Clock enable        
546
   if register_wr_en(26)='1' then
547
    r26h <= reg_rd_in;
548
   elsif (reg_h_adr_cml_2(0)='1'and reg_h_wr='1') then
549
    r26h <= reg_h_in(7 downto 0);
550
   end if;
551
  end if;
552
 end if;
553
end process;
554
 
555
-- SynEDA CoreMultiplier
556
-- assignment(s): r27h
557
-- replace(s): reg_h_adr, r27h
558
 
559
-- R27 (HIGH)
560
R27:process(cp2,ireset)
561
begin
562
 if ireset='0' then
563
  r27h <= (others =>'0');
564
 elsif (cp2='1' and cp2'event) then r27h <= r27h_cml_2;
565
  if (cp2en='1') then                                                     -- Clock enable        
566
   if register_wr_en(27)='1' then
567
    r27h <= reg_rd_in;
568
   elsif (reg_h_adr_cml_2(0)='1'and reg_h_wr='1') then
569
    r27h <= reg_h_in(15 downto 8);
570
   end if;
571
  end if;
572
 end if;
573
end process;
574
 
575
-- SynEDA CoreMultiplier
576
-- assignment(s): r28h
577
-- replace(s): reg_h_adr, r28h
578
 
579
-- R28 (LOW)
580
R28:process(cp2,ireset)
581
begin
582
 if ireset='0' then
583
  r28h <= (others =>'0');
584
 elsif (cp2='1' and cp2'event) then r28h <= r28h_cml_2;
585
  if (cp2en='1') then                                                     -- Clock enable        
586
   if register_wr_en(28)='1' then
587
    r28h <= reg_rd_in;
588
   elsif (reg_h_adr_cml_2(1)='1'and reg_h_wr='1') then
589
    r28h <= reg_h_in(7 downto 0);
590
   end if;
591
  end if;
592
 end if;
593
end process;
594
 
595
-- SynEDA CoreMultiplier
596
-- assignment(s): r29h
597
-- replace(s): reg_h_adr, r29h
598
 
599
-- R29 (HIGH)
600
R29:process(cp2,ireset)
601
begin
602
 if ireset='0' then
603
  r29h <= (others =>'0');
604
 elsif (cp2='1' and cp2'event) then r29h <= r29h_cml_2;
605
  if (cp2en='1') then                                                     -- Clock enable        
606
   if register_wr_en(29)='1' then
607
    r29h <= reg_rd_in;
608
   elsif (reg_h_adr_cml_2(1)='1'and reg_h_wr='1') then
609
    r29h <= reg_h_in(15 downto 8);
610
   end if;
611
  end if;
612
 end if;
613
end process;
614
 
615
-- SynEDA CoreMultiplier
616
-- assignment(s): r30h
617
-- replace(s): reg_h_adr, r30h
618
 
619
-- R30 (LOW)
620
R30:process(cp2,ireset)
621
begin
622
 if ireset='0' then
623
  r30h <= (others =>'0');
624
 elsif (cp2='1' and cp2'event) then r30h <= r30h_cml_2;
625
  if (cp2en='1') then                                                     -- Clock enable        
626
   if register_wr_en(30)='1' then
627
    r30h <= reg_rd_in;
628
   elsif (reg_h_adr_cml_2(2)='1'and reg_h_wr='1') then
629
    r30h <= reg_h_in(7 downto 0);
630
   end if;
631
  end if;
632
 end if;
633
end process;
634
 
635
-- SynEDA CoreMultiplier
636
-- assignment(s): r31h
637
-- replace(s): reg_h_adr, r31h
638
 
639
-- R31 (HIGH)
640
R31:process(cp2,ireset)
641
begin
642
 if ireset='0' then
643
  r31h <= (others =>'0');
644
 elsif (cp2='1' and cp2'event) then r31h <= r31h_cml_2;
645
  if (cp2en='1') then                                                     -- Clock enable        
646
   if register_wr_en(31)='1' then
647
    r31h <= reg_rd_in;
648
   elsif (reg_h_adr_cml_2(2)='1'and reg_h_wr='1') then
649
    r31h <= reg_h_in(15 downto 8);
650
   end if;
651
  end if;
652
 end if;
653
end process;
654
 
655
end generate;
656
 
657
 
658
-- Register file without global reset (for synthesis)
659
 
660
RegFileWithoutRst:if not CResetRegFile generate
661
 
662
R0_R25:process(cp2)
663
begin
664
 if (cp2='1' and cp2'event) then
665
  if (cp2en='1') then                                                     -- Clock enable        
666
   for i in 0 to 25 loop
667
    if register_wr_en(i)='1' then
668
     register_file(i) <= reg_rd_in;
669
    end if;
670
   end loop;
671
  end if;
672
 end if;
673
end process;
674
 
675
 
676
-- R26 (LOW)
677
R26:process(cp2)
678
begin
679
 if (cp2='1' and cp2'event) then
680
  if (cp2en='1') then                                                     -- Clock enable        
681
   if register_wr_en(26)='1' then
682
    r26h <= reg_rd_in;
683
   elsif (reg_h_adr(0)='1'and reg_h_wr='1') then
684
    r26h <= reg_h_in(7 downto 0);
685
   end if;
686
  end if;
687
 end if;
688
end process;
689
 
690
-- R27 (HIGH)
691
R27:process(cp2)
692
begin
693
 if (cp2='1' and cp2'event) then
694
  if (cp2en='1') then                                                     -- Clock enable        
695
   if register_wr_en(27)='1' then
696
    r27h <= reg_rd_in;
697
   elsif (reg_h_adr(0)='1'and reg_h_wr='1') then
698
    r27h <= reg_h_in(15 downto 8);
699
   end if;
700
  end if;
701
 end if;
702
end process;
703
 
704
-- R28 (LOW)
705
R28:process(cp2)
706
begin
707
 if (cp2='1' and cp2'event) then
708
  if (cp2en='1') then                                                     -- Clock enable        
709
   if register_wr_en(28)='1' then
710
    r28h <= reg_rd_in;
711
   elsif (reg_h_adr(1)='1'and reg_h_wr='1') then
712
    r28h <= reg_h_in(7 downto 0);
713
   end if;
714
  end if;
715
 end if;
716
end process;
717
 
718
-- R29 (HIGH)
719
R29:process(cp2)
720
begin
721
 if (cp2='1' and cp2'event) then
722
  if (cp2en='1') then                                                     -- Clock enable        
723
   if register_wr_en(29)='1' then
724
    r29h <= reg_rd_in;
725
   elsif (reg_h_adr(1)='1'and reg_h_wr='1') then
726
    r29h <= reg_h_in(15 downto 8);
727
   end if;
728
  end if;
729
 end if;
730
end process;
731
 
732
-- R30 (LOW)
733
R30:process(cp2)
734
begin
735
 if (cp2='1' and cp2'event) then
736
  if (cp2en='1') then                                                     -- Clock enable        
737
   if register_wr_en(30)='1' then
738
    r30h <= reg_rd_in;
739
   elsif (reg_h_adr(2)='1'and reg_h_wr='1') then
740
    r30h <= reg_h_in(7 downto 0);
741
   end if;
742
  end if;
743
 end if;
744
end process;
745
 
746
-- R31 (HIGH)
747
R31:process(cp2)
748
begin
749
 if (cp2='1' and cp2'event) then
750
  if (cp2en='1') then                                                     -- Clock enable        
751
   if register_wr_en(31)='1' then
752
    r31h <= reg_rd_in;
753
   elsif (reg_h_adr(2)='1'and reg_h_wr='1') then
754
    r31h <= reg_h_in(15 downto 8);
755
   end if;
756
  end if;
757
 end if;
758
end process;
759
 
760
end generate;
761
 
762
end RTL;

powered by: WebSVN 2.1.0

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