在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
12
返回列表 发新帖
楼主: oscillator_cn1

[求助] 问一个systemverilog 字符串串联的问题

[复制链接]
发表于 2012-3-19 23:48:22 | 显示全部楼层
直接用{}不行?
发表于 2012-11-28 10:45:19 | 显示全部楼层
学习了
谢谢
发表于 2013-5-29 15:55:30 | 显示全部楼层



谢谢将你的解决方法写出来!


   
Useful SystemVerilog System Tasks
Task NameDescription
$sscanf(str,format,args);
$sscanf 将字符串按照某个模板格式进行扫描,其字符串格式和C语言中的printf()函数类似
$sformat(str,format,args);
$sformat是$sscanf的反函数。将字符串按照给定的格式填入相应的参数args中
$display(format,args);
$display就是Verilog的printf语句,在stdout上显示格式化的字符串
$sformatf(format,args);
$sformatf任务和$sformat相似,除了其返回字符串结果。字符串作为$sformatf的返回值,而不是像$sformt一样放在第一个参数上。
发表于 2013-12-4 15:59:32 | 显示全部楼层
同志们得勤翻看sv LRM, 里面有明确的内容解决这问题:
In Verilog, the ‘define macro 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 quo-         
tation 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 argu-         
ments, e.g.          
`define foo(f) f``_suffix          
This expands:          
‘foo(bar)          
to:          
bar_suffix
发表于 2013-12-5 17:43:13 | 显示全部楼层
$psprintf()可以返回字符串
发表于 2018-8-29 15:27:09 | 显示全部楼层
反正总而言之就是用sformat这个函数是么
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /2 下一条

×

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-5-10 09:19 , Processed in 0.021052 second(s), 6 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表