如何将 vhdl 定点库包含到 ghdl-0.33?

How to include vhdl fixed point library to ghdl-0.33?

我是 ghdl 模拟器的新手,并且在 windows 上使用 ghdl。我在我的电脑上安装了 ghdl (ghdl-0.33-win32) 并尝试了简单的加法器代码并且它有效。我目前需要模拟一些我使用过 David Bishop 的定点和浮点包的数学方程式。当我将库包含到我的库中并编译它时,它会出现错误:

"fixed_pkg" not found in library "ieee"

或者,如果我将 fixed_pkg_c 文件复制到我的项目文件中,则编译工作:

"fixed_pkg" not found in library "work"

谁能告诉我包含这些固定和浮动包的方法(或我应该遵循的命令集)?

ghdl-0.33-win32 安装部分支持 VHDL 标准的 IEEE 1076-2008 修订版。

此支持包括 David Bishop 的定点和浮点综合符合条件的库,这些库包含在该修订版中(请参阅 IEEE 标准 1076-2008,16。预定义语言环境,16.10 定点包和 16.11 浮点包)。作为该修订版中接受的 IEEE 包,它们可以在 IEEE 库中找到。

ghdl 支持的默认版本是 93c(-1993 支持范围索引中的混合文字和表达式边界,该标准的后续版本支持)。

通过使用 --std=08 选项分析 (-a) 和详细说明 (-e) 命令来调用符合 -2008 修订版的 ghdl。

发现使用 mcode(即时代码)即时代码生成版本的 ghdl(例如 Win32 发行版)有一个区别:

来自 运行 命令的最新 GHDL Documentation section on Invoking GHDL

run -r

Runs/simulates a design. The options and arguments are the same as for the elaboration command.

  • GGC/LLVM: simply, the filename of the executable is determined and it is executed. Options are ignored. You may also directly execute the program. The executable must be in the current directory.
  • mcode: the design is elaborated and the simulation is launched. As a consequence, you must use the same options used during analysis.

在诸如为 Win32 分发的 mcode 版本中,-e 详细命令是多余的,运行 命令 (-r) 必须包含与分析命令 (-a) 相同的选项。

与 GCC 或 LLVM 版本的 ghdl 不同,mcode 版本需要为 运行 命令提供详细说明的任何相关选项。

对于 GCC 或 LLVM ghdl 实现以及 VHDL 文件和实体,用于分析、阐述和模拟在文件中找到的实体的命令为:

ghdl -a --std=08 vhdl_file_name
ghdl -e --std=08 entity_name
ghdl -r entity_name

用于模拟的 运行 命令 (-r) 还允许选择多个体系结构之一或已声明的配置。

对于 ghdl 的 mcode 版本,细化命令被忽略,既没有来自分析的目标代码文件,也没有生成单独的可执行文件,但有一个库文件(对于名为 work 的工作库和 -2008 这将默认命名为work-obj08.cf)用于协调标准要求的分析顺序

对于 ghdl 的 mcode 版本,最少的命令是:

ghdl -a --std=08 vhdl_file_name
ghdl -r --std=08 entity_name

如果详细说明命令是多余的,则必须将使用 运行 命令进行模拟之前的详细说明以及与分析命令共享的任何有效详细说明选项都必须传递给 运行 命令。

要使用 --std=08 访问 IEEE -2008 库中的 fixed_pkg 包,您的实体或体系结构必须在上下文子句的范围内,从而在 fixed_pkg 中进行声明可见:

library ieee;
use ieee.fixed_pkg.all;

use 子句使 fixed_pkg 中的声明可见。

Tristan 刚刚发布 ghdl-0.34 which currently includes both a win32 mcode version (mingw32) and a 64 bit LLVM version (mingw64). The matching GHDL Documentation 在颜色条突出显示的段落中提供了有用的提示。

因为 ghdl 是开源的,它在很大程度上取决于用户反馈来纠正操作和文档中的差异。

差异可以报告为 issue(需要 github 登录)。反映 ghdl 文档不够清晰的问题可能会导致改进。

GTKWave,一个支持GHDL波形格式的波形查看器可以从Sourceforge获得。 ghdl 还支持 gtkwave 使用的 VCD 和 FST 波形转储文件格式。