【问题标题】:vhdl error: integer literal cannot have negative exponentvhdl 错误:整数文字不能有负指数
【发布时间】:2014-03-01 19:03:03
【问题描述】:

Quartus 编译器在这一行报告上述错误信息

constant LIMIT : float (5 downto -27) := 1E-12;

常量是float类型,为什么会被当成整数处理?

此常量仅用于 if 语句,并与另一个浮点类型变量进行比较。

【问题讨论】:

    标签: compiler-errors vhdl


    【解决方案1】:

    文字1E-12是一个整数,因为尾数('E'之前的1)是一个整数;对于 real 类型文字类型写入 1.0E-12

    但这会返回 VHDL real 类型,而不是 VHDL float_generic_pkg 包中使用的 float。对于 float 类型常量,请使用 float_generic_pkg 包中的 to_float 函数。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-03-20
      • 1970-01-01
      • 2012-01-20
      • 1970-01-01
      • 2015-02-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多