时钟数组的 VHDL 语法(被综合接受,但不被 Active-HDL 模拟器接受)

发布于 2024-10-31 07:38:52 字数 1030 浏览 0 评论 0原文

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

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

我发现该错误不喜欢信号 clk(i) 中的 (i),但我不想将循环展开到 (0)、(1) 等,因为它用于不同端口的多种不同配置尺寸,我确信一定有一种方法来描述这一点。

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

非常简单的示例准确地显示了我的问题。 (目的是确保数据首先使用其自己的关联时钟输入 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;

I've a problem with some VHDL syntax in some old code that I want to reuse. It is accepted by the synthesis tool (Synplify) but the simulator (Aldec Active-HDL 8.3) gives the following error. (Note: This construction was accepted by a previous version of this simulator).

#Error: COMP96_0228: buffered_data.vhdl : (19, 28): The actual must be denoted by a static signal name, if the actual is associated with a signal parameter of any mode.

I get that the error doesn't like the (i) in the signal clk(i) but I don't want to unroll the loop to (0),(1),etc because it's used in several different configurations for different port sizes and I'm sure there must be a way to describe this.

My solution so far is to encapsulate one instance in it's own entity/arch hierarchy and use a "generate" to instantiate once for each port but I don't like it. Any better ideas?

Very simplified example showing exactly my issue. (The intent is to ensure that data is first clocked into the FPGA using its own associated clock before anything else)

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;

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

伤痕我心 2024-11-07 07:38:52

如果将进程内部的循环更改为进程外部的生成语句,它在 ModelSim 中工作得很好(我没有可用的 Aldec),而且恕我直言,它似乎比带有一堆时钟的单个进程更干净。我通常还会使用泛型来定义端口宽度,而不是将它们作为架构中的常量拉入,但我认为您这样做是有原因的:

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;

If you change the loop inside the process into a generate statement outside the process, it works fine in ModelSim (I don't have Aldec available), and IMHO seems cleaner than a single process with a bunch of clocks. I would also typically use a generic to define the port widths, rather than pulling them in as a constant inside the architecture, but I figure you've got some reason for doing it that way:

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;
天气好吗我好吗 2024-11-07 07:38:52

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

但我还没有想到真正的答案,抱歉!

FWIW, I get the same with 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

As an aside - is there a reason for your use of the constant and not just doing this?

    for i in clk'range loop

But no actual answer has occurred to me yet, sorry!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文