verilog - %m 如何在 $display 系统任务中工作?
问题描述
我想了解Verilog%m
在系统任务中的用法。$display
这是书中给出的示例代码。如果有人用更多的例子来解释这一点会更好,因为书中似乎不清楚。
//the highest-level module called top. No argument is required. This
//is a useful feature)
$display("This string is displayed from %m level of hierarchy");
-- This string is displayed from top.p1 level of hierarchy
解决方案
免费的 IEEE Std 1800-2012,第 21.2.1.6 节分层名称格式指出:
%m 格式说明符不接受参数。相反,它使显示任务打印调用包含格式说明符的系统任务的设计元素、子例程、命名块或标记语句的分层名称。当有许多调用系统任务的模块实例时,这很有用。
这是一个例子:
module top;
buff b0 (.buf_in(1'b0), .buf_out());
endmodule
module buff (
input buf_in,
output buf_out
);
wire a;
inv i0 (.in(buf_in), .out(a ));
inv i1 (.in(a ), .out(buf_out));
initial $display("Inside hierarchy %m");
endmodule
module inv (
input in,
output out
);
assign out = ~in;
initial $display("Inside hierarchy %m");
endmodule
输出:
Inside hierarchy top.b0
Inside hierarchy top.b0.i0
Inside hierarchy top.b0.i1
推荐阅读
- raspberry-pi3 - NeutralinoJs 在 Raspberry Pi 3 中不起作用(使用 32 位 Raspbian 操作系统)
- c# - 列表
> 到 C# 中的二维字符串数组 - python - 为什么单次断开连接会多次触发 stomp 监听器 on_disconnected 方法?
- c - 对由 gcc 翻译的汇编代码以用 C 实现 N 阶乘的怀疑
- c# - Discord bot 创建和删除临时频道
- visual-studio - 如何将 opencv 库从 Visual Studio 交叉编译到 linux?(Ubuntu)
- python - 当我在自定义循环中使用 keras 回调时,日志字典是否仍作为输入传递?
- github-actions - GitHub 操作:使用不同的环境值重复步骤
- excel - 将按钮操作到工作表仅适用于调试模式
- java - 设计更改为调用 2 个 DTO 类的构造函数