当前位置:网站首页>Floating point addition and subtraction method of vivado IP core floating point
Floating point addition and subtraction method of vivado IP core floating point
2022-07-29 06:39:00 【Doze in the wind】
Vivado IP Core floating point addition and subtraction Floating-point
Catalog
One 、 Example of floating point addition and subtraction
Two 、 Configuration instructions
3、 ... and 、Floating-point IP Core configuration steps
Preface
With the continuous development of manufacturing technology , Field programmable logic gate array (FPGA) More and more integration , More and more applications , Among them, some mathematical processing classes must be used when processing digital signals IP nucleus . Recently, research on Spatial Adaptive Anti-jamming Technology is under way FPGA Hardware implementation , Some of them are inevitably used IP nucleus , Today from Floating point addition and subtraction So let's talk about that vivado In the middle of Floating-point This IP Nuclear bar , I hope it can help you in your study .
Tips : The following is the main body of this article , All are original by the author , It's not easy to write an article , I hope you will attach a link to this article when reprinting .
One 、 Example of floating point addition and subtraction
In order to facilitate the analysis of the results of the later simulation , Here we will give examples of floating-point addition and subtraction , The following example is directly used for simulation , Verify whether the simulation results are correct .
example: Set floating point number a=32'b1100_0000_1101_0011_0011_0011_0011_0011, namely a=-6.6, Floating point numbers b=32'b0100_0001_0000_1100_1100_1100_1100_1101, namely b=8.8, be a+b=32'b0100_0000_0000_1100_1100_1100_1100_1110, namely a+b=2.2000003( The reason is not equal to 2.2, Because the floating-point representation itself has a precision problem ),a-b=32'b1100_0001_0111_0110_0110_0110_0110_0110, namely a-b=-15.4.
Two 、 Configuration instructions
Because this time a Floating-point IP Nuclear realization can add and subtract , So there must be a control signal to control whether to add or subtract . This control signal is in the data book 6 Bit , But the specific generation IP Nuclear time actually has 8 position , The default configuration of the upper two digits is 0, The specific configuration is shown in the figure 1 Shown .

3、 ... and 、Floating-point IP Core configuration steps
stay vivado Mid search Floating-point, To find the IP After the core, you can complete the corresponding configuration according to the following operations .
1. First configuration Operation Selection Interface , Pictured 2 Shown .

2. Next configuration Precision of Inputs Interface , Pictured 3 Shown .

3. Then configure Optimizations Interface , Pictured 4 Shown .

4. Final configuration Interface Options Interface , Pictured 5 Shown .

above 4 After all the interfaces are configured, you can click on the lower right corner OK Button generation IP nucleus .
Four 、 Simulation
1. Top level code
Build a top-level module , Name it float_add_sub, Used to instantiate the just generated IP nucleus .
The code is as follows :
`timescale 1ns / 1ps
//
// Company: cq university
// Engineer: clg
// Create Date: 2022/07/23 12:19:25
// Design Name:
// Module Name: float_add_sub
// Project Name:
// Target Devices:
// Tool Versions: 2017.4
// Description:
// Dependencies:
// Revision:1.0
// Revision 0.01 - File Created
// Additional Comments:
//
//
module float_add_sub(
input clk,
input a_tvalid,
input [31:0] a_tdata,
input b_tvalid,
input [31:0] b_tdata,
input operation_tvalid,
input [7:0] operation_tdata,
output result_tvalid,
output [31:0] result_tdata
);
float_add_sub_ip float_add_sub_ip_u1(
.aclk(clk),
.s_axis_a_tvalid(a_tvalid),
.s_axis_a_tdata(a_tdata),
.s_axis_b_tvalid(b_tvalid),
.s_axis_b_tdata(b_tdata),
.s_axis_operation_tvalid(operation_tvalid),
.s_axis_operation_tdata(operation_tdata),
.m_axis_result_tvalid(result_tvalid),
.m_axis_result_tdata(result_tdata)
);
endmodule
2. Simulation code
Build a simulation module , Name it float_add_sub_tb, It is used to simulate the instantiation of the top-level module just now IP nucleus .
The code is as follows :
`timescale 1ns / 1ps
//
// Company: cq uiniversity
// Engineer: clg
// Create Date: 2022/07/23 12:34:59
// Design Name:
// Module Name: float_add_sub_tb
// Project Name:
// Target Devices:
// Tool Versions: 2017.4
// Description:
// Dependencies:
// Revision:1.0
// Revision 0.01 - File Created
// Additional Comments:
//
module float_add_sub_tb();
reg clk;
reg a_tvalid;
reg [31:0] a_tdata;
reg b_tvalid;
reg [31:0] b_tdata;
reg operation_tvalid;
reg [7:0] operation_tdata;
wire result_tvalid;
wire [31:0] result_tdata;
float_add_sub u1_float_add_sub(
.clk(clk),
.a_tvalid(a_tvalid),
.a_tdata(a_tdata),
.b_tvalid(b_tvalid),
.b_tdata(b_tdata),
.operation_tvalid(operation_tvalid),
.operation_tdata(operation_tdata),
.result_tvalid(result_tvalid),
.result_tdata(result_tdata)
);
always #5 clk=~clk;
initial begin
clk=1'b0;
#10; a_tvalid<=1'b1;
a_tdata<=32'b1100_0000_1101_0011_0011_0011_0011_0011;
b_tvalid<=1'b1;
b_tdata<=32'b0100_0001_0000_1100_1100_1100_1100_1101;
operation_tvalid<=1'b1;
operation_tdata<=8'b0000_0000; // Add
#400; a_tvalid<=1'b1;
b_tvalid<=1'b1;
operation_tvalid<=1'b1;
operation_tdata<=8'b0000_0001; // Subtraction
end
always @(posedge clk) begin
if (result_tvalid == 1'b1) begin
a_tvalid <=1'b0;
b_tvalid<=1'b0;
operation_tvalid <= 1'b0;
end
end
endmodule
5、 ... and 、 Simulation analysis
The simulation results are shown in the figure 6 Shown , Compare the examples of floating-point addition and subtraction listed above , It can be seen that this module successfully realizes the addition and subtraction of floating-point numbers .

summary
This time, I introduce How do you use it? vivado Medium Floating-point IP Verify the addition and subtraction of floating-point numbers .
边栏推荐
猜你喜欢

Merkletree builds QT implementation UI

三、广域通信网

Redshift restore SP effect - SP map export settings and map import configuration
![Self study understanding of [chain forward star]](/img/b4/7f66026a482540bf27f088c321a840.png)
Self study understanding of [chain forward star]

虹科分享 | FPGA 实现的直通与存储转发切换延迟

2022年的软件测试的岗位要求为何越来越高?这其中有什么不可告人的秘密吗?

FIR filter design (1) -- using the FDATool toolbox of MATLAB to design FIR filter parameters

Circular linked list and bidirectional linked list

JVM memory structure

Joint use skills of joiner.on and stream().Map
随机推荐
Day16 set
不安全的第三方组件的漏洞如何做前置规避?
Rowkey design
五、 无线通信网
Idea installing Scala
如何判断业务被DDoS攻击?又会造成哪些危害?
FPGA - odd even frequency division and decimal frequency division code routine
自动化测试的生命周期是什么?
[interview questions] the latest software test interview questions in 2022 (400) [with answers] continue to update
What is the basic principle of Library collision and library collision attack
九、 组网技术
虹科分享 | 为什么说EtherCAT是提高控制系统性能的最佳解决方案?
Vivado IP核之复数浮点数除法 Floating-point
day03_2_作业
钓鱼邮件处置
JVM memory structure
Circular linked list and bidirectional linked list
Network Security Learning (II)
What is WAF protection
六、 网络互联与互联网