pic*_*ico 2 fpga vhdl xilinx vivado ghdl
我写了一些 vivado RTL,然后在实体的端口中添加了一些 vhdl 属性来定义 Xilinx Vivado 工具的接口,如下所示:
library ieee;
use ieee.std_logic_1164.all;
entity vivado_rtl_island is
port(
-- Clocks
i_m50_clk :in std_logic;
i_m50_rst :in std_logic;
-- APB Command Inteface
s_paddr :in std_logic_vector(31 downto 0);
s_psel :in std_logic;
s_penable :in std_logic;
s_pwrite :in std_logic;
s_pwdata :in std_logic_vector(31 downto 0);
s_pready :out std_logic;
s_prdata :out std_logic_vector(31 downto 0);
s_pread :out std_logic;
s_pslverr :out std_logic
);
end entity;
architecture rtl of vivado_rtl_island is
-- Define APB Interface for "Vivado IP Integrator"
ATTRIBUTE X_INTERFACE_INFO: STRING;
ATTRIBUTE X_INTERFACE_INFO of s_paddr: SIGNAL is "xilinx.com:interface:apb:1.0 APB_S PADDR";
ATTRIBUTE X_INTERFACE_INFO of s_psel: SIGNAL is "xilinx.com:interface:apb:1.0 APB_S PSEL";
ATTRIBUTE X_INTERFACE_INFO of s_penable: SIGNAL is "xilinx.com:interface:apb:1.0 APB_S PENABLE";
ATTRIBUTE X_INTERFACE_INFO of s_pwrite: SIGNAL is "xilinx.com:interface:apb:1.0 APB_S PWRITE";
ATTRIBUTE X_INTERFACE_INFO of s_pwdata: SIGNAL is "xilinx.com:interface:apb:1.0 APB_S PWDATA";
ATTRIBUTE X_INTERFACE_INFO of s_pready: SIGNAL is "xilinx.com:interface:apb:1.0 APB_S PREADY";
ATTRIBUTE X_INTERFACE_INFO of s_prdata: SIGNAL is "xilinx.com:interface:apb:1.0 APB_S PRDATA";
ATTRIBUTE X_INTERFACE_INFO of s_pslverr: SIGNAL is "xilinx.com:interface:apb:1.0 APB_S PSLVERR";
begin
end architecture;
Run Code Online (Sandbox Code Playgroud)
在那里,我尝试使用 GHDL 编译上述 rtl,如下所示:
$ ghdl -a --std=08 --ieee=synopsys --work=work vivado_rtl_island.vhd
Run Code Online (Sandbox Code Playgroud)
GHDL 产生以下错误:
vivado_rtl_island.vhd:28:33: no "s_paddr" for attribute specification
vivado_rtl_island.vhd:29:33: no "s_psel" for attribute specification
vivado_rtl_island.vhd:30:33: no "s_penable" for attribute specification
vivado_rtl_island.vhd:31:33: no "s_pwrite" for attribute specification
vivado_rtl_island.vhd:32:33: no "s_pwdata" for attribute specification
vivado_rtl_island.vhd:33:33: no "s_pready" for attribute specification
vivado_rtl_island.vhd:34:33: no "s_prdata" for attribute specification
vivado_rtl_island.vhd:35:33: no "s_pslverr" for attribute specification
Run Code Online (Sandbox Code Playgroud)
但是,当我使用modelsim 编译它时,它不会产生错误。
有没有人知道如何在 GHDL 中解决这个问题,以便我可以添加这些属性,而模拟器将忽略它们而不产生错误?
小智 5
请参阅 IEEE Std 1076-2008 7.2 属性规范,第 9 段:
实体声明、体系结构、配置或包的属性的属性规范应立即出现在该声明的声明部分中。类似地,设计单元、子程序、块语句或包的接口对象的属性的属性规范应立即出现在该设计单元、子程序、块语句或包的声明部分中。类似地,设计单元、子程序、块语句或包的接口对象的属性的属性规范应立即出现在该设计单元、子程序、块语句或包的声明部分中。...
设计单位是实体声明(3.2 Entity Declarations),一个主要单位(13.1 Design units)。每个 IEEE Std 1076 修订版(-1987 到 -2008,在 5.2 属性规范中找到 -2008 之前)中都存在此语义限制。Modelsim 错误地“编译”了您的规范。
Xilinx 的 Vivado 综合历来利用 Modelsim 行为。有趣的是,Vivado 不一致地遵守上述 7.2 中第一个引用句子的语义要求,这在早期的修订版中也有发现,但在第二个修订版中没有。您可以在实体声明部分中声明实体的属性,而 Vivado 至少在历史上要求在架构声明部分中指定端口的属性。
使用 ghdl 时不会丢失所有内容。有一个命令行参数可以在分析过程中传递,以放宽各种规则以匹配第三方工具依赖的 Modelsim 的行为。
ghdl -a --std=08 --ieee=synopsys -frelaxed-rules --work=work vivado_rtl_island.vhdl
vivado_rtl_island.vhdl:28:33:warning: attribute for port "s_paddr" must be specified in the entity [-Wspecs]
vivado_rtl_island.vhdl:29:33:warning: attribute for port "s_psel" must be specified in the entity [-Wspecs]
vivado_rtl_island.vhdl:30:33:warning: attribute for port "s_penable" must be specified in the entity [-Wspecs]
vivado_rtl_island.vhdl:31:33:warning: attribute for port "s_pwrite" must be specified in the entity [-Wspecs]
vivado_rtl_island.vhdl:32:33:warning: attribute for port "s_pwdata" must be specified in the entity [-Wspecs]
vivado_rtl_island.vhdl:33:33:warning: attribute for port "s_pready" must be specified in the entity [-Wspecs]
vivado_rtl_island.vhdl:34:33:warning: attribute for port "s_prdata" must be specified in the entity [-Wspecs]
vivado_rtl_island.vhdl:35:33:warning: attribute for port "s_pslverr" must be specified in the entity [-Wspecs]
Run Code Online (Sandbox Code Playgroud)
您可以添加命令行标志-frelaxed-rules,错误将转换为警告。
标准修订版 -2008 的默认 ghdl 行为已更改。您会注意到,没有指定--std=08默认标准合规性是--std=93c包括-frelaxed-rules并以其他方式与`--std=93 (-1993) 兼容。没有包含宽松规则的 -2008 修订版。
语义限制背后的原因源于领先的(在 -1987 年)供应商无法在没有直接访问端口声明的情况下实现在端口上指定用户属性。虽然该供应商可能不再提供 VHDL 产品,但限制仍然存在。
我们发现 Modelsim 的各种实例有效地试图通过市场份额影响来引导标准(它们有一个命令行-pendanticerrors参数将许多警告更改为错误)。
ghdl 开发遵循他们的领导,除了严格遵守标准是规范(--std=93c尽管默认情况下),命令行参数启用警告而不是错误。
这样做的原因是那些实施 VHDL 的人倾向于根据标准而不是通过对具有最大市场份额的供应商进行逆向工程来实现。
ghdl文档中的 -frelaxed-rules 描述可能不完整。在有关VHDL 标准的部分以及其他部分中可以找到提及。
Xilinx 已经意识到这个问题。Modelsim 无疑知道它们与标准的不同之处,并且目前没有供应商参与 VHDL 标准修订过程。
查看 ghdl 源代码树,ghdl-0.35 于 2017 年 12 月 14 日发布,并且问题 525于2018年2 月 7 日进行了修复(请参阅 src/vhdl/sem_specs.adb)以向架构声明部分添加端口属性-frelaxed-rules以提供不考虑当前的功能--std=08(在 ghdl-0.36 开发周期中)。
另请参阅问题 838 Xilinx Vivado 和 Modelsim 支持端口上与 GHDL 不同的属性,在 github 上,OP 寻求第二意见,说明此答案有效。