-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtanh_module_real.vhd
59 lines (49 loc) · 1.08 KB
/
tanh_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
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use ieee.math_real.all;
use IEEE.numeric_std.all;
entity tanh_module is
Port (
clk : in std_logic;
enable : in std_logic;
input : in real;
output : out real);
end tanh_module;
architecture high_level_sim of tanh_module is
type fifo is array(0 to 3) of real;
signal internal_regs : fifo;
begin
process(clk)
begin
if rising_edge(clk) then
if enable='1' then
internal_regs(0) <= TANH(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;
output <= internal_regs(3);
end high_level_sim;