在我想要重用的一些旧代码中,我遇到了一些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,然后再进行其他操作)
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;发布于 2011-04-06 23:14:29
如果您将进程内的循环更改为进程外的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;发布于 2011-04-06 21:25:47
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但是我还没有真正的回答,对不起!
https://stackoverflow.com/questions/5565989
复制相似问题