diff --git a/libveriuser/a_object_of_type.c b/libveriuser/a_object_of_type.c index 4a05119fd..53b806448 100644 --- a/libveriuser/a_object_of_type.c +++ b/libveriuser/a_object_of_type.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2009 Michael Ruff (mruff at chiaro.com) + * Copyright (c) 2002-2013 Michael Ruff (mruff at chiaro.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -45,7 +45,7 @@ int acc_object_of_type(handle object, PLI_INT32 type) case accScope: if (vtype == vpiModule || vtype == vpiNamedBegin || vtype == vpiNamedFork || vtype == vpiTask || - vtype == vpiFunction) rtn = 1; + vtype == vpiFunction || vtype == vpiGenScope) rtn = 1; break; case accNet: rtn = vtype == vpiNet; break; diff --git a/vpi/sys_display.c b/vpi/sys_display.c index 4b87a9f72..047c0dc6a 100644 --- a/vpi/sys_display.c +++ b/vpi/sys_display.c @@ -1863,6 +1863,7 @@ static PLI_INT32 sys_printtimescale_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) vpiHandle arg = vpi_scan(argv); switch (vpi_get(vpiType, arg)) { case vpiFunction: + case vpiGenScope: case vpiIntegerVar: case vpiBitVar: case vpiByteVar: diff --git a/vpi/sys_fst.c b/vpi/sys_fst.c index 916c5847c..ffce94008 100644 --- a/vpi/sys_fst.c +++ b/vpi/sys_fst.c @@ -469,7 +469,9 @@ static void scan_item(unsigned depth, vpiHandle item, int skip) struct t_cb_data cb; struct vcd_info* info; - PLI_INT32 type; + enum fstVarType type = FST_VT_VCD_MAX; + enum fstScopeType stype = FST_ST_VCD_MAX; + enum fstVarDir dir; const char *name; const char *fullname; char *escname; @@ -514,11 +516,12 @@ static void scan_item(unsigned depth, vpiHandle item, int skip) } break; - case vpiNamedBegin: type = FST_ST_VCD_BEGIN; break; - case vpiNamedFork: type = FST_ST_VCD_FORK; break; - case vpiFunction: type = FST_ST_VCD_FUNCTION; break; - case vpiModule: type = FST_ST_VCD_MODULE; break; - case vpiTask: type = FST_ST_VCD_TASK; break; + case vpiNamedBegin: stype = FST_ST_VCD_BEGIN; break; + case vpiNamedFork: stype = FST_ST_VCD_FORK; break; + case vpiFunction: stype = FST_ST_VCD_FUNCTION; break; + case vpiGenScope: stype = FST_ST_VCD_GENERATE; break; + case vpiModule: stype = FST_ST_VCD_MODULE; break; + case vpiTask: stype = FST_ST_VCD_TASK; break; default: vpi_printf("FST warning: $dumpvars: Unsupported argument " @@ -596,20 +599,24 @@ static void scan_item(unsigned depth, vpiHandle item, int skip) * zero so we will also use a width of one for events. */ if (item_type == vpiNamedEvent) size = 1; else size = vpi_get(vpiSize, item); + /* The FST format supports a port direction so if the net + * is a port set the direction to one of the following: + * FST_VD_INPUT, FST_VD_OUTPUT or FST_VD_INOUT */ + dir = FST_VD_IMPLICIT; - if (size > 1 || vpi_get(vpiLeftRange, item) != 0) { + if (size > 1 || vpi_get(vpiLeftRange, item) != 0) { char *buf = malloc(strlen(escname) + 65); sprintf(buf, "%s [%i:%i]", escname, (int)vpi_get(vpiLeftRange, item), (int)vpi_get(vpiRightRange, item)); new_ident = fstWriterCreateVar(dump_file, type, - FST_VD_IMPLICIT, size, buf, + dir, size, buf, (fstHandle)(long)ident); free(buf); } else { new_ident = fstWriterCreateVar(dump_file, type, - FST_VD_IMPLICIT, size, escname, + dir, size, escname, (fstHandle)(long)ident); } free(escname); @@ -643,9 +650,10 @@ static void scan_item(unsigned depth, vpiHandle item, int skip) break; case vpiModule: - case vpiNamedBegin: - case vpiTask: + case vpiGenScope: case vpiFunction: + case vpiTask: + case vpiNamedBegin: case vpiNamedFork: if (depth > 0) { @@ -660,6 +668,7 @@ static void scan_item(unsigned depth, vpiHandle item, int skip) vpiVariables, /* Scope */ vpiFunction, + vpiGenScope, vpiModule, vpiNamedBegin, vpiNamedFork, @@ -689,7 +698,7 @@ static void scan_item(unsigned depth, vpiHandle item, int skip) free(defname); defname = NULL; } - fstWriterSetScope(dump_file, type, name, defname); + fstWriterSetScope(dump_file, stype, name, defname); free(defname); for (i=0; types[i]>0; i++) { @@ -734,10 +743,11 @@ static int draw_scope(vpiHandle item, vpiHandle callh) switch (scope_type) { case vpiNamedBegin: type = FST_ST_VCD_BEGIN; break; - case vpiTask: type = FST_ST_VCD_TASK; break; case vpiFunction: type = FST_ST_VCD_FUNCTION; break; case vpiNamedFork: type = FST_ST_VCD_FORK; break; + case vpiGenScope: type = FST_ST_VCD_GENERATE; break; case vpiModule: type = FST_ST_VCD_MODULE; break; + case vpiTask: type = FST_ST_VCD_TASK; break; default: type = FST_ST_VCD_MODULE; vpi_printf("FST Error: %s:%d: $dumpvars: Unsupported scope " diff --git a/vpi/sys_lxt.c b/vpi/sys_lxt.c index 06692c0f6..66d5d5e24 100644 --- a/vpi/sys_lxt.c +++ b/vpi/sys_lxt.c @@ -640,9 +640,10 @@ static void scan_item(unsigned depth, vpiHandle item, int skip) break; case vpiModule: - case vpiNamedBegin: - case vpiTask: + case vpiGenScope: case vpiFunction: + case vpiTask: + case vpiNamedBegin: case vpiNamedFork: if (depth > 0) { @@ -657,6 +658,7 @@ static void scan_item(unsigned depth, vpiHandle item, int skip) vpiVariables, /* Scope */ vpiFunction, + vpiGenScope, vpiModule, vpiNamedBegin, vpiNamedFork, diff --git a/vpi/sys_lxt2.c b/vpi/sys_lxt2.c index 1643d1e6a..f2f1839e2 100644 --- a/vpi/sys_lxt2.c +++ b/vpi/sys_lxt2.c @@ -695,9 +695,10 @@ static void scan_item(unsigned depth, vpiHandle item, int skip) break; case vpiModule: - case vpiNamedBegin: - case vpiTask: + case vpiGenScope: case vpiFunction: + case vpiTask: + case vpiNamedBegin: case vpiNamedFork: if (depth > 0) { @@ -712,6 +713,7 @@ static void scan_item(unsigned depth, vpiHandle item, int skip) vpiVariables, /* Scope */ vpiFunction, + vpiGenScope, vpiModule, vpiNamedBegin, vpiNamedFork, diff --git a/vpi/sys_vcd.c b/vpi/sys_vcd.c index f8d91a38a..62a6f75b5 100644 --- a/vpi/sys_vcd.c +++ b/vpi/sys_vcd.c @@ -545,6 +545,7 @@ static void scan_item(unsigned depth, vpiHandle item, int skip) break; case vpiNamedBegin: type = "begin"; break; + case vpiGenScope: type = "begin"; break; case vpiNamedFork: type = "fork"; break; case vpiFunction: type = "function"; break; case vpiModule: type = "module"; break; @@ -667,9 +668,10 @@ static void scan_item(unsigned depth, vpiHandle item, int skip) break; case vpiModule: - case vpiNamedBegin: - case vpiTask: + case vpiGenScope: case vpiFunction: + case vpiTask: + case vpiNamedBegin: case vpiNamedFork: if (depth > 0) { @@ -683,6 +685,7 @@ static void scan_item(unsigned depth, vpiHandle item, int skip) vpiVariables, /* Scope */ vpiFunction, + vpiGenScope, vpiModule, vpiNamedBegin, vpiNamedFork, @@ -733,6 +736,7 @@ static int draw_scope(vpiHandle item, vpiHandle callh) switch (vpi_get(vpiType, scope)) { case vpiNamedBegin: type = "begin"; break; + case vpiGenScope: type = "begin"; break; case vpiTask: type = "task"; break; case vpiFunction: type = "function"; break; case vpiNamedFork: type = "fork"; break; diff --git a/vpi/vcd_priv.c b/vpi/vcd_priv.c index da2a03a12..77a5dcda7 100644 --- a/vpi/vcd_priv.c +++ b/vpi/vcd_priv.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2011 Stephen Williams (steve@icarus.com) + * Copyright (c) 2003-2013 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -178,8 +178,9 @@ PLI_INT32 sys_dumpvars_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) #endif /* The module types. */ case vpiModule: - case vpiTask: + case vpiGenScope: case vpiFunction: + case vpiTask: case vpiNamedBegin: case vpiNamedFork: /* The variable types. */ diff --git a/vpi/vpi_debug.c b/vpi/vpi_debug.c index c1a2d415b..4a4515b43 100644 --- a/vpi/vpi_debug.c +++ b/vpi/vpi_debug.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2012 Stephen Williams (steve@icarus.com) + * Copyright (c) 2011-2013 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -38,6 +38,7 @@ static void dump_object(vpiHandle item) /* These types are themselves scopes and have objects within. */ case vpiModule: + case vpiGenScope: case vpiFunction: case vpiTask: case vpiNamedBegin: diff --git a/vpi_user.h b/vpi_user.h index dc601509a..4b17ae2f0 100644 --- a/vpi_user.h +++ b/vpi_user.h @@ -1,7 +1,7 @@ #ifndef __vpi_user_H #define __vpi_user_H /* - * Copyright (c) 1999-2012 Stephen Williams (steve@icarus.com) + * Copyright (c) 1999-2013 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -312,11 +312,12 @@ typedef struct t_vpi_delay { /********************** object types added with 1364-2001 *********************/ -# define vpiRegArray 116 +#define vpiCallback 107 +#define vpiRegArray 116 /********************** object types added with 1364-2005 *********************/ -#define vpiCallback 1000 +#define vpiGenScope 134 /* PROPERTIES */ #define vpiUndefined (-1) diff --git a/vvp/stop.cc b/vvp/stop.cc index 7f5685ed0..4f1e67503 100644 --- a/vvp/stop.cc +++ b/vvp/stop.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2012 Stephen Williams (steve@icarus.com) + * Copyright (c) 2003-2013 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -133,6 +133,7 @@ static void cmd_call(unsigned argc, char*argv[]) switch (table[tmp]->get_type_code()) { case vpiModule: + case vpiGenScope: case vpiFunction: case vpiTask: case vpiNamedBegin: @@ -236,6 +237,11 @@ static void cmd_list(unsigned, char*[]) printf("module : %s\n", scope->name); break; + case vpiGenScope: + scope = dynamic_cast<__vpiScope*>(table[idx]); + printf("generate: %s\n", scope->name); + break; + case vpiTask: scope = dynamic_cast<__vpiScope*>(table[idx]); printf("task : %s\n", scope->name); diff --git a/vvp/vpi_priv.cc b/vvp/vpi_priv.cc index 9c6645e31..15aff987e 100644 --- a/vvp/vpi_priv.cc +++ b/vvp/vpi_priv.cc @@ -307,6 +307,8 @@ static const char* vpi_type_values(PLI_INT32 code) return "vpiEnumTypespec"; case vpiFunction: return "vpiFunction"; + case vpiGenScope: + return "vpiGenScope"; case vpiIntVar: return "vpiIntVar"; case vpiIntegerVar: diff --git a/vvp/vpi_scope.cc b/vvp/vpi_scope.cc index af27a4feb..f18aea030 100644 --- a/vvp/vpi_scope.cc +++ b/vvp/vpi_scope.cc @@ -61,6 +61,7 @@ static void delete_sub_scopes(struct __vpiScope *scope) case vpiTask: contexts_delete(lscope); case vpiModule: + case vpiGenScope: case vpiNamedBegin: case vpiNamedFork: delete_sub_scopes(lscope); @@ -187,6 +188,8 @@ static const char* scope_get_type(int code) switch (code) { case vpiModule: return "vpiModule"; + case vpiGenScope: + return "vpiGenScope"; case vpiFunction: return "vpiFunction"; case vpiTask: @@ -273,6 +276,7 @@ static int compare_types(int code, int type) if ( code == vpiInternalScope && (type == vpiModule || + type == vpiGenScope || type == vpiFunction || type == vpiTask || type == vpiNamedBegin || @@ -368,6 +372,11 @@ struct vpiScopeBegin : public __vpiScope { int get_type_code(void) const { return vpiNamedBegin; } }; +struct vpiScopeGenerate : public __vpiScope { + inline vpiScopeGenerate() { } + int get_type_code(void) const { return vpiGenScope; } +}; + struct vpiScopeFork : public __vpiScope { inline vpiScopeFork() { } int get_type_code(void) const { return vpiNamedFork; } @@ -435,7 +444,7 @@ compile_scope_decl(char*label, char*type, char*name, char*tname, } else if (strcmp(base_type,"begin") == 0) { scope = new vpiScopeBegin; } else if (strcmp(base_type,"generate") == 0) { - scope = new vpiScopeBegin; + scope = new vpiScopeGenerate; } else if (strcmp(base_type,"package") == 0) { scope = new vpiScopePackage; } else if (strcmp(base_type,"class") == 0) {