系统生成器错误:“此块的输入不能全部为常量”

问题描述 投票:1回答:2

我正在阅读文章(attached file)并使用System Generator在Matlab / Simulink上建立VCO电路(Charged balance)。我收到一些错误,我不知道如何修复它。在我运行的一次性计时器模块中,它会通知:

Error 0001: The inputs to this block cannot all be constant.
Block: 'VCO_v2/one-shot timer '

这是我的图enter image description here

这是我遇到enter image description here的错误

This is my VCO file I simulink

matlab vhdl simulink fpga xilinx
2个回答
1
投票

你已经附加了两个实体。我假设你正在使用oneshot v1。

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

entity oneshot is
    port ( clk : in STD_LOGIC;
            ce : in STD_LOGIC;
            trigger : in STD_LOGIC;
            delay : in STD_LOGIC_VECTOR (7 downto 0);
            pulse : out STD_LOGIC :='0');
end oneshot;

architecture Behavioral of oneshot is
    signal count: INTEGER range 0 to 255; -- count variable
    signal flag : STD_LOGIC := '0'; -- count variable
begin
    process (flag,clk,delay)
    begin
        -- wait for trigger leading edge
        if trigger = '1' then
            count <= to_integer(unsigned(delay));
        elsif rising_edge(clk) then
            if count > 0 then
                pulse <= '1';
                count <= count - 1;
            else
                pulse <= '0';
            --flag <='0';
            end if;
        end if;
    end process;
end Behavioral;

那么什么是flag信号呢?为什么它在灵敏度列表中?为什么有未使用的ce输入?

但是让我们来看看oneshot_config.m文件。错误消息来自那里:

function setup_as_single_rate(block,clkname,cename) 
    inputRates = block.inputRates; 
    uniqueInputRates = unique(inputRates); 
    if (length(uniqueInputRates)==1 & uniqueInputRates(1)==Inf) 
        block.addError('The inputs to this block cannot all be constant.'); 
        return; 
    end 
    if (uniqueInputRates(end) == Inf) 
        hasConstantInput = true; 
        uniqueInputRates = uniqueInputRates(1:end-1); 
    end 
    if (length(uniqueInputRates) ~= 1) 
        block.addError('The inputs to this block must run at a single rate.'); 
        return; 
    end 
    theInputRate = uniqueInputRates(1); 
    for i = 1:block.numSimulinkOutports 
        block.outport(i).setRate(theInputRate); 
    end 
    block.addClkCEPair(clkname,cename,theInputRate); 
    return; 

这就是这里所说的

if (this_block.inputRatesKnown)
    setup_as_single_rate(this_block,'clk','ce')
end  % if(inputRatesKnown)

所以matlab代码检查inputRates输入的所有输入的this_block。它得出结论,所有输入都是恒定的(你没有可变输入系统),并得出结论认为这不起作用。这是因为它试图从输入中自动确定时钟频率,这对常数来说是不可能的。

所以你必须手动配置时钟频率。你可以修改oneshot_config.m。但可能你可以为常量块分配一个速率。它应该像block.outport.setRate(...);

我的Matlab pc上没有安装System Generator,所以我无法检查。


1
投票

我找到了这个问题的答案。只需改变Matlab的常量块而不是使用Xilinx的常量块。

© www.soinside.com 2019 - 2024. All rights reserved.