Merge branch 'master' into x-sizer5

This commit is contained in:
Stephen Williams 2014-06-02 17:07:02 -07:00
commit f104ffc133
5 changed files with 42 additions and 14 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998-2013 Stephen Williams (steve@icarus.com)
* Copyright (c) 1998-2014 Stephen Williams (steve@icarus.com)
* Copyright CERN 2013 / Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
@ -1307,6 +1307,10 @@ void PGModule::elaborate_mod_(Design*des, Module*rmod, NetScope*scope) const
perm_string pname = peek_tail_name(mport[0]->path());
NetNet*tmp = instance[0]->find_signal(pname);
// Handle the error case where there is no internal
// signal connected to the port.
if (!tmp) continue;
assert(tmp);
if (tmp->port_type() == NetNet::PINPUT) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998-2013 Stephen Williams (steve@icarus.com)
* Copyright (c) 1998-2014 Stephen Williams (steve@icarus.com)
* Copyright CERN 2013 / Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
@ -344,7 +344,16 @@ PTask* pform_push_task_scope(const struct vlltype&loc, char*name, bool is_auto)
FILE_NAME(task, loc);
PScopeExtra*scopex = find_nearest_scopex(lexical_scope);
assert(scopex);
if ((scopex == 0) && (generation_flag < GN_VER2005_SV)) {
cerr << task->get_fileline() << ": error: task declarations "
"must be contained within a module." << endl;
error_count += 1;
}
if ((scopex == 0) && (generation_flag >= GN_VER2005_SV)) {
cerr << task->get_fileline() << ": sorry: task declarations "
"in the compilation unit scope are not yet supported." << endl;
error_count += 1;
}
if (pform_cur_generate) {
// Check if the task is already in the dictionary.
@ -357,7 +366,7 @@ PTask* pform_push_task_scope(const struct vlltype&loc, char*name, bool is_auto)
error_count += 1;
}
pform_cur_generate->tasks[task->pscope_name()] = task;
} else {
} else if (scopex) {
// Check if the task is already in the dictionary.
if (scopex->tasks.find(task->pscope_name()) != scopex->tasks.end()) {
cerr << task->get_fileline() << ": error: duplicate "
@ -381,13 +390,17 @@ PFunction* pform_push_function_scope(const struct vlltype&loc, const char*name,
PFunction*func = new PFunction(func_name, lexical_scope, is_auto);
FILE_NAME(func, loc);
LexicalScope*scope = lexical_scope;
PScopeExtra*scopex = dynamic_cast<PScopeExtra*> (scope);
while (scope && !scopex) {
scope = scope->parent_scope();
scopex = dynamic_cast<PScopeExtra*> (scope);
PScopeExtra*scopex = find_nearest_scopex(lexical_scope);
if ((scopex == 0) && (generation_flag < GN_VER2005_SV)) {
cerr << func->get_fileline() << ": error: function declarations "
"must be contained within a module." << endl;
error_count += 1;
}
if ((scopex == 0) && (generation_flag >= GN_VER2005_SV)) {
cerr << func->get_fileline() << ": sorry: function declarations "
"in the compilation unit scope are not yet supported." << endl;
error_count += 1;
}
assert(scopex);
if (pform_cur_generate) {
// Check if the function is already in the dictionary.
@ -400,7 +413,7 @@ PFunction* pform_push_function_scope(const struct vlltype&loc, const char*name,
error_count += 1;
}
pform_cur_generate->funcs[func->pscope_name()] = func;
} else {
} else if (scopex != 0) {
// Check if the function is already in the dictionary.
if (scopex->funcs.find(func->pscope_name()) != scopex->funcs.end()) {
cerr << func->get_fileline() << ": error: duplicate "

View File

@ -56,7 +56,8 @@ distclean: clean
rm -f Makefile config.log
cppcheck: $(O:.o=.c)
cppcheck --enable=all -f $(INCLUDE_PATH) $^
cppcheck --enable=all -f --suppressions-list=$(srcdir)/cppcheck.sup \
--relative-paths=$(srcdir) $(INCLUDE_PATH) $^
Makefile: $(srcdir)/Makefile.in ../config.status
cd ..; ./config.status --file=tgt-vlog95/$@

8
tgt-vlog95/cppcheck.sup Normal file
View File

@ -0,0 +1,8 @@
// These are the global access functions called from the compiler so they
// are not used here.
// target_design()
unusedFunction:vlog95.c:59
// target_query()
unusedFunction:vlog95.c:226

View File

@ -1713,8 +1713,10 @@ template <class T> bool vector4_to_value(const vvp_vector4_t&vec, T&val)
break;
case BIT4_1:
// On overflow, return the maximum value of type T
if (msk == 0) return ~msk;
res |= msk;
if (msk == 0)
res = ~msk;
else
res |= msk;
break;
default:
return false;