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 7 and 8

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 7 Rev 8
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 45... Line 46...
 
 
   -- 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 136... Line 138...
         when '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' => return true;
         when '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' => return true;
         when others => return false;
         when others => return false;
      end case;
      end case;
   end is_digit;
   end is_digit;
 
 
 
 
   -- Assign values to a integer vector from a string:
   -- Assign values to a integer vector from a string:
   -- Arguments:
   -- Arguments:
   --    str_v : string to be converted
   --    str_v : string to be converted
   --    n : number of elements of the vector
   --    n : number of elements of the vector
   -- Return: assigned integer vector
   -- Return: assigned integer vector
Line 232... Line 235...
   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-2019 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.