-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathscalar_multiplier_ard.vhd
30 lines (23 loc) · 1.09 KB
/
scalar_multiplier_ard.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
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
use work.Common.all;
library ieee_proposed;
use IEEE_PROPOSED.fixed_pkg.all;
entity scalar_multiplier_ard is
Port ( scalar : in sfixed (7 downto -8);
nn_in : in vector_fixed_point_type;
nn_out : out sfixed_fixed_point_type
);
end scalar_multiplier_ard;
architecture Behavioral of scalar_multiplier_ard is
begin
nn_out(0) <= scalar * to_sfixed(to_integer(unsigned(nn_in(0)(31 downto 16))),7,-8);
nn_out(1) <= scalar * to_sfixed(to_integer(unsigned(nn_in(1)(31 downto 16))),7,-8);
nn_out(2) <= scalar * to_sfixed(to_integer(unsigned(nn_in(2)(31 downto 16))),7,-8);
nn_out(3) <= scalar * to_sfixed(to_integer(unsigned(nn_in(3)(31 downto 16))),7,-8);
nn_out(4) <= scalar * to_sfixed(to_integer(unsigned(nn_in(4)(31 downto 16))),7,-8);
nn_out(5) <= scalar * to_sfixed(to_integer(unsigned(nn_in(5)(31 downto 16))),7,-8);
nn_out(6) <= scalar * to_sfixed(to_integer(unsigned(nn_in(6)(31 downto 16))),7,-8);
nn_out(7) <= scalar * to_sfixed(to_integer(unsigned(nn_in(7)(31 downto 16))),7,-8);
end Behavioral;