首页 > 其他 > 详细

%s 与 %0s在 verilog中的区别

时间:2015-03-05 18:59:17      阅读:273      评论:0      收藏:0      [点我收藏+]

what is different between %s and %0s?(%s和%零s)

%s prints the string as it is with spaces at the begining if string contents
are less than string variable size.
whereas %0s supress printing spaces.

(如果字符串的内容小于字符串变量的尺寸,%s打印字符串时前面会添加空格;而%0s不会添加空格(字符串顶头打印))
Here is an example. Hope this helps!

Code:
module test();
   reg [10*8:0] str = "hello";
   initial begin
      $display("%s", str);
      $display("%0s", str);
   end
endmodule // test

%s 与 %0s在 verilog中的区别

原文:http://www.cnblogs.com/hfyfpga/p/4316262.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!