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

Subversion Repositories mlite

[/] [mlite/] [trunk/] [vhdl/] [mlite_pack.vhd] - Blame information for rev 264

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 39 rhoads
---------------------------------------------------------------------
2 43 rhoads
-- TITLE: Plasma Misc. Package
3 39 rhoads
-- AUTHOR: Steve Rhoads (rhoadss@yahoo.com)
4
-- DATE CREATED: 2/15/01
5
-- FILENAME: mlite_pack.vhd
6 43 rhoads
-- PROJECT: Plasma CPU core
7 39 rhoads
-- COPYRIGHT: Software placed into the public domain by the author.
8
--    Software 'as is' without warranty.  Author liable for nothing.
9
-- DESCRIPTION:
10 43 rhoads
--    Data types, constants, and add functions needed for the Plasma CPU.
11 39 rhoads
---------------------------------------------------------------------
12
library ieee;
13
use ieee.std_logic_1164.all;
14
 
15
package mlite_pack is
16
   constant ZERO          : std_logic_vector(31 downto 0) :=
17
      "00000000000000000000000000000000";
18
   constant ONES          : std_logic_vector(31 downto 0) :=
19
      "11111111111111111111111111111111";
20
   --make HIGH_Z equal to ZERO if compiler complains
21
   constant HIGH_Z        : std_logic_vector(31 downto 0) :=
22
      "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ";
23
 
24 91 rhoads
   subtype alu_function_type is std_logic_vector(3 downto 0);
25 128 rhoads
   constant ALU_NOTHING   : alu_function_type := "0000";
26
   constant ALU_ADD       : alu_function_type := "0001";
27
   constant ALU_SUBTRACT  : alu_function_type := "0010";
28
   constant ALU_LESS_THAN : alu_function_type := "0011";
29
   constant ALU_LESS_THAN_SIGNED : alu_function_type := "0100";
30
   constant ALU_OR        : alu_function_type := "0101";
31
   constant ALU_AND       : alu_function_type := "0110";
32
   constant ALU_XOR       : alu_function_type := "0111";
33
   constant ALU_NOR       : alu_function_type := "1000";
34 39 rhoads
 
35
   subtype shift_function_type is std_logic_vector(1 downto 0);
36 128 rhoads
   constant SHIFT_NOTHING        : shift_function_type := "00";
37
   constant SHIFT_LEFT_UNSIGNED  : shift_function_type := "01";
38
   constant SHIFT_RIGHT_SIGNED   : shift_function_type := "11";
39
   constant SHIFT_RIGHT_UNSIGNED : shift_function_type := "10";
40 39 rhoads
 
41 44 rhoads
   subtype mult_function_type is std_logic_vector(3 downto 0);
42 128 rhoads
   constant MULT_NOTHING       : mult_function_type := "0000";
43
   constant MULT_READ_LO       : mult_function_type := "0001";
44
   constant MULT_READ_HI       : mult_function_type := "0010";
45
   constant MULT_WRITE_LO      : mult_function_type := "0011";
46
   constant MULT_WRITE_HI      : mult_function_type := "0100";
47
   constant MULT_MULT          : mult_function_type := "0101";
48
   constant MULT_SIGNED_MULT   : mult_function_type := "0110";
49
   constant MULT_DIVIDE        : mult_function_type := "0111";
50
   constant MULT_SIGNED_DIVIDE : mult_function_type := "1000";
51 39 rhoads
 
52
   subtype a_source_type is std_logic_vector(1 downto 0);
53 128 rhoads
   constant A_FROM_REG_SOURCE : a_source_type := "00";
54
   constant A_FROM_IMM10_6    : a_source_type := "01";
55
   constant A_FROM_PC         : a_source_type := "10";
56 39 rhoads
 
57
   subtype b_source_type is std_logic_vector(1 downto 0);
58 128 rhoads
   constant B_FROM_REG_TARGET : b_source_type := "00";
59
   constant B_FROM_IMM        : b_source_type := "01";
60
   constant B_FROM_SIGNED_IMM : b_source_type := "10";
61
   constant B_FROM_IMMX4      : b_source_type := "11";
62 39 rhoads
 
63
   subtype c_source_type is std_logic_vector(2 downto 0);
64 128 rhoads
   constant C_FROM_NULL       : c_source_type := "000";
65
   constant C_FROM_ALU        : c_source_type := "001";
66
   constant C_FROM_SHIFT      : c_source_type := "001"; --same as alu
67
   constant C_FROM_MULT       : c_source_type := "001"; --same as alu
68
   constant C_FROM_MEMORY     : c_source_type := "010";
69
   constant C_FROM_PC         : c_source_type := "011";
70
   constant C_FROM_PC_PLUS4   : c_source_type := "100";
71
   constant C_FROM_IMM_SHIFT16: c_source_type := "101";
72
   constant C_FROM_REG_SOURCEN: c_source_type := "110";
73 39 rhoads
 
74
   subtype pc_source_type is std_logic_vector(1 downto 0);
75 128 rhoads
   constant FROM_INC4       : pc_source_type := "00";
76
   constant FROM_OPCODE25_0 : pc_source_type := "01";
77
   constant FROM_BRANCH     : pc_source_type := "10";
78
   constant FROM_LBRANCH    : pc_source_type := "11";
79 39 rhoads
 
80
   subtype branch_function_type is std_logic_vector(2 downto 0);
81 128 rhoads
   constant BRANCH_LTZ : branch_function_type := "000";
82
   constant BRANCH_LEZ : branch_function_type := "001";
83
   constant BRANCH_EQ  : branch_function_type := "010";
84
   constant BRANCH_NE  : branch_function_type := "011";
85
   constant BRANCH_GEZ : branch_function_type := "100";
86
   constant BRANCH_GTZ : branch_function_type := "101";
87
   constant BRANCH_YES : branch_function_type := "110";
88 139 rhoads
   constant BRANCH_NO  : branch_function_type := "111";
89 39 rhoads
 
90
   -- mode(32=1,16=2,8=3), signed, write
91
   subtype mem_source_type is std_logic_vector(3 downto 0);
92 128 rhoads
   constant MEM_FETCH   : mem_source_type := "0000";
93
   constant MEM_READ32  : mem_source_type := "0100";
94
   constant MEM_WRITE32 : mem_source_type := "0101";
95
   constant MEM_READ16  : mem_source_type := "1000";
96 139 rhoads
   constant MEM_READ16S : mem_source_type := "1010";
97 128 rhoads
   constant MEM_WRITE16 : mem_source_type := "1001";
98
   constant MEM_READ8   : mem_source_type := "1100";
99 139 rhoads
   constant MEM_READ8S  : mem_source_type := "1110";
100 128 rhoads
   constant MEM_WRITE8  : mem_source_type := "1101";
101 39 rhoads
 
102 139 rhoads
   function bv_adder(a     : in std_logic_vector;
103
                     b     : in std_logic_vector;
104 47 rhoads
                     do_add: in std_logic) return std_logic_vector;
105 39 rhoads
   function bv_negate(a : in std_logic_vector) return std_logic_vector;
106
   function bv_increment(a : in std_logic_vector(31 downto 2)
107 139 rhoads
                         ) return std_logic_vector;
108
   function bv_inc(a : in std_logic_vector
109
                  ) return std_logic_vector;
110 47 rhoads
 
111
   -- For Altera
112
   COMPONENT lpm_ram_dp
113
      GENERIC (
114
         lpm_width        : NATURAL;
115
         lpm_widthad      : NATURAL;
116
         rden_used        : STRING;
117
         intended_device_family : STRING;
118
         lpm_indata       : STRING;
119
         lpm_wraddress_control          : STRING;
120
         lpm_rdaddress_control          : STRING;
121
         lpm_outdata      : STRING;
122
         use_eab          : STRING;
123
         lpm_type         : STRING);
124
      PORT (
125 91 rhoads
         wren      : IN STD_LOGIC ;
126 47 rhoads
         wrclock   : IN STD_LOGIC ;
127 91 rhoads
         q         : OUT STD_LOGIC_VECTOR (lpm_width-1 DOWNTO 0);
128
         data      : IN STD_LOGIC_VECTOR (lpm_width-1 DOWNTO 0);
129
         rdaddress : IN STD_LOGIC_VECTOR (lpm_widthad-1 DOWNTO 0);
130
         wraddress : IN STD_LOGIC_VECTOR (lpm_widthad-1 DOWNTO 0));
131 47 rhoads
   END COMPONENT;
132
 
133
   -- For Altera
134 62 rhoads
   component LPM_RAM_DQ
135
      generic (
136 91 rhoads
         LPM_WIDTH    : natural;    -- MUST be greater than 0
137
         LPM_WIDTHAD  : natural;    -- MUST be greater than 0
138 62 rhoads
         LPM_NUMWORDS : natural := 0;
139 91 rhoads
         LPM_INDATA   : string := "REGISTERED";
140 62 rhoads
         LPM_ADDRESS_CONTROL: string := "REGISTERED";
141 91 rhoads
         LPM_OUTDATA  : string := "REGISTERED";
142
         LPM_FILE     : string := "UNUSED";
143
         LPM_TYPE     : string := "LPM_RAM_DQ";
144
         USE_EAB      : string := "OFF";
145 62 rhoads
         INTENDED_DEVICE_FAMILY  : string := "UNUSED";
146 91 rhoads
         LPM_HINT     : string := "UNUSED");
147 62 rhoads
                port (
148
         DATA     : in std_logic_vector(LPM_WIDTH-1 downto 0);
149
         ADDRESS  : in std_logic_vector(LPM_WIDTHAD-1 downto 0);
150
         INCLOCK  : in std_logic := '0';
151
         OUTCLOCK : in std_logic := '0';
152
         WE       : in std_logic;
153
         Q        : out std_logic_vector(LPM_WIDTH-1 downto 0));
154
   end component;
155 47 rhoads
 
156
   -- For Xilinx
157 264 rhoads
   component RAM16X1D
158
      -- synthesis translate_off 
159
      generic (INIT : bit_vector := X"16");
160
      -- synthesis translate_on 
161
      port (DPO   : out STD_ULOGIC;
162
            SPO   : out STD_ULOGIC;
163
            A0    : in STD_ULOGIC;
164
            A1    : in STD_ULOGIC;
165
            A2    : in STD_ULOGIC;
166
            A3    : in STD_ULOGIC;
167
            D     : in STD_ULOGIC;
168
            DPRA0 : in STD_ULOGIC;
169
            DPRA1 : in STD_ULOGIC;
170
            DPRA2 : in STD_ULOGIC;
171
            DPRA3 : in STD_ULOGIC;
172
            WCLK  : in STD_ULOGIC;
173
            WE    : in STD_ULOGIC);
174 47 rhoads
   end component;
175 116 rhoads
 
176 47 rhoads
   component pc_next
177 139 rhoads
      port(clk         : in std_logic;
178
           reset_in    : in std_logic;
179
           pc_new      : in std_logic_vector(31 downto 2);
180
           take_branch : in std_logic;
181
           pause_in    : in std_logic;
182
           opcode25_0  : in std_logic_vector(25 downto 0);
183
           pc_source   : in pc_source_type;
184
           pc_future   : out std_logic_vector(31 downto 2);
185
           pc_current  : out std_logic_vector(31 downto 2);
186
           pc_plus4    : out std_logic_vector(31 downto 2));
187 47 rhoads
   end component;
188
 
189
   component mem_ctrl
190
      port(clk          : in std_logic;
191
           reset_in     : in std_logic;
192
           pause_in     : in std_logic;
193
           nullify_op   : in std_logic;
194 139 rhoads
           address_pc   : in std_logic_vector(31 downto 2);
195 47 rhoads
           opcode_out   : out std_logic_vector(31 downto 0);
196
 
197 139 rhoads
           address_in   : in std_logic_vector(31 downto 0);
198 47 rhoads
           mem_source   : in mem_source_type;
199
           data_write   : in std_logic_vector(31 downto 0);
200
           data_read    : out std_logic_vector(31 downto 0);
201
           pause_out    : out std_logic;
202 264 rhoads
 
203
           address_next : out std_logic_vector(31 downto 2);
204
           byte_we_next : out std_logic_vector(3 downto 0);
205
 
206
           address      : out std_logic_vector(31 downto 2);
207
           byte_we      : out std_logic_vector(3 downto 0);
208
           data_w       : out std_logic_vector(31 downto 0);
209
           data_r       : in std_logic_vector(31 downto 0));
210 47 rhoads
   end component;
211
 
212
   component control
213
      port(opcode       : in  std_logic_vector(31 downto 0);
214
           intr_signal  : in  std_logic;
215
           rs_index     : out std_logic_vector(5 downto 0);
216
           rt_index     : out std_logic_vector(5 downto 0);
217
           rd_index     : out std_logic_vector(5 downto 0);
218
           imm_out      : out std_logic_vector(15 downto 0);
219
           alu_func     : out alu_function_type;
220
           shift_func   : out shift_function_type;
221
           mult_func    : out mult_function_type;
222
           branch_func  : out branch_function_type;
223
           a_source_out : out a_source_type;
224
           b_source_out : out b_source_type;
225
           c_source_out : out c_source_type;
226
           pc_source_out: out pc_source_type;
227 194 rhoads
           mem_source_out:out mem_source_type;
228
           exception_out: out std_logic);
229 47 rhoads
   end component;
230
 
231
   component reg_bank
232 139 rhoads
      generic(memory_type : string := "XILINX_16X");
233 47 rhoads
      port(clk            : in  std_logic;
234
           reset_in       : in  std_logic;
235 70 rhoads
           pause          : in  std_logic;
236 47 rhoads
           rs_index       : in  std_logic_vector(5 downto 0);
237
           rt_index       : in  std_logic_vector(5 downto 0);
238
           rd_index       : in  std_logic_vector(5 downto 0);
239
           reg_source_out : out std_logic_vector(31 downto 0);
240
           reg_target_out : out std_logic_vector(31 downto 0);
241
           reg_dest_new   : in  std_logic_vector(31 downto 0);
242
           intr_enable    : out std_logic);
243
   end component;
244
 
245
   component bus_mux
246
      port(imm_in       : in  std_logic_vector(15 downto 0);
247
           reg_source   : in  std_logic_vector(31 downto 0);
248
           a_mux        : in  a_source_type;
249
           a_out        : out std_logic_vector(31 downto 0);
250
 
251
           reg_target   : in  std_logic_vector(31 downto 0);
252
           b_mux        : in  b_source_type;
253
           b_out        : out std_logic_vector(31 downto 0);
254
 
255
           c_bus        : in  std_logic_vector(31 downto 0);
256
           c_memory     : in  std_logic_vector(31 downto 0);
257 139 rhoads
           c_pc         : in  std_logic_vector(31 downto 2);
258
           c_pc_plus4   : in  std_logic_vector(31 downto 2);
259 47 rhoads
           c_mux        : in  c_source_type;
260
           reg_dest_out : out std_logic_vector(31 downto 0);
261
 
262
           branch_func  : in  branch_function_type;
263
           take_branch  : out std_logic);
264
   end component;
265
 
266
   component alu
267 139 rhoads
      generic(alu_type  : string := "DEFAULT");
268 47 rhoads
      port(a_in         : in  std_logic_vector(31 downto 0);
269
           b_in         : in  std_logic_vector(31 downto 0);
270
           alu_function : in  alu_function_type;
271
           c_alu        : out std_logic_vector(31 downto 0));
272
   end component;
273
 
274
   component shifter
275 139 rhoads
      generic(shifter_type : string := "DEFAULT" );
276 47 rhoads
      port(value        : in  std_logic_vector(31 downto 0);
277
           shift_amount : in  std_logic_vector(4 downto 0);
278
           shift_func   : in  shift_function_type;
279
           c_shift      : out std_logic_vector(31 downto 0));
280
   end component;
281
 
282
   component mult
283 139 rhoads
      generic(mult_type  : string := "DEFAULT");
284
      port(clk       : in  std_logic;
285
           reset_in  : in  std_logic;
286
           a, b      : in  std_logic_vector(31 downto 0);
287
           mult_func : in  mult_function_type;
288
           c_mult    : out std_logic_vector(31 downto 0);
289
           pause_out : out std_logic);
290 47 rhoads
   end component;
291
 
292 70 rhoads
   component pipeline
293
      port(clk            : in  std_logic;
294
           reset          : in  std_logic;
295
           a_bus          : in  std_logic_vector(31 downto 0);
296
           a_busD         : out std_logic_vector(31 downto 0);
297
           b_bus          : in  std_logic_vector(31 downto 0);
298
           b_busD         : out std_logic_vector(31 downto 0);
299
           alu_func       : in  alu_function_type;
300
           alu_funcD      : out alu_function_type;
301
           shift_func     : in  shift_function_type;
302
           shift_funcD    : out shift_function_type;
303
           mult_func      : in  mult_function_type;
304
           mult_funcD     : out mult_function_type;
305
           reg_dest       : in  std_logic_vector(31 downto 0);
306
           reg_destD      : out std_logic_vector(31 downto 0);
307
           rd_index       : in  std_logic_vector(5 downto 0);
308
           rd_indexD      : out std_logic_vector(5 downto 0);
309
 
310
           rs_index       : in  std_logic_vector(5 downto 0);
311
           rt_index       : in  std_logic_vector(5 downto 0);
312
           pc_source      : in  pc_source_type;
313
           mem_source     : in  mem_source_type;
314
           a_source       : in  a_source_type;
315
           b_source       : in  b_source_type;
316
           c_source       : in  c_source_type;
317
           c_bus          : in  std_logic_vector(31 downto 0);
318
           pause_any      : in  std_logic;
319
           pause_pipeline : out std_logic);
320
   end component;
321
 
322 47 rhoads
   component mlite_cpu
323 139 rhoads
      generic(memory_type     : string := "XILINX_16X"; --ALTERA_LPM, or DUAL_PORT_
324 132 rhoads
              mult_type       : string := "DEFAULT";
325
              shifter_type    : string := "DEFAULT";
326 139 rhoads
              alu_type        : string := "DEFAULT";
327 202 rhoads
              pipeline_stages : natural := 2); --2 or 3
328 47 rhoads
      port(clk         : in std_logic;
329
           reset_in    : in std_logic;
330
           intr_in     : in std_logic;
331
 
332 264 rhoads
           address_next : out std_logic_vector(31 downto 2); --for synch ram
333
           byte_we_next : out std_logic_vector(3 downto 0);
334
 
335
           address      : out std_logic_vector(31 downto 2);
336
           byte_we      : out std_logic_vector(3 downto 0);
337
           data_w       : out std_logic_vector(31 downto 0);
338
           data_r       : in std_logic_vector(31 downto 0);
339
           mem_pause    : in std_logic);
340 47 rhoads
   end component;
341
 
342 50 rhoads
   component ram
343 132 rhoads
      generic(memory_type : string := "DEFAULT");
344 139 rhoads
      port(clk               : in std_logic;
345
           enable            : in std_logic;
346
           write_byte_enable : in std_logic_vector(3 downto 0);
347
           address           : in std_logic_vector(31 downto 2);
348
           data_write        : in std_logic_vector(31 downto 0);
349
           data_read         : out std_logic_vector(31 downto 0));
350 47 rhoads
   end component; --ram
351 264 rhoads
 
352
   component ddr_ctrl
353
      port(clk      : in std_logic;
354
           clk_2x   : in std_logic;
355
           reset_in : in std_logic;
356 47 rhoads
 
357 264 rhoads
           address  : in std_logic_vector(25 downto 2);
358
           byte_we  : in std_logic_vector(3 downto 0);
359
           data_w   : in std_logic_vector(31 downto 0);
360
           data_r   : out std_logic_vector(31 downto 0);
361
           active   : in std_logic;
362
           pause    : out std_logic;
363
 
364
           SD_CK_P  : out std_logic;     --clock_positive
365
           SD_CK_N  : out std_logic;     --clock_negative
366
           SD_CKE   : out std_logic;     --clock_enable
367
 
368
           SD_BA    : out std_logic_vector(1 downto 0);  --bank_address
369
           SD_A     : out std_logic_vector(12 downto 0); --address(row or col)
370
           SD_CS    : out std_logic;     --chip_select
371
           SD_RAS   : out std_logic;     --row_address_strobe
372
           SD_CAS   : out std_logic;     --column_address_strobe
373
           SD_WE    : out std_logic;     --write_enable
374
 
375
           SD_DQ    : inout std_logic_vector(15 downto 0); --data
376
           SD_UDM   : out std_logic;     --upper_byte_enable
377
           SD_UDQS  : inout std_logic;   --upper_data_strobe
378
           SD_LDM   : out std_logic;     --low_byte_enable
379
           SD_LDQS  : inout std_logic);  --low_data_strobe
380
   end component; --ddr
381
 
382 47 rhoads
   component uart
383 50 rhoads
      generic(log_file : string := "UNUSED");
384 139 rhoads
      port(clk          : in std_logic;
385
           reset        : in std_logic;
386
           enable_read  : in std_logic;
387
           enable_write : in std_logic;
388
           data_in      : in std_logic_vector(7 downto 0);
389
           data_out     : out std_logic_vector(7 downto 0);
390
           uart_read    : in std_logic;
391
           uart_write   : out std_logic;
392
           busy_write   : out std_logic;
393
           data_avail   : out std_logic);
394 47 rhoads
   end component; --uart
395
 
396 50 rhoads
   component plasma
397 139 rhoads
      generic(memory_type : string := "XILINX_X16"; --"DUAL_PORT_" "ALTERA_LPM";
398 50 rhoads
              log_file    : string := "UNUSED");
399 139 rhoads
      port(clk               : in std_logic;
400
           reset             : in std_logic;
401
           uart_write        : out std_logic;
402
           uart_read         : in std_logic;
403
 
404
           address           : out std_logic_vector(31 downto 2);
405 264 rhoads
           byte_we           : out std_logic_vector(3 downto 0);
406 139 rhoads
           data_write        : out std_logic_vector(31 downto 0);
407
           data_read         : in std_logic_vector(31 downto 0);
408
           mem_pause_in      : in std_logic;
409
 
410
           gpio0_out         : out std_logic_vector(31 downto 0);
411
           gpioA_in          : in std_logic_vector(31 downto 0));
412 50 rhoads
   end component; --plasma
413
 
414 139 rhoads
end; --package mlite_pack
415 62 rhoads
 
416
 
417 39 rhoads
package body mlite_pack is
418
 
419 139 rhoads
function bv_adder(a     : in std_logic_vector;
420
                  b     : in std_logic_vector;
421 47 rhoads
                  do_add: in std_logic) return std_logic_vector is
422 39 rhoads
   variable carry_in : std_logic;
423 139 rhoads
   variable bb       : std_logic_vector(a'length-1 downto 0);
424
   variable result   : std_logic_vector(a'length downto 0);
425 39 rhoads
begin
426 47 rhoads
   if do_add = '1' then
427 39 rhoads
      bb := b;
428
      carry_in := '0';
429
   else
430
      bb := not b;
431
      carry_in := '1';
432
   end if;
433 139 rhoads
   for index in 0 to a'length-1 loop
434 39 rhoads
      result(index) := a(index) xor bb(index) xor carry_in;
435
      carry_in := (carry_in and (a(index) or bb(index))) or
436
                  (a(index) and bb(index));
437
   end loop;
438 139 rhoads
   result(a'length) := carry_in xnor do_add;
439 39 rhoads
   return result;
440
end; --function
441
 
442 91 rhoads
 
443 39 rhoads
function bv_negate(a : in std_logic_vector) return std_logic_vector is
444
   variable carry_in : std_logic;
445 139 rhoads
   variable not_a    : std_logic_vector(a'length-1 downto 0);
446
   variable result   : std_logic_vector(a'length-1 downto 0);
447 39 rhoads
begin
448
   not_a := not a;
449
   carry_in := '1';
450
   for index in a'reverse_range loop
451
      result(index) := not_a(index) xor carry_in;
452
      carry_in := carry_in and not_a(index);
453
   end loop;
454
   return result;
455
end; --function
456
 
457 91 rhoads
 
458 39 rhoads
function bv_increment(a : in std_logic_vector(31 downto 2)
459
                     ) return std_logic_vector is
460
   variable carry_in : std_logic;
461
   variable result   : std_logic_vector(31 downto 2);
462
begin
463
   carry_in := '1';
464
   for index in 2 to 31 loop
465
      result(index) := a(index) xor carry_in;
466
      carry_in := a(index) and carry_in;
467
   end loop;
468
   return result;
469
end; --function
470
 
471 91 rhoads
 
472 139 rhoads
function bv_inc(a : in std_logic_vector
473
                ) return std_logic_vector is
474 39 rhoads
   variable carry_in : std_logic;
475 139 rhoads
   variable result   : std_logic_vector(a'length-1 downto 0);
476 39 rhoads
begin
477
   carry_in := '1';
478 139 rhoads
   for index in 0 to a'length-1 loop
479 39 rhoads
      result(index) := a(index) xor carry_in;
480
      carry_in := a(index) and carry_in;
481
   end loop;
482
   return result;
483
end; --function
484
 
485
end; --package body
486
 
487
 

powered by: WebSVN 2.1.0

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