vivado Convergent Rounding (LSB CorrectionTechnique)

2024-02-17 16:44

本文主要是介绍vivado Convergent Rounding (LSB CorrectionTechnique),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

DSP块基元利用模式检测电路来计算收敛舍入(要么为偶数,要么为奇数)。以下是收敛舍入推理的示例,它在块满时进行推理并且还推断出2输入and门(1 LUT)以实现LSB校正。

Rounding to Even (Verilog)
Filename: convergentRoundingEven.v
// Convergent rounding(Even) Example which makes use of pattern detect
// File: convergentRoundingEven.v
module convergentRoundingEven (
input clk,
input [23:0] a,
input [15:0] b,
output reg signed [23:0] zlast
);
reg signed [23:0] areg;
reg signed [15:0] breg;
reg signed [39:0] z1;
reg pattern_detect;
wire [15:0] pattern = 16'b0000000000000000;
wire [39:0] c = 40'b0000000000000000000000000111111111111111; // 15 ones
wire signed [39:0] multadd;
wire signed [15:0] zero;
reg signed [39:0] multadd_reg;
// Convergent Rounding: LSB Correction Technique
// ---------------------------------------------
// For static convergent rounding, the pattern detector can be used
// to detect the midpoint case. For example, in an 8-bit round, if
// the decimal place is set at 4, the C input should be set to
// 0000.0111. Round to even rounding should use CARRYIN = "1" and
// check for PATTERN "XXXX.0000" and replace the units place with 0
// if the pattern is matched. See UG193 for more details.
assign multadd = z1 + c + 1'b1;
always @(posedge clk)
begin
areg <= a;
breg <= b;
z1 <= areg * breg;
pattern_detect <= multadd[15:0] == pattern ? 1'b1 : 1'b0;
multadd_reg <= multadd;
end
// Unit bit replaced with 0 if pattern is detected
always @(posedge clk)
zlast <= pattern_detect ? {multadd_reg[39:17],1'b0} : multadd_reg[39:16];
endmodule // convergentRoundingEven
Rounding to Even (VHDL)
Filename: convergentRoundingEven.vhd
-- Convergent rounding(Even) Example which makes use of pattern detect
-- File: convergentRoundingEven.vhd
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity convergentRoundingEven is
port (clk : in std_logic;
a : in std_logic_vector (23 downto 0);
b : in std_logic_vector (15 downto 0);
zlast : out std_logic_vector (23 downto 0));
end convergentRoundingEven;
architecture beh of convergentRoundingEven is
signal ar : signed(a'range);
signal br : signed(b'range);
signal z1 : signed(a'length + b'length - 1 downto 0);
signal multaddr : signed(a'length + b'length - 1 downto 0);
signal multadd : signed(a'length + b'length - 1 downto 0);
signal pattern_detect : boolean;
constant pattern : signed(15 downto 0) := (others => '0');
constant c : signed := "0000000000000000000000000111111111111111";
-- Convergent Rounding: LSB Correction Technique
-- ---------------------------------------------
-- For static convergent rounding, the pattern detector can be used
-- to detect the midpoint case. For example, in an 8-bit round, if
-- the decimal place is set at 4, the C input should be set to
-- 0000.0111. Round to even rounding should use CARRYIN = "1" and
-- check for PATTERN "XXXX.0000" and replace the units place with 0
-- if the pattern is matched. See UG193 for more details.
begin
multadd <= z1 + c + 1;
process(clk)
begin
if rising_edge(clk) then
ar <= signed(a);
br <= signed(b);
z1 <= ar * br;
multaddr <= multadd;
if multadd(15 downto 0) = pattern then
pattern_detect <= true;
else
pattern_detect <= false;
end if;
end if;
end process;
-- Unit bit replaced with 0 if pattern is detected
process(clk)
begin
if rising_edge(clk) then
if pattern_detect = true then
zlast <= std_logic_vector(multaddr(39 downto 17)) & "0";
else
zlast <= std_logic_vector(multaddr(39 downto 16));
end if;
end if;
end process;
end beh;
Rounding to Odd (Verilog)
Filename: convergentRoundingOdd.v
// Convergent rounding(Odd) Example which makes use of pattern detect
// File: convergentRoundingOdd.v
module convergentRoundingOdd (
input clk,
input [23:0] a,
input [15:0] b,
output reg signed [23:0] zlast
);
reg signed [23:0] areg;
reg signed [15:0] breg;
reg signed [39:0] z1;
reg pattern_detect;
wire [15:0] pattern = 16'b1111111111111111;
wire [39:0] c = 40'b0000000000000000000000000111111111111111; // 15 ones
wire signed [39:0] multadd;
wire signed [15:0] zero;
reg signed [39:0] multadd_reg;
// Convergent Rounding: LSB Correction Technique
// ---------------------------------------------
// For static convergent rounding, the pattern detector can be
// used to detect the midpoint case. For example, in an 8-bit
// round, if the decimal place is set at 4, the C input should
// be set to 0000.0111. Round to odd rounding should use
// CARRYIN = "0" and check for PATTERN "XXXX.1111" and then
// replace the units place bit with 1 if the pattern is
// matched. See UG193 for details
assign multadd = z1 + c;
always @(posedge clk)
begin
areg <= a;
breg <= b;
z1 <= areg * breg;
pattern_detect <= multadd[15:0] == pattern ? 1'b1 : 1'b0;
multadd_reg <= multadd;
end
always @(posedge clk)
zlast <= pattern_detect ? {multadd_reg[39:17],1'b1} : multadd_reg[39:16];
endmodule // convergentRoundingOdd
Rounding to Odd (VHDL)
Filename: convergentRoundingOdd.vhd
-- Convergent rounding(Odd) Example which makes use of pattern detect
-- File: convergentRoundingOdd.vhd
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity convergentRoundingOdd is
port (clk : in std_logic;
a : in std_logic_vector (23 downto 0);
b : in std_logic_vector (15 downto 0);
zlast : out std_logic_vector (23 downto 0));
end convergentRoundingOdd;
architecture beh of convergentRoundingOdd is
signal ar : signed(a'range);
signal br : signed(b'range);
signal z1 : signed(a'length + b'length - 1 downto 0);
signal multadd, multaddr : signed(a'length + b'length - 1 downto 0);
signal pattern_detect : boolean;
constant pattern : signed(15 downto 0) := (others => '1');
constant c : signed := "0000000000000000000000000111111111111111";
-- Convergent Rounding: LSB Correction Technique
-- ---------------------------------------------
-- For static convergent rounding, the pattern detector can be
-- used to detect the midpoint case. For example, in an 8-bit
-- round, if the decimal place is set at 4, the C input should
-- be set to 0000.0111. Round to odd rounding should use
-- CARRYIN = "0" and check for PATTERN "XXXX.1111" and then
-- replace the units place bit with 1 if the pattern is
-- matched. See UG193 for details
begin
multadd <= z1 + c;
process(clk)
begin
if rising_edge(clk) then
ar <= signed(a);
br <= signed(b);
z1 <= ar * br;
multaddr <= multadd;
if multadd(15 downto 0) = pattern then
pattern_detect <= true;
else
pattern_detect <= false;
end if;
end if;
end process;
process(clk)
begin
if rising_edge(clk) then
if pattern_detect = true then
zlast <= std_logic_vector(multaddr(39 downto 17)) & "1";
else
zlast <= std_logic_vector(multaddr(39 downto 16));
end if;
end if;
end process;
end beh;

这篇关于vivado Convergent Rounding (LSB CorrectionTechnique)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/718389

相关文章

vivado 添加多循环路径

添加多循环路径 接下来,您将使用约束编辑器添加一个多循环路径。 1.双击树的“异常”类别下的“设置多周期路径”。 2.在“设置多周期路径”对话框中,将路径乘数设置为2。 3.在“通过”输入框中,键入以下字符串(或者,您可以复制和粘贴它 从这里): [get_pins cpuEngine/or1200_cpu/or1200_alu/*] 请注意,Tcl命令显示在command字段中。

vivado error:Combinatorial Loop Alert:1 LUT cells form a combinatorial loop

VIVADO ERROR :Combinatorial Loop Alert:1 LUT cells form a combinatorial loop vivao生成bit流时发生报错,如下图所示定位原因解决 vivao生成bit流时发生报错,如下图所示 定位原因 在三段式状态机中,组合逻辑代码if else 语句未写全只写了if…elsif…,没有写else,导致错误

vivado 创建时间约束3

下图显示了完成的输入延迟页面。请注意,四个约束是 跳过。 12.成功输入所有输入约束值后,单击下一步。 向导的“输出延迟”页面显示了中不受约束的所有输出 设计。页面布局与输入页面非常相似。 13.在“输出延迟”页面中,单击“时钟”标题,按时钟的字母顺序对表格进行排序 名字。 14.使用下表约束所有输出,就像您对输入约束值所做的那样。 您可以在向导中一次选择多行,同时编辑多个条目。

vivado 创建时间约束1

步骤3:创建时间约束 在此步骤中,您打开合成的设计并使用AMD Vivado™定时约束 男巫定时约束向导分析门级网表并发现缺失 约束。使用“定时约束”向导为此设计生成约束。 1.在“流导航器”中,单击“打开综合设计”。 2.当综合设计打开时,单击综合设计下的约束向导 部分。 此时会出现“定时约束”向导的介绍页面。本页介绍 向导创建的约束类型:时钟、输入和输出端口以及时钟 域交叉。 3.阅读页面后,

Vivado+PetaLinux 系统搭建教程

PetaLinux 是基于 Yocto project DDR SDRAM 双倍数据率同步动态随机存取存储器(英语:Double Data Rate Synchronous Dynamic Random Access Memory,简称DDR SDRAM)为具有双倍资料传输率的SDRAM,其资料传输速度为系统主频的两倍,由于速度增加,其传输性能优于传统的SDRAM。 FTP文件传输 在ubun

点击Vivado的安装程序exe无法安装的解决办法

在Windows操作系统上,在安装Vivado的时候会遇到双击xsetup.exe没有反应的情况,即使是用管理员权限再加上设置兼容模式也没有任何效果,且此问题有可能在多个版本上都存在,包括最新的2016.02。 打开解压后的Vivado安装包的bin目录下,可以看到xsetup.exe本质上是调用xsetup.bat (个别版本是xsetup2.bat)这个批处理文件。 接下来我们可以尝试用管理员

创建 AD9361 的 vivado 工程,纯FPGA配置,不使用ARM程序

前言 AD9361 的配置程序,如果使用官方的,就必须用ps进行配置,复杂不好使,如果直接使用FPGA配置,将会特别的简单。 配置软件 创建一份完整的寄存器配置表 //************************************************************// AD9361 R2 Auto Generated Initialization Scri

Vivado DDS IP核使用和仿真(二、多通道信号发生器)

按照博文https://blog.csdn.net/u013215852/article/details/91042672了解完单通道信号发生器之后,我们来看一下如果用一个IP核同时生成多通道信号怎么做,本文以1MHz和10MHz双通道为例: 1、设置参数,注意与单通道不同的地方 通道设置为2,那么我们想要得到与单通道一样16bit的输出数据,那么根据公式 我们就需要把Frequen

Vivado DDS IP核使用和仿真(一、单通道信号发生器)小补充

请先看上一篇博文:https://blog.csdn.net/u013215852/article/details/91042672 在此博文的最后,生成了同时输出正弦信号和余弦信号,一些读者对此有一些疑问,其实很简单,按照上一篇的设置,如果把output设置为Sine and Cosine,那么IP核会自动将输出的宽度扩大一倍,即16变成了32,根据下图可知高16位为SINE,低16位为COS

ubuntu,vivado HLS C simulation启动失败

在ubuntu18.04环境下安装了vivado2018.3版本,运行C simulation时失败,原因是缺少组件,解决办法: sudo apt-get install tofrodos gawk xvfb git libncurses5-dev tftpd zlib1g-dev zlib1g-dev:i386 libssl-dev flex bison chrpath socat autoc