当前位置:网站首页>[FPGA]: IP core - multiplier
[FPGA]: IP core - multiplier
2022-07-24 10:46:00 【Summer is cool and autumn falls】
List of articles
One 、 Multiplier
1.1 summary
Multiplier as the name suggests , Used for multiplication .
1.2 Port specification


1.3 ip Nuclear production
(1) stay ip catalog Choose from multiplier
(2)basic The specific configuration and meaning of are as follows :
(3)output and control The configuration is as follows :
1.4 Code implementation
The main program :
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;
-- Uncomment the following library declaration if instantiating
-- any Xilinx leaf cells in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity Multiplier is
Port (
CLK: in std_logic;
A : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
B : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
CE : IN STD_LOGIC;
SCLR : IN STD_LOGIC;
P : OUT STD_LOGIC_VECTOR(63 DOWNTO 0)
);
end Multiplier;
architecture Behavioral of Multiplier is
COMPONENT mult_gen_0
PORT (
CLK : IN STD_LOGIC;
A : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
B : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
CE : IN STD_LOGIC;
SCLR : IN STD_LOGIC;
P : OUT STD_LOGIC_VECTOR(63 DOWNTO 0)
);
END COMPONENT;
begin
signed32_signed32 : mult_gen_0
PORT MAP (
CLK => CLK,
A => A,
B => B,
CE => CE,
SCLR => SCLR,
P => P
);
end Behavioral;
The test file (VHDL):
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;
-- Uncomment the following library declaration if instantiating
-- any Xilinx leaf cells in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity multiplier_tb is
-- Port ( );
end multiplier_tb;
architecture Behavioral of multiplier_tb is
signal clk : std_logic;
signal a : std_logic_vector(31 downto 0);
signal b : std_logic_vector(31 downto 0);
signal cs : std_logic;
signal sclr : std_logic;
signal result : std_logic_vector(63 downto 0);
COMPONENT multiplier
Port (
CLK: in std_logic;
A : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
B : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
CE : IN STD_LOGIC;
SCLR : IN STD_LOGIC;
P : OUT STD_LOGIC_VECTOR(63 DOWNTO 0)
);
END COMPONENT;
begin
multiplier_inst0: multiplier
Port map (
CLK => clk,
A => a,
B => b,
CE => cs,
SCLR => sclr,
P => result
);
clk_gen: process
begin
clk <='1';
wait for 5ns;
clk <= '0';
wait for 5ns;
end process;
process
begin
a <= (others=>'0') ; -- Brackets must be added, otherwise an error will be reported
b <= (others=>'0');
cs <= '0';
sclr <='1';
wait for 20ns;
a <= conv_std_logic_vector(11,32);
b <= conv_std_logic_vector(10,32);
cs <= '1';
sclr <='0';
wait for 100ns;
a <= conv_std_logic_vector(-11,32);
b <= conv_std_logic_vector(10,32);
wait for 100ns;
cs <='0';
wait; -- Keep waiting
end process;
end Behavioral;
The test file (Verilog):
module multiplier_tb1();
reg clk;
reg signed [31:0] a;
reg signed [31:0] b;
reg cs;
reg sclr;
wire signed [63:0] result ;
Multiplier Multiplier_inst0
(
.CLK (clk),
.A (a),
.B (b ),
.CE (cs ),
.SCLR (sclr ),
.P (result)
);
initial clk=1;
always #5 clk=~clk;
initial begin
a = 0 ;
b = 0;
cs = 0;
sclr =1;
#20;
a = 32'd11;
b = 32'd10;
cs = 1;
sclr = 0;
#100;
a = $signed(-11);
b = 32'd10;
#100;
cs =0;
end
endmodule
1.5 Simulation results

As you can see from the diagram , The output is one clock cycle later than the input , This is related to ip Nuclear pipeline stages Same settings , And the multiplication result is correct .
边栏推荐
- 每日三题 7.22
- ECCV 2022 | Tsinghua proposes the first transformer to embed spectral sparsity
- Ffmpeg splash screen solution (modify the source code and discard incomplete frames)
- Sentinel 三种流控模式
- 零基础学习CANoe Panel(8)—— 数据/文本编辑控件(Hex/Text Editor )
- Volcanic engine: open ByteDance, the same AI infrastructure, a system to solve multiple training tasks
- Image processing: floating point number to fixed point number
- How many indexes are associated indexes under MySQL InnoDB?
- 《nlp入门+实战:第二章:pytorch的入门使用 》
- Machine learning quiz (11) verification code recognition test - deep learning experiment using QT and tensorflow2
猜你喜欢
随机推荐
After the QT program minimizes the tray, a msgbox pops up. Click OK and the program exits. The problem is solved
How to build a node development environment efficiently
[dish of learning notes dog learning C] advanced pointer
跨平台音频播放库
Chapter V Modification implementation (impl) class
【类、抽象与继承】
5个最佳WordPress广告插件
Is it safe to open an online stock account?
Cross platform audio playback Library
实时天气API
563 pages (300000 words) overall design scheme of smart Chemical Park (phase I)
用 Signal Processing Toolbox 软件对数据进行滤波
Binlog and iptables prevent nmap scanning, xtrabackup full + incremental backup, and the relationship between redlog and binlog
[dish of learning notes dog learning C] initial level of pointer
PostgreSQL rounding
[micro service] eureka+ribbon realizes registration center and load balancing
MySQL - 索引的隐藏和删除
常量指针、指针常量
Design of dual machine hot standby scheme
Scaffold document directory description and document exposure




![[AHK] AutoHotKey tutorial ①](/img/70/20f2e19e3e268ffe2f1e2956719c09.png)



