我试图编译我的设计,使用fphdl库http://www.eda.org/fphdl/进行浮点操作。而在modelsim中,当在Quartus hdl中进行综合时,模拟是正常的,但编译器会抱怨以下语句:
result := to_integer (fract (frac'high downto frac'high-base))理由是:“表达式不是常量”从类似的帖子中我了解到这个编译器不喜欢frac'high-base不受约束。我尝试约束所有相关信号,如下所示:
variable frac : UNSIGNED (23 downto 0);
variable base : INTEGER range 0 to 23;但是错误仍然存在……在hdl级别或Quartus本身有解决方法吗?
发布于 2016-02-27 21:38:50
请注意,错误消息显示:
表达式不是常量
而不是:
... constrained
因此,错误消息的原因是,当fract的范围在运行时是可变的,并且在精化时不固定时,不能合成to_integer函数。
Quartus的解决方法可以是:
variable part : UNSIGNED(23 downto 0);
...
part := (others => '0');
part(base downto 0) := frac(frac'high downto frac'high - base);
result := to_integer(part);然后对从frac中提取的部分进行零扩展,然后固定提供给to_integer的向量长度,从而允许Quartus合成。
https://stackoverflow.com/questions/35670271
复制相似问题