时钟数组的 VHDL 语法(被综合接受,但不被 Active-HDL 模拟器接受)
我在一些我想重用的旧代码中遇到一些 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果将进程内部的循环更改为进程外部的生成语句,它在 ModelSim 中工作得很好(我没有可用的 Aldec),而且恕我直言,它似乎比带有一堆时钟的单个进程更干净。我通常还会使用泛型来定义端口宽度,而不是将它们作为架构中的常量拉入,但我认为您这样做是有原因的:
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:
FWIW,我对 Modelsim 也有同样的看法:
顺便说一句 - 您使用
constant
而不仅仅是这样做有什么原因吗?但我还没有想到真正的答案,抱歉!
FWIW, I get the same with Modelsim:
As an aside - is there a reason for your use of the
constant
and not just doing this?But no actual answer has occurred to me yet, sorry!