2

有没有办法在verilog中合成一个架构,这样一个深度嵌套的端点可以访问一些顶级引脚(来自.ucf),而无需通过层次结构的每个模块明确路由引脚。

就我而言,我有一个带有深度嵌套端点的 PCIe 块。在端点处有一个地址解码器,需要从顶层的引脚提供一些信号信息。

我宁愿不修改每个中间模块来携带必要的电线。

我的网络搜索很受挫,因为“net”和“bus”这两个词在 verilog 中已经有了不同的含义。

我已经尝试过特定的分层命名,例如(例如)top.button 和 top.LED,但只成功地访问了可读引脚,而不是可写引脚,这让我假设我在这里遗漏了一些基本的东西。

更新 我可以模拟这个 http://www.edaplayground.com/x/AAq

并无错误地合成(类似的结构)(Xilinx XST),但是当它在真实硬件中运行时,LED 上没有输出,所以我想知道合成是否不支持向上的名称引用?

4

3 回答 3

1

Have you tried explicitly naming the complete hierarchical path of the pin you want to access?

For example, lets say your top module instance name is top, and then five level down the hierarchy you need to access top's pin x and assign it to the local variable y:

//At level 5:
assign y = top.x

Some synthesis tools support $top. In that case, you can try:

//At level 5:
assign y = $top().x

Here is a working example on edaplayground.com (I have not tried synthesis).

For more info, see "Upwards name referencing" in Section 23.8 of IEEE 1800-2012

于 2014-07-07T18:39:43.307 回答
1

是的,这是可能的,并且可以使用一些工具进行综合。我知道的唯一机制是在函数中使用静态变量来创建“连接”,调用函数一次来设置值,一次调用来获取值。

有关这方面的示例,请查看我在 Github 上的概念验证

SystemVerilog 概念验证,用于在函数内部使用静态变量在模块之间进行通信。

这允许建立连接,而无需通过层次结构添加布线。可能的应用包括将信号拉出到逻辑分析器、写入全局资源(事件日志、统计信息、UART 等)

这在 Quartus 13 中正确合成,我没有用其他工具尝试过,所以 YMMV。

更新:Xilinx Vivado 目前不支持,有关详细信息,请参阅此线程

于 2014-07-06T06:25:10.530 回答
-2

如果在实施时知道,使用 IEEE 1800-2012 的 SystemVerilog 接口第 3.5 节和第 25 节可以解决此问题。

接口是一组命名的网络,因此如果路径中的所有内容都连接到该接口,则向该接口添加一个额外的网络意味着该接口的所有实例都会获得额外的线路。

向接口添加信号允许低级模块使用该总线立即连接到其他所有模块(顶层),一旦接口通过层次结构连接,无需任何额外的端口工作来连接。

Interfaces vs Structs 之前已经讨论过
关于接口的 Doulos 教程

为了获得更完整的答案,我包含了 25.3.3 IEEE 1800 中给出的示例,该示例显示了通过接口连接的模块:

// memMod and cpuMod can use any interface
module memMod (interface a, input logic clk);
  ...
endmodule

module cpuMod(interface b, input logic clk);
  ...
endmodule

interface simple_bus; // Define the interface
  logic req, gnt;
  logic [7:0] addr, data;
  logic [1:0] mode;
  logic start, rdy;
endinterface: simple_bus

module top;
  logic clk = 0;

  simple_bus sb_intf(); // Instantiate the interface
  // Reference the sb_intf instance of the simple_bus
  // interface from the generic interfaces of the
  // memMod and cpuMod modules
  memMod mem (.a(sb_intf), .clk(clk));
  cpuMod cpu (.b(sb_intf), .clk(clk));
endmodule

使用 modports(IEEE 1800 的第 25.5 节),您可以指定接口的主从部分来定义端口方向。

正如蒂姆所提到的,我避免使用它,因为它变得非常难以调试。我曾参与过一个大量使用接口的项目。连接不是一对一的,而是通过层次结构到处传播。想象一下寄存器写入发生在 LBUS 上,使用 WiredOR 总线或三态进行回读。我们当时拥有的工具无法让您看到哪个模块正在驱动总线。因此,如果它从多个驱动器中变为 X,那么它就是一个关于导致它的猜测游戏。

我们不仅为标准协议(如 LBUS)使用接口,还为正在动态更改的新协议使用接口,这意味着未针对协议更改进行修复的模块会损坏总线。使用接口大大加快了实现速度,因为额外的信号可以快速集成。由于无法追踪接口问题的根源,因此调试成本几乎是不可能的。

于 2014-07-07T06:46:51.123 回答