URL
https://opencores.org/ocsvn/gfir/gfir/trunk
[/] [gfir/] [trunk/] [vhdl/] [src/] [multiplier_gen.vhd] - Blame information for rev 6
Go to most recent revision |
Details |
Compare with Previous |
View Log
Line No. |
Rev |
Author |
Line |
1 |
4 |
ahmed.shah |
----------
|
2 |
|
|
--! @file
|
3 |
|
|
--! @brief This is signed constant multiplier with unsigned input port.
|
4 |
|
|
----------
|
5 |
|
|
LIBRARY ieee;
|
6 |
|
|
USE ieee.std_logic_1164.all;
|
7 |
|
|
USE ieee.std_logic_signed.all;
|
8 |
|
|
USE ieee.std_logic_arith.all;
|
9 |
|
|
|
10 |
|
|
ENTITY multiplier_gen IS
|
11 |
|
|
generic (multi_width_const : natural;
|
12 |
|
|
multi_width_in : natural);
|
13 |
|
|
port (multiplier_const : in std_logic_vector(multi_width_const-1 downto 0); --! Constant multiplier hardwired to the filter coefficient
|
14 |
|
|
multiplier_in : in std_logic_vector(multi_width_in-1 downto 0); --! Constant multiplier input port with variable bit-width
|
15 |
|
|
multiplier_out : out std_logic_vector((multi_width_const+multi_width_in)+1 downto 0)); --! Constant multiplier output port
|
16 |
|
|
END ENTITY multiplier_gen;
|
17 |
|
|
|
18 |
|
|
--
|
19 |
|
|
ARCHITECTURE behave OF multiplier_gen IS
|
20 |
|
|
signal tmp_multiplier_out : std_logic_vector((multi_width_const+multi_width_in) downto 0);
|
21 |
|
|
signal tmp_msb : std_logic;
|
22 |
|
|
BEGIN
|
23 |
|
|
tmp_multiplier_out <= unsigned(multiplier_in) * signed(multiplier_const);
|
24 |
|
|
tmp_msb <= tmp_multiplier_out(tmp_multiplier_out'left);
|
25 |
|
|
multiplier_out <= tmp_msb&tmp_multiplier_out;
|
26 |
|
|
END ARCHITECTURE behave;
|
27 |
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.