|
发表于 2013-12-11 15:40:46
|
显示全部楼层
2# 的方法好像不可以 编译都有问题
是不是根本实现不了?
systemverilog lrm 3.1a 关于define就下面几行说明:
25.2 ‘define macros
In Verilog, the ‘definemacro text can include a backslash ( \) at the end of a line to show continuation on
the next line.
In SystemVerilog, the macro text can also include `", `\`"and ``.
An `"overrides the usual lexical meaning of", and indicates that the expansion should include an actual quotation mark. This allows string literals to be constructed from macro arguments.
A `\`"indicates that the expansion should include the escape sequence \", e.g.
`define msg(x,y) `"x: `\`"y`\`"`"
This expands:
$display(`msg(left side,right side));
to:
$display("left side: \"right side\"");
A ``delimits lexical tokens without introducing white space, allowing identifiers to be constructed from arguments, e.g.
`define foo(f) f``_suffix
This expands:
‘foo(bar)
to:
bar_suffix
Accellera
SystemVerilog 3.1a Extensions to Verilog-2001
344 Copyright 2004 Accellera. All rights reserved .
The ‘includedirective can be followed by a macro, instead of a literal string:
‘define home(filename) ‘"/home/foo/filename‘"
‘include ‘home(myfile) |
|