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

Subversion Repositories avr_hp

[/] [avr_hp/] [trunk/] [rtl/] [rtl_v5_cm3/] [alu_avr.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 tobil
--************************************************************************************************
2
--  ALU(internal module) for AVR core
3
--      Version 1.2
4
--  Designed by Ruslan Lepetenok 
5
--      Modified 02.08.2003 
6
-- (CPC/SBC/SBCI Z-flag bug found)
7
--  H-flag with NEG instruction found
8
--************************************************************************************************
9
 
10
library IEEE;
11
use IEEE.std_logic_1164.all;
12
 
13
 
14
entity alu_avr_cm3 is port(
15
                cp2_cml_1 : in std_logic;
16
                cp2_cml_2 : in std_logic;
17
 
18
 
19
              alu_data_r_in   : in std_logic_vector(7 downto 0);
20
              alu_data_d_in   : in std_logic_vector(7 downto 0);
21
 
22
              alu_c_flag_in   : in std_logic;
23
              alu_z_flag_in   : in std_logic;
24
 
25
 
26
-- OPERATION SIGNALS INPUTS
27
              idc_add         :in std_logic;
28
              idc_adc         :in std_logic;
29
              idc_adiw        :in std_logic;
30
              idc_sub         :in std_logic;
31
              idc_subi        :in std_logic;
32
              idc_sbc         :in std_logic;
33
              idc_sbci        :in std_logic;
34
              idc_sbiw        :in std_logic;
35
 
36
              adiw_st         : in std_logic;
37
              sbiw_st         : in std_logic;
38
 
39
              idc_and         :in std_logic;
40
              idc_andi        :in std_logic;
41
              idc_or          :in std_logic;
42
              idc_ori         :in std_logic;
43
              idc_eor         :in std_logic;
44
              idc_com         :in std_logic;
45
              idc_neg         :in std_logic;
46
 
47
              idc_inc         :in std_logic;
48
              idc_dec         :in std_logic;
49
 
50
              idc_cp          :in std_logic;
51
              idc_cpc         :in std_logic;
52
              idc_cpi         :in std_logic;
53
              idc_cpse        :in std_logic;
54
 
55
              idc_lsr         :in std_logic;
56
              idc_ror         :in std_logic;
57
              idc_asr         :in std_logic;
58
              idc_swap        :in std_logic;
59
 
60
 
61
-- DATA OUTPUT
62
              alu_data_out    : out std_logic_vector(7 downto 0);
63
 
64
-- FLAGS OUTPUT
65
              alu_c_flag_out  : out std_logic;
66
              alu_z_flag_out  : out std_logic;
67
              alu_n_flag_out  : out std_logic;
68
              alu_v_flag_out  : out std_logic;
69
              alu_s_flag_out  : out std_logic;
70
              alu_h_flag_out  : out std_logic
71
);
72
 
73
end alu_avr_cm3;
74
 
75
architecture rtl of alu_avr_cm3 is
76
 
77
-- ####################################################
78
-- INTERNAL SIGNALS
79
-- ####################################################
80
 
81
signal alu_data_out_int             : std_logic_vector (7 downto 0);
82
 
83
-- ALU FLAGS (INTERNAL)
84
signal alu_z_flag_out_int       : std_logic;
85
signal alu_c_flag_in_int        : std_logic;            -- INTERNAL CARRY FLAG
86
 
87
signal alu_n_flag_out_int       : std_logic;
88
signal alu_v_flag_out_int       : std_logic;
89
signal alu_c_flag_out_int       : std_logic;
90
 
91
-- ADDER SIGNALS --
92
signal adder_nadd_sub : std_logic;        -- 0 -> ADD ,1 -> SUB
93
signal adder_v_flag_out : std_logic;
94
 
95
signal adder_carry : std_logic_vector(8 downto 0);
96
signal adder_d_in  : std_logic_vector(8 downto 0);
97
signal adder_r_in  : std_logic_vector(8 downto 0);
98
signal adder_out   : std_logic_vector(8 downto 0);
99
 
100
-- NEG OPERATOR SIGNALS 
101
signal neg_op_in    : std_logic_vector(7 downto 0);
102
signal neg_op_carry : std_logic_vector(8 downto 0);
103
signal neg_op_out   : std_logic_vector(8 downto 0);
104
 
105
-- INC, DEC OPERATOR SIGNALS 
106
signal incdec_op_in    : std_logic_vector (7 downto 0);
107
signal incdec_op_carry : std_logic_vector(7 downto 0);
108
signal incdec_op_out   : std_logic_vector(7 downto 0);
109
 
110
 
111
signal com_op_out : std_logic_vector(7 downto 0);
112
signal and_op_out : std_logic_vector(7 downto 0);
113
signal or_op_out : std_logic_vector(7 downto 0);
114
signal eor_op_out : std_logic_vector(7 downto 0);
115
 
116
-- SHIFT SIGNALS
117
signal right_shift_out : std_logic_vector(7 downto 0);
118
 
119
-- SWAP SIGNALS
120
signal swap_out : std_logic_vector(7 downto 0);
121
 
122
signal alu_data_r_in_cml_1 :  std_logic_vector ( 7 downto 0 );
123
signal alu_data_d_in_cml_2 :  std_logic_vector ( 7 downto 0 );
124
signal alu_z_flag_out_cml_out :  std_logic;
125
signal alu_z_flag_in_cml_2 :  std_logic;
126
signal alu_h_flag_out_cml_out :  std_logic;
127
signal idc_add_cml_2 :  std_logic;
128
signal idc_adc_cml_2 :  std_logic;
129
signal idc_adc_cml_1 :  std_logic;
130
signal idc_adiw_cml_2 :  std_logic;
131
signal idc_sub_cml_2 :  std_logic;
132
signal idc_sub_cml_1 :  std_logic;
133
signal idc_subi_cml_2 :  std_logic;
134
signal idc_subi_cml_1 :  std_logic;
135
signal idc_sbc_cml_2 :  std_logic;
136
signal idc_sbc_cml_1 :  std_logic;
137
signal idc_sbci_cml_2 :  std_logic;
138
signal idc_sbci_cml_1 :  std_logic;
139
signal idc_sbiw_cml_2 :  std_logic;
140
signal idc_sbiw_cml_1 :  std_logic;
141
signal adiw_st_cml_2 :  std_logic;
142
signal adiw_st_cml_1 :  std_logic;
143
signal sbiw_st_cml_2 :  std_logic;
144
signal sbiw_st_cml_1 :  std_logic;
145
signal idc_com_cml_2 :  std_logic;
146
signal idc_neg_cml_2 :  std_logic;
147
signal idc_inc_cml_2 :  std_logic;
148
signal idc_dec_cml_2 :  std_logic;
149
signal idc_cp_cml_2 :  std_logic;
150
signal idc_cp_cml_1 :  std_logic;
151
signal idc_cpc_cml_2 :  std_logic;
152
signal idc_cpc_cml_1 :  std_logic;
153
signal idc_cpi_cml_2 :  std_logic;
154
signal idc_cpi_cml_1 :  std_logic;
155
signal idc_cpse_cml_1 :  std_logic;
156
signal idc_lsr_cml_2 :  std_logic;
157
signal idc_ror_cml_2 :  std_logic;
158
signal idc_ror_cml_1 :  std_logic;
159
signal idc_asr_cml_2 :  std_logic;
160
signal alu_data_out_int_cml_2 :  std_logic_vector ( 7 downto 0 );
161
signal alu_c_flag_in_int_cml_1 :  std_logic;
162
signal alu_n_flag_out_cml_out :  std_logic;
163
signal alu_s_flag_out_cml_out :  std_logic;
164
signal alu_n_flag_out_int_cml_2 :  std_logic;
165
signal adder_nadd_sub_cml_1 :  std_logic;
166
signal adder_v_flag_out_cml_2 :  std_logic;
167
signal adder_carry_cml_2 :  std_logic_vector ( 8 downto 0 );
168
signal adder_r_in_cml_1 :  std_logic_vector ( 8 downto 0 );
169
signal adder_out_cml_2 :  std_logic_vector ( 8 downto 0 );
170
signal neg_op_carry_cml_2 :  std_logic_vector ( 8 downto 0 );
171
signal incdec_op_carry_cml_2 :  std_logic_vector ( 7 downto 0 );
172
 
173
begin
174
 
175
 
176
 
177
process(cp2_cml_1) begin
178
if (cp2_cml_1 = '1' and cp2_cml_1'event) then
179
        alu_data_r_in_cml_1 <= alu_data_r_in;
180
        idc_adc_cml_1 <= idc_adc;
181
        idc_sub_cml_1 <= idc_sub;
182
        idc_subi_cml_1 <= idc_subi;
183
        idc_sbc_cml_1 <= idc_sbc;
184
        idc_sbci_cml_1 <= idc_sbci;
185
        idc_sbiw_cml_1 <= idc_sbiw;
186
        adiw_st_cml_1 <= adiw_st;
187
        sbiw_st_cml_1 <= sbiw_st;
188
        idc_cp_cml_1 <= idc_cp;
189
        idc_cpc_cml_1 <= idc_cpc;
190
        idc_cpi_cml_1 <= idc_cpi;
191
        idc_cpse_cml_1 <= idc_cpse;
192
        idc_ror_cml_1 <= idc_ror;
193
        alu_c_flag_in_int_cml_1 <= alu_c_flag_in_int;
194
        adder_nadd_sub_cml_1 <= adder_nadd_sub;
195
        adder_r_in_cml_1 <= adder_r_in;
196
end if;
197
end process;
198
 
199
process(cp2_cml_2) begin
200
if (cp2_cml_2 = '1' and cp2_cml_2'event) then
201
        alu_data_d_in_cml_2 <= alu_data_d_in;
202
        alu_z_flag_in_cml_2 <= alu_z_flag_in;
203
        idc_add_cml_2 <= idc_add;
204
        idc_adc_cml_2 <= idc_adc_cml_1;
205
        idc_adiw_cml_2 <= idc_adiw;
206
        idc_sub_cml_2 <= idc_sub_cml_1;
207
        idc_subi_cml_2 <= idc_subi_cml_1;
208
        idc_sbc_cml_2 <= idc_sbc_cml_1;
209
        idc_sbci_cml_2 <= idc_sbci_cml_1;
210
        idc_sbiw_cml_2 <= idc_sbiw_cml_1;
211
        adiw_st_cml_2 <= adiw_st_cml_1;
212
        sbiw_st_cml_2 <= sbiw_st_cml_1;
213
        idc_com_cml_2 <= idc_com;
214
        idc_neg_cml_2 <= idc_neg;
215
        idc_inc_cml_2 <= idc_inc;
216
        idc_dec_cml_2 <= idc_dec;
217
        idc_cp_cml_2 <= idc_cp_cml_1;
218
        idc_cpc_cml_2 <= idc_cpc_cml_1;
219
        idc_cpi_cml_2 <= idc_cpi_cml_1;
220
        idc_lsr_cml_2 <= idc_lsr;
221
        idc_ror_cml_2 <= idc_ror_cml_1;
222
        idc_asr_cml_2 <= idc_asr;
223
        alu_data_out_int_cml_2 <= alu_data_out_int;
224
        alu_n_flag_out_int_cml_2 <= alu_n_flag_out_int;
225
        adder_v_flag_out_cml_2 <= adder_v_flag_out;
226
        adder_carry_cml_2 <= adder_carry;
227
        adder_out_cml_2 <= adder_out;
228
        neg_op_carry_cml_2 <= neg_op_carry;
229
        incdec_op_carry_cml_2 <= incdec_op_carry;
230
end if;
231
end process;
232
alu_z_flag_out <= alu_z_flag_out_cml_out;
233
alu_h_flag_out <= alu_h_flag_out_cml_out;
234
alu_n_flag_out <= alu_n_flag_out_cml_out;
235
alu_s_flag_out <= alu_s_flag_out_cml_out;
236
 
237
 
238
 
239
-- ########################################################################
240
-- ###############              ALU
241
-- ########################################################################
242
 
243
adder_nadd_sub <=(idc_sub or idc_subi or idc_sbc or idc_sbci or idc_sbiw or sbiw_st or
244
                  idc_cp or idc_cpc or idc_cpi or idc_cpse ); -- '0' -> '+'; '1' -> '-' 
245
 
246
-- SREG C FLAG (ALU INPUT)
247
alu_c_flag_in_int <= alu_c_flag_in and
248
(idc_adc or adiw_st or idc_sbc or idc_sbci or sbiw_st or
249
idc_cpc or
250
idc_ror);
251
 
252
-- SynEDA CoreMultiplier
253
-- assignment(s): alu_z_flag_out
254
-- replace(s): alu_z_flag_in, idc_sbc, idc_sbci, adiw_st, sbiw_st, idc_cpc
255
 
256
-- SREG Z FLAG ()
257
-- alu_z_flag_out <= (alu_z_flag_out_int and not(adiw_st or sbiw_st)) or 
258
--                   ((alu_z_flag_in and alu_z_flag_out_int) and (adiw_st or sbiw_st));
259
alu_z_flag_out_cml_out <= (alu_z_flag_out_int and not(adiw_st_cml_2 or sbiw_st_cml_2 or idc_cpc_cml_2 or idc_sbc_cml_2 or idc_sbci_cml_2)) or
260
                  ((alu_z_flag_in_cml_2 and alu_z_flag_out_int) and (adiw_st_cml_2 or sbiw_st_cml_2))or
261
                                  (alu_z_flag_in_cml_2 and alu_z_flag_out_int and(idc_cpc_cml_2 or idc_sbc_cml_2 or idc_sbci_cml_2));   -- Previous value (for CPC/SBC/SBCI instructions)
262
 
263
-- SynEDA CoreMultiplier
264
-- assignment(s): alu_n_flag_out
265
-- replace(s): alu_n_flag_out_int
266
 
267
-- SREG N FLAG
268
alu_n_flag_out_cml_out <= alu_n_flag_out_int_cml_2;
269
 
270
-- SREG V FLAG
271
alu_v_flag_out <= alu_v_flag_out_int;
272
 
273
 
274
alu_c_flag_out <= alu_c_flag_out_int;
275
 
276
alu_data_out <= alu_data_out_int;
277
 
278
-- #########################################################################################
279
 
280
adder_d_in <= '0'&alu_data_d_in;
281
adder_r_in <= '0'&alu_data_r_in;
282
 
283
--########################## ADDEER ###################################
284
 
285
adder_out(0) <= adder_d_in(0) xor adder_r_in_cml_1(0) xor alu_c_flag_in_int_cml_1;
286
 
287
summator:for i in 1 to 8 generate
288
-- SynEDA CoreMultiplier
289
-- assignment(s): adder_out
290
-- replace(s): alu_c_flag_in_int, adder_r_in
291
 
292
adder_out(i) <= adder_d_in(i) xor adder_r_in_cml_1(i) xor adder_carry(i-1);
293
end generate;
294
 
295
 
296
adder_carry(0) <= ((adder_d_in(0) xor adder_nadd_sub_cml_1) and adder_r_in_cml_1(0)) or
297
                (((adder_d_in(0) xor adder_nadd_sub_cml_1) or adder_r_in_cml_1(0)) and alu_c_flag_in_int_cml_1);
298
 
299
summator2:for i in 1 to 8 generate
300
-- SynEDA CoreMultiplier
301
-- assignment(s): adder_carry
302
-- replace(s): alu_c_flag_in_int, adder_nadd_sub, adder_r_in
303
 
304
adder_carry(i) <= ((adder_d_in(i) xor adder_nadd_sub_cml_1) and adder_r_in_cml_1(i)) or
305
                (((adder_d_in(i) xor adder_nadd_sub_cml_1) or adder_r_in_cml_1(i)) and adder_carry(i-1));
306
end generate;
307
 
308
-- FLAGS  FOR ADDER INSTRUCTIONS: 
309
-- CARRY FLAG (C) -> adder_out(8)
310
-- HALF CARRY FLAG (H) -> adder_carry(3)
311
-- TOW'S COMPLEMENT OVERFLOW  (V) -> 
312
 
313
-- SynEDA CoreMultiplier
314
-- assignment(s): adder_v_flag_out
315
-- replace(s): adder_nadd_sub, adder_r_in
316
 
317
adder_v_flag_out <= (((adder_d_in(7) and adder_r_in_cml_1(7) and not adder_out(7)) or
318
                    (not adder_d_in(7) and not adder_r_in_cml_1(7) and adder_out(7))) and not adder_nadd_sub_cml_1) or -- ADD
319
                    (((adder_d_in(7) and not adder_r_in_cml_1(7) and not adder_out(7)) or
320
                                        (not adder_d_in(7) and adder_r_in_cml_1(7) and adder_out(7))) and adder_nadd_sub_cml_1);
321
                                                                                                                                                                                                                   -- SUB
322
--#####################################################################
323
 
324
 
325
-- LOGICAL OPERATIONS FOR ONE OPERAND
326
 
327
--########################## NEG OPERATION ####################
328
 
329
neg_op_out(0)   <= not alu_data_d_in(0) xor '1';
330
neg_op:for i in 1 to 7 generate
331
neg_op_out(i)   <= not alu_data_d_in(i) xor neg_op_carry(i-1);
332
end generate;
333
neg_op_out(8) <= neg_op_carry(7) xor '1';
334
 
335
 
336
neg_op_carry(0) <= not alu_data_d_in(0) and '1';
337
neg_op2:for i in 1 to 7 generate
338
neg_op_carry(i) <= not alu_data_d_in(i) and neg_op_carry(i-1);
339
end generate;
340
neg_op_carry(8) <= neg_op_carry(7);                            -- ??!!
341
 
342
 
343
-- CARRY FLAGS  FOR NEG INSTRUCTION: 
344
-- CARRY FLAG -> neg_op_out(8)
345
-- HALF CARRY FLAG -> neg_op_carry(3)
346
-- TOW's COMPLEMENT OVERFLOW FLAG -> alu_data_d_in(7) and neg_op_carry(6) 
347
--############################################################################  
348
 
349
 
350
--########################## INC, DEC OPERATIONS ####################
351
 
352
incdec_op_out(0)      <=  alu_data_d_in(0) xor '1';
353
inc_dec:for i in 1 to 7 generate
354
incdec_op_out(i)   <= alu_data_d_in(i) xor incdec_op_carry(i-1);
355
end generate;
356
 
357
 
358
incdec_op_carry(0)    <=  alu_data_d_in(0) xor idc_dec;
359
inc_dec2:for i in 1 to 7 generate
360
incdec_op_carry(i) <= (alu_data_d_in(i) xor idc_dec) and incdec_op_carry(i-1);
361
end generate;
362
 
363
-- TOW's COMPLEMENT OVERFLOW FLAG -> (alu_data_d_in(7) xor idc_dec) and incdec_op_carry(6) 
364
--####################################################################
365
 
366
 
367
--########################## COM OPERATION ###################################
368
com_op_out <= not alu_data_d_in;
369
-- FLAGS 
370
-- TOW's COMPLEMENT OVERFLOW FLAG (V)  -> '0'
371
-- CARRY FLAG (C) -> '1' 
372
--############################################################################
373
 
374
-- LOGICAL OPERATIONS FOR TWO OPERANDS  
375
 
376
-- SynEDA CoreMultiplier
377
-- assignment(s): and_op_out
378
-- replace(s): alu_data_r_in
379
 
380
--########################## AND OPERATION ###################################
381
and_op_out <= alu_data_d_in and alu_data_r_in_cml_1;
382
-- FLAGS 
383
-- TOW's COMPLEMENT OVERFLOW FLAG (V)  -> '0'
384
--############################################################################
385
 
386
-- SynEDA CoreMultiplier
387
-- assignment(s): or_op_out
388
-- replace(s): alu_data_r_in
389
 
390
--########################## OR OPERATION ###################################
391
or_op_out <= alu_data_d_in or alu_data_r_in_cml_1;
392
-- FLAGS 
393
-- TOW's COMPLEMENT OVERFLOW FLAG (V)  -> '0'
394
--############################################################################
395
 
396
-- SynEDA CoreMultiplier
397
-- assignment(s): eor_op_out
398
-- replace(s): alu_data_r_in
399
 
400
--########################## EOR OPERATION ###################################
401
eor_op_out <= alu_data_d_in xor alu_data_r_in_cml_1;
402
-- FLAGS 
403
-- TOW's COMPLEMENT OVERFLOW FLAG (V)  -> '0'
404
--############################################################################
405
 
406
-- SHIFT OPERATIONS 
407
 
408
-- ########################## RIGHT(LSR, ROR, ASR) #######################
409
 
410
right_shift_out(7) <= (idc_ror_cml_1 and alu_c_flag_in_int_cml_1) or (idc_asr and alu_data_d_in(7)); -- right_shift_out(7)
411
shift_right:for i in 6 downto 0 generate
412
-- SynEDA CoreMultiplier
413
-- assignment(s): right_shift_out
414
-- replace(s): idc_ror, alu_c_flag_in_int
415
 
416
right_shift_out(i) <= alu_data_d_in(i+1);
417
end generate;
418
 
419
-- FLAGS 
420
-- CARRY FLAG (C)                      -> alu_data_d_in(0) 
421
-- NEGATIVE FLAG (N)                   -> right_shift_out(7)
422
-- TOW's COMPLEMENT OVERFLOW FLAG (V)  -> N xor C  (left_shift_out(7) xor alu_data_d_in(0))
423
 
424
-- #######################################################################
425
 
426
 
427
-- ################################## SWAP ###############################
428
 
429
swap_h:for i in 7 downto 4 generate
430
swap_out(i) <= alu_data_d_in(i-4);
431
end generate;
432
swap_l:for i in 3 downto 0 generate
433
swap_out(i) <= alu_data_d_in(i+4);
434
end generate;
435
-- #######################################################################
436
 
437
-- ALU OUTPUT MUX
438
 
439
alu_data_out_mux:for i in alu_data_out_int'range generate
440
-- SynEDA CoreMultiplier
441
-- assignment(s): alu_data_out_int
442
-- replace(s): idc_adc, idc_sub, idc_subi, idc_sbc, idc_sbci, idc_sbiw, adiw_st, sbiw_st, idc_cp, idc_cpc, idc_cpi, idc_cpse, idc_ror
443
 
444
alu_data_out_int(i) <= (adder_out(i) and (idc_add or idc_adc_cml_1 or (idc_adiw or adiw_st_cml_1) or    -- !!!!!
445
                                     idc_sub_cml_1 or idc_subi_cml_1 or idc_sbc_cml_1 or idc_sbci_cml_1 or
446
                                     (idc_sbiw_cml_1 or sbiw_st_cml_1) or    -- !!!!!
447
                                     idc_cpse_cml_1 or idc_cp_cml_1 or idc_cpc_cml_1 or idc_cpi_cml_1)) or
448
                                     (neg_op_out(i) and idc_neg) or                               -- NEG
449
                                     (incdec_op_out(i) and (idc_inc or idc_dec)) or               -- INC/DEC
450
                                     (com_op_out(i) and idc_com) or                               -- COM
451
                                     (and_op_out(i) and (idc_and or idc_andi)) or                 -- AND/ANDI                                   
452
                                     (or_op_out(i)  and (idc_or or idc_ori)) or                   -- OR/ORI                                   
453
                                     (eor_op_out(i) and idc_eor) or                               -- EOR
454
                                     (right_shift_out(i) and (idc_lsr or idc_ror_cml_1 or idc_asr)) or  -- LSR/ROR/ASR
455
                                     (swap_out(i) and idc_swap);                                  -- SWAP
456
 
457
 
458
end generate;
459
 
460
--@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ALU FLAGS OUTPUTS @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
461
 
462
-- SynEDA CoreMultiplier
463
-- assignment(s): alu_h_flag_out
464
-- replace(s): idc_add, idc_adc, idc_sub, idc_subi, idc_sbc, idc_sbci, idc_neg, idc_cp, idc_cpc, idc_cpi, adder_carry, neg_op_carry
465
 
466
alu_h_flag_out_cml_out <= (adder_carry_cml_2(3) and                                                      -- ADDER INSTRUCTIONS
467
             (idc_add_cml_2 or idc_adc_cml_2 or idc_sub_cml_2 or idc_subi_cml_2 or idc_sbc_cml_2 or idc_sbci_cml_2 or idc_cp_cml_2 or idc_cpc_cml_2 or idc_cpi_cml_2)) or
468
             (not neg_op_carry_cml_2(3) and idc_neg_cml_2); -- H-flag problem with NEG instruction fixing                                         -- NEG
469
 
470
 
471
-- SynEDA CoreMultiplier
472
-- assignment(s): alu_s_flag_out
473
-- replace(s): alu_n_flag_out_int
474
 
475
alu_s_flag_out_cml_out <= alu_n_flag_out_int_cml_2 xor alu_v_flag_out_int;
476
 
477
-- SynEDA CoreMultiplier
478
-- assignment(s): alu_v_flag_out_int
479
-- replace(s): alu_data_d_in, idc_add, idc_adc, idc_sub, idc_subi, idc_sbc, idc_sbci, adiw_st, sbiw_st, idc_neg, idc_inc, idc_dec, idc_cp, idc_cpc, idc_cpi, idc_lsr, idc_ror, idc_asr, alu_n_flag_out_int, adder_v_flag_out, neg_op_carry, incdec_op_carry
480
 
481
alu_v_flag_out_int <= (adder_v_flag_out_cml_2 and
482
             (idc_add_cml_2 or idc_adc_cml_2 or idc_sub_cml_2 or idc_subi_cml_2 or idc_sbc_cml_2 or idc_sbci_cml_2 or adiw_st_cml_2 or sbiw_st_cml_2 or idc_cp_cml_2 or idc_cpi_cml_2 or idc_cpc_cml_2)) or
483
             ((alu_data_d_in_cml_2(7) and neg_op_carry_cml_2(6)) and idc_neg_cml_2) or                                       -- NEG
484
                     (not alu_data_d_in_cml_2(7) and incdec_op_carry_cml_2(6) and idc_inc_cml_2) or -- INC
485
                     (alu_data_d_in_cml_2(7) and incdec_op_carry_cml_2(6) and idc_dec_cml_2) or   -- DEC
486
                         ((alu_n_flag_out_int_cml_2 xor alu_c_flag_out_int) and (idc_lsr_cml_2 or idc_ror_cml_2 or idc_asr_cml_2));            -- LSR,ROR,ASR
487
 
488
 
489
alu_n_flag_out_int <= alu_data_out_int(7);
490
 
491
-- SynEDA CoreMultiplier
492
-- assignment(s): alu_z_flag_out_int
493
-- replace(s): alu_data_out_int
494
 
495
alu_z_flag_out_int <= '1' when alu_data_out_int_cml_2="00000000" else '0';
496
 
497
-- SynEDA CoreMultiplier
498
-- assignment(s): alu_c_flag_out_int
499
-- replace(s): alu_data_d_in, idc_add, idc_adc, idc_adiw, idc_sub, idc_subi, idc_sbc, idc_sbci, idc_sbiw, adiw_st, sbiw_st, idc_com, idc_neg, idc_cp, idc_cpc, idc_cpi, idc_lsr, idc_ror, idc_asr, adder_out
500
 
501
alu_c_flag_out_int <= (adder_out_cml_2(8) and
502
                       (idc_add_cml_2 or idc_adc_cml_2 or (idc_adiw_cml_2 or adiw_st_cml_2) or idc_sub_cml_2 or idc_subi_cml_2 or idc_sbc_cml_2 or idc_sbci_cml_2 or (idc_sbiw_cml_2 or sbiw_st_cml_2) or idc_cp_cml_2 or idc_cpc_cml_2 or idc_cpi_cml_2)) or -- ADDER
503
                                           (not alu_z_flag_out_int and idc_neg_cml_2) or    -- NEG
504
                                           (alu_data_d_in_cml_2(0) and (idc_lsr_cml_2 or idc_ror_cml_2 or idc_asr_cml_2)) or idc_com_cml_2;
505
 
506
-- @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
507
 
508
 
509
end rtl;

powered by: WebSVN 2.1.0

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