add sys_tasks.rs comment
This commit is contained in:
parent
d9fe1e9ed5
commit
539bb20112
@ -34,13 +34,16 @@ pub const VLOG_CONTINUOUS_MONITORING_TASKS: &[(&str, &str, &str)] = &[
|
|||||||
("monitorb", "$monitorb($1);", "监控变量并在变量变化时以二进制格式打印。\n```verilog\n$monitorb(data);\n```"),
|
("monitorb", "$monitorb($1);", "监控变量并在变量变化时以二进制格式打印。\n```verilog\n$monitorb(data);\n```"),
|
||||||
("monitoro", "$monitoro($1);", "监控变量并在变量变化时以八进制格式打印。\n```verilog\n$monitoro(data);\n```"),
|
("monitoro", "$monitoro($1);", "监控变量并在变量变化时以八进制格式打印。\n```verilog\n$monitoro(data);\n```"),
|
||||||
("monitorh", "$monitorh($1);", "监控变量并在变量变化时以十六进制格式打印。\n```verilog\n$monitorh(data);\n```"),
|
("monitorh", "$monitorh($1);", "监控变量并在变量变化时以十六进制格式打印。\n```verilog\n$monitorh(data);\n```"),
|
||||||
("monitoron", "$monitoron();", "启用监控任务。\n```verilog\n$monitoron();\n```"),
|
// monitoron和monitoroff与后面的dumpon和dumpoff等保持一致,不带无参括号
|
||||||
("monitoroff", "$monitoroff();", "关闭监控任务。\n```verilog\n$monitoroff();\n```"),
|
("monitoron", "$monitoron;", "启用监控任务。\n```verilog\n$monitoron();\n```"),
|
||||||
|
("monitoroff", "$monitoroff;", "关闭监控任务。\n```verilog\n$monitoroff();\n```"),
|
||||||
];
|
];
|
||||||
|
|
||||||
/// File input-output system tasks and functions ieee1364 17.2.1
|
/// File input-output system tasks and functions ieee1364 17.2.1
|
||||||
/// (&str, &str, &str): (label, snippet, description)
|
/// (&str, &str, &str): (label, snippet, description)
|
||||||
pub const VLOG_FILE_IO_TASKS: &[(&str, &str, &str)] = &[
|
pub const VLOG_FILE_IO_TASKS: &[(&str, &str, &str)] = &[
|
||||||
|
// fopen有两个参数 文件名和type
|
||||||
|
// number_file = $fopen("numbers.txt", "r");
|
||||||
("fopen", "$fopen($1);", "打开文件并返回文件句柄。\n```verilog\ninteger file_handle;\n// 默认以 \"w\" 作为 flag,如果 file_handle == 0,文件打开失败,file_handle == 1,文件打开成功\nfile_handle = $fopen(\"data.bin\", \"r\");\n```\n\n其余文件描述符\n| 参数 | 描述 |\n|------|-------|\n| `r` 或 `rb` | 以只读方式打开文件 |\n| `w` 或 `wb` | 截断文件长度为零或创建新文件以进行写入 |\n| `a` 或 `ab` | 追加;在文件末尾打开以进行写入,或创建新文件以进行写入 |\n| `r+`、`r+b` 或 `rb+` | 以读写方式打开文件 |\n| `w+`、`w+b` 或 `wb+` | 截断文件或创建新文件以进行读写 |\n| `a+`、`a+b` 或 `ab+` | 追加;在文件末尾打开或创建新文件以进行读写 |"),
|
("fopen", "$fopen($1);", "打开文件并返回文件句柄。\n```verilog\ninteger file_handle;\n// 默认以 \"w\" 作为 flag,如果 file_handle == 0,文件打开失败,file_handle == 1,文件打开成功\nfile_handle = $fopen(\"data.bin\", \"r\");\n```\n\n其余文件描述符\n| 参数 | 描述 |\n|------|-------|\n| `r` 或 `rb` | 以只读方式打开文件 |\n| `w` 或 `wb` | 截断文件长度为零或创建新文件以进行写入 |\n| `a` 或 `ab` | 追加;在文件末尾打开以进行写入,或创建新文件以进行写入 |\n| `r+`、`r+b` 或 `rb+` | 以读写方式打开文件 |\n| `w+`、`w+b` 或 `wb+` | 截断文件或创建新文件以进行读写 |\n| `a+`、`a+b` 或 `ab+` | 追加;在文件末尾打开或创建新文件以进行读写 |"),
|
||||||
("fclose", "$fclose($1);", "关闭文件。\n```verilog\n$fclose(file_handle);\n```"),
|
("fclose", "$fclose($1);", "关闭文件。\n```verilog\n$fclose(file_handle);\n```"),
|
||||||
];
|
];
|
||||||
@ -73,7 +76,6 @@ pub const VLOG_FILE_OUTPUT_TASKS: &[(&str, &str, &str)] = &[
|
|||||||
/// Formatting data to a string tasks ieee1364 17.2.3
|
/// Formatting data to a string tasks ieee1364 17.2.3
|
||||||
/// (&str, &str, &str): (label, snippet, description)
|
/// (&str, &str, &str): (label, snippet, description)
|
||||||
pub const VLOG_FORMATTING_TASKS: &[(&str, &str, &str)] = &[
|
pub const VLOG_FORMATTING_TASKS: &[(&str, &str, &str)] = &[
|
||||||
("sscanf", "$sscanf($1, $2, $3);", "从字符串中读取格式化数据。\n```verilog\ninteger value;\n$sscanf(\"123\", \"%d\", value);\n```"),
|
|
||||||
("swrite", "$swrite($1, $2);", "将格式化字符串存储到字符串变量中,不自动添加换行符。\n```verilog\nstring formatted_string;\n$swrite(formatted_string, \"Data: %d\", data);\n```"),
|
("swrite", "$swrite($1, $2);", "将格式化字符串存储到字符串变量中,不自动添加换行符。\n```verilog\nstring formatted_string;\n$swrite(formatted_string, \"Data: %d\", data);\n```"),
|
||||||
("swriteb", "$swriteb($1, $2);", "将二进制格式的表达式存储到字符串变量中,不自动添加换行符。\n```verilog\nstring formatted_string;\n$swriteb(formatted_string, data);\n```"),
|
("swriteb", "$swriteb($1, $2);", "将二进制格式的表达式存储到字符串变量中,不自动添加换行符。\n```verilog\nstring formatted_string;\n$swriteb(formatted_string, data);\n```"),
|
||||||
("swriteo", "$swriteo($1, $2);", "将八进制格式的表达式存储到字符串变量中,不自动添加换行符。\n```verilog\nstring formatted_string;\n$swriteo(formatted_string, data);\n```"),
|
("swriteo", "$swriteo($1, $2);", "将八进制格式的表达式存储到字符串变量中,不自动添加换行符。\n```verilog\nstring formatted_string;\n$swriteo(formatted_string, data);\n```"),
|
||||||
@ -88,12 +90,31 @@ pub const VLOG_FILE_READING_TASKS: &[(&str, &str, &str)] = &[
|
|||||||
("fgetc", "$fgetc($1);", "从文件中读取一个字符。\n```verilog\ninteger char;\nchar = $fgetc(file_handle);\n```"),
|
("fgetc", "$fgetc($1);", "从文件中读取一个字符。\n```verilog\ninteger char;\nchar = $fgetc(file_handle);\n```"),
|
||||||
("ungetc", "$ungetc($1, $2);", "将字符推回到文件流中。\n```verilog\n$ungetc(char, file_handle);\n```"),
|
("ungetc", "$ungetc($1, $2);", "将字符推回到文件流中。\n```verilog\n$ungetc(char, file_handle);\n```"),
|
||||||
|
|
||||||
// 17.2.4.2 Reading a line at a time
|
// 17.2.4.2 Reading a line at a time、
|
||||||
("fgets", "$fgets($1, $2, $3);", "从文件中读取一行数据。\n```verilog\nstring line;\n$fgets(line, file_handle);\n```"),
|
// 只有两个参数 char_num = $fgets(fbuf,fd);
|
||||||
|
("fgets", "$fgets($1, $2);", "从文件中读取一行数据。\n```verilog\nstring line;\n$fgets(line, file_handle);\n```"),
|
||||||
|
|
||||||
// 17.2.4.3 Reading formatted data
|
// 17.2.4.3 Reading formatted data
|
||||||
("fscanf", "$fscanf($1, $2, $3);", "从文件中读取格式化数据。\n```verilog\ninteger value;\n$fscanf(file_handle, \"%d\", value);\n```"),
|
("fscanf", "$fscanf($1, $2, $3);", "从文件中读取格式化数据。\n```verilog\ninteger value;\n$fscanf(file_handle, \"%d\", value);\n```"),
|
||||||
("sscanf", "$sscanf($1, $2, $3);", "从字符串中读取格式化数据。\n```verilog\ninteger value;\n$sscanf(\"123\", \"%d\", value);\n```"),
|
("sscanf", "$sscanf($1, $2, $3);", "从字符串中读取格式化数据。\n```verilog\ninteger value;\n$sscanf(\"123\", \"%d\", value);\n```"),
|
||||||
|
|
||||||
|
// 17.2.4.4 Reading binary data
|
||||||
|
// 漏了一个
|
||||||
|
// integer <integer>;
|
||||||
|
// <integer> = $fread(<store>,<file_desc>);
|
||||||
|
// <integer> = $fread(<store>,<file_desc>, <start> );
|
||||||
|
// <integer> = $fread(<store>,<file_desc>, <start>, <count> );
|
||||||
|
// <integer> = $fread(<store>,<file_desc>, , <count> );
|
||||||
|
// integer:整型数值,返回本次$fread 读取的真实字节数量,当返回值为0 ,表示错误读取或者文件结束。
|
||||||
|
// store:将二进制文件中的数据读取到寄存器或者二维数组中。
|
||||||
|
// file_desc:为打开的文件句柄
|
||||||
|
// start: 为二维数组的起始地址
|
||||||
|
// count: 从起始地址开始, 写入二维数组的数量。
|
||||||
|
// fread
|
||||||
|
// integer fd;
|
||||||
|
// reg [7:0] fbuf [3:0];
|
||||||
|
// char_num = $fread(fbuf, fd, 0, 4); //读取二进制文件中的数据,存放到fbuf[0],fbuf[1],fbuf[2],fbuf[3]
|
||||||
|
// char_num = $fread(fbuf, fd, 1, 2); //读取二进制文件中的数据,存放到fbuf[1],fbuf[2]
|
||||||
];
|
];
|
||||||
|
|
||||||
/// File positioning tasks ieee1364 17.2.5
|
/// File positioning tasks ieee1364 17.2.5
|
||||||
@ -113,6 +134,9 @@ pub const VLOG_FLUSHING_OUTPUT_TASKS: &[(&str, &str, &str)] = &[
|
|||||||
/// I/O error status tasks ieee1364 17.2.7
|
/// I/O error status tasks ieee1364 17.2.7
|
||||||
/// (&str, &str, &str): (label, snippet, description)
|
/// (&str, &str, &str): (label, snippet, description)
|
||||||
pub const VLOG_IO_ERROR_STATUS_TASKS: &[(&str, &str, &str)] = &[
|
pub const VLOG_IO_ERROR_STATUS_TASKS: &[(&str, &str, &str)] = &[
|
||||||
|
// err = $ferror(fd, str) ; str会提供更加详细的错误信息
|
||||||
|
// err 返回非零值表示错误, str 返回非零值存储错误类型, 官方建议 str 长度为 640bit 位宽
|
||||||
|
// 假如打开一个不存在的文件,则err会得到00000002,str则会得到No such file or directory
|
||||||
("ferror", "$ferror($1);", "检查文件读写错误。\n```verilog\ninteger error;\nerror = $ferror(file_handle);\n```"),
|
("ferror", "$ferror($1);", "检查文件读写错误。\n```verilog\ninteger error;\nerror = $ferror(file_handle);\n```"),
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -132,6 +156,9 @@ pub const VLOG_LOADING_MEMORY_TASKS: &[(&str, &str, &str)] = &[
|
|||||||
/// Loading timing data from an SDF file tasks ieee1364 17.2.10
|
/// Loading timing data from an SDF file tasks ieee1364 17.2.10
|
||||||
/// (&str, &str, &str): (label, snippet, description)
|
/// (&str, &str, &str): (label, snippet, description)
|
||||||
pub const VLOG_LOADING_TIMING_TASKS: &[(&str, &str, &str)] = &[
|
pub const VLOG_LOADING_TIMING_TASKS: &[(&str, &str, &str)] = &[
|
||||||
|
// $sdf_annotate ("sdf_file"[, module_instance][,"sdf_configfile"][,"sdf_logfile"][,"mtm_spec"][,"scale_factors"][,"scale_type"]);
|
||||||
|
// 最简单的方式可以只需要两个参数,大概就这样就好?
|
||||||
|
// $sdf_annotate(“ring_oscillator.sdf”,ring_oscillator);
|
||||||
("sdf_annotate", "$sdf_annotate($1, $2);", "从 SDF 文件加载时序数据并应用于模块实例。\n```verilog\n$sdf_annotate(\"timing.sdf\", top_module);\n```"),
|
("sdf_annotate", "$sdf_annotate($1, $2);", "从 SDF 文件加载时序数据并应用于模块实例。\n```verilog\n$sdf_annotate(\"timing.sdf\", top_module);\n```"),
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -240,6 +267,7 @@ pub const VLOG_CONVERSION_FUNCTIONS_TASKS: &[(&str, &str, &str)] = &[
|
|||||||
("rtoi", "$rtoi($1);", "将实数转换为整数。\n```verilog\ninteger integer_value;\ninteger_value = $rtoi(real_value);\n```"),
|
("rtoi", "$rtoi($1);", "将实数转换为整数。\n```verilog\ninteger integer_value;\ninteger_value = $rtoi(real_value);\n```"),
|
||||||
("bitstoreal", "$bitstoreal($1);", "将 64 位位向量转换为实数。\n```verilog\nreal real_value;\nreal_value = $bitstoreal(bit_vector);\n```"),
|
("bitstoreal", "$bitstoreal($1);", "将 64 位位向量转换为实数。\n```verilog\nreal real_value;\nreal_value = $bitstoreal(bit_vector);\n```"),
|
||||||
("realtobits", "$realtobits($1);", "将实数转换为 64 位位向量。\n```verilog\nreg [63:0] bit_vector;\nbit_vector = $realtobits(real_value);\n```"),
|
("realtobits", "$realtobits($1);", "将实数转换为 64 位位向量。\n```verilog\nreg [63:0] bit_vector;\nbit_vector = $realtobits(real_value);\n```"),
|
||||||
|
// bitstoshortreal和shortrealtobits是sv中的task
|
||||||
("bitstoshortreal", "$bitstoshortreal($1);", "将 32 位位向量转换为短实数。\n```verilog\nshortreal shortreal_value;\nshortreal_value = $bitstoshortreal(bit_vector);\n```"),
|
("bitstoshortreal", "$bitstoshortreal($1);", "将 32 位位向量转换为短实数。\n```verilog\nshortreal shortreal_value;\nshortreal_value = $bitstoshortreal(bit_vector);\n```"),
|
||||||
("shortrealtobits", "$shortrealtobits($1);", "将短实数转换为 32 位位向量。\n```verilog\nreg [31:0] bit_vector;\nbit_vector = $shortrealtobits(shortreal_value);\n```"),
|
("shortrealtobits", "$shortrealtobits($1);", "将短实数转换为 32 位位向量。\n```verilog\nreg [31:0] bit_vector;\nbit_vector = $shortrealtobits(shortreal_value);\n```"),
|
||||||
];
|
];
|
||||||
@ -347,6 +375,16 @@ pub const VLOG_DUMPFLUSH_TASKS: &[(&str, &str, &str)] = &[
|
|||||||
("dumpflush", "$dumpflush;", "刷新波形转储文件,确保所有数据都写入文件。\n```verilog\n$dumpflush;\n```"),
|
("dumpflush", "$dumpflush;", "刷新波形转储文件,确保所有数据都写入文件。\n```verilog\n$dumpflush;\n```"),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// 18.3 Creating extended VCD File
|
||||||
|
// 主要比传统的dump多了一个指定文件名的功能
|
||||||
|
// dumpports $dumpports ( scope_list , file_pathname ) ;
|
||||||
|
// dumpportsoff $dumpportsoff ( file_pathname ) ;
|
||||||
|
// dumpportson $dumpportson ( file_pathname ) ;
|
||||||
|
// dumpportslimit $dumpportslimit ( filesize , file_pathname ) ;
|
||||||
|
// dumpportsflush $dumpportsflush ( file_pathname ) ;
|
||||||
|
// vcdclose $vcdclose
|
||||||
|
// vcdclose的信息比较少,文档中的sample是$vcdclose #13000 $end,vcdclose_task ::= $vcdclose final_simulation_time $end,感觉应该是要和$end连用的
|
||||||
|
|
||||||
/// FSDB related tasks
|
/// FSDB related tasks
|
||||||
/// (&str, &str, &str): (label, snippet, description)
|
/// (&str, &str, &str): (label, snippet, description)
|
||||||
pub const VLOG_FSDB_TASKS: &[(&str, &str, &str)] = &[
|
pub const VLOG_FSDB_TASKS: &[(&str, &str, &str)] = &[
|
||||||
|
Loading…
x
Reference in New Issue
Block a user