]> rtime.felk.cvut.cz Git - fpga/lx-cpu1/lx-rocon.git/blob - hw/lx-fncapprox/lx_fncapprox_dsp48.vhd
230199c68f9d5c7ddf82d724bdb28ad9c17a2775
[fpga/lx-cpu1/lx-rocon.git] / hw / lx-fncapprox / lx_fncapprox_dsp48.vhd
1 library ieee;
2 use ieee.std_logic_1164.all;
3 use ieee.std_logic_unsigned.all;
4 use ieee.numeric_std.all;
5 use work.lx_fncapprox_pkg.all;
6
7 -- IRC bus interconnect
8 entity lx_fncapprox_dsp48 is
9         port (
10                 P         : out std_logic_vector(47 downto 0);
11                 A         : in  std_logic_vector(17 downto 0) := (others => '0');
12                 B         : in  std_logic_vector(17 downto 0) := (others => '0');
13                 C         : in  std_logic_vector(47 downto 0) := (others => '0');
14                 ADD_SUB_X : in  std_logic;
15                 CLK       : in  std_logic;
16                 CE        : in  std_logic
17         );
18 end lx_fncapprox_dsp48;
19
20 architecture Behavioral of lx_fncapprox_dsp48 is
21         signal P_s        : std_logic_vector(47 downto 0);
22
23 begin
24
25         P <= P_s;
26
27 update:
28         process
29         begin
30                 wait until CLK'event and CLK= '1' and CE = '1';
31                 if ADD_SUB_X = '1' then
32                         P_s <= std_logic_vector(unsigned(C) - unsigned(A) * unsigned(B));
33                 else
34                         P_s <= std_logic_vector(unsigned(C) + unsigned(A) * unsigned(B));
35                 end if;
36         end process;
37 end Behavioral;
38