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

Subversion Repositories avr_hp

[/] [avr_hp/] [trunk/] [rtl/] [rtl_orig/] [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 is port (
15
                                                  --Clock and reset
16
                                              cp2         : in  std_logic;
17
                                                  cp2en       : in  std_logic;
18
                          ireset      : in  std_logic;
19
 
20
                          reg_rd_in   : in  std_logic_vector(7 downto 0);
21
                          reg_rd_out  : out std_logic_vector(7 downto 0);
22
                          reg_rd_out_int  : out std_logic_vector(7 downto 0);
23
                          reg_rd_adr  : in  std_logic_vector(4 downto 0);
24
                          reg_rd_adr_int      : in std_logic_vector  (4 downto 0);
25
                          reg_rr_out  : out std_logic_vector(7 downto 0);
26
                          reg_rr_adr  : in  std_logic_vector(4 downto 0);
27
                          reg_rd_wr   : in  std_logic;
28
 
29
                          post_inc    : in  std_logic; -- POST INCREMENT FOR LD/ST INSTRUCTIONS
30
                          pre_dec     : in  std_logic; -- PRE DECREMENT FOR LD/ST INSTRUCTIONS
31
                          reg_h_wr    : in  std_logic;
32
                          reg_h_out   : out std_logic_vector(15 downto 0);
33
                          reg_h_adr   : in  std_logic_vector(2 downto 0);  -- x,y,z
34
                                  reg_z_out   : out std_logic_vector(15 downto 0) -- OUTPUT OF R31:R30 FOR LPM/ELPM/IJMP INSTRUCTIONS
35
                          );
36
end reg_file;
37
 
38
architecture RTL of reg_file is
39
 
40
type register_file_type is array(0 to 25) of std_logic_vector(7 downto 0);
41
type register_mux_type is array(0 to 31) of std_logic_vector(7 downto 0);
42
signal register_file : register_file_type;
43
signal r26h : std_logic_vector(7 downto 0);
44
signal r27h : std_logic_vector(7 downto 0);
45
signal r28h : std_logic_vector(7 downto 0);
46
signal r29h : std_logic_vector(7 downto 0);
47
signal r30h : std_logic_vector(7 downto 0);
48
signal r31h : std_logic_vector(7 downto 0);
49
 
50
signal register_wr_en  : std_logic_vector(31 downto 0);
51
 
52
signal sg_rd_decode   : std_logic_vector (31 downto 0);
53
signal sg_rd_decode_int   : std_logic_vector (31 downto 0);
54
signal sg_rr_decode   : std_logic_vector (31 downto 0);
55
 
56
--signal sg_tmp_rd_data : register_mux_type;
57
signal sg_tmp_rd_data_0 : std_logic_vector(7 downto 0);
58
signal sg_tmp_rd_data_1 : std_logic_vector(7 downto 0);
59
signal sg_tmp_rd_data_2 : std_logic_vector(7 downto 0);
60
signal sg_tmp_rd_data_3 : std_logic_vector(7 downto 0);
61
signal sg_tmp_rd_data_4 : std_logic_vector(7 downto 0);
62
signal sg_tmp_rd_data_5 : std_logic_vector(7 downto 0);
63
signal sg_tmp_rd_data_6 : std_logic_vector(7 downto 0);
64
signal sg_tmp_rd_data_7 : std_logic_vector(7 downto 0);
65
signal sg_tmp_rd_data_8 : std_logic_vector(7 downto 0);
66
signal sg_tmp_rd_data_9 : std_logic_vector(7 downto 0);
67
signal sg_tmp_rd_data_10 : std_logic_vector(7 downto 0);
68
signal sg_tmp_rd_data_11 : std_logic_vector(7 downto 0);
69
signal sg_tmp_rd_data_12 : std_logic_vector(7 downto 0);
70
signal sg_tmp_rd_data_13 : std_logic_vector(7 downto 0);
71
signal sg_tmp_rd_data_14 : std_logic_vector(7 downto 0);
72
signal sg_tmp_rd_data_15 : std_logic_vector(7 downto 0);
73
signal sg_tmp_rd_data_16 : std_logic_vector(7 downto 0);
74
signal sg_tmp_rd_data_17 : std_logic_vector(7 downto 0);
75
signal sg_tmp_rd_data_18 : std_logic_vector(7 downto 0);
76
signal sg_tmp_rd_data_19 : std_logic_vector(7 downto 0);
77
signal sg_tmp_rd_data_20 : std_logic_vector(7 downto 0);
78
signal sg_tmp_rd_data_21 : std_logic_vector(7 downto 0);
79
signal sg_tmp_rd_data_22 : std_logic_vector(7 downto 0);
80
signal sg_tmp_rd_data_23 : std_logic_vector(7 downto 0);
81
signal sg_tmp_rd_data_24 : std_logic_vector(7 downto 0);
82
signal sg_tmp_rd_data_25 : std_logic_vector(7 downto 0);
83
signal sg_tmp_rd_data_26 : std_logic_vector(7 downto 0);
84
signal sg_tmp_rd_data_27 : std_logic_vector(7 downto 0);
85
signal sg_tmp_rd_data_28 : std_logic_vector(7 downto 0);
86
signal sg_tmp_rd_data_29 : std_logic_vector(7 downto 0);
87
signal sg_tmp_rd_data_30 : std_logic_vector(7 downto 0);
88
signal sg_tmp_rd_data_31 : std_logic_vector(7 downto 0);
89
signal sg_tmp_rd_data_0_int : std_logic_vector(7 downto 0);
90
signal sg_tmp_rd_data_1_int : std_logic_vector(7 downto 0);
91
signal sg_tmp_rd_data_2_int : std_logic_vector(7 downto 0);
92
signal sg_tmp_rd_data_3_int : std_logic_vector(7 downto 0);
93
signal sg_tmp_rd_data_4_int : std_logic_vector(7 downto 0);
94
signal sg_tmp_rd_data_5_int : std_logic_vector(7 downto 0);
95
signal sg_tmp_rd_data_6_int : std_logic_vector(7 downto 0);
96
signal sg_tmp_rd_data_7_int : std_logic_vector(7 downto 0);
97
signal sg_tmp_rd_data_8_int : std_logic_vector(7 downto 0);
98
signal sg_tmp_rd_data_9_int : std_logic_vector(7 downto 0);
99
signal sg_tmp_rd_data_10_int : std_logic_vector(7 downto 0);
100
signal sg_tmp_rd_data_11_int : std_logic_vector(7 downto 0);
101
signal sg_tmp_rd_data_12_int : std_logic_vector(7 downto 0);
102
signal sg_tmp_rd_data_13_int : std_logic_vector(7 downto 0);
103
signal sg_tmp_rd_data_14_int : std_logic_vector(7 downto 0);
104
signal sg_tmp_rd_data_15_int : std_logic_vector(7 downto 0);
105
signal sg_tmp_rd_data_16_int : std_logic_vector(7 downto 0);
106
signal sg_tmp_rd_data_17_int : std_logic_vector(7 downto 0);
107
signal sg_tmp_rd_data_18_int : std_logic_vector(7 downto 0);
108
signal sg_tmp_rd_data_19_int : std_logic_vector(7 downto 0);
109
signal sg_tmp_rd_data_20_int : std_logic_vector(7 downto 0);
110
signal sg_tmp_rd_data_21_int : std_logic_vector(7 downto 0);
111
signal sg_tmp_rd_data_22_int : std_logic_vector(7 downto 0);
112
signal sg_tmp_rd_data_23_int : std_logic_vector(7 downto 0);
113
signal sg_tmp_rd_data_24_int : std_logic_vector(7 downto 0);
114
signal sg_tmp_rd_data_25_int : std_logic_vector(7 downto 0);
115
signal sg_tmp_rd_data_26_int : std_logic_vector(7 downto 0);
116
signal sg_tmp_rd_data_27_int : std_logic_vector(7 downto 0);
117
signal sg_tmp_rd_data_28_int : std_logic_vector(7 downto 0);
118
signal sg_tmp_rd_data_29_int : std_logic_vector(7 downto 0);
119
signal sg_tmp_rd_data_30_int : std_logic_vector(7 downto 0);
120
signal sg_tmp_rd_data_31_int : std_logic_vector(7 downto 0);
121
--signal sg_tmp_rr_data : register_mux_type;
122
signal sg_tmp_rr_data_0 : std_logic_vector(7 downto 0);
123
signal sg_tmp_rr_data_1 : std_logic_vector(7 downto 0);
124
signal sg_tmp_rr_data_2 : std_logic_vector(7 downto 0);
125
signal sg_tmp_rr_data_3 : std_logic_vector(7 downto 0);
126
signal sg_tmp_rr_data_4 : std_logic_vector(7 downto 0);
127
signal sg_tmp_rr_data_5 : std_logic_vector(7 downto 0);
128
signal sg_tmp_rr_data_6 : std_logic_vector(7 downto 0);
129
signal sg_tmp_rr_data_7 : std_logic_vector(7 downto 0);
130
signal sg_tmp_rr_data_8 : std_logic_vector(7 downto 0);
131
signal sg_tmp_rr_data_9 : std_logic_vector(7 downto 0);
132
signal sg_tmp_rr_data_10 : std_logic_vector(7 downto 0);
133
signal sg_tmp_rr_data_11 : std_logic_vector(7 downto 0);
134
signal sg_tmp_rr_data_12 : std_logic_vector(7 downto 0);
135
signal sg_tmp_rr_data_13 : std_logic_vector(7 downto 0);
136
signal sg_tmp_rr_data_14 : std_logic_vector(7 downto 0);
137
signal sg_tmp_rr_data_15 : std_logic_vector(7 downto 0);
138
signal sg_tmp_rr_data_16 : std_logic_vector(7 downto 0);
139
signal sg_tmp_rr_data_17 : std_logic_vector(7 downto 0);
140
signal sg_tmp_rr_data_18 : std_logic_vector(7 downto 0);
141
signal sg_tmp_rr_data_19 : std_logic_vector(7 downto 0);
142
signal sg_tmp_rr_data_20 : std_logic_vector(7 downto 0);
143
signal sg_tmp_rr_data_21 : std_logic_vector(7 downto 0);
144
signal sg_tmp_rr_data_22 : std_logic_vector(7 downto 0);
145
signal sg_tmp_rr_data_23 : std_logic_vector(7 downto 0);
146
signal sg_tmp_rr_data_24 : std_logic_vector(7 downto 0);
147
signal sg_tmp_rr_data_25 : std_logic_vector(7 downto 0);
148
signal sg_tmp_rr_data_26 : std_logic_vector(7 downto 0);
149
signal sg_tmp_rr_data_27 : std_logic_vector(7 downto 0);
150
signal sg_tmp_rr_data_28 : std_logic_vector(7 downto 0);
151
signal sg_tmp_rr_data_29 : std_logic_vector(7 downto 0);
152
signal sg_tmp_rr_data_30 : std_logic_vector(7 downto 0);
153
signal sg_tmp_rr_data_31 : std_logic_vector(7 downto 0);
154
 
155
signal sg_adr16_postinc : std_logic_vector (15 downto 0);
156
signal sg_adr16_predec  : std_logic_vector (15 downto 0);
157
signal reg_h_in         : std_logic_vector  (15 downto 0);
158
 
159
signal sg_tmp_h_data    : std_logic_vector  (15 downto 0);
160
 
161
begin
162
 
163
write_decode: for i in 0 to 31 generate
164
register_wr_en(i) <= '1' when (i=reg_rd_adr and reg_rd_wr='1') else '0';
165
end generate;
166
 
167
rd_mux_decode: for i in 0 to 31 generate
168
sg_rd_decode(i) <= '1' when (reg_rd_adr=i) else '0';
169
end generate;
170
 
171
rd_mux_decode_int: for i in 0 to 31 generate
172
sg_rd_decode_int(i) <= '1' when (reg_rd_adr_int=i) else '0';
173
end generate;
174
 
175
rr_mux_decode: for i in 0 to 31 generate
176
sg_rr_decode(i) <= '1' when (reg_rr_adr=i) else '0';
177
end generate;
178
 
179
reg_z_out <= r31h&r30h; -- R31:R30 OUTPUT FOR LPM/ELPM INSTRUCTIONS 
180
 
181
--sg_tmp_rd_data(0) <= register_file(0) when sg_rd_decode(0)='1' else (others=>'0');
182
--read_rd_mux: for i in 1 to 25 generate
183
--sg_tmp_rd_data(i) <= register_file(i) when sg_rd_decode(i)='1' else sg_tmp_rd_data(i-1);
184
--end generate;
185
--sg_tmp_rd_data(26) <= r26h when sg_rd_decode(26)='1' else sg_tmp_rd_data(25);
186
--sg_tmp_rd_data(27) <= r27h when sg_rd_decode(27)='1' else sg_tmp_rd_data(26);
187
--sg_tmp_rd_data(28) <= r28h when sg_rd_decode(28)='1' else sg_tmp_rd_data(27);
188
--sg_tmp_rd_data(29) <= r29h when sg_rd_decode(29)='1' else sg_tmp_rd_data(28);
189
--sg_tmp_rd_data(30) <= r30h when sg_rd_decode(30)='1' else sg_tmp_rd_data(29);
190
--sg_tmp_rd_data(31) <= r31h when sg_rd_decode(31)='1' else sg_tmp_rd_data(30); 
191
--reg_rd_out <= sg_tmp_rd_data(31); 
192
 
193
sg_tmp_rd_data_0 <= register_file(0) when sg_rd_decode(0)='1' else (others=>'0');
194
sg_tmp_rd_data_1 <= register_file(1) when sg_rd_decode(1)='1' else sg_tmp_rd_data_0;
195
sg_tmp_rd_data_2 <= register_file(2) when sg_rd_decode(2)='1' else sg_tmp_rd_data_1;
196
sg_tmp_rd_data_3 <= register_file(3) when sg_rd_decode(3)='1' else sg_tmp_rd_data_2;
197
sg_tmp_rd_data_4 <= register_file(4) when sg_rd_decode(4)='1' else sg_tmp_rd_data_3;
198
sg_tmp_rd_data_5 <= register_file(5) when sg_rd_decode(5)='1' else sg_tmp_rd_data_4;
199
sg_tmp_rd_data_6 <= register_file(6) when sg_rd_decode(6)='1' else sg_tmp_rd_data_5;
200
sg_tmp_rd_data_7 <= register_file(7) when sg_rd_decode(7)='1' else sg_tmp_rd_data_6;
201
sg_tmp_rd_data_8 <= register_file(8) when sg_rd_decode(8)='1' else sg_tmp_rd_data_7;
202
sg_tmp_rd_data_9 <= register_file(9) when sg_rd_decode(9)='1' else sg_tmp_rd_data_8;
203
sg_tmp_rd_data_10 <= register_file(10) when sg_rd_decode(10)='1' else sg_tmp_rd_data_9;
204
sg_tmp_rd_data_11 <= register_file(11) when sg_rd_decode(11)='1' else sg_tmp_rd_data_10;
205
sg_tmp_rd_data_12 <= register_file(12) when sg_rd_decode(12)='1' else sg_tmp_rd_data_11;
206
sg_tmp_rd_data_13 <= register_file(13) when sg_rd_decode(13)='1' else sg_tmp_rd_data_12;
207
sg_tmp_rd_data_14 <= register_file(14) when sg_rd_decode(14)='1' else sg_tmp_rd_data_13;
208
sg_tmp_rd_data_15 <= register_file(15) when sg_rd_decode(15)='1' else sg_tmp_rd_data_14;
209
sg_tmp_rd_data_16 <= register_file(16) when sg_rd_decode(16)='1' else sg_tmp_rd_data_15;
210
sg_tmp_rd_data_17 <= register_file(17) when sg_rd_decode(17)='1' else sg_tmp_rd_data_16;
211
sg_tmp_rd_data_18 <= register_file(18) when sg_rd_decode(18)='1' else sg_tmp_rd_data_17;
212
sg_tmp_rd_data_19 <= register_file(19) when sg_rd_decode(19)='1' else sg_tmp_rd_data_18;
213
sg_tmp_rd_data_20 <= register_file(20) when sg_rd_decode(20)='1' else sg_tmp_rd_data_19;
214
sg_tmp_rd_data_21 <= register_file(21) when sg_rd_decode(21)='1' else sg_tmp_rd_data_20;
215
sg_tmp_rd_data_22 <= register_file(22) when sg_rd_decode(22)='1' else sg_tmp_rd_data_21;
216
sg_tmp_rd_data_23 <= register_file(23) when sg_rd_decode(23)='1' else sg_tmp_rd_data_22;
217
sg_tmp_rd_data_24 <= register_file(24) when sg_rd_decode(24)='1' else sg_tmp_rd_data_23;
218
sg_tmp_rd_data_25 <= register_file(25) when sg_rd_decode(25)='1' else sg_tmp_rd_data_24;
219
sg_tmp_rd_data_26 <= r26h when sg_rd_decode(26)='1' else sg_tmp_rd_data_25;
220
sg_tmp_rd_data_27 <= r27h when sg_rd_decode(27)='1' else sg_tmp_rd_data_26;
221
sg_tmp_rd_data_28 <= r28h when sg_rd_decode(28)='1' else sg_tmp_rd_data_27;
222
sg_tmp_rd_data_29 <= r29h when sg_rd_decode(29)='1' else sg_tmp_rd_data_28;
223
sg_tmp_rd_data_30 <= r30h when sg_rd_decode(30)='1' else sg_tmp_rd_data_29;
224
sg_tmp_rd_data_31 <= r31h when sg_rd_decode(31)='1' else sg_tmp_rd_data_30;
225
reg_rd_out <= sg_tmp_rd_data_31;
226
 
227
sg_tmp_rd_data_0_int <= register_file(0) when sg_rd_decode_int(0)='1' else (others=>'0');
228
sg_tmp_rd_data_1_int <= register_file(1) when sg_rd_decode_int(1)='1' else sg_tmp_rd_data_0_int;
229
sg_tmp_rd_data_2_int <= register_file(2) when sg_rd_decode_int(2)='1' else sg_tmp_rd_data_1_int;
230
sg_tmp_rd_data_3_int <= register_file(3) when sg_rd_decode_int(3)='1' else sg_tmp_rd_data_2_int;
231
sg_tmp_rd_data_4_int <= register_file(4) when sg_rd_decode_int(4)='1' else sg_tmp_rd_data_3_int;
232
sg_tmp_rd_data_5_int <= register_file(5) when sg_rd_decode_int(5)='1' else sg_tmp_rd_data_4_int;
233
sg_tmp_rd_data_6_int <= register_file(6) when sg_rd_decode_int(6)='1' else sg_tmp_rd_data_5_int;
234
sg_tmp_rd_data_7_int <= register_file(7) when sg_rd_decode_int(7)='1' else sg_tmp_rd_data_6_int;
235
sg_tmp_rd_data_8_int <= register_file(8) when sg_rd_decode_int(8)='1' else sg_tmp_rd_data_7_int;
236
sg_tmp_rd_data_9_int <= register_file(9) when sg_rd_decode_int(9)='1' else sg_tmp_rd_data_8_int;
237
sg_tmp_rd_data_10_int <= register_file(10) when sg_rd_decode_int(10)='1' else sg_tmp_rd_data_9_int;
238
sg_tmp_rd_data_11_int <= register_file(11) when sg_rd_decode_int(11)='1' else sg_tmp_rd_data_10_int;
239
sg_tmp_rd_data_12_int <= register_file(12) when sg_rd_decode_int(12)='1' else sg_tmp_rd_data_11_int;
240
sg_tmp_rd_data_13_int <= register_file(13) when sg_rd_decode_int(13)='1' else sg_tmp_rd_data_12_int;
241
sg_tmp_rd_data_14_int <= register_file(14) when sg_rd_decode_int(14)='1' else sg_tmp_rd_data_13_int;
242
sg_tmp_rd_data_15_int <= register_file(15) when sg_rd_decode_int(15)='1' else sg_tmp_rd_data_14_int;
243
sg_tmp_rd_data_16_int <= register_file(16) when sg_rd_decode_int(16)='1' else sg_tmp_rd_data_15_int;
244
sg_tmp_rd_data_17_int <= register_file(17) when sg_rd_decode_int(17)='1' else sg_tmp_rd_data_16_int;
245
sg_tmp_rd_data_18_int <= register_file(18) when sg_rd_decode_int(18)='1' else sg_tmp_rd_data_17_int;
246
sg_tmp_rd_data_19_int <= register_file(19) when sg_rd_decode_int(19)='1' else sg_tmp_rd_data_18_int;
247
sg_tmp_rd_data_20_int <= register_file(20) when sg_rd_decode_int(20)='1' else sg_tmp_rd_data_19_int;
248
sg_tmp_rd_data_21_int <= register_file(21) when sg_rd_decode_int(21)='1' else sg_tmp_rd_data_20_int;
249
sg_tmp_rd_data_22_int <= register_file(22) when sg_rd_decode_int(22)='1' else sg_tmp_rd_data_21_int;
250
sg_tmp_rd_data_23_int <= register_file(23) when sg_rd_decode_int(23)='1' else sg_tmp_rd_data_22_int;
251
sg_tmp_rd_data_24_int <= register_file(24) when sg_rd_decode_int(24)='1' else sg_tmp_rd_data_23_int;
252
sg_tmp_rd_data_25_int <= register_file(25) when sg_rd_decode_int(25)='1' else sg_tmp_rd_data_24_int;
253
sg_tmp_rd_data_26_int <= r26h when sg_rd_decode_int(26)='1' else sg_tmp_rd_data_25_int;
254
sg_tmp_rd_data_27_int <= r27h when sg_rd_decode_int(27)='1' else sg_tmp_rd_data_26_int;
255
sg_tmp_rd_data_28_int <= r28h when sg_rd_decode_int(28)='1' else sg_tmp_rd_data_27_int;
256
sg_tmp_rd_data_29_int <= r29h when sg_rd_decode_int(29)='1' else sg_tmp_rd_data_28_int;
257
sg_tmp_rd_data_30_int <= r30h when sg_rd_decode_int(30)='1' else sg_tmp_rd_data_29_int;
258
sg_tmp_rd_data_31_int <= r31h when sg_rd_decode_int(31)='1' else sg_tmp_rd_data_30_int;
259
reg_rd_out_int <= sg_tmp_rd_data_31_int;
260
 
261
--sg_tmp_rr_data(0) <= register_file(0) when sg_rr_decode(0)='1' else (others=>'0');
262
--read_rr_mux: for i in 1 to 25 generate
263
--sg_tmp_rr_data(i) <= register_file(i) when sg_rr_decode(i)='1' else sg_tmp_rr_data(i-1);
264
--end generate;
265
--sg_tmp_rr_data() <= register_file() when sg_rr_decode()='1' else sg_tmp_rr_data();
266
--sg_tmp_rr_data(26) <= r26h when sg_rr_decode(26)='1' else sg_tmp_rr_data(25);
267
--sg_tmp_rr_data(27) <= r27h when sg_rr_decode(27)='1' else sg_tmp_rr_data(26);
268
--sg_tmp_rr_data(28) <= r28h when sg_rr_decode(28)='1' else sg_tmp_rr_data(27);
269
--sg_tmp_rr_data(29) <= r29h when sg_rr_decode(29)='1' else sg_tmp_rr_data(28);
270
--sg_tmp_rr_data(30) <= r30h when sg_rr_decode(30)='1' else sg_tmp_rr_data(29);
271
--sg_tmp_rr_data(31) <= r31h when sg_rr_decode(31)='1' else sg_tmp_rr_data(30);
272
--reg_rr_out <= sg_tmp_rr_data(31);
273
 
274
 
275
sg_tmp_rr_data_0 <= register_file(0) when sg_rr_decode(0)='1' else (others=>'0');
276
sg_tmp_rr_data_1 <= register_file(1) when sg_rr_decode(1)='1' else sg_tmp_rr_data_0;
277
sg_tmp_rr_data_2 <= register_file(2) when sg_rr_decode(2)='1' else sg_tmp_rr_data_1;
278
sg_tmp_rr_data_3 <= register_file(3) when sg_rr_decode(3)='1' else sg_tmp_rr_data_2;
279
sg_tmp_rr_data_4 <= register_file(4) when sg_rr_decode(4)='1' else sg_tmp_rr_data_3;
280
sg_tmp_rr_data_5 <= register_file(5) when sg_rr_decode(5)='1' else sg_tmp_rr_data_4;
281
sg_tmp_rr_data_6 <= register_file(6) when sg_rr_decode(6)='1' else sg_tmp_rr_data_5;
282
sg_tmp_rr_data_7 <= register_file(7) when sg_rr_decode(7)='1' else sg_tmp_rr_data_6;
283
sg_tmp_rr_data_8 <= register_file(8) when sg_rr_decode(8)='1' else sg_tmp_rr_data_7;
284
sg_tmp_rr_data_9 <= register_file(9) when sg_rr_decode(9)='1' else sg_tmp_rr_data_8;
285
sg_tmp_rr_data_10 <= register_file(10) when sg_rr_decode(10)='1' else sg_tmp_rr_data_9;
286
sg_tmp_rr_data_11 <= register_file(11) when sg_rr_decode(11)='1' else sg_tmp_rr_data_10;
287
sg_tmp_rr_data_12 <= register_file(12) when sg_rr_decode(12)='1' else sg_tmp_rr_data_11;
288
sg_tmp_rr_data_13 <= register_file(13) when sg_rr_decode(13)='1' else sg_tmp_rr_data_12;
289
sg_tmp_rr_data_14 <= register_file(14) when sg_rr_decode(14)='1' else sg_tmp_rr_data_13;
290
sg_tmp_rr_data_15 <= register_file(15) when sg_rr_decode(15)='1' else sg_tmp_rr_data_14;
291
sg_tmp_rr_data_16 <= register_file(16) when sg_rr_decode(16)='1' else sg_tmp_rr_data_15;
292
sg_tmp_rr_data_17 <= register_file(17) when sg_rr_decode(17)='1' else sg_tmp_rr_data_16;
293
sg_tmp_rr_data_18 <= register_file(18) when sg_rr_decode(18)='1' else sg_tmp_rr_data_17;
294
sg_tmp_rr_data_19 <= register_file(19) when sg_rr_decode(19)='1' else sg_tmp_rr_data_18;
295
sg_tmp_rr_data_20 <= register_file(20) when sg_rr_decode(20)='1' else sg_tmp_rr_data_19;
296
sg_tmp_rr_data_21 <= register_file(21) when sg_rr_decode(21)='1' else sg_tmp_rr_data_20;
297
sg_tmp_rr_data_22 <= register_file(22) when sg_rr_decode(22)='1' else sg_tmp_rr_data_21;
298
sg_tmp_rr_data_23 <= register_file(23) when sg_rr_decode(23)='1' else sg_tmp_rr_data_22;
299
sg_tmp_rr_data_24 <= register_file(24) when sg_rr_decode(24)='1' else sg_tmp_rr_data_23;
300
sg_tmp_rr_data_25 <= register_file(25) when sg_rr_decode(25)='1' else sg_tmp_rr_data_24;
301
sg_tmp_rr_data_26 <= r26h when sg_rr_decode(26)='1' else sg_tmp_rr_data_25;
302
sg_tmp_rr_data_27 <= r27h when sg_rr_decode(27)='1' else sg_tmp_rr_data_26;
303
sg_tmp_rr_data_28 <= r28h when sg_rr_decode(28)='1' else sg_tmp_rr_data_27;
304
sg_tmp_rr_data_29 <= r29h when sg_rr_decode(29)='1' else sg_tmp_rr_data_28;
305
sg_tmp_rr_data_30 <= r30h when sg_rr_decode(30)='1' else sg_tmp_rr_data_29;
306
sg_tmp_rr_data_31 <= r31h when sg_rr_decode(31)='1' else sg_tmp_rr_data_30;
307
reg_rr_out <= sg_tmp_rr_data_31;
308
 
309
 
310
h_dat_mux_l:for i in 0 to 7 generate
311
sg_tmp_h_data(i) <= (r26h(i) and reg_h_adr(0)) or (r28h(i) and reg_h_adr(1)) or (r30h(i) and reg_h_adr(2));
312
end generate;
313
h_dat_mux_h:for i in 8 to 15 generate
314
sg_tmp_h_data(i) <= (r27h(i-8) and reg_h_adr(0)) or (r29h(i-8) and reg_h_adr(1)) or (r31h(i-8) and reg_h_adr(2));
315
end generate;
316
 
317
 
318
sg_adr16_postinc <= sg_tmp_h_data +1;
319
sg_adr16_predec  <= sg_tmp_h_data -1;
320
-- OUTPUT TO THE ADDRESS BUS
321
reg_h_out <= sg_adr16_predec when (pre_dec='1') else           -- PREDECREMENT
322
             sg_tmp_h_data;            -- NO PREDECREMENT
323
 
324
-- TO REGISTERS
325
reg_h_in  <= sg_adr16_postinc when (post_inc='1') else         -- POST INC 
326
             sg_adr16_predec;                                  -- PRE DEC
327
 
328
-- Register file with global reset (for simulation)
329
 
330
RegFileWithRst:if CResetRegFile generate
331
 
332
R0_R25:process(cp2,ireset)
333
begin
334
 if ireset='0' then
335
  for i in 0 to 25 loop
336
   register_file(i) <= (others =>'0');
337
  end loop;
338
 elsif (cp2='1' and cp2'event) then
339
  if (cp2en='1') then                                                     -- Clock enable        
340
   for i in 0 to 25 loop
341
    if register_wr_en(i)='1' then
342
     register_file(i) <= reg_rd_in;
343
    end if;
344
   end loop;
345
  end if;
346
 end if;
347
end process;
348
 
349
 
350
-- R26 (LOW)
351
R26:process(cp2,ireset)
352
begin
353
 if ireset='0' then
354
  r26h <= (others =>'0');
355
 elsif (cp2='1' and cp2'event) then
356
  if (cp2en='1') then                                                     -- Clock enable        
357
   if register_wr_en(26)='1' then
358
    r26h <= reg_rd_in;
359
   elsif (reg_h_adr(0)='1'and reg_h_wr='1') then
360
    r26h <= reg_h_in(7 downto 0);
361
   end if;
362
  end if;
363
 end if;
364
end process;
365
 
366
-- R27 (HIGH)
367
R27:process(cp2,ireset)
368
begin
369
 if ireset='0' then
370
  r27h <= (others =>'0');
371
 elsif (cp2='1' and cp2'event) then
372
  if (cp2en='1') then                                                     -- Clock enable        
373
   if register_wr_en(27)='1' then
374
    r27h <= reg_rd_in;
375
   elsif (reg_h_adr(0)='1'and reg_h_wr='1') then
376
    r27h <= reg_h_in(15 downto 8);
377
   end if;
378
  end if;
379
 end if;
380
end process;
381
 
382
-- R28 (LOW)
383
R28:process(cp2,ireset)
384
begin
385
 if ireset='0' then
386
  r28h <= (others =>'0');
387
 elsif (cp2='1' and cp2'event) then
388
  if (cp2en='1') then                                                     -- Clock enable        
389
   if register_wr_en(28)='1' then
390
    r28h <= reg_rd_in;
391
   elsif (reg_h_adr(1)='1'and reg_h_wr='1') then
392
    r28h <= reg_h_in(7 downto 0);
393
   end if;
394
  end if;
395
 end if;
396
end process;
397
 
398
-- R29 (HIGH)
399
R29:process(cp2,ireset)
400
begin
401
 if ireset='0' then
402
  r29h <= (others =>'0');
403
 elsif (cp2='1' and cp2'event) then
404
  if (cp2en='1') then                                                     -- Clock enable        
405
   if register_wr_en(29)='1' then
406
    r29h <= reg_rd_in;
407
   elsif (reg_h_adr(1)='1'and reg_h_wr='1') then
408
    r29h <= reg_h_in(15 downto 8);
409
   end if;
410
  end if;
411
 end if;
412
end process;
413
 
414
-- R30 (LOW)
415
R30:process(cp2,ireset)
416
begin
417
 if ireset='0' then
418
  r30h <= (others =>'0');
419
 elsif (cp2='1' and cp2'event) then
420
  if (cp2en='1') then                                                     -- Clock enable        
421
   if register_wr_en(30)='1' then
422
    r30h <= reg_rd_in;
423
   elsif (reg_h_adr(2)='1'and reg_h_wr='1') then
424
    r30h <= reg_h_in(7 downto 0);
425
   end if;
426
  end if;
427
 end if;
428
end process;
429
 
430
-- R31 (HIGH)
431
R31:process(cp2,ireset)
432
begin
433
 if ireset='0' then
434
  r31h <= (others =>'0');
435
 elsif (cp2='1' and cp2'event) then
436
  if (cp2en='1') then                                                     -- Clock enable        
437
   if register_wr_en(31)='1' then
438
    r31h <= reg_rd_in;
439
   elsif (reg_h_adr(2)='1'and reg_h_wr='1') then
440
    r31h <= reg_h_in(15 downto 8);
441
   end if;
442
  end if;
443
 end if;
444
end process;
445
 
446
end generate;
447
 
448
 
449
-- Register file without global reset (for synthesis)
450
 
451
RegFileWithoutRst:if not CResetRegFile generate
452
 
453
R0_R25:process(cp2)
454
begin
455
 if (cp2='1' and cp2'event) then
456
  if (cp2en='1') then                                                     -- Clock enable        
457
   for i in 0 to 25 loop
458
    if register_wr_en(i)='1' then
459
     register_file(i) <= reg_rd_in;
460
    end if;
461
   end loop;
462
  end if;
463
 end if;
464
end process;
465
 
466
 
467
-- R26 (LOW)
468
R26:process(cp2)
469
begin
470
 if (cp2='1' and cp2'event) then
471
  if (cp2en='1') then                                                     -- Clock enable        
472
   if register_wr_en(26)='1' then
473
    r26h <= reg_rd_in;
474
   elsif (reg_h_adr(0)='1'and reg_h_wr='1') then
475
    r26h <= reg_h_in(7 downto 0);
476
   end if;
477
  end if;
478
 end if;
479
end process;
480
 
481
-- R27 (HIGH)
482
R27:process(cp2)
483
begin
484
 if (cp2='1' and cp2'event) then
485
  if (cp2en='1') then                                                     -- Clock enable        
486
   if register_wr_en(27)='1' then
487
    r27h <= reg_rd_in;
488
   elsif (reg_h_adr(0)='1'and reg_h_wr='1') then
489
    r27h <= reg_h_in(15 downto 8);
490
   end if;
491
  end if;
492
 end if;
493
end process;
494
 
495
-- R28 (LOW)
496
R28:process(cp2)
497
begin
498
 if (cp2='1' and cp2'event) then
499
  if (cp2en='1') then                                                     -- Clock enable        
500
   if register_wr_en(28)='1' then
501
    r28h <= reg_rd_in;
502
   elsif (reg_h_adr(1)='1'and reg_h_wr='1') then
503
    r28h <= reg_h_in(7 downto 0);
504
   end if;
505
  end if;
506
 end if;
507
end process;
508
 
509
-- R29 (HIGH)
510
R29:process(cp2)
511
begin
512
 if (cp2='1' and cp2'event) then
513
  if (cp2en='1') then                                                     -- Clock enable        
514
   if register_wr_en(29)='1' then
515
    r29h <= reg_rd_in;
516
   elsif (reg_h_adr(1)='1'and reg_h_wr='1') then
517
    r29h <= reg_h_in(15 downto 8);
518
   end if;
519
  end if;
520
 end if;
521
end process;
522
 
523
-- R30 (LOW)
524
R30:process(cp2)
525
begin
526
 if (cp2='1' and cp2'event) then
527
  if (cp2en='1') then                                                     -- Clock enable        
528
   if register_wr_en(30)='1' then
529
    r30h <= reg_rd_in;
530
   elsif (reg_h_adr(2)='1'and reg_h_wr='1') then
531
    r30h <= reg_h_in(7 downto 0);
532
   end if;
533
  end if;
534
 end if;
535
end process;
536
 
537
-- R31 (HIGH)
538
R31:process(cp2)
539
begin
540
 if (cp2='1' and cp2'event) then
541
  if (cp2en='1') then                                                     -- Clock enable        
542
   if register_wr_en(31)='1' then
543
    r31h <= reg_rd_in;
544
   elsif (reg_h_adr(2)='1'and reg_h_wr='1') then
545
    r31h <= reg_h_in(15 downto 8);
546
   end if;
547
  end if;
548
 end if;
549
end process;
550
 
551
end generate;
552
 
553
end RTL;

powered by: WebSVN 2.1.0

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