时钟阵列的VHDL语法(由综合但不是Active-HDL模拟器接受)

时间:2011-04-06 12:01:08

标签: vhdl

我在一些我想重用的旧代码中遇到了一些VHDL语法的问题。它被合成工具(Synplify)接受,但模拟器(Aldec Active-HDL 8.3)给出以下错误。 (注意:此结构已被此模拟器的先前版本接受)。

#Error:COMP96_0228:buffered_data.vhdl:(19,28):如果实际值与任何模式的信号参数相关联,则必须用静态信号名称表示实际值。

我得知错误不喜欢信号clk(i)中的(i)但是我不想将循环展开到(0),(1)等,因为它在几种不同的配置中使用对于不同的端口大小,我确信必须有一种方法来描述它。

到目前为止,我的解决方案是将一个实例封装在它自己的实体/ arch层次结构中,并使用“generate”为每个端口实例化一次,但我不喜欢它。有更好的想法吗?

非常简单的示例显示了我的问题。 (目的是确保数据首先使用其自己的相关时钟先插入FPGA中)

library IEEE;
use IEEE.STD_LOGIC_1164.all;

entity input_buffer is
     port(
         clk : in std_logic_vector;
         data_in : in std_logic_vector;
         data_out : out std_logic_vector
         );
end input_buffer;

architecture rtl of input_buffer is
    constant c_NumOfPorts : integer := 3;
begin

    p_process: process(clk)
    begin
        for i in 0 to c_NumOfPorts-1 loop
            if rising_edge(clk(i)) then -- error here
                data_out(i) <= data_in(i);
            end if;
        end loop;
    end process;

end rtl;

2 个答案:

答案 0 :(得分:2)

如果你将进程内的循环更改为进程外的generate语句,它在ModelSim中工作正常(我没有Aldec可用),并且IMHO看起来比带有一堆时钟的单个进程更清晰。我通常也会使用泛型来定义端口宽度,而不是将它们作为架构中的常量拉入,但我认为你有这样做的理由:

library IEEE;
use IEEE.STD_LOGIC_1164.all;

entity input_buffer is
     port(
         clk : in std_logic_vector;
         data_in : in std_logic_vector;
         data_out : out std_logic_vector
         );
end input_buffer;

architecture rtl of input_buffer is
    constant c_NumOfPorts : integer := 3;
begin

    gen : for i in 0 to c_NumOfPorts-1 generate
    begin
        p_process: process(clk(i))
        begin
            if rising_edge(clk(i)) then -- error here
                data_out(i) <= data_in(i);
            end if;
        end process;
    end generate;

end rtl;

答案 1 :(得分:0)

FWIW,我和Modelsim一样:

Model Technology ModelSim PE vcom 10.0a Compiler 2011.02 Feb 20 2011
-- Loading package STANDARD
-- Loading package TEXTIO
-- Loading package std_logic_1164
-- Compiling entity input_buffer
-- Compiling architecture rtl of input_buffer
** Error: clk.vhd(19): (vcom-1450) Actual (indexed name) for formal "s" is not a static signal name.
** Error: clk.vhd(25): VHDL Compiler exiting

顺便说一下 - 您是否有理由使用constant而不仅仅是这样做?

    for i in clk'range loop

但我还没有找到真正的答案,对不起!