首页 文章

VHDL包'IEEE.std_logic_arith'是否附带ghdl?

提问于
浏览
2

我试图用GHDL模拟Xilinx GTXE2收发器 . 在GTXE2_CHANNEL.vhd中,我收到一个错误,即在'ieee'库中找不到'std_logic_arith' .

首先,这是我的机器设置:

So question 1: 这个包是否包含在GHDL中?

我试图将VHDL标准更改为VHDL-2008 --std=08 ,但ghdl无法识别此选项,因此我目前正在使用VHDL-2002进行编译 . 但没有改变 .

我还尝试从Xilinx的vhdl源文件夹 C:\Xilinx\14.7\ISE_DS \ISE\vhdl\src\ieee 手动包含IEEE源代码 . 但是当我编译std_logic_arith时,它抱怨缺少std_logic_1164,这通常是找到的 . 除此之外,std_logic_1164中的FOREIGN属性存在问题 .

所以这是我要编译的文件列表/编译顺序(Xilinx'* .prj文件的修改版本):

# board and device configuration
#vhdl poc       "tb/common/my_config_KC705.vhdl"

# IEEE packages
#xilinx ieee    "ieee/std_logic_1164.vhd"
#xilinx ieee    "ieee/std_logic_arith.vhd"

# Xilinx Packages and Primitives
xilinx unisim   "unisims/unisim_VCOMP.vhd"
xilinx unisim   "unisims/unisim_VPKG.vhd"
xilinx work     "unisims/primitive/FD.vhd"
xilinx work     "unisims/primitive/BUFG.vhd"
xilinx work     "unisims/primitive/BUFR.vhd"
xilinx work     "unisims/secureip/GTXE2_CHANNEL.vhd"

此列表将转换为GHDL命令,这些命令在临时目录中执行:

C:\Program Files (x86)\GHDL\0.31\bin\ghdl.exe -a --std=02 -P. --work=poc "D:\VHDL\git\SATAController\lib\PoC\tb\common\my_config_KC705.vhdl"
GHDL Messages:
  D:\VHDL\git\SATAController\lib\PoC\tb\common\my_config_KC705.vhdl:52:14:warning: package "my_config" does not require a body
C:\Program Files (x86)\GHDL\0.31\bin\ghdl.exe -a --std=02 -P. --work=unisim "C:\Xilinx\14.7\ISE_DS\ISE\vhdl\src\unisims\unisim_VCOMP.vhd"
C:\Program Files (x86)\GHDL\0.31\bin\ghdl.exe -a --std=02 -P. --work=unisim "C:\Xilinx\14.7\ISE_DS\ISE\vhdl\src\unisims\unisim_VPKG.vhd"
C:\Program Files (x86)\GHDL\0.31\bin\ghdl.exe -a --std=02 -P. --work=work "C:\Xilinx\14.7\ISE_DS\ISE\vhdl\src\unisims\primitive\FD.vhd"
C:\Program Files (x86)\GHDL\0.31\bin\ghdl.exe -a --std=02 -P. --work=work "C:\Xilinx\14.7\ISE_DS\ISE\vhdl\src\unisims\primitive\BUFG.vhd"
C:\Program Files (x86)\GHDL\0.31\bin\ghdl.exe -a --std=02 -P. --work=work "C:\Xilinx\14.7\ISE_DS\ISE\vhdl\src\unisims\primitive\BUFR.vhd"
C:\Program Files (x86)\GHDL\0.31\bin\ghdl.exe -a --std=02 -P. --work=work "C:\Xilinx\14.7\ISE_DS\ISE\vhdl\src\unisims\secureip\GTXE2_CHANNEL.vhd"
GHDL Messages:
  C:\Xilinx\14.7\ISE_DS\ISE\vhdl\src\unisims\secureip\GTXE2_CHANNEL.vhd:34:10: primary unit "std_logic_arith" not found in library "ieee"

最后ieee.std_logic_1164中的FOREIGN属性错误:

PS D:\VHDL\git\SATAController\lib\PoC\temp\ghdl> & 'C:\Program Files (x86)\GHDL\0.31\bin\ghdl.exe' -a --std=02 '-P.' --work=ieee 'C:\Xilinx\14.7\ISE_DS\ISE\vhdl\src\ieee\std_logic_arith.vhd'
GHDL Messages:
  C:\Xilinx\14.7\ISE_DS\ISE\vhdl\src\ieee\std_logic_arith.vhd:211:15: value of 'FOREIGN attribute does not begin with VHPIDIRECT
  C:\Xilinx\14.7\ISE_DS\ISE\vhdl\src\ieee\std_logic_arith.vhd:212:15: value of 'FOREIGN attribute does not begin with VHPIDIRECT
  C:\Xilinx\14.7\ISE_DS\ISE\vhdl\src\ieee\std_logic_arith.vhd:213:15: value of 'FOREIGN attribute does not begin with VHPIDIRECT
  C:\Xilinx\14.7\ISE_DS\ISE\vhdl\src\ieee\std_logic_arith.vhd:214:15: value of 'FOREIGN attribute does not begin with VHPIDIRECT
  C:\Xilinx\14.7\ISE_DS\ISE\vhdl\src\ieee\std_logic_arith.vhd:215:15: value of 'FOREIGN attribute does not begin with VHPIDIRECT
  C:\Xilinx\14.7\ISE_DS\ISE\vhdl\src\ieee\std_logic_arith.vhd:216:15: value of 'FOREIGN attribute does not begin with VHPIDIRECT
  C:\Xilinx\14.7\ISE_DS\ISE\vhdl\src\ieee\std_logic_arith.vhd:218:15: value of 'FOREIGN attribute does not begin with VHPIDIRECT
  C:\Xilinx\14.7\ISE_DS\ISE\vhdl\src\ieee\std_logic_arith.vhd:219:15: value of 'FOREIGN attribute does not begin with VHPIDIRECT
  C:\Xilinx\14.7\ISE_DS\ISE\vhdl\src\ieee\std_logic_arith.vhd:220:15: value of 'FOREIGN attribute does not begin with VHPIDIRECT
  C:\Xilinx\14.7\ISE_DS\ISE\vhdl\src\ieee\std_logic_arith.vhd:221:15: value of 'FOREIGN attribute does not begin with VHPIDIRECT
  C:\Xilinx\14.7\ISE_DS\ISE\vhdl\src\ieee\std_logic_arith.vhd:223:15: value of 'FOREIGN attribute does not begin with VHPIDIRECT
  C:\Xilinx\14.7\ISE_DS\ISE\vhdl\src\ieee\std_logic_arith.vhd:224:15: value of 'FOREIGN attribute does not begin with VHPIDIRECT
  C:\Xilinx\14.7\ISE_DS\ISE\vhdl\src\ieee\std_logic_arith.vhd:225:15: value of 'FOREIGN attribute does not begin with VHPIDIRECT
  C:\Xilinx\14.7\ISE_DS\ISE\vhdl\src\ieee\std_logic_arith.vhd:227:15: value of 'FOREIGN attribute does not begin with VHPIDIRECT
  C:\Xilinx\14.7\ISE_DS\ISE\vhdl\src\ieee\std_logic_arith.vhd:228:15: value of 'FOREIGN attribute does not begin with VHPIDIRECT
  C:\Xilinx\14.7\ISE_DS\ISE\vhdl\src\ieee\std_logic_arith.vhd:229:15: value of 'FOREIGN attribute does not begin with VHPIDIRECT
  C:\Xilinx\14.7\ISE_DS\ISE\vhdl\src\ieee\std_logic_arith.vhd:231:15: value of 'FOREIGN attribute does not begin with VHPIDIRECT
  C:\Xilinx\14.7\ISE_DS\ISE\vhdl\src\ieee\std_logic_arith.vhd:232:15: value of 'FOREIGN attribute does not begin with VHPIDIRECT
  C:\Xilinx\14.7\ISE_DS\ISE\vhdl\src\ieee\std_logic_arith.vhd:233:15: value of 'FOREIGN attribute does not begin with VHPIDIRECT
  C:\Xilinx\14.7\ISE_DS\ISE\vhdl\src\ieee\std_logic_arith.vhd:235:15: value of 'FOREIGN attribute does not begin with VHPIDIRECT
  C:\Xilinx\14.7\ISE_DS\ISE\vhdl\src\ieee\std_logic_arith.vhd:236:15: value of 'FOREIGN attribute does not begin with VHPIDIRECT
  C:\Xilinx\14.7\ISE_DS\ISE\vhdl\src\ieee\std_logic_arith.vhd:238:15: 'FOREIGN allowed only for architectures and subprograms

Question 2: 如何编译ieee.std_logic_1164?

每个安装了GHDL环境的人都可以测试这个例子 . Xilinx库不需要my_config_KC705.vhdl .


这样做的目的是什么?

  • iSim仿真非常慢 - >大约15 ns sim-time在1秒cpu-time内计算; 100我们 - > 40分钟的等待

  • iSim使用大约2.6 GiB的主内存 - 可能GHDL更节俭

  • xSim对我们的VHDL库抱有一些抱怨 - 所以iSim目前是#1选项

  • 我之前使用Xilinx原语测试了GHDL并且它有效,因此下一个挑战是模拟一个安全组件:)

  • 如果我找到足够的时间,我也会尝试使用QuestaSim

1 回答

  • 6

    Yes this package is included with ghdl

    在ghdl手册或手册页中,您会发现可以选择 --ieee=synopsys--ieee=mentor 作为分析和详细命令的命令行选项 .

    查看您的库目录:

    david_koontz@Macbook: ls /opt/ghdl/ghdl_mcode/libraries/synopsys
    std_logic_arith.vhdl      std_logic_misc.vhdl       std_logic_textio.vhdl
    std_logic_misc-body.vhdl  std_logic_signed.vhdl     std_logic_unsigned.vhdl
    
    david_koontz@Macbook: ls /opt/ghdl/ghdl_mcode/libraries/mentor
    std_logic_arith.vhdl       std_logic_arith_body.vhdl
    

    你会找到包 std_logic_arith .

    由于存在冲突的声明,您可以发现在分析和详细说明期间还必须使用 -fexplicit 命令行选项 .

    分析期间给出的选项( -a )或详细说明( -e )遵循命令 .

    How can I compile ieee.std_logic_1164?

    您不应该分析包 ieee.std_logic_1164 ,它们是预先分析的 . 首先尝试以上(更常见的是synopsys) . 请注意,指导者和synopsys包都不包含任何FOREIGN属性 . FOREIGN属性修饰以外部编程语言实现的子程序声明(函数) .

    info ghdlghdl.htmlGHDL guide)第5节VHDL的实施(使用供应商库的小节,它提供了一些关于处理unisim的建议) . 还有一节与其他语言接口,介绍如何使用FOREIGN属性 .

    另请参阅3.10 IEEE库陷阱,解释非IEEE 'standard'库的问题,除了Tristan的非母语英语拼写错误 .

    如果您真的想分析IEEE库,请先阅读整个GHDL指南 . 它涉及应首先理解的几个命令行选项 . Windows ghdl发行版基于一个即时代码生成系统(mcode),它将代码分析为库文件(以.cf后缀结尾),并重新分析在发布过程中发行版库中的源代码 .

    我已成功分析并在OS X下的mhd版本的ghdl上使用了unisim库,而没有修改IEEE库 .

    你会发现ghdl在内存利用方面并不是最快的,也不是最快的 .

    您还可以加入Ghdl-discuss邮件列表 . ghdl正在Sourceforge上积极开发 . 见ghdl-updates . ghdl-0.32应该会在今年发布(希望如此),并且会增加-2008的支持以及无数的修复 .

    Windows版本可能是取代mcode版本(32位二进制)的新解释版本 . 所有的开发工作目前都由Tristan Gingold完成 . 他还在实施一个全方位的LLVM后端版本,这可能有望在Windows上获得更好的性能 .

    On the FOREIGN attributes

    我发现我有几个Xilinx std_logic_arith 封装源包含FOREIGN属性的文件,尽管行号减4 .

    属性和编译器编译指示的组合,例如:

    -- pragma map_to_operator MULT_TC_OP
      -- pragma type_function MULT_SIGNED_ARG
      -- pragma return_port_name Z
    

    用于允许加速功能执行 . 外语库在任何情况下都不会使用它们 . 此外,在GHDL指南的 5.8.1 Foreign declarations 中找到的要求是FOREIGN属性's string value contain be prefixed with 2584152 is a restriction enabling linking in the gcc version where the ABI for those libraries if found wouldn'无论如何都要保证兼容 .

    您可以简单地注释掉错误消息找到的属性 . 加速执行是不可能的,在任何情况下都需要gcc版本的ghdl .

    与使用ghdl的Synopsys软件包相比,没有性能优势 .

相关问题