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

Subversion Repositories artificial_neural_network

[/] [artificial_neural_network/] [trunk/] [ANN_kernel/] [RTL_VHDL_files/] [layers_pkg.vhd] - Diff between revs 8 and 9

Show entire file | Details | Blame | View Log

Rev 8 Rev 9
Line 18... Line 18...
--
--
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
 
 
library IEEE;
library IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.STD_LOGIC_1164.all;
use IEEE.numeric_std.all;
 
 
 
--library proc_common_v3_00_a; -- Deprecated libray from XPS tool
--library proc_common_v3_00_a; -- Deprecated libray from XPS tool
--use proc_common_v3_00_a.proc_common_pkg.all;
--use proc_common_v3_00_a.proc_common_pkg.all;
 
 
package layers_pkg is
package layers_pkg is
Line 46... Line 45...
 
 
   -- Argument: c : character to be checked
   -- Argument: c : character to be checked
   -- Return: TRUE if c is 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9
   -- Return: TRUE if c is 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9
   function is_digit(c : character) return boolean;
   function is_digit(c : character) return boolean;
 
 
 
 
   -- Base two logarithm for int_vector:
   -- Base two logarithm for int_vector:
   -- Arguments:
   -- Arguments:
   --    v : integer vector
   --    v : integer vector
   --    n : number of elements of the vector
   --    n : number of elements of the vector
   -- Return : integer vector of the base two logarithms of each elment of v
   -- Return : integer vector of the base two logarithms of each elment of v
Line 235... Line 233...
   function calculate_addr_l(NumIn : integer; NumN : int_vector; n : integer) return integer is -- matrix + b_sel
   function calculate_addr_l(NumIn : integer; NumN : int_vector; n : integer) return integer is -- matrix + b_sel
      variable addr_l : integer := log2(NumIn)+log2(NumN(0)); -- return value. Initialized with the weight memory length of the first layer
      variable addr_l : integer := log2(NumIn)+log2(NumN(0)); -- return value. Initialized with the weight memory length of the first layer
   begin
   begin
      -- Calculate the maximum of the weight memory length:
      -- Calculate the maximum of the weight memory length:
      for i in 1 to n-1 loop
      for i in 1 to n-1 loop
         addr_l := max2( addr_l, log2(NumN(i-1)+log2(NumN(i))) );
         addr_l := max2( addr_l, log2(NumN(i-1))+log2(NumN(i)) );
      end loop;
      end loop;
      addr_l := addr_l +1; -- add bias select bit
      addr_l := addr_l +1; -- add bias select bit
      return addr_l;
      return addr_l;
   end calculate_addr_l;
   end calculate_addr_l;
 
 

powered by: WebSVN 2.1.0

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