Add support for a generate scope to vvp and the vpi routines.
Instead of just translating a generate scope to a named begin/end scope this patch creates a generate specific scope (vpiScopeGenerate) that is of the vpiGenScope type. This may not match the standard 100%, but does allow the FST dumper to denote generate scopes differently than the other scope types. Most of the VPI code treats a vpiGenScope just like a named block so only the FST dumper should have different behavior.
This commit is contained in:
parent
f636ffde48
commit
54cb85adfc
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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 "
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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. */
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue