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/] [support_pkg.vhd] - Blame information for rev 8

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

Line No. Rev Author Line
1 8 jstefanowi
library IEEE;
2
use IEEE.STD_LOGIC_1164.all;
3
use IEEE.numeric_std.all;
4
use work.layers_pkg.all;
5
package support_pkg is
6
 
7
    -- generic constants:
8
 
9
  constant NbitIn   : natural := 12;
10
  constant LSB_In   : natural := 8;
11
  constant Nbit     : natural := 12;
12
  constant NbitW    : natural := 24;
13
  constant LSB_OUT  : natural := 8;
14
  constant Nlayer   : natural := 3;
15
 
16
  constant NbitOut : integer := 12 ;
17
  constant NumIn   : integer := 1;
18
  constant NumN    : int_vector(Nlayer-1 downto 0) := assign_ints("2 3 1",Nlayer);
19
  constant LSbit   : int_vector(Nlayer-1 downto 0) := assign_ints("8 8 8",Nlayer);
20
  constant NbitO   : int_vector(Nlayer-1 downto 0) := assign_ints("12 12 12",Nlayer);
21
  constant l_type  : string  := "SP PS SP";                  -- Layer type of each layer
22
  constant f_type  : string  := "siglu2 siglu2 siglu2";  -- Activation function type of each layer
23
 
24
  function real2stdlv (bitW : natural; din : real) return std_logic_vector;
25
 
26
end support_pkg;
27
 
28
package body support_pkg is
29
 
30
function real2stdlv (bitW : natural; din : real) return std_logic_vector is
31
    variable vres : signed(bitW-1 downto 0) := (others => '0');
32
  begin  -- real2stdlv
33
    vres:= to_signed(integer(din*(2.0**(LSB_OUT))), bitW);
34
    return std_logic_vector(vres);
35
  end real2stdlv;
36
 
37
end support_pkg;

powered by: WebSVN 2.1.0

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