SV中文件操作的那些函数
(2014-07-31 16:46:50)
标签:
文件操作函数 |
分类: 杂谈 |
1,函数原型:char * fgets (char *buf, int bufsize, FILE *stream); 其中*buf,用来储存所得数据的地址。bufsize, 指明储存数据的大小。 *stream将要读取的文件流。
2,函数原型:int sscanf (const char *buffer,
const
3,fflush(stdin):功能清空输入缓冲区,来确保不影响后面数据的读取。
4,SV中的两个命令行输入的调试函数。$test$plusargs,原文解释为:If the prefix of one of the supplied plusargs matches all characters in the provided string, a non-zero integer is returned. If no plusarg from the command line matches the string provided, the integer value zero (0) is returned.
eg: initial
当命令行输入中没有HELLO时,display不会显示。有HELLO时,display执行。字符串也可以来自于其他脚本文件中,如ini等。These arguments are visually distinguished from other simulator arguments by the starting with the plus (+) character.
%o octal conversion
%e real exponential conversion
eg:
integer
module 在10000个时钟后结束。
5,函数原型:¥sformat (output_reg, format_string, list_of_arguments);将arguments的值按着format的格式输入到output_reg中。
Eg: for (int i =0; i<2;i++)
结果为:slave[0],
6,函数原型:int

加载中…