Skip to content

Commit

Permalink
Issue chipsalliance#859: vpiModule & vpiInterface are part of standard
Browse files Browse the repository at this point in the history
Follow up to a previous change where vpiModule & vpiInterface were
renamed to vpiModuleInst & vpiInterfaceInst, respectively. This is
flawed and doesn't meet the vpi standard. Reverting the names back to
vpiModule & vpiInterface. However, the classes generated against the
models remain named module_inst & interface_inst.
  • Loading branch information
hs-apotell committed Jan 15, 2023
1 parent be2f18d commit f40dead
Show file tree
Hide file tree
Showing 24 changed files with 88 additions and 81 deletions.
2 changes: 1 addition & 1 deletion include/sv_vpi_user.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ extern "C" {

/****************************** OBJECT TYPES ******************************/
#define vpiPackage 600
#define vpiInterfaceInst 601
#define vpiInterface 601
#define vpiProgram 602
#define vpiInterfaceArray 603
#define vpiProgramArray 604
Expand Down
2 changes: 1 addition & 1 deletion include/vpi_user.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ typedef PLI_UINT32 *vpiHandle;
#define vpiMemory 29 /* behavioral memory */
#define vpiMemoryWord 30 /* single word of memory */
#define vpiModPath 31 /* module path for path delays */
#define vpiModuleInst 32 /* module instance */
#define vpiModule 32 /* module instance */
#define vpiNamedBegin 33 /* named block statement */
#define vpiNamedEvent 34 /* event variable */
#define vpiNamedFork 35 /* named fork-join block */
Expand Down
6 changes: 3 additions & 3 deletions model/design.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
card: any
- class: allInterfaces
type: interface_inst
vpi_obj: vpiInterfaceInst
vpi_obj: vpiInterface
vpi: uhdmallInterfaces
card: any
- class: allUdps
Expand All @@ -66,7 +66,7 @@
card: any
- class: allModules
type: module_inst
vpi_obj: vpiModuleInst
vpi_obj: vpiModule
vpi: uhdmallModules
card: any
- class_ref: typespecs
Expand Down Expand Up @@ -95,6 +95,6 @@
card: any
- class: topModules
type: module_inst
vpi_obj: vpiModuleInst
vpi_obj: vpiModule
vpi: uhdmtopModules
card: any
4 changes: 2 additions & 2 deletions model/gen_scope.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
card: any
- obj_ref: modules
name: modules
vpi: vpiModuleInst
vpi: vpiModule
type: module_inst
card: any
- obj_ref: module_arrays
Expand Down Expand Up @@ -102,7 +102,7 @@
card: any
- obj_ref: interfaces
name: interface_inst
vpi: vpiInterfaceInst
vpi: vpiInterface
type: interface_inst
card: any
- obj_ref: interface_arrays
Expand Down
2 changes: 1 addition & 1 deletion model/instance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
card: any
- obj_ref: module_inst
name: module_inst
vpi: vpiModuleInst
vpi: vpiModule
type: module_inst
card: 1
- class_ref: instance
Expand Down
2 changes: 1 addition & 1 deletion model/instance_array.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
card: any
- obj_ref: modules
name: modules
vpi: vpiModuleInst
vpi: vpiModule
type: module_inst
card: any
- class_ref: elem_typespec
Expand Down
4 changes: 2 additions & 2 deletions model/interface_inst.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
type: int
card: 1
- property: type
name: vpiInterfaceInst
name: vpiInterface
vpi: vpiType
type: unsigned int
card: 1
Expand Down Expand Up @@ -72,7 +72,7 @@
card: any
- obj_ref: interfaces
name: interface_inst
vpi: vpiInterfaceInst
vpi: vpiInterface
type: interface_inst
card: any
- obj_ref: interface_arrays
Expand Down
2 changes: 1 addition & 1 deletion model/modport.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
card: any
- obj_ref: interface_inst
name: interface_inst
vpi: vpiInterfaceInst
vpi: vpiInterface
type: interface_inst
card: 1
6 changes: 3 additions & 3 deletions model/module_inst.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
type: int
card: 1
- property: type
name: vpiModuleInst
name: vpiModule
vpi: vpiType
type: unsigned int
card: 1
Expand Down Expand Up @@ -68,7 +68,7 @@
card: any
- obj_ref: interfaces
name: interface_inst
vpi: vpiInterfaceInst
vpi: vpiInterface
type: interface_inst
card: any
- obj_ref: interface_arrays
Expand All @@ -83,7 +83,7 @@
card: any
- obj_ref: modules
name: modules
vpi: vpiModuleInst
vpi: vpiModule
type: module_inst
card: any
- obj_ref: module_arrays
Expand Down
2 changes: 1 addition & 1 deletion model/nets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,6 @@
card: 1
- obj_ref: module_inst
name: module_inst
vpi: vpiModuleInst
vpi: vpiModule
type: module_inst
card: 1
2 changes: 1 addition & 1 deletion model/ports.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,6 @@
card: 1
- obj_ref: module_inst
name: module_inst
vpi: vpiModuleInst
vpi: vpiModule
type: module_inst
card: 1
2 changes: 1 addition & 1 deletion model/process_stmt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
card: 1
- obj_ref: module_inst
name: module_inst
vpi: vpiModuleInst
vpi: vpiModule
type: module_inst
card: 1
- obj_ref: attributes
Expand Down
2 changes: 1 addition & 1 deletion model/program.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
card: 1
- obj_ref: interfaces
name: interface_inst
vpi: vpiInterfaceInst
vpi: vpiInterface
type: interface_inst
card: any
- group_ref: expr_dist
Expand Down
2 changes: 1 addition & 1 deletion model/tchk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
- obj_ref: module_inst
name: module_inst
type: module_inst
vpi: vpiModuleInst
vpi: vpiModule
card: 1
- class_ref: expr
name: expr
Expand Down
4 changes: 2 additions & 2 deletions model/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
vpi: vpiTopModule
card: 1
- obj_ref: modules
vpi: vpiModuleInst
vpi: vpiModule
type: module_inst
card: any

- obj_def: design
- class: uhdmAllModules
type: module_inst
vpi_obj: vpiModuleInst
vpi_obj: vpiModule
card: any
2 changes: 1 addition & 1 deletion model/variables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
card: 1
- obj_ref: module_inst
name: module_inst
vpi: vpiModuleInst
vpi: vpiModule
type: module_inst
card: 1
- class_ref: instance
Expand Down
4 changes: 2 additions & 2 deletions scripts/VpiListener.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ def _get_listeners(classname, vpi, type, card):
listeners = []

if card == '1':
# upward vpiModuleInst, vpiInterfaceInst relation (when card == 1, pointing to the parent object) creates loops in visitors
if vpi in ['vpiParent', 'vpiInstance', 'vpiModuleInst', 'vpiInterfaceInst', 'vpiUse', 'vpiProgram', 'vpiClassDefn', 'vpiPackage', 'vpiUdp']:
# upward vpiModule, vpiInterface relation (when card == 1, pointing to the parent object) creates loops in visitors
if vpi in ['vpiParent', 'vpiInstance', 'vpiModule', 'vpiInterface', 'vpiUse', 'vpiProgram', 'vpiClassDefn', 'vpiPackage', 'vpiUdp']:
return listeners

if 'func_call' in classname and vpi == 'vpiFunction':
Expand Down
9 changes: 7 additions & 2 deletions scripts/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ def get_modellist_filepath():


def make_vpi_name(classname):
classname_overrides = {
'module_inst': 'module',
'interface_inst': 'interface'
}
classname = classname_overrides.get(classname, classname)
vpiclasstype = f'vpi{classname[:1].upper()}{classname[1:]}'

underscore = False
Expand All @@ -125,7 +130,7 @@ def make_vpi_name(classname):
else:
vpiclasstype += ch

overrides = {
vpiname_overrides = {
'vpiForkStmt': 'vpiFork',
'vpiForStmt': 'vpiFor',
'vpiIoDecl': 'vpiIODecl',
Expand All @@ -149,4 +154,4 @@ def make_vpi_name(classname):
'vpiSwitchTran': 'vpiSwitch',
}

return overrides.get(vpiclasstype, vpiclasstype)
return vpiname_overrides.get(vpiclasstype, vpiclasstype)
2 changes: 1 addition & 1 deletion scripts/vpi_visitor_cpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def _get_implementation(classname, vpi, card):
if card == '1':
shallow_visit = 'false'

if vpi in ['vpiParent', 'vpiInstance', 'vpiModuleInst', 'vpiInterfaceInst', 'vpiUse', 'vpiProgram', 'vpiClassDefn', 'vpiPackage', 'vpiUdp']:
if vpi in ['vpiParent', 'vpiInstance', 'vpiModule', 'vpiInterface', 'vpiUse', 'vpiProgram', 'vpiClassDefn', 'vpiPackage', 'vpiUdp']:
# Prevent walking upwards and makes the UHDM output cleaner
# Prevent loop in Standard VPI
shallow_visit = 'true'
Expand Down
Loading

0 comments on commit f40dead

Please sign in to comment.