Merge branch 'master' of github.com:steveicarus/iverilog

This commit is contained in:
Stephen Williams 2013-01-05 16:40:14 -08:00
commit d04aa4b234
6 changed files with 57 additions and 12 deletions

View File

@ -59,7 +59,7 @@ static fp_element_t cur_element;
long integer;
char*text;
};
%token <text> STRING
%token <integer> INTEGER
%token K_ELEMENT

View File

@ -77,8 +77,8 @@ vvp_array_t array_find(const char*label)
* an array of vvp_vector4_t vectors.
*
* - Array of real variables
* The valsr member points to a vvp_realarray_t objects that has an
* array of double variables. This is very much line the way the
* The vals member points to a dynamic array objects that has an
* array of double variables. This is very much like the way the
* vector4 array works.
*/
struct __vpiArray : public __vpiHandle {
@ -1074,7 +1074,7 @@ vvp_vector4_t array_get_word(vvp_array_t arr, unsigned address)
arr->vals->get_word(address, val);
return val;
}
assert(arr->vals4 == 0);
assert(arr->vals == 0);
assert(arr->nets != 0);
@ -2038,10 +2038,10 @@ void memory_delete(vpiHandle item)
// constant_delete(handle)?
delete arr->vals4;
// if (arr->valsr) {}
// if (arr->vals) {}
// Delete the individual words?
// constant_delete(handle)?
delete arr->valsr;
delete arr->vals;
if (arr->nets) {
for (unsigned idx = 0; idx < arr->array_count; idx += 1) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001-2012 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-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
@ -31,6 +31,9 @@
# include <cstdlib>
# include <cstring>
# include <unistd.h>
#ifdef CHECK_WITH_VALGRIND
# include <pthread.h>
#endif
#if defined(HAVE_SYS_RESOURCE_H)
# include <sys/time.h>
@ -232,6 +235,14 @@ static void final_cleanup()
* files are automatically closed.
*/
load_module_delete();
#ifdef CHECK_WITH_VALGRIND
simulator_cb_delete();
/* This is needed to prevent valgrind from complaining about
* _dlerror_run() having a memory leak. */
// HERE: Is this portable? Does it break anything?
pthread_exit(NULL);
#endif
}
unsigned module_cnt = 0;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001-2012 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-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
@ -31,6 +31,9 @@
# include "event.h"
# include "vvp_net_sig.h"
# include "config.h"
#ifdef CHECK_WITH_VALGRIND
#include "vvp_cleanup.h"
#endif
# include <cstdio>
# include <cassert>
# include <cstdlib>
@ -412,6 +415,36 @@ static simulator_callback*EndOfCompile = 0;
static simulator_callback*StartOfSimulation = 0;
static simulator_callback*EndOfSimulation = 0;
#ifdef CHECK_WITH_VALGRIND
/* This is really only needed if the simulator aborts before starting the
* main event loop. For that reason we can skip the next sim time queue. */
void simulator_cb_delete(void)
{
simulator_callback* cur;
/* Delete all the end of compile callbacks. */
while (EndOfCompile) {
cur = EndOfCompile;
EndOfCompile = dynamic_cast<simulator_callback*>(cur->next);
delete cur;
}
/* Delete all the start of simulation callbacks. */
while (StartOfSimulation) {
cur = StartOfSimulation;
StartOfSimulation = dynamic_cast<simulator_callback*>(cur->next);
delete cur;
}
/* Delete all the end of simulation callbacks. */
while (EndOfSimulation) {
cur = EndOfSimulation;
EndOfSimulation = dynamic_cast<simulator_callback*>(cur->next);
delete cur;
}
}
#endif
void vpiEndOfCompile(void) {
simulator_callback* cur;

View File

@ -706,14 +706,14 @@ void print_vpi_call_errors()
#ifdef CHECK_WITH_VALGRIND
static void cleanup_vpi_call_args(unsigned argc, vpiHandle*argv)
{
#if 0
if (argc) {
struct __vpiSysTaskCall*obj = new struct __vpiSysTaskCall;
/* Since this is just being used to cleanup the arguments a
* system task definition can be used. */
struct __vpiSysTaskCall*obj = new systask_def;
obj->nargs = argc;
obj->args = argv;
vpi_call_delete(&obj->base);
vpi_call_delete(obj);
}
#endif
}
#endif

View File

@ -34,6 +34,7 @@ extern void load_module_delete(void);
extern void modpath_delete(void);
extern void root_table_delete(void);
extern void signal_pool_delete(void);
extern void simulator_cb_delete(void);
extern void udp_defns_delete(void);
extern void vpi_handle_delete(void);
extern void vpi_stack_delete(void);