mirror of
https://github.com/verilator/verilator.git
synced 2025-01-01 04:07:34 +00:00
Codacy/Cppcheck cleanups and badge.
This commit is contained in:
parent
baa6a2c31a
commit
9f977ed419
3
.codacy.yml
Normal file
3
.codacy.yml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
exclude_paths:
|
||||||
|
- 'include/vltstd/**'
|
@ -14,6 +14,7 @@
|
|||||||
.*\.key
|
.*\.key
|
||||||
.*\.vcd
|
.*\.vcd
|
||||||
.*\.1
|
.*\.1
|
||||||
|
\.codacy\.yml
|
||||||
\.travis\.yml
|
\.travis\.yml
|
||||||
/build/
|
/build/
|
||||||
/obj_dir/
|
/obj_dir/
|
||||||
|
@ -3,6 +3,9 @@
|
|||||||
|
|
||||||
=pod
|
=pod
|
||||||
|
|
||||||
|
=for html <a href="https://www.gnu.org/licenses/lgpl-3.0"><img src="https://img.shields.io/badge/License-LGPL%20v3-blue.svg"></a>
|
||||||
|
=for html <a href="https://opensource.org/licenses/Artistic-2.0"><img src="https://img.shields.io/badge/License-Artistic%202.0-0298c3.svg"></a>
|
||||||
|
=for html <a href="https://www.codacy.com/manual/wsnyder/verilator"><img src="https://api.codacy.com/project/badge/Grade/ff998fdaa6f64b9a95eb5f342ee6bf4d"></a>
|
||||||
=for html <a href="https://travis-ci.com/verilator/verilator"><img src="https://travis-ci.com/verilator/verilator.svg?branch=master"></a>
|
=for html <a href="https://travis-ci.com/verilator/verilator"><img src="https://travis-ci.com/verilator/verilator.svg?branch=master"></a>
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
@ -16,23 +16,23 @@
|
|||||||
# not be used as the script relies on Git revisions for caching.
|
# not be used as the script relies on Git revisions for caching.
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
if [ -z ${VERILATOR_NUM_JOBS} ]; then
|
if [ -z "${VERILATOR_NUM_JOBS}" ]; then
|
||||||
VERILATOR_NUM_JOBS=$(nproc)
|
VERILATOR_NUM_JOBS=$(nproc)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Caching would be simpler if we installed without VERILATOR_ROOT, but
|
# Caching would be simpler if we installed without VERILATOR_ROOT, but
|
||||||
# it's needed for driver.pl outside of the repo
|
# it's needed for driver.pl outside of the repo
|
||||||
if [ -z ${VERILATOR_ROOT} ]; then
|
if [ -z "${VERILATOR_ROOT}" ]; then
|
||||||
echo "VERILATOR_ROOT not set"
|
echo "VERILATOR_ROOT not set"
|
||||||
exit -1
|
exit -1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z ${VERILATOR_CACHE} ]; then
|
if [ -z "${VERILATOR_CACHE}" ]; then
|
||||||
echo "VERILATOR_CACHE not set"
|
echo "VERILATOR_CACHE not set"
|
||||||
exit -1
|
exit -1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
VERILATOR_REV=$(cd ${VERILATOR_ROOT} && git rev-parse HEAD)
|
VERILATOR_REV=$(cd "${VERILATOR_ROOT}" && git rev-parse HEAD)
|
||||||
echo "Found Verilator rev ${VERILATOR_REV}"
|
echo "Found Verilator rev ${VERILATOR_REV}"
|
||||||
|
|
||||||
CACHED_REV_FILE=${VERILATOR_CACHE}/.rev.txt
|
CACHED_REV_FILE=${VERILATOR_CACHE}/.rev.txt
|
||||||
@ -50,15 +50,15 @@ if [[ ! -f ${CACHED_REV_FILE} || \
|
|||||||
cd ${VERILATOR_ROOT}
|
cd ${VERILATOR_ROOT}
|
||||||
autoconf && ./configure ${VERILATOR_CONFIG_FLAGS} && make -j ${VERILATOR_NUM_JOBS}
|
autoconf && ./configure ${VERILATOR_CONFIG_FLAGS} && make -j ${VERILATOR_NUM_JOBS}
|
||||||
# Copy the Verilator build artifacts
|
# Copy the Verilator build artifacts
|
||||||
mkdir -p ${VERILATOR_CACHE}
|
mkdir -p "${VERILATOR_CACHE}"
|
||||||
rm -rf ${VERILATOR_CACHE}/*
|
rm -rf "${VERILATOR_CACHE}/*"
|
||||||
cp bin/*bin* ${VERILATOR_CACHE}
|
cp bin/*bin* "${VERILATOR_CACHE}"
|
||||||
# Remember the Git revision
|
# Remember the Git revision
|
||||||
echo ${VERILATOR_REV} > ${CACHED_REV_FILE}
|
echo ${VERILATOR_REV} > ${CACHED_REV_FILE}
|
||||||
else
|
else
|
||||||
echo "Using cached Verilator"
|
echo "Using cached Verilator"
|
||||||
cd ${VERILATOR_ROOT}
|
cd "${VERILATOR_ROOT}"
|
||||||
# Create include/verilated_config.h and maybe other things
|
# Create include/verilated_config.h and maybe other things
|
||||||
autoconf && ./configure ${VERILATOR_CONFIG_FLAGS}
|
autoconf && ./configure ${VERILATOR_CONFIG_FLAGS}
|
||||||
cp ${VERILATOR_CACHE}/* bin
|
cp "${VERILATOR_CACHE}/*" bin
|
||||||
fi
|
fi
|
||||||
|
@ -162,7 +162,7 @@
|
|||||||
//=========================================================================
|
//=========================================================================
|
||||||
// C++-2011
|
// C++-2011
|
||||||
|
|
||||||
#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)
|
#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) || defined(VL_CPPCHECK)
|
||||||
# define VL_EQ_DELETE = delete
|
# define VL_EQ_DELETE = delete
|
||||||
# define vl_unique_ptr std::unique_ptr
|
# define vl_unique_ptr std::unique_ptr
|
||||||
// By default we use std:: types in C++11.
|
// By default we use std:: types in C++11.
|
||||||
|
@ -222,6 +222,7 @@ public:
|
|||||||
m_newRvEqnp->deleteTree();
|
m_newRvEqnp->deleteTree();
|
||||||
}
|
}
|
||||||
virtual ~ChangedInsertVisitor() {}
|
virtual ~ChangedInsertVisitor() {}
|
||||||
|
VL_UNCOPYABLE(ChangedInsertVisitor);
|
||||||
};
|
};
|
||||||
|
|
||||||
//######################################################################
|
//######################################################################
|
||||||
|
@ -1622,7 +1622,7 @@ void EmitCStmts::displayArg(AstNode* dispp, AstNode** elistp, bool isScan,
|
|||||||
if (argp->widthMin() > VL_VALUE_STRING_MAX_WIDTH) {
|
if (argp->widthMin() > VL_VALUE_STRING_MAX_WIDTH) {
|
||||||
dispp->v3error("Exceeded limit of "+cvtToStr(VL_VALUE_STRING_MAX_WIDTH)+" bits for any $display-like arguments");
|
dispp->v3error("Exceeded limit of "+cvtToStr(VL_VALUE_STRING_MAX_WIDTH)+" bits for any $display-like arguments");
|
||||||
}
|
}
|
||||||
if (argp && argp->widthMin()>8 && fmtLetter=='c') {
|
if (argp->widthMin() > 8 && fmtLetter == 'c') {
|
||||||
// Technically legal, but surely not what the user intended.
|
// Technically legal, but surely not what the user intended.
|
||||||
argp->v3warn(WIDTH, dispp->verilogKwd()<<"of %c format of > 8 bit value");
|
argp->v3warn(WIDTH, dispp->verilogKwd()<<"of %c format of > 8 bit value");
|
||||||
}
|
}
|
||||||
|
@ -253,7 +253,7 @@ public:
|
|||||||
// Xml output
|
// Xml output
|
||||||
m_os<<"<module_files>\n";
|
m_os<<"<module_files>\n";
|
||||||
for (std::deque<FileLine*>::iterator it = m_nodeModules.begin();
|
for (std::deque<FileLine*>::iterator it = m_nodeModules.begin();
|
||||||
it != m_nodeModules.end(); it++) {
|
it != m_nodeModules.end(); ++it) {
|
||||||
m_os<<"<file id=\""<<(*it)->filenameLetters()
|
m_os<<"<file id=\""<<(*it)->filenameLetters()
|
||||||
<<"\" filename=\""<<(*it)->filename()
|
<<"\" filename=\""<<(*it)->filename()
|
||||||
<<"\" language=\""<<(*it)->language().ascii()<<"\"/>\n";
|
<<"\" language=\""<<(*it)->language().ascii()<<"\"/>\n";
|
||||||
|
@ -384,7 +384,11 @@ void DfaGraph::nfaToDfa() {
|
|||||||
class DfaGraphReduce : GraphAlg<> {
|
class DfaGraphReduce : GraphAlg<> {
|
||||||
private:
|
private:
|
||||||
// METHODS
|
// METHODS
|
||||||
|
#ifdef VL_CPPCHECK
|
||||||
|
static int debug() { return 9; }
|
||||||
|
#else
|
||||||
static int debug() { return 0; }
|
static int debug() { return 0; }
|
||||||
|
#endif
|
||||||
DfaGraph* graphp() { return static_cast<DfaGraph*>(m_graphp); }
|
DfaGraph* graphp() { return static_cast<DfaGraph*>(m_graphp); }
|
||||||
|
|
||||||
bool isDead(DfaVertex* vertexp) {
|
bool isDead(DfaVertex* vertexp) {
|
||||||
|
@ -346,13 +346,12 @@ private:
|
|||||||
{
|
{
|
||||||
m_lifep = ifLifep;
|
m_lifep = ifLifep;
|
||||||
iterateAndNextNull(nodep->ifsp());
|
iterateAndNextNull(nodep->ifsp());
|
||||||
m_lifep = prevLifep;
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
m_lifep = elseLifep;
|
m_lifep = elseLifep;
|
||||||
iterateAndNextNull(nodep->elsesp());
|
iterateAndNextNull(nodep->elsesp());
|
||||||
m_lifep = prevLifep;
|
|
||||||
}
|
}
|
||||||
|
m_lifep = prevLifep;
|
||||||
UINFO(4," join "<<endl);
|
UINFO(4," join "<<endl);
|
||||||
// Find sets on both flows
|
// Find sets on both flows
|
||||||
m_lifep->dualBranch(ifLifep, elseLifep);
|
m_lifep->dualBranch(ifLifep, elseLifep);
|
||||||
|
@ -1121,7 +1121,7 @@ class LinkDotFindVisitor : public AstNVisitor {
|
|||||||
ins = true;
|
ins = true;
|
||||||
} else if (findvarp != nodep) {
|
} else if (findvarp != nodep) {
|
||||||
UINFO(4,"DupVar: "<<nodep<<" ;; "<<foundp<<endl);
|
UINFO(4,"DupVar: "<<nodep<<" ;; "<<foundp<<endl);
|
||||||
if (foundp && foundp->parentp() == m_curSymp // Only when on same level
|
if (foundp->parentp() == m_curSymp // Only when on same level
|
||||||
&& !foundp->imported()) { // and not from package
|
&& !foundp->imported()) { // and not from package
|
||||||
nodep->v3error("Duplicate declaration of enum value: "<<nodep->prettyName()<<endl
|
nodep->v3error("Duplicate declaration of enum value: "<<nodep->prettyName()<<endl
|
||||||
<<nodep->warnContextPrimary()<<endl
|
<<nodep->warnContextPrimary()<<endl
|
||||||
|
@ -648,7 +648,7 @@ void ParamVisitor::visitCell(AstCell* nodep, const string& hierName) {
|
|||||||
<<modvarp->prettyNameQ());
|
<<modvarp->prettyNameQ());
|
||||||
} else {
|
} else {
|
||||||
UINFO(9,"Parameter type assignment expr="<<exprp<<" to "<<origp<<endl);
|
UINFO(9,"Parameter type assignment expr="<<exprp<<" to "<<origp<<endl);
|
||||||
if (origp && exprp->sameTree(origp)) {
|
if (exprp->sameTree(origp)) {
|
||||||
// Setting parameter to its default value. Just ignore it.
|
// Setting parameter to its default value. Just ignore it.
|
||||||
// This prevents making additional modules, and makes coverage more
|
// This prevents making additional modules, and makes coverage more
|
||||||
// obvious as it won't show up under a unique module page name.
|
// obvious as it won't show up under a unique module page name.
|
||||||
|
@ -191,7 +191,7 @@ size_t V3ParseImp::ppInputToLex(char* buf, size_t max_size) {
|
|||||||
m_ppBuffers.push_front(remainder); // Put back remainder for next time
|
m_ppBuffers.push_front(remainder); // Put back remainder for next time
|
||||||
len = (max_size-got);
|
len = (max_size-got);
|
||||||
}
|
}
|
||||||
strncpy(buf+got, front.c_str(), len);
|
memcpy(buf+got, front.c_str(), len);
|
||||||
got += len;
|
got += len;
|
||||||
}
|
}
|
||||||
if (debug()>=9) {
|
if (debug()>=9) {
|
||||||
|
@ -505,7 +505,6 @@ void V3TSP::tspSort(const V3TSP::StateVec& states, V3TSP::StateVec* resultp) {
|
|||||||
|
|
||||||
if (max_cost_idx == resultp->size() - 1) {
|
if (max_cost_idx == resultp->size() - 1) {
|
||||||
// List is already rotated for minimum cost. stop.
|
// List is already rotated for minimum cost. stop.
|
||||||
UASSERT(resultp->size() == resultp->size(), "sizes should match");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -756,7 +756,6 @@ public:
|
|||||||
m_chgSubStmts = 0;
|
m_chgSubStmts = 0;
|
||||||
m_activityNumber = 0;
|
m_activityNumber = 0;
|
||||||
m_code = 0;
|
m_code = 0;
|
||||||
m_finding = false;
|
|
||||||
m_funcNum = 0;
|
m_funcNum = 0;
|
||||||
iterate(nodep);
|
iterate(nodep);
|
||||||
}
|
}
|
||||||
|
@ -435,7 +435,6 @@ private:
|
|||||||
// ARRAYSEL(...) -> ARRAYSEL(COND(LT(bit<maxbit), bit, 0))
|
// ARRAYSEL(...) -> ARRAYSEL(COND(LT(bit<maxbit), bit, 0))
|
||||||
AstNRelinker replaceHandle;
|
AstNRelinker replaceHandle;
|
||||||
AstNode* bitp = nodep->bitp()->unlinkFrBack(&replaceHandle);
|
AstNode* bitp = nodep->bitp()->unlinkFrBack(&replaceHandle);
|
||||||
V3Number zeronum (nodep, bitp->width(), 0);
|
|
||||||
AstNode* newp = new AstCondBound(bitp->fileline(),
|
AstNode* newp = new AstCondBound(bitp->fileline(),
|
||||||
condp, bitp,
|
condp, bitp,
|
||||||
new AstConst(bitp->fileline(),
|
new AstConst(bitp->fileline(),
|
||||||
|
@ -23,7 +23,7 @@ void clockit(int clk1, int clk0) {
|
|||||||
topp->c0 = clk0;
|
topp->c0 = clk0;
|
||||||
#endif
|
#endif
|
||||||
#ifdef TEST_VERBOSE
|
#ifdef TEST_VERBOSE
|
||||||
printf("[%d] c1=%d c0=%d\n", main_time, clk1, clk0);
|
printf("[%d] c1=%u c0=%u\n", main_time, clk1, clk0);
|
||||||
#endif
|
#endif
|
||||||
topp->eval();
|
topp->eval();
|
||||||
main_time++;
|
main_time++;
|
||||||
|
@ -176,16 +176,16 @@ void _dpii_all(int c, int p, int u, const svOpenArrayHandle i, const svOpenArray
|
|||||||
vec[0].a = (~vec[0].a);
|
vec[0].a = (~vec[0].a);
|
||||||
vec[1].a = (~vec[1].a);
|
vec[1].a = (~vec[1].a);
|
||||||
vec[2].a = (~vec[2].a) & 0x7fffffff;
|
vec[2].a = (~vec[2].a) & 0x7fffffff;
|
||||||
vec[0].b = vec[0].b;
|
//vec[0].b = vec[0].b;
|
||||||
vec[1].b = vec[1].b;
|
//vec[1].b = vec[1].b;
|
||||||
vec[2].b = vec[2].b;
|
//vec[2].b = vec[2].b;
|
||||||
#else
|
#else
|
||||||
vec[0].aval = (~vec[0].aval);
|
vec[0].aval = (~vec[0].aval);
|
||||||
vec[1].aval = (~vec[1].aval);
|
vec[1].aval = (~vec[1].aval);
|
||||||
vec[2].aval = (~vec[2].aval) & 0x7fffffff;
|
vec[2].aval = (~vec[2].aval) & 0x7fffffff;
|
||||||
vec[0].bval = vec[0].bval;
|
//vec[0].bval = vec[0].bval;
|
||||||
vec[1].bval = vec[1].bval;
|
//vec[1].bval = vec[1].bval;
|
||||||
vec[2].bval = vec[2].bval;
|
//vec[2].bval = vec[2].bval;
|
||||||
#endif
|
#endif
|
||||||
svPutLogicArrElemVecVal(o, vec, a, b, c);
|
svPutLogicArrElemVecVal(o, vec, a, b, c);
|
||||||
}
|
}
|
||||||
|
@ -86,8 +86,8 @@ void mon_register_b(const char* namep, int isOut) {
|
|||||||
|
|
||||||
extern "C" void mon_register_done();
|
extern "C" void mon_register_done();
|
||||||
void mon_register_done() {
|
void mon_register_done() {
|
||||||
const char* modp = svGetNameFromScope(svGetScope());
|
|
||||||
#ifdef TEST_VERBOSE
|
#ifdef TEST_VERBOSE
|
||||||
|
const char* modp = svGetNameFromScope(svGetScope());
|
||||||
VL_PRINTF("- mon_register_done('%s');\n", modp);
|
VL_PRINTF("- mon_register_done('%s');\n", modp);
|
||||||
#endif
|
#endif
|
||||||
// Print list of all signals - if we didn't register2 anything we'd pick them off here
|
// Print list of all signals - if we didn't register2 anything we'd pick them off here
|
||||||
|
@ -45,7 +45,6 @@ int dpii_a_func(int i) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int dpii_a_task(int i, int* op) {
|
int dpii_a_task(int i, int* op) {
|
||||||
int o = 0;
|
|
||||||
(void)dpix_a_task(i, op);
|
(void)dpix_a_task(i, op);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,8 @@ int main(int argc, char **argv, char **env) {
|
|||||||
++main_time;
|
++main_time;
|
||||||
|
|
||||||
const VerilatedScopeNameMap* scopeMapp = Verilated::scopeNameMap();
|
const VerilatedScopeNameMap* scopeMapp = Verilated::scopeNameMap();
|
||||||
for (VerilatedScopeNameMap::const_iterator it = scopeMapp->begin(); it != scopeMapp->end(); it++) {
|
for (VerilatedScopeNameMap::const_iterator it = scopeMapp->begin();
|
||||||
|
it != scopeMapp->end(); ++it) {
|
||||||
#ifdef TEST_VERBOSE
|
#ifdef TEST_VERBOSE
|
||||||
VL_PRINTF("---------------------------------------------\n");
|
VL_PRINTF("---------------------------------------------\n");
|
||||||
VL_PRINTF("Scope = %s\n", it->first);
|
VL_PRINTF("Scope = %s\n", it->first);
|
||||||
|
Loading…
Reference in New Issue
Block a user