我正在使用TT2。我想从模板文件中打印something[%0d]
。但我似乎无法找到模板工具包使用的任何转义字符。
有关如何在%
下跳过[
和TT
的任何建议?
确切的行是:
printer.print_object(.name($sformatf("[% item %]_slv_agent_cfg[%0d]:", i)), .value([% item %]_slv_agent_cfg[i]));
提前致谢
答案 0 :(得分:4)
您可以使用
[% "[%" %]
代替
[%
看起来像这样:
$ tpage <<<'slv_agent_cfg[% "[%" %]0d]'
slv_agent_cfg[%0d]
$ tpage <<<'slv_agent_cfg[% "[%0d]" %]'
slv_agent_cfg[%0d]
更短的解决方案是使用
[[%%]%
代替
[%
看起来像这样:
$ tpage <<<'slv_agent_cfg[[%%]%0d]'
slv_agent_cfg[%0d]
如果您发现自己需要转移太多实例,可以切换tag style。
最后,你可以改变程序以避免序列。例如,您可以替换
"slv_agent_cfg[%0d]"
与
"slv_agent_cfg[\%0d]"
或
{"slv_agent_cfg[","%0d]"}
我不知道Verilog,所以细节可能不正确,但你明白了。
答案 1 :(得分:0)
If I'm using TT to write out a TT template, is there a good way to escape [% and %]?
所以something[\%0d]
应该有用。