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 12

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
  constant NbitIn   : natural := 12;
8
  constant LSB_In   : natural := 8;
9
  constant Nbit     : natural := 12;
10
  constant NbitW    : natural := 24;
11
  constant LSB_OUT  : natural := 8;
12
  constant Nlayer   : natural := 3;
13
 
14
  constant NbitOut : integer := 12 ;
15
  constant NumIn   : integer := 1;
16
  constant NumN    : int_vector(Nlayer-1 downto 0) := assign_ints("2 3 1",Nlayer);
17
  constant LSbit   : int_vector(Nlayer-1 downto 0) := assign_ints("8 8 8",Nlayer);
18
  constant NbitO   : int_vector(Nlayer-1 downto 0) := assign_ints("12 12 12",Nlayer);
19
  constant l_type  : string  := "SP PS SP";                  -- Layer type of each layer
20 10 jstefanowi
  constant f_type  : string  := "sigmat sigmat sigmat";  -- Activation function type of each layer
21 8 jstefanowi
 
22
  function real2stdlv (bitW : natural; din : real) return std_logic_vector;
23
 
24
end support_pkg;
25
 
26
package body support_pkg is
27
 
28
function real2stdlv (bitW : natural; din : real) return std_logic_vector is
29
    variable vres : signed(bitW-1 downto 0) := (others => '0');
30
  begin  -- real2stdlv
31
    vres:= to_signed(integer(din*(2.0**(LSB_OUT))), bitW);
32
    return std_logic_vector(vres);
33
  end real2stdlv;
34
 
35
end support_pkg;

powered by: WebSVN 2.1.0

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