-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsigmoid_module_real.vhd
79 lines (67 loc) · 1.48 KB
/
sigmoid_module_real.vhd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use ieee.math_real.all;
use IEEE.numeric_std.all;
entity sigmoid_module is
Port (
clk : in std_logic;
enable : in std_logic;
input : in real;
output : out real);
end sigmoid_module;
architecture high_level_sim of sigmoid_module is
type fifo is array(0 to 5) of real;
signal internal_regs : fifo;
begin
process(clk)
variable ii : real;
variable oo : real;
begin
if rising_edge(clk) then
if enable='1' then
internal_regs(0) <= 1.0 / (1.0 + EXP(-1.0 * input));
end if;
end if;
end process;
process(clk)
begin
if rising_edge(clk) then
if enable='1' then
internal_regs(1) <= internal_regs(0);
end if;
end if;
end process;
process(clk)
begin
if rising_edge(clk) then
if enable='1' then
internal_regs(2) <= internal_regs(1);
end if;
end if;
end process;
process(clk)
begin
if rising_edge(clk) then
if enable='1' then
internal_regs(3) <= internal_regs(2);
end if;
end if;
end process;
process(clk)
begin
if rising_edge(clk) then
if enable='1' then
internal_regs(4) <= internal_regs(3);
end if;
end if;
end process;
process(clk)
begin
if rising_edge(clk) then
if enable='1' then
internal_regs(5) <= internal_regs(4);
end if;
end if;
end process;
output <= internal_regs(5);
end high_level_sim;