Skip to content

Commit

Permalink
Merge pull request #845 from hs-apotell/Issue#831
Browse files Browse the repository at this point in the history
Issue #831: Fix compile issues on MinGW
  • Loading branch information
alaindargelas authored Dec 23, 2022
2 parents e572ac3 + ae0a2dc commit 46b7b0f
Show file tree
Hide file tree
Showing 49 changed files with 230 additions and 225 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ else()
)
endif()

if (WIN32)
add_compile_definitions(WIN32_LEAN_AND_MEAN)
endif()

# All the files the generator depends on.
file(GLOB yaml_SRC ${PROJECT_SOURCE_DIR}/model/*.yaml)
file(GLOB templates_SRC ${PROJECT_SOURCE_DIR}/templates/*.h
Expand Down
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 vpiInterface 601
#define vpiInterfaceInst 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 vpiModule 32 /* module instance */
#define vpiModuleInst 32 /* module instance */
#define vpiNamedBegin 33 /* named block statement */
#define vpiNamedEvent 34 /* event variable */
#define vpiNamedFork 35 /* named fork-join block */
Expand Down
2 changes: 1 addition & 1 deletion model/actual_group.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# Parameters, enum_const, io_decl are not in the actual group in the Standard, we add them to the group for binding convenience

- group_def: actual_group
- obj_ref: interface
- obj_ref: interface_inst
- obj_ref: interface_array
- obj_ref: modport
- class_ref: nets
Expand Down
12 changes: 6 additions & 6 deletions model/design.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
vpi: uhdmallClasses
card: any
- class: allInterfaces
type: interface
vpi_obj: vpiInterface
type: interface_inst
vpi_obj: vpiInterfaceInst
vpi: uhdmallInterfaces
card: any
- class: allUdps
Expand All @@ -65,8 +65,8 @@
vpi: uhdmallPrograms
card: any
- class: allModules
type: module
vpi_obj: vpiModule
type: module_inst
vpi_obj: vpiModuleInst
vpi: uhdmallModules
card: any
- class_ref: typespecs
Expand Down Expand Up @@ -94,7 +94,7 @@
type: param_assign
card: any
- class: topModules
type: module
vpi_obj: vpiModule
type: module_inst
vpi_obj: vpiModuleInst
vpi: uhdmtopModules
card: any
10 changes: 5 additions & 5 deletions model/gen_scope.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
card: any
- obj_ref: modules
name: modules
vpi: vpiModule
type: module
vpi: vpiModuleInst
type: module_inst
card: any
- obj_ref: module_arrays
name: module array
Expand Down Expand Up @@ -101,9 +101,9 @@
type: assertion
card: any
- obj_ref: interfaces
name: interface
vpi: vpiInterface
type: interface
name: interface_inst
vpi: vpiInterfaceInst
type: interface_inst
card: any
- obj_ref: interface_arrays
vpi: vpiInterfaceArray
Expand Down
8 changes: 4 additions & 4 deletions model/instance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@
vpi: vpiAssertion
type: assertion
card: any
- obj_ref: module
name: module
vpi: vpiModule
type: module
- obj_ref: module_inst
name: module_inst
vpi: vpiModuleInst
type: module_inst
card: 1
- class_ref: instance
name: instance
Expand Down
4 changes: 2 additions & 2 deletions model/instance_array.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@
card: any
- obj_ref: modules
name: modules
vpi: vpiModule
type: module
vpi: vpiModuleInst
type: module_inst
card: any
- class_ref: elem_typespec
name: elem typespec
Expand Down
5 changes: 2 additions & 3 deletions model/interf_prog_mod_group.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
# Universal Hardware Data Model (UHDM) "interface program module group" formal description

- group_def: interf_prog_mod_group
- obj_ref: module
- obj_ref: module_inst
- obj_ref: program
- obj_ref: interface

- obj_ref: interface_inst
14 changes: 7 additions & 7 deletions model/interface.yaml → model/interface_inst.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Universal Hardware Data Model (UHDM) "interface" formal description
# Universal Hardware Data Model (UHDM) "interface_inst" formal description

- obj_def: interface
- obj_def: interface_inst
- extends: instance
- property: index
name: index
vpi: vpiIndex
type: int
card: 1
- property: type
name: vpiInterface
name: vpiInterfaceInst
vpi: vpiType
type: unsigned int
card: 1
Expand Down Expand Up @@ -71,9 +71,9 @@
type: clocking_block
card: any
- obj_ref: interfaces
name: interface
vpi: vpiInterface
type: interface
name: interface_inst
vpi: vpiInterfaceInst
type: interface_inst
card: any
- obj_ref: interface_arrays
vpi: vpiInterfaceArray
Expand All @@ -94,4 +94,4 @@
name: gen scope array
vpi: vpiGenScopeArray
type: gen_scope_array
card: any
card: any
4 changes: 2 additions & 2 deletions model/models.lst
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,10 @@ class_defn.yaml
class_obj.yaml
class_var.yaml
instance.yaml
interface.yaml
interface_inst.yaml
program.yaml
package.yaml
module.yaml
module_inst.yaml
checker_decl.yaml
checker_inst.yaml
short_real_typespec.yaml
Expand Down
8 changes: 4 additions & 4 deletions model/modport.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
vpi: vpiIODecl
type: io_decl
card: any
- obj_ref: interface
name: interface
vpi: vpiInterface
type: interface
- obj_ref: interface_inst
name: interface_inst
vpi: vpiInterfaceInst
type: interface_inst
card: 1
16 changes: 8 additions & 8 deletions model/module.yaml → model/module_inst.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Universal Hardware Data Model (UHDM) "module" formal description
# Universal Hardware Data Model (UHDM) "module_inst" formal description

- obj_def: module
- obj_def: module_inst
- extends: instance
- property: index
name: index
vpi: vpiIndex
type: int
card: 1
- property: type
name: vpiModule
name: vpiModuleInst
vpi: vpiType
type: unsigned int
card: 1
Expand Down Expand Up @@ -67,9 +67,9 @@
type: port
card: any
- obj_ref: interfaces
name: interface
vpi: vpiInterface
type: interface
name: interface_inst
vpi: vpiInterfaceInst
type: interface_inst
card: any
- obj_ref: interface_arrays
vpi: vpiInterfaceArray
Expand All @@ -83,8 +83,8 @@
card: any
- obj_ref: modules
name: modules
vpi: vpiModule
type: module
vpi: vpiModuleInst
type: module_inst
card: any
- obj_ref: module_arrays
name: module array
Expand Down
8 changes: 4 additions & 4 deletions model/nets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@
vpi: vpiSimNet
type: nets
card: 1
- obj_ref: module
name: module
vpi: vpiModule
type: module
- obj_ref: module_inst
name: module_inst
vpi: vpiModuleInst
type: module_inst
card: 1
8 changes: 4 additions & 4 deletions model/ports.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@
vpi: vpiInstance
type: instance
card: 1
- obj_ref: module
name: module
vpi: vpiModule
type: module
- obj_ref: module_inst
name: module_inst
vpi: vpiModuleInst
type: module_inst
card: 1
10 changes: 5 additions & 5 deletions model/process_stmt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
vpi: vpiStmt
type: stmt
card: 1
- obj_ref: module
name: module
vpi: vpiModule
type: module
- obj_ref: module_inst
name: module_inst
vpi: vpiModuleInst
type: module_inst
card: 1
- obj_ref: attributes
name: attributes
vpi: vpiAttribute
type: attribute
card: any
card: any
8 changes: 4 additions & 4 deletions model/program.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
type: instance_array
card: 1
- obj_ref: interfaces
name: interface
vpi: vpiInterface
type: interface
name: interface_inst
vpi: vpiInterfaceInst
type: interface_inst
card: any
- group_ref: expr_dist
name: expr distribution
Expand Down Expand Up @@ -74,4 +74,4 @@
name: gen scope array
vpi: vpiGenScopeArray
type: gen_scope_array
card: any
card: any
8 changes: 4 additions & 4 deletions model/tchk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
# Universal Hardware Data Model (UHDM) "tchk" formal description

- obj_def: tchk
- obj_ref: module
name: module
type: module
vpi: vpiModule
- obj_ref: module_inst
name: module_inst
type: module_inst
vpi: vpiModuleInst
card: 1
- class_ref: expr
name: expr
Expand Down
8 changes: 4 additions & 4 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: vpiModule
type: module
vpi: vpiModuleInst
type: module_inst
card: any

- obj_def: design
- class: uhdmAllModules
type: module
vpi_obj: vpiModule
type: module_inst
vpi_obj: vpiModuleInst
card: any
8 changes: 4 additions & 4 deletions model/variables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@
vpi: vpiTchkTerm
type: tchk_term
card: 1
- obj_ref: module
name: module
vpi: vpiModule
type: module
- obj_ref: module_inst
name: module_inst
vpi: vpiModuleInst
type: module_inst
card: 1
- class_ref: instance
name: instance
Expand Down
4 changes: 2 additions & 2 deletions scripts/ElaboratorListener_cpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ def _generate_class_listeners(models):


def generate(models):
module_listeners = _generate_module_listeners(models, 'module')
interface_listeners = _generate_module_listeners(models, 'interface')
module_listeners = _generate_module_listeners(models, 'module_inst')
interface_listeners = _generate_module_listeners(models, 'interface_inst')
class_listeners = _generate_class_listeners(models)

with open(config.get_template_filepath('ElaboratorListener.cpp'), 'rt') as strm:
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 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']:
# 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']:
return listeners

if 'func_call' in classname and vpi == 'vpiFunction':
Expand Down
6 changes: 3 additions & 3 deletions scripts/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,9 @@ def _get_DeepClone_implementation(model, models):
content.append( ' if (instance* inst = any_cast<instance*>(parent))')
content.append( ' clone->Instance(inst);')

elif method == 'Module':
includes.add('module')
content.append(f' if (auto obj = {method}()) clone->{method}((module*) obj);')
elif method == 'Module_inst':
includes.add('module_inst')
content.append(f' if (auto obj = {method}()) clone->{method}((module_inst*) obj);')

elif method == 'Typespec':
includes.add('typespec')
Expand Down
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', 'vpiModule', 'vpiInterface', 'vpiUse', 'vpiProgram', 'vpiClassDefn', 'vpiPackage', 'vpiUdp']:
if vpi in ['vpiParent', 'vpiInstance', 'vpiModuleInst', 'vpiInterfaceInst', '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 46b7b0f

Please sign in to comment.