Open dtauxe opened 6 years ago
Based on the spec, I created the following solution:
" From IEEE 1800-2017 Section 20
syntax match svSystemFunction "\$\(finish\|stop\|exit\|realtime\|stime\|time\|printtimescale\|timeformat\|bistoreal\|realtobits\|bitstoshortreal\|shortrealtobits\|itor\|rtoi\|signed\|unsigned\|cast\|bits\|isunbounded\|typename\|unpacked_dimensions\|dimensions\|left\|right\|low\|high\|increment\|size\|clog2\|ln\|log10\|a\?\(sin\|cos\|tan\)h\?\|exp\|atan2\|sqrt\|hypot\|pow\|floor\|ceil\|countbits\|contones\|onehot\|onehot0\|isunknown\|fatal\|error\|warning\|info\|assert\(pass\|fail\|nonvacuous\)\?\(on\|off\)\|assertkill\|assertcontrol\|sampled\|\(rose\|fell\|stable\|changed\|past\)\(_gclk\)\?\|future_gclk\|rising_glk\|falling_gclk\|steady_gclk\|changing_gclk\|coverage_control\|coverage_get_max\|coverage_get\|coverage_merge\|coverage_save\|get_coverage\|set_coverage_db_name\|load_coverage_db\|random\|dist_chi_square\|dist_erlang\|dist_exponential\|dist_normal\|dist_poisson\|dist_t\|dist_uniform\|q_initialize\|q_add\|q_remove\|q_full\|q_exam\|a\?sync$\(n\?\(and\|or\)\)$\(array\|plane\)\|system\)\>"
" From IEEE 1800-2017 Section 21
syntax match svIOSysFunction "\$\(f\?\(display\|write\|strobe\|monitor\)\(b\|h\|o\)\?\|monitoroff\|monitoron\|fclose\|fopen\|swrite\|sformat\|swriteb\|sformatf\|swriteh\|fgetc\|swriteo\|ungetc\|fscanf\|fgets\|fread\|sscanf\|fseek\|rewind\|fflush\|ftell\|feof\|ferror\|\(read\|write\)mem\(b\|h\)\|test$plusargs\|value$plusargs\|dumpfile\|dumpvars\|dump\(ports\)\?\(on\|off\|all\|limit\|flush\)\)\>"
" From IEEE 1800-2017 Annex D
syntax match svOptionalSysFunction "\$\(\|countdrivers\|getpattern\|incsave\|input\|key\|list\|log\|nokey\|nolog\|reset\|reset_count\|reset_value\|restart\|save\|scale\|scope\|showscopes\|showvars\|sreadmemb\|sreadmemh\|\|\)\>"
" . . .
highlight! default link svIOSysFunction svSystemFunction
highlight! default link svOptionalSysFunction svSystemFunction
to replace the original svSystemFunction. I haven't tested it extensively, so there might be some typos in there somewhere.
I noticed this with
$sformatf
, but I don't think it's the only one.Similarly, the functions like
$syncnandarray
should instead look like$sync$nand$array
, at least based on the latest 2017 spec.