【发布时间】:2017-03-24 14:04:54
【问题描述】:
使用泛型合成代码时遇到问题: 我的实体是:
entity MyEntity is
generic(
OUTWIDTH : integer range 8 to 64;
NBREG : integer range 2 to 8);
port(
port1 ....
port2 ....
);
end entity;
architecture rtl of MyEntity is
constant KEEP_VAL : std_logic_vector(OUTWIDTH/8-1 downto 0) := (others=>'1'); -- used to compare my signal with (others=>'1')
signal keep : std_logic_vector((NBREG*OUTWIDTH/8)-1 downto 0);
begin
process(clk)
variable v1 : integer range 0 to NBREG-1
begin
if(rising_edge(clk)) then
--SOME CODE
....
....
-- The comparison I want to do :
if(keep((v1+1)*(OUTWIDTH/8)-1 downto v1*(OUTWIDTH/8)) = KEEP_VAL) then -- the line where the error appears
-- DO sthg
end if;
end process;
end rtl;
要恢复,我想知道具有通用宽度 (OUTWIDTH) 的信号的所有位是否都是“1”。前面的代码在模拟中运行良好,但不想被合成。 为 Libero 合成: @E: CD289 : 期待常量表达式
我假设我可以用一个函数来做到这一点(每个位上的 for 循环并与 '1' 进行比较)但是还有其他“直接”选项吗?
谢谢。
【问题讨论】:
-
如果您编辑问题以显示与您的错误相关的行会很有帮助
-
错误与比较行相关(if条件)
标签: generics comparison vhdl synthesis