首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >时钟阵列的VHDL语法(被综合接受,但不被活动HDL模拟器接受)

时钟阵列的VHDL语法(被综合接受,但不被活动HDL模拟器接受)
EN

Stack Overflow用户
提问于 2011-04-06 20:01:08
回答 2查看 2.5K关注 0票数 2

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

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

我知道这个错误不像信号clk(i)中的(i),但我不想将循环展开到(0)、(1)等,因为它用于不同端口大小的几种不同配置,我相信肯定有一种方法来描述这一点。

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

非常简单的例子显示了我的问题。(这样做的目的是确保数据首先使用自己的相关时钟输入FPGA,然后再进行其他操作)

代码语言:javascript
复制
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;
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2011-04-06 23:14:29

如果您将进程内的循环更改为进程外的generate语句,它在ModelSim中工作得很好(我没有Aldec可用),而且IMHO看起来比有一堆时钟的单个进程更干净。我通常也会使用泛型来定义端口宽度,而不是将它们作为常量放入体系结构中,但我认为这样做是有原因的:

代码语言:javascript
复制
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;
票数 2
EN

Stack Overflow用户

发布于 2011-04-06 21:25:47

FWIW,我得到了同样的Modelsim:

代码语言:javascript
复制
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而不是这样做有什么原因吗?

代码语言:javascript
复制
    for i in clk'range loop

但是我还没有真正的回答,对不起!

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

https://stackoverflow.com/questions/5565989

复制
相关文章

相似问题

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