首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >输入数据没有加载到寄存器中--仅在后合成时序模拟[VHDL][Vivado] (解决)中出现问题。

输入数据没有加载到寄存器中--仅在后合成时序模拟[VHDL][Vivado] (解决)中出现问题。
EN

Stack Overflow用户
提问于 2021-01-12 17:47:27
回答 1查看 255关注 0票数 0

这是什么

我正在尝试创建一个简单的FIR滤波器。我要介绍的是,您可能不是FIR过滤器,因为我正在逐渐增加我的教育需求项目的复杂性,直到它达到预期的功能为止。

它应该做什么

基本上,它目前应该做的是:

  • 在应用load = 1之后将数据加载到寄存器,
  • 在应用

=1之后卸载处理过的数据(这是样本与相应系数相乘的乘积)。

失败的地方,

然而,据我注意到,它无法将数据加载到寄存器中。看起来像锁存器一样工作,因为在load下降到0之后,输入端口上的最后一个向量值被锁在寄存器中。但我可能错了,它只是在模拟中像这样工作而已。前后综合功能仿真正在工作!只有合成后的时间不能按要求工作!

我试过什么

  • 在其.vhd文件中向实体声明中添加了DONT_TOUCH参数,
  • 在将数据从data_in端口传输到寄存器后添加了某种缓冲区(无符号变量),但在合成后甚至没有出现在原理图中,可能DONT_TOUCH不起作用?

模拟图片

预合成功能- https://imgur.com/0TaNQyn

后合成时序- https://imgur.com/mEOv67t

程序

我用的是Vivado 2020.2 webpack

Testbench

这里的Testbench代码:https://pastebin.pl/view/d2f9a4ad

主代码

代码语言:javascript
运行
复制
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.numeric_std.ALL;

entity fir is
 Port ( 
 clk: in std_logic;
 data_in: in unsigned(7 downto 0);
 data_out: out unsigned(7 downto 0);
 en: in std_logic;
 load: in std_logic;
 start: in std_logic;
 reset: in std_logic
 );
end fir;

architecture Behavioral of fir is

-- type coeff_array is array (0 to 7) of integer range 0 to 255;
constant reg_size: integer := 8;
constant filter_order: integer := 7;

type samples_reg is array (0 to reg_size-1) of unsigned(7 downto 0);
type coeffs_reg is array (0 to filter_order) of unsigned(7 downto 0);


begin

process(clk, reset)
     
    -- variable coeffs: coeff_array := (0,0,0,0,0,0,0,0);
    --variable b0: unsigned(7 downto 0) := 8D"0";
    variable b0: unsigned(7 downto 0) := to_unsigned(1,8);
    variable b1: unsigned(7 downto 0) := to_unsigned(2,8);
    variable b2: unsigned(7 downto 0) := to_unsigned(3,8);
    variable b3: unsigned(7 downto 0) := to_unsigned(4,8);
    variable b4: unsigned(7 downto 0) := to_unsigned(5,8);
    variable b5: unsigned(7 downto 0) := to_unsigned(6,8);
    variable b6: unsigned(7 downto 0) := to_unsigned(7,8);
    variable b7: unsigned(7 downto 0) := to_unsigned(8,8);
    
    variable i: integer range 0 to reg_size := 0;
    
    variable samples: samples_reg := (others => (others => '0'));
    variable coeffs: coeffs_reg := (b0,b1,b2,b3,b4,b5,b6,b7);
    
    variable data_processed: unsigned(15 downto 0) := (others => '0');
    
       
    
    
    -- variable reg_element:
    
    -- signal s1 : signed(47 downto 0) := 48D"46137344123";
    
    begin    
    
    if reset = '1' then
        -- data_out <= (others => '0');
        samples := (others => (others => '0'));
        data_processed := (others => '0');
        i := 0;            

    -- synch part
    elsif rising_edge(clk) and en = '1' then
    
    samples := samples;
        
        -- loading data
        if load = '1' then
            samples(i) := data_in;
            
            i := i+1;
        else null;
        end if;                      
        
        -- deloading data
        if start = '1' then
            
        data_processed := samples(i)*coeffs(i);
        i := i+1;
        else null; 
        end if;
            
        -- reset counter after overflow
        if(i = reg_size) then
            i := 0;
        else null;
        end if;
        
        -- reset counter if no data is being transferred
        if load = '0' and start = '0' then
            i := 0;
            data_processed := (others => '0');
        else null;
        end if;    
                    
    end if;
    
    data_out <= data_processed(7 downto 0);
    
 end process;


end Behavioral;

其他信息

  • ,我刚刚注意到,在一个过度循环中,我保持负载= 1,这就是为什么最高的数首先出现的原因。
  • 系数是:1,2,3,4,5,6,7,8。在合成后的模拟中,在进入UUT之后,我注意到样本寄存器没有加载数据(除了前面提到的最后一个),I正在增加,其余的似乎正在工作,properly.
  • I'll很高兴听到除了问题解决方案之外,我的代码有了一些改进!
EN

回答 1

Stack Overflow用户

发布于 2021-01-14 21:25:17

结果,在计时模拟中,我必须给设备至少100 ns的热身时间。

时间模拟似乎考虑了一些与设备启动相关的因素--无论如何,我不确定解释,但我相信上面的解决方案。

我重新定义了标题,这样其他人就可以通过搜索本例中的核心问题找到这篇文章。

祝你好运:)

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65689231

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档