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

Subversion Repositories avr_hp

[/] [avr_hp/] [trunk/] [rtl/] [rtl_v5_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_rd_wr_cml_2 :  std_logic;
167
signal reg_h_adr_cml_2 :  std_logic_vector ( 2 downto 0 );
168
signal register_file_cml_2 :  register_file_type;
169
signal register_file_cml_1 :  register_file_type;
170
signal r26h_cml_2 :  std_logic_vector ( 7 downto 0 );
171
signal r26h_cml_1 :  std_logic_vector ( 7 downto 0 );
172
signal r27h_cml_2 :  std_logic_vector ( 7 downto 0 );
173
signal r27h_cml_1 :  std_logic_vector ( 7 downto 0 );
174
signal r28h_cml_2 :  std_logic_vector ( 7 downto 0 );
175
signal r28h_cml_1 :  std_logic_vector ( 7 downto 0 );
176
signal r29h_cml_2 :  std_logic_vector ( 7 downto 0 );
177
signal r29h_cml_1 :  std_logic_vector ( 7 downto 0 );
178
signal reg_z_out_cml_out :  std_logic_vector ( 15 downto 0 );
179
signal r30h_cml_2 :  std_logic_vector ( 7 downto 0 );
180
signal r30h_cml_1 :  std_logic_vector ( 7 downto 0 );
181
signal r31h_cml_2 :  std_logic_vector ( 7 downto 0 );
182
signal r31h_cml_1 :  std_logic_vector ( 7 downto 0 );
183
signal sg_rd_decode_cml_1 :  std_logic_vector ( 31 downto 0 );
184
signal sg_tmp_rd_data_15_cml_1 :  std_logic_vector ( 7 downto 0 );
185
signal sg_adr16_predec_cml_2 :  std_logic_vector ( 15 downto 0 );
186
signal sg_tmp_h_data_cml_2 :  std_logic_vector ( 15 downto 0 );
187
 
188
begin
189
 
190
 
191
 
192
process(cp2_cml_1) begin
193
if (cp2_cml_1 = '1' and cp2_cml_1'event) then
194
        reg_rd_adr_cml_1 <= reg_rd_adr;
195
        register_file_cml_1 <= register_file;
196
        r26h_cml_1 <= r26h;
197
        r27h_cml_1 <= r27h;
198
        r28h_cml_1 <= r28h;
199
        r29h_cml_1 <= r29h;
200
        r30h_cml_1 <= r30h;
201
        r31h_cml_1 <= r31h;
202
        sg_rd_decode_cml_1 <= sg_rd_decode;
203
        sg_tmp_rd_data_15_cml_1 <= sg_tmp_rd_data_15;
204
end if;
205
end process;
206
 
207
process(cp2_cml_2) begin
208
if (cp2_cml_2 = '1' and cp2_cml_2'event) then
209
        reg_rd_adr_cml_2 <= reg_rd_adr_cml_1;
210
        reg_rd_wr_cml_2 <= reg_rd_wr;
211
        reg_h_adr_cml_2 <= reg_h_adr;
212
        register_file_cml_2 <= register_file_cml_1;
213
        r26h_cml_2 <= r26h_cml_1;
214
        r27h_cml_2 <= r27h_cml_1;
215
        r28h_cml_2 <= r28h_cml_1;
216
        r29h_cml_2 <= r29h_cml_1;
217
        r30h_cml_2 <= r30h_cml_1;
218
        r31h_cml_2 <= r31h_cml_1;
219
        sg_adr16_predec_cml_2 <= sg_adr16_predec;
220
        sg_tmp_h_data_cml_2 <= sg_tmp_h_data;
221
end if;
222
end process;
223
reg_z_out <= reg_z_out_cml_out;
224
 
225
 
226
write_decode: for i in 0 to 31 generate
227
-- SynEDA CoreMultiplier
228
-- assignment(s): register_wr_en
229
-- replace(s): reg_rd_adr, reg_rd_wr
230
 
231
register_wr_en(i) <= '1' when (i=reg_rd_adr_cml_2 and reg_rd_wr_cml_2='1') else '0';
232
end generate;
233
 
234
rd_mux_decode: for i in 0 to 31 generate
235
sg_rd_decode(i) <= '1' when (reg_rd_adr=i) else '0';
236
end generate;
237
 
238
rd_mux_decode_int: for i in 0 to 31 generate
239
sg_rd_decode_int(i) <= '1' when (reg_rd_adr_int=i) else '0';
240
end generate;
241
 
242
rr_mux_decode: for i in 0 to 31 generate
243
sg_rr_decode(i) <= '1' when (reg_rr_adr=i) else '0';
244
end generate;
245
 
246
-- SynEDA CoreMultiplier
247
-- assignment(s): reg_z_out
248
-- replace(s): r30h, r31h
249
 
250
reg_z_out_cml_out <= r31h_cml_1&r30h_cml_1; -- R31:R30 OUTPUT FOR LPM/ELPM INSTRUCTIONS 
251
 
252
--sg_tmp_rd_data(0) <= register_file(0) when sg_rd_decode(0)='1' else (others=>'0');
253
--read_rd_mux: for i in 1 to 25 generate
254
--sg_tmp_rd_data(i) <= register_file(i) when sg_rd_decode(i)='1' else sg_tmp_rd_data(i-1);
255
--end generate;
256
--sg_tmp_rd_data(26) <= r26h when sg_rd_decode(26)='1' else sg_tmp_rd_data(25);
257
--sg_tmp_rd_data(27) <= r27h when sg_rd_decode(27)='1' else sg_tmp_rd_data(26);
258
--sg_tmp_rd_data(28) <= r28h when sg_rd_decode(28)='1' else sg_tmp_rd_data(27);
259
--sg_tmp_rd_data(29) <= r29h when sg_rd_decode(29)='1' else sg_tmp_rd_data(28);
260
--sg_tmp_rd_data(30) <= r30h when sg_rd_decode(30)='1' else sg_tmp_rd_data(29);
261
--sg_tmp_rd_data(31) <= r31h when sg_rd_decode(31)='1' else sg_tmp_rd_data(30); 
262
--reg_rd_out <= sg_tmp_rd_data(31); 
263
 
264
sg_tmp_rd_data_0 <= register_file(0) when sg_rd_decode(0)='1' else (others=>'0');
265
sg_tmp_rd_data_1 <= register_file(1) when sg_rd_decode(1)='1' else sg_tmp_rd_data_0;
266
sg_tmp_rd_data_2 <= register_file(2) when sg_rd_decode(2)='1' else sg_tmp_rd_data_1;
267
sg_tmp_rd_data_3 <= register_file(3) when sg_rd_decode(3)='1' else sg_tmp_rd_data_2;
268
sg_tmp_rd_data_4 <= register_file(4) when sg_rd_decode(4)='1' else sg_tmp_rd_data_3;
269
sg_tmp_rd_data_5 <= register_file(5) when sg_rd_decode(5)='1' else sg_tmp_rd_data_4;
270
sg_tmp_rd_data_6 <= register_file(6) when sg_rd_decode(6)='1' else sg_tmp_rd_data_5;
271
sg_tmp_rd_data_7 <= register_file(7) when sg_rd_decode(7)='1' else sg_tmp_rd_data_6;
272
sg_tmp_rd_data_8 <= register_file(8) when sg_rd_decode(8)='1' else sg_tmp_rd_data_7;
273
sg_tmp_rd_data_9 <= register_file(9) when sg_rd_decode(9)='1' else sg_tmp_rd_data_8;
274
sg_tmp_rd_data_10 <= register_file(10) when sg_rd_decode(10)='1' else sg_tmp_rd_data_9;
275
sg_tmp_rd_data_11 <= register_file(11) when sg_rd_decode(11)='1' else sg_tmp_rd_data_10;
276
sg_tmp_rd_data_12 <= register_file(12) when sg_rd_decode(12)='1' else sg_tmp_rd_data_11;
277
sg_tmp_rd_data_13 <= register_file(13) when sg_rd_decode(13)='1' else sg_tmp_rd_data_12;
278
sg_tmp_rd_data_14 <= register_file(14) when sg_rd_decode(14)='1' else sg_tmp_rd_data_13;
279
sg_tmp_rd_data_15 <= register_file(15) when sg_rd_decode(15)='1' else sg_tmp_rd_data_14;
280
-- SynEDA CoreMultiplier
281
-- assignment(s): sg_tmp_rd_data_16
282
-- replace(s): register_file, sg_rd_decode, sg_tmp_rd_data_15
283
 
284
sg_tmp_rd_data_16 <= register_file_cml_1(16) when sg_rd_decode_cml_1(16)='1' else sg_tmp_rd_data_15_cml_1;
285
-- SynEDA CoreMultiplier
286
-- assignment(s): sg_tmp_rd_data_17
287
-- replace(s): register_file, sg_rd_decode
288
 
289
sg_tmp_rd_data_17 <= register_file_cml_1(17) when sg_rd_decode_cml_1(17)='1' else sg_tmp_rd_data_16;
290
-- SynEDA CoreMultiplier
291
-- assignment(s): sg_tmp_rd_data_18
292
-- replace(s): register_file, sg_rd_decode
293
 
294
sg_tmp_rd_data_18 <= register_file_cml_1(18) when sg_rd_decode_cml_1(18)='1' else sg_tmp_rd_data_17;
295
-- SynEDA CoreMultiplier
296
-- assignment(s): sg_tmp_rd_data_19
297
-- replace(s): register_file, sg_rd_decode
298
 
299
sg_tmp_rd_data_19 <= register_file_cml_1(19) when sg_rd_decode_cml_1(19)='1' else sg_tmp_rd_data_18;
300
-- SynEDA CoreMultiplier
301
-- assignment(s): sg_tmp_rd_data_20
302
-- replace(s): register_file, sg_rd_decode
303
 
304
sg_tmp_rd_data_20 <= register_file_cml_1(20) when sg_rd_decode_cml_1(20)='1' else sg_tmp_rd_data_19;
305
-- SynEDA CoreMultiplier
306
-- assignment(s): sg_tmp_rd_data_21
307
-- replace(s): register_file, sg_rd_decode
308
 
309
sg_tmp_rd_data_21 <= register_file_cml_1(21) when sg_rd_decode_cml_1(21)='1' else sg_tmp_rd_data_20;
310
-- SynEDA CoreMultiplier
311
-- assignment(s): sg_tmp_rd_data_22
312
-- replace(s): register_file, sg_rd_decode
313
 
314
sg_tmp_rd_data_22 <= register_file_cml_1(22) when sg_rd_decode_cml_1(22)='1' else sg_tmp_rd_data_21;
315
-- SynEDA CoreMultiplier
316
-- assignment(s): sg_tmp_rd_data_23
317
-- replace(s): register_file, sg_rd_decode
318
 
319
sg_tmp_rd_data_23 <= register_file_cml_1(23) when sg_rd_decode_cml_1(23)='1' else sg_tmp_rd_data_22;
320
-- SynEDA CoreMultiplier
321
-- assignment(s): sg_tmp_rd_data_24
322
-- replace(s): register_file, sg_rd_decode
323
 
324
sg_tmp_rd_data_24 <= register_file_cml_1(24) when sg_rd_decode_cml_1(24)='1' else sg_tmp_rd_data_23;
325
-- SynEDA CoreMultiplier
326
-- assignment(s): sg_tmp_rd_data_25
327
-- replace(s): register_file, sg_rd_decode
328
 
329
sg_tmp_rd_data_25 <= register_file_cml_1(25) when sg_rd_decode_cml_1(25)='1' else sg_tmp_rd_data_24;
330
-- SynEDA CoreMultiplier
331
-- assignment(s): sg_tmp_rd_data_26
332
-- replace(s): r26h, sg_rd_decode
333
 
334
sg_tmp_rd_data_26 <= r26h_cml_1 when sg_rd_decode_cml_1(26)='1' else sg_tmp_rd_data_25;
335
-- SynEDA CoreMultiplier
336
-- assignment(s): sg_tmp_rd_data_27
337
-- replace(s): r27h, sg_rd_decode
338
 
339
sg_tmp_rd_data_27 <= r27h_cml_1 when sg_rd_decode_cml_1(27)='1' else sg_tmp_rd_data_26;
340
-- SynEDA CoreMultiplier
341
-- assignment(s): sg_tmp_rd_data_28
342
-- replace(s): r28h, sg_rd_decode
343
 
344
sg_tmp_rd_data_28 <= r28h_cml_1 when sg_rd_decode_cml_1(28)='1' else sg_tmp_rd_data_27;
345
-- SynEDA CoreMultiplier
346
-- assignment(s): sg_tmp_rd_data_29
347
-- replace(s): r29h, sg_rd_decode
348
 
349
sg_tmp_rd_data_29 <= r29h_cml_1 when sg_rd_decode_cml_1(29)='1' else sg_tmp_rd_data_28;
350
-- SynEDA CoreMultiplier
351
-- assignment(s): sg_tmp_rd_data_30
352
-- replace(s): r30h, sg_rd_decode
353
 
354
sg_tmp_rd_data_30 <= r30h_cml_1 when sg_rd_decode_cml_1(30)='1' else sg_tmp_rd_data_29;
355
-- SynEDA CoreMultiplier
356
-- assignment(s): sg_tmp_rd_data_31
357
-- replace(s): r31h, sg_rd_decode
358
 
359
sg_tmp_rd_data_31 <= r31h_cml_1 when sg_rd_decode_cml_1(31)='1' else sg_tmp_rd_data_30;
360
reg_rd_out <= sg_tmp_rd_data_31;
361
 
362
sg_tmp_rd_data_0_int <= register_file(0) when sg_rd_decode_int(0)='1' else (others=>'0');
363
sg_tmp_rd_data_1_int <= register_file(1) when sg_rd_decode_int(1)='1' else sg_tmp_rd_data_0_int;
364
sg_tmp_rd_data_2_int <= register_file(2) when sg_rd_decode_int(2)='1' else sg_tmp_rd_data_1_int;
365
sg_tmp_rd_data_3_int <= register_file(3) when sg_rd_decode_int(3)='1' else sg_tmp_rd_data_2_int;
366
sg_tmp_rd_data_4_int <= register_file(4) when sg_rd_decode_int(4)='1' else sg_tmp_rd_data_3_int;
367
sg_tmp_rd_data_5_int <= register_file(5) when sg_rd_decode_int(5)='1' else sg_tmp_rd_data_4_int;
368
sg_tmp_rd_data_6_int <= register_file(6) when sg_rd_decode_int(6)='1' else sg_tmp_rd_data_5_int;
369
sg_tmp_rd_data_7_int <= register_file(7) when sg_rd_decode_int(7)='1' else sg_tmp_rd_data_6_int;
370
sg_tmp_rd_data_8_int <= register_file(8) when sg_rd_decode_int(8)='1' else sg_tmp_rd_data_7_int;
371
sg_tmp_rd_data_9_int <= register_file(9) when sg_rd_decode_int(9)='1' else sg_tmp_rd_data_8_int;
372
sg_tmp_rd_data_10_int <= register_file(10) when sg_rd_decode_int(10)='1' else sg_tmp_rd_data_9_int;
373
sg_tmp_rd_data_11_int <= register_file(11) when sg_rd_decode_int(11)='1' else sg_tmp_rd_data_10_int;
374
sg_tmp_rd_data_12_int <= register_file(12) when sg_rd_decode_int(12)='1' else sg_tmp_rd_data_11_int;
375
sg_tmp_rd_data_13_int <= register_file(13) when sg_rd_decode_int(13)='1' else sg_tmp_rd_data_12_int;
376
sg_tmp_rd_data_14_int <= register_file(14) when sg_rd_decode_int(14)='1' else sg_tmp_rd_data_13_int;
377
sg_tmp_rd_data_15_int <= register_file(15) when sg_rd_decode_int(15)='1' else sg_tmp_rd_data_14_int;
378
sg_tmp_rd_data_16_int <= register_file(16) when sg_rd_decode_int(16)='1' else sg_tmp_rd_data_15_int;
379
sg_tmp_rd_data_17_int <= register_file(17) when sg_rd_decode_int(17)='1' else sg_tmp_rd_data_16_int;
380
sg_tmp_rd_data_18_int <= register_file(18) when sg_rd_decode_int(18)='1' else sg_tmp_rd_data_17_int;
381
sg_tmp_rd_data_19_int <= register_file(19) when sg_rd_decode_int(19)='1' else sg_tmp_rd_data_18_int;
382
sg_tmp_rd_data_20_int <= register_file(20) when sg_rd_decode_int(20)='1' else sg_tmp_rd_data_19_int;
383
sg_tmp_rd_data_21_int <= register_file(21) when sg_rd_decode_int(21)='1' else sg_tmp_rd_data_20_int;
384
sg_tmp_rd_data_22_int <= register_file(22) when sg_rd_decode_int(22)='1' else sg_tmp_rd_data_21_int;
385
sg_tmp_rd_data_23_int <= register_file(23) when sg_rd_decode_int(23)='1' else sg_tmp_rd_data_22_int;
386
sg_tmp_rd_data_24_int <= register_file(24) when sg_rd_decode_int(24)='1' else sg_tmp_rd_data_23_int;
387
sg_tmp_rd_data_25_int <= register_file(25) when sg_rd_decode_int(25)='1' else sg_tmp_rd_data_24_int;
388
sg_tmp_rd_data_26_int <= r26h when sg_rd_decode_int(26)='1' else sg_tmp_rd_data_25_int;
389
sg_tmp_rd_data_27_int <= r27h when sg_rd_decode_int(27)='1' else sg_tmp_rd_data_26_int;
390
sg_tmp_rd_data_28_int <= r28h when sg_rd_decode_int(28)='1' else sg_tmp_rd_data_27_int;
391
sg_tmp_rd_data_29_int <= r29h when sg_rd_decode_int(29)='1' else sg_tmp_rd_data_28_int;
392
sg_tmp_rd_data_30_int <= r30h when sg_rd_decode_int(30)='1' else sg_tmp_rd_data_29_int;
393
sg_tmp_rd_data_31_int <= r31h when sg_rd_decode_int(31)='1' else sg_tmp_rd_data_30_int;
394
reg_rd_out_int <= sg_tmp_rd_data_31_int;
395
 
396
--sg_tmp_rr_data(0) <= register_file(0) when sg_rr_decode(0)='1' else (others=>'0');
397
--read_rr_mux: for i in 1 to 25 generate
398
--sg_tmp_rr_data(i) <= register_file(i) when sg_rr_decode(i)='1' else sg_tmp_rr_data(i-1);
399
--end generate;
400
--sg_tmp_rr_data() <= register_file() when sg_rr_decode()='1' else sg_tmp_rr_data();
401
--sg_tmp_rr_data(26) <= r26h when sg_rr_decode(26)='1' else sg_tmp_rr_data(25);
402
--sg_tmp_rr_data(27) <= r27h when sg_rr_decode(27)='1' else sg_tmp_rr_data(26);
403
--sg_tmp_rr_data(28) <= r28h when sg_rr_decode(28)='1' else sg_tmp_rr_data(27);
404
--sg_tmp_rr_data(29) <= r29h when sg_rr_decode(29)='1' else sg_tmp_rr_data(28);
405
--sg_tmp_rr_data(30) <= r30h when sg_rr_decode(30)='1' else sg_tmp_rr_data(29);
406
--sg_tmp_rr_data(31) <= r31h when sg_rr_decode(31)='1' else sg_tmp_rr_data(30);
407
--reg_rr_out <= sg_tmp_rr_data(31);
408
 
409
 
410
sg_tmp_rr_data_0 <= register_file(0) when sg_rr_decode(0)='1' else (others=>'0');
411
sg_tmp_rr_data_1 <= register_file(1) when sg_rr_decode(1)='1' else sg_tmp_rr_data_0;
412
sg_tmp_rr_data_2 <= register_file(2) when sg_rr_decode(2)='1' else sg_tmp_rr_data_1;
413
sg_tmp_rr_data_3 <= register_file(3) when sg_rr_decode(3)='1' else sg_tmp_rr_data_2;
414
sg_tmp_rr_data_4 <= register_file(4) when sg_rr_decode(4)='1' else sg_tmp_rr_data_3;
415
sg_tmp_rr_data_5 <= register_file(5) when sg_rr_decode(5)='1' else sg_tmp_rr_data_4;
416
sg_tmp_rr_data_6 <= register_file(6) when sg_rr_decode(6)='1' else sg_tmp_rr_data_5;
417
sg_tmp_rr_data_7 <= register_file(7) when sg_rr_decode(7)='1' else sg_tmp_rr_data_6;
418
sg_tmp_rr_data_8 <= register_file(8) when sg_rr_decode(8)='1' else sg_tmp_rr_data_7;
419
sg_tmp_rr_data_9 <= register_file(9) when sg_rr_decode(9)='1' else sg_tmp_rr_data_8;
420
sg_tmp_rr_data_10 <= register_file(10) when sg_rr_decode(10)='1' else sg_tmp_rr_data_9;
421
sg_tmp_rr_data_11 <= register_file(11) when sg_rr_decode(11)='1' else sg_tmp_rr_data_10;
422
sg_tmp_rr_data_12 <= register_file(12) when sg_rr_decode(12)='1' else sg_tmp_rr_data_11;
423
sg_tmp_rr_data_13 <= register_file(13) when sg_rr_decode(13)='1' else sg_tmp_rr_data_12;
424
sg_tmp_rr_data_14 <= register_file(14) when sg_rr_decode(14)='1' else sg_tmp_rr_data_13;
425
sg_tmp_rr_data_15 <= register_file(15) when sg_rr_decode(15)='1' else sg_tmp_rr_data_14;
426
sg_tmp_rr_data_16 <= register_file(16) when sg_rr_decode(16)='1' else sg_tmp_rr_data_15;
427
sg_tmp_rr_data_17 <= register_file(17) when sg_rr_decode(17)='1' else sg_tmp_rr_data_16;
428
sg_tmp_rr_data_18 <= register_file(18) when sg_rr_decode(18)='1' else sg_tmp_rr_data_17;
429
sg_tmp_rr_data_19 <= register_file(19) when sg_rr_decode(19)='1' else sg_tmp_rr_data_18;
430
sg_tmp_rr_data_20 <= register_file(20) when sg_rr_decode(20)='1' else sg_tmp_rr_data_19;
431
sg_tmp_rr_data_21 <= register_file(21) when sg_rr_decode(21)='1' else sg_tmp_rr_data_20;
432
sg_tmp_rr_data_22 <= register_file(22) when sg_rr_decode(22)='1' else sg_tmp_rr_data_21;
433
sg_tmp_rr_data_23 <= register_file(23) when sg_rr_decode(23)='1' else sg_tmp_rr_data_22;
434
sg_tmp_rr_data_24 <= register_file(24) when sg_rr_decode(24)='1' else sg_tmp_rr_data_23;
435
sg_tmp_rr_data_25 <= register_file(25) when sg_rr_decode(25)='1' else sg_tmp_rr_data_24;
436
sg_tmp_rr_data_26 <= r26h when sg_rr_decode(26)='1' else sg_tmp_rr_data_25;
437
sg_tmp_rr_data_27 <= r27h when sg_rr_decode(27)='1' else sg_tmp_rr_data_26;
438
sg_tmp_rr_data_28 <= r28h when sg_rr_decode(28)='1' else sg_tmp_rr_data_27;
439
sg_tmp_rr_data_29 <= r29h when sg_rr_decode(29)='1' else sg_tmp_rr_data_28;
440
sg_tmp_rr_data_30 <= r30h when sg_rr_decode(30)='1' else sg_tmp_rr_data_29;
441
sg_tmp_rr_data_31 <= r31h when sg_rr_decode(31)='1' else sg_tmp_rr_data_30;
442
reg_rr_out <= sg_tmp_rr_data_31;
443
 
444
 
445
h_dat_mux_l:for i in 0 to 7 generate
446
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));
447
end generate;
448
h_dat_mux_h:for i in 8 to 15 generate
449
-- SynEDA CoreMultiplier
450
-- assignment(s): sg_tmp_h_data
451
-- replace(s): r26h, r27h, r28h, r29h, r30h, r31h
452
 
453
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));
454
end generate;
455
 
456
 
457
-- SynEDA CoreMultiplier
458
-- assignment(s): sg_adr16_postinc
459
-- replace(s): sg_tmp_h_data
460
 
461
sg_adr16_postinc <= sg_tmp_h_data_cml_2 +1;
462
sg_adr16_predec  <= sg_tmp_h_data -1;
463
-- OUTPUT TO THE ADDRESS BUS
464
reg_h_out <= sg_adr16_predec when (pre_dec='1') else           -- PREDECREMENT
465
             sg_tmp_h_data;            -- NO PREDECREMENT
466
 
467
-- SynEDA CoreMultiplier
468
-- assignment(s): reg_h_in
469
-- replace(s): sg_adr16_predec
470
 
471
-- TO REGISTERS
472
reg_h_in  <= sg_adr16_postinc when (post_inc='1') else         -- POST INC 
473
             sg_adr16_predec_cml_2;                                  -- PRE DEC
474
 
475
-- Register file with global reset (for simulation)
476
 
477
RegFileWithRst:if CResetRegFile generate
478
 
479
-- SynEDA CoreMultiplier
480
-- assignment(s): register_file
481
-- replace(s): register_file
482
 
483
R0_R25:process(cp2,ireset)
484
begin
485
 if ireset='0' then
486
  for i in 0 to 25 loop
487
   register_file(i) <= (others =>'0');
488
  end loop;
489
 elsif (cp2='1' and cp2'event) then register_file <= register_file_cml_2;
490
  if (cp2en='1') then                                                     -- Clock enable        
491
   for i in 0 to 25 loop
492
    if register_wr_en(i)='1' then
493
     register_file(i) <= reg_rd_in;
494
    end if;
495
   end loop;
496
  end if;
497
 end if;
498
end process;
499
 
500
 
501
-- SynEDA CoreMultiplier
502
-- assignment(s): r26h
503
-- replace(s): reg_h_adr, r26h
504
 
505
-- R26 (LOW)
506
R26:process(cp2,ireset)
507
begin
508
 if ireset='0' then
509
  r26h <= (others =>'0');
510
 elsif (cp2='1' and cp2'event) then r26h <= r26h_cml_2;
511
  if (cp2en='1') then                                                     -- Clock enable        
512
   if register_wr_en(26)='1' then
513
    r26h <= reg_rd_in;
514
   elsif (reg_h_adr_cml_2(0)='1'and reg_h_wr='1') then
515
    r26h <= reg_h_in(7 downto 0);
516
   end if;
517
  end if;
518
 end if;
519
end process;
520
 
521
-- SynEDA CoreMultiplier
522
-- assignment(s): r27h
523
-- replace(s): reg_h_adr, r27h
524
 
525
-- R27 (HIGH)
526
R27:process(cp2,ireset)
527
begin
528
 if ireset='0' then
529
  r27h <= (others =>'0');
530
 elsif (cp2='1' and cp2'event) then r27h <= r27h_cml_2;
531
  if (cp2en='1') then                                                     -- Clock enable        
532
   if register_wr_en(27)='1' then
533
    r27h <= reg_rd_in;
534
   elsif (reg_h_adr_cml_2(0)='1'and reg_h_wr='1') then
535
    r27h <= reg_h_in(15 downto 8);
536
   end if;
537
  end if;
538
 end if;
539
end process;
540
 
541
-- SynEDA CoreMultiplier
542
-- assignment(s): r28h
543
-- replace(s): reg_h_adr, r28h
544
 
545
-- R28 (LOW)
546
R28:process(cp2,ireset)
547
begin
548
 if ireset='0' then
549
  r28h <= (others =>'0');
550
 elsif (cp2='1' and cp2'event) then r28h <= r28h_cml_2;
551
  if (cp2en='1') then                                                     -- Clock enable        
552
   if register_wr_en(28)='1' then
553
    r28h <= reg_rd_in;
554
   elsif (reg_h_adr_cml_2(1)='1'and reg_h_wr='1') then
555
    r28h <= reg_h_in(7 downto 0);
556
   end if;
557
  end if;
558
 end if;
559
end process;
560
 
561
-- SynEDA CoreMultiplier
562
-- assignment(s): r29h
563
-- replace(s): reg_h_adr, r29h
564
 
565
-- R29 (HIGH)
566
R29:process(cp2,ireset)
567
begin
568
 if ireset='0' then
569
  r29h <= (others =>'0');
570
 elsif (cp2='1' and cp2'event) then r29h <= r29h_cml_2;
571
  if (cp2en='1') then                                                     -- Clock enable        
572
   if register_wr_en(29)='1' then
573
    r29h <= reg_rd_in;
574
   elsif (reg_h_adr_cml_2(1)='1'and reg_h_wr='1') then
575
    r29h <= reg_h_in(15 downto 8);
576
   end if;
577
  end if;
578
 end if;
579
end process;
580
 
581
-- SynEDA CoreMultiplier
582
-- assignment(s): r30h
583
-- replace(s): reg_h_adr, r30h
584
 
585
-- R30 (LOW)
586
R30:process(cp2,ireset)
587
begin
588
 if ireset='0' then
589
  r30h <= (others =>'0');
590
 elsif (cp2='1' and cp2'event) then r30h <= r30h_cml_2;
591
  if (cp2en='1') then                                                     -- Clock enable        
592
   if register_wr_en(30)='1' then
593
    r30h <= reg_rd_in;
594
   elsif (reg_h_adr_cml_2(2)='1'and reg_h_wr='1') then
595
    r30h <= reg_h_in(7 downto 0);
596
   end if;
597
  end if;
598
 end if;
599
end process;
600
 
601
-- SynEDA CoreMultiplier
602
-- assignment(s): r31h
603
-- replace(s): reg_h_adr, r31h
604
 
605
-- R31 (HIGH)
606
R31:process(cp2,ireset)
607
begin
608
 if ireset='0' then
609
  r31h <= (others =>'0');
610
 elsif (cp2='1' and cp2'event) then r31h <= r31h_cml_2;
611
  if (cp2en='1') then                                                     -- Clock enable        
612
   if register_wr_en(31)='1' then
613
    r31h <= reg_rd_in;
614
   elsif (reg_h_adr_cml_2(2)='1'and reg_h_wr='1') then
615
    r31h <= reg_h_in(15 downto 8);
616
   end if;
617
  end if;
618
 end if;
619
end process;
620
 
621
end generate;
622
 
623
 
624
-- Register file without global reset (for synthesis)
625
 
626
RegFileWithoutRst:if not CResetRegFile generate
627
 
628
R0_R25:process(cp2)
629
begin
630
 if (cp2='1' and cp2'event) then
631
  if (cp2en='1') then                                                     -- Clock enable        
632
   for i in 0 to 25 loop
633
    if register_wr_en(i)='1' then
634
     register_file(i) <= reg_rd_in;
635
    end if;
636
   end loop;
637
  end if;
638
 end if;
639
end process;
640
 
641
 
642
-- R26 (LOW)
643
R26:process(cp2)
644
begin
645
 if (cp2='1' and cp2'event) then
646
  if (cp2en='1') then                                                     -- Clock enable        
647
   if register_wr_en(26)='1' then
648
    r26h <= reg_rd_in;
649
   elsif (reg_h_adr(0)='1'and reg_h_wr='1') then
650
    r26h <= reg_h_in(7 downto 0);
651
   end if;
652
  end if;
653
 end if;
654
end process;
655
 
656
-- R27 (HIGH)
657
R27:process(cp2)
658
begin
659
 if (cp2='1' and cp2'event) then
660
  if (cp2en='1') then                                                     -- Clock enable        
661
   if register_wr_en(27)='1' then
662
    r27h <= reg_rd_in;
663
   elsif (reg_h_adr(0)='1'and reg_h_wr='1') then
664
    r27h <= reg_h_in(15 downto 8);
665
   end if;
666
  end if;
667
 end if;
668
end process;
669
 
670
-- R28 (LOW)
671
R28:process(cp2)
672
begin
673
 if (cp2='1' and cp2'event) then
674
  if (cp2en='1') then                                                     -- Clock enable        
675
   if register_wr_en(28)='1' then
676
    r28h <= reg_rd_in;
677
   elsif (reg_h_adr(1)='1'and reg_h_wr='1') then
678
    r28h <= reg_h_in(7 downto 0);
679
   end if;
680
  end if;
681
 end if;
682
end process;
683
 
684
-- R29 (HIGH)
685
R29:process(cp2)
686
begin
687
 if (cp2='1' and cp2'event) then
688
  if (cp2en='1') then                                                     -- Clock enable        
689
   if register_wr_en(29)='1' then
690
    r29h <= reg_rd_in;
691
   elsif (reg_h_adr(1)='1'and reg_h_wr='1') then
692
    r29h <= reg_h_in(15 downto 8);
693
   end if;
694
  end if;
695
 end if;
696
end process;
697
 
698
-- R30 (LOW)
699
R30:process(cp2)
700
begin
701
 if (cp2='1' and cp2'event) then
702
  if (cp2en='1') then                                                     -- Clock enable        
703
   if register_wr_en(30)='1' then
704
    r30h <= reg_rd_in;
705
   elsif (reg_h_adr(2)='1'and reg_h_wr='1') then
706
    r30h <= reg_h_in(7 downto 0);
707
   end if;
708
  end if;
709
 end if;
710
end process;
711
 
712
-- R31 (HIGH)
713
R31:process(cp2)
714
begin
715
 if (cp2='1' and cp2'event) then
716
  if (cp2en='1') then                                                     -- Clock enable        
717
   if register_wr_en(31)='1' then
718
    r31h <= reg_rd_in;
719
   elsif (reg_h_adr(2)='1'and reg_h_wr='1') then
720
    r31h <= reg_h_in(15 downto 8);
721
   end if;
722
  end if;
723
 end if;
724
end process;
725
 
726
end generate;
727
 
728
end RTL;

powered by: WebSVN 2.1.0

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