From 92dd13a22510f032a2e9778597f45078d923ea17 Mon Sep 17 00:00:00 2001 From: Cary R Date: Thu, 21 Aug 2008 11:42:53 -0700 Subject: [PATCH 1/3] Error message for missing system tasks/functions. This patch adds an error message for the standard system tasks and functions that are not currently implemented. These are currently $fmonitor*, $ferror, $fread, the queue and PLA tasks. --- vpi/sys_icarus.c | 157 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 149 insertions(+), 8 deletions(-) diff --git a/vpi/sys_icarus.c b/vpi/sys_icarus.c index d2e1921d2..ecfdc5f02 100644 --- a/vpi/sys_icarus.c +++ b/vpi/sys_icarus.c @@ -42,18 +42,159 @@ static PLI_INT32 finish_and_return_calltf(PLI_BYTE8* name) return 0; } +static PLI_INT32 task_not_implemented_compiletf(PLI_BYTE8* name) +{ + vpiHandle callh = vpi_handle(vpiSysTfCall, 0); + + vpi_printf("%s:%d: SORRY: task %s() is not currently implemented.\n", + vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh), + name); + vpi_control(vpiFinish, 1); + return 0; +} + +static PLI_INT32 function_not_implemented_compiletf(PLI_BYTE8* name) +{ + vpiHandle callh = vpi_handle(vpiSysTfCall, 0); + + vpi_printf("%s:%d: SORRY: function %s() is not currently implemented.\n", + vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh), + name); + vpi_control(vpiFinish, 1); + return 0; +} + /* * Register the function with Verilog. */ void sys_special_register(void) { - s_vpi_systf_data tf_data; + s_vpi_systf_data tf_data; - tf_data.type = vpiSysTask; - tf_data.calltf = finish_and_return_calltf; - tf_data.compiletf = sys_one_numeric_arg_compiletf; - tf_data.sizetf = 0; - tf_data.tfname = "$finish_and_return"; - tf_data.user_data = "$finish_and_return"; - vpi_register_systf(&tf_data); + tf_data.type = vpiSysTask; + tf_data.calltf = finish_and_return_calltf; + tf_data.compiletf = sys_one_numeric_arg_compiletf; + tf_data.sizetf = 0; + tf_data.tfname = "$finish_and_return"; + tf_data.user_data = "$finish_and_return"; + vpi_register_systf(&tf_data); + + /* These tasks are not currently implemented. */ + tf_data.type = vpiSysTask; + tf_data.calltf = 0; + tf_data.sizetf = 0; + tf_data.compiletf = task_not_implemented_compiletf; + + tf_data.tfname = "$fmonitor"; + tf_data.user_data = "$fmonitor"; + vpi_register_systf(&tf_data); + + tf_data.tfname = "$fmonitorb"; + tf_data.user_data = "$fmonitorb"; + vpi_register_systf(&tf_data); + + tf_data.tfname = "$fmonitoro"; + tf_data.user_data = "$fmonitoro"; + vpi_register_systf(&tf_data); + + tf_data.tfname = "$fmonitorh"; + tf_data.user_data = "$fmonitorh"; + vpi_register_systf(&tf_data); + + tf_data.tfname = "$async$and$array"; + tf_data.user_data = "$async$and$array"; + vpi_register_systf(&tf_data); + + tf_data.tfname = "$async$nand$array"; + tf_data.user_data = "$async$nand$array"; + vpi_register_systf(&tf_data); + + tf_data.tfname = "$async$or$array"; + tf_data.user_data = "$async$or$array"; + vpi_register_systf(&tf_data); + + tf_data.tfname = "$async$nor$array"; + tf_data.user_data = "$async$nor$array"; + vpi_register_systf(&tf_data); + + tf_data.tfname = "$async$and$plane"; + tf_data.user_data = "$async$and$plane"; + vpi_register_systf(&tf_data); + + tf_data.tfname = "$async$nand$plane"; + tf_data.user_data = "$async$nand$plane"; + vpi_register_systf(&tf_data); + + tf_data.tfname = "$async$or$plane"; + tf_data.user_data = "$async$or$plane"; + vpi_register_systf(&tf_data); + + tf_data.tfname = "$async$nor$plane"; + tf_data.user_data = "$async$nor$plane"; + vpi_register_systf(&tf_data); + + tf_data.tfname = "$sync$and$array"; + tf_data.user_data = "$sync$and$array"; + vpi_register_systf(&tf_data); + + tf_data.tfname = "$sync$nand$array"; + tf_data.user_data = "$sync$nand$array"; + vpi_register_systf(&tf_data); + + tf_data.tfname = "$sync$or$array"; + tf_data.user_data = "$sync$or$array"; + vpi_register_systf(&tf_data); + + tf_data.tfname = "$sync$nor$array"; + tf_data.user_data = "$sync$nor$array"; + vpi_register_systf(&tf_data); + + tf_data.tfname = "$sync$and$plane"; + tf_data.user_data = "$sync$and$plane"; + vpi_register_systf(&tf_data); + + tf_data.tfname = "$sync$nand$plane"; + tf_data.user_data = "$sync$nand$plane"; + vpi_register_systf(&tf_data); + + tf_data.tfname = "$sync$or$plane"; + tf_data.user_data = "$sync$or$plane"; + vpi_register_systf(&tf_data); + + tf_data.tfname = "$sync$nor$plane"; + tf_data.user_data = "$sync$nor$plane"; + vpi_register_systf(&tf_data); + + tf_data.tfname = "$q_initialize"; + tf_data.user_data = "$q_initialize"; + vpi_register_systf(&tf_data); + + tf_data.tfname = "$q_add"; + tf_data.user_data = "$q_add"; + vpi_register_systf(&tf_data); + + tf_data.tfname = "$q_remove"; + tf_data.user_data = "$q_remove"; + vpi_register_systf(&tf_data); + + tf_data.tfname = "$q_full"; + tf_data.user_data = "$q_full"; + vpi_register_systf(&tf_data); + + tf_data.tfname = "$q_exam"; + tf_data.user_data = "$q_exam"; + vpi_register_systf(&tf_data); + + /* These functions are not currently implemented. */ + tf_data.compiletf = function_not_implemented_compiletf; + tf_data.type = vpiSysFunc; + tf_data.sysfunctype = vpiIntFunc; + + tf_data.tfname = "$ferror"; + tf_data.user_data = "$ferror"; + vpi_register_systf(&tf_data); + + tf_data.tfname = "$fread"; + tf_data.user_data = "$fread"; + vpi_register_systf(&tf_data); } From be3d7b435d1e4435420e4ac3df34425cd30ecf6b Mon Sep 17 00:00:00 2001 From: Cary R Date: Fri, 22 Aug 2008 19:32:01 -0700 Subject: [PATCH 2/3] Print a better message for instance port expression errors. This patch adds code to print an error message when there is a syntax error in the port expression list. --- parse.y | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/parse.y b/parse.y index 4b2dae490..a26cdc1b8 100644 --- a/parse.y +++ b/parse.y @@ -1502,6 +1502,32 @@ gate_instance delete rng; $$ = tmp; } + + | IDENTIFIER '(' error ')' + { lgate*tmp = new lgate; + tmp->name = $1; + tmp->parms = 0; + tmp->parms_by_name = 0; + tmp->file = @1.text; + tmp->lineno = @1.first_line; + yyerror(@2, "error: Syntax error in instance port " + "expression(s)."); + delete[]$1; + $$ = tmp; + } + + | IDENTIFIER range '(' error ')' + { lgate*tmp = new lgate; + tmp->name = $1; + tmp->parms = 0; + tmp->parms_by_name = 0; + tmp->file = @1.text; + tmp->lineno = @1.first_line; + yyerror(@3, "error: Syntax error in instance port " + "expression(s)."); + delete[]$1; + $$ = tmp; + } ; gate_instance_list From bccb762e9f9b276276edd60404a23540c6dbeb12 Mon Sep 17 00:00:00 2001 From: Cary R Date: Tue, 26 Aug 2008 09:44:44 -0700 Subject: [PATCH 3/3] Correctly cast strlen() for %*s width argument. We had fixed many of these warning before, but I missed this one since this file was not part of the distribution when we fixed the other cases. --- vpi/sys_clog2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vpi/sys_clog2.c b/vpi/sys_clog2.c index 043e44fd0..9d30f60a5 100644 --- a/vpi/sys_clog2.c +++ b/vpi/sys_clog2.c @@ -63,7 +63,7 @@ static PLI_INT32 sys_clog2_compiletf(PLI_BYTE8 *name) vpi_printf("%s $clog2 takes at most one argument.\n", msg); vpi_printf("%*s Found %u extra argument%s.\n", - strlen(msg), " ", argc, argc == 1 ? "" : "s"); + (int) strlen(msg), " ", argc, argc == 1 ? "" : "s"); vpi_control(vpiFinish, 1); }