mirror of
https://github.com/verilator/verilator.git
synced 2024-12-29 10:47: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
|
||||
.*\.vcd
|
||||
.*\.1
|
||||
\.codacy\.yml
|
||||
\.travis\.yml
|
||||
/build/
|
||||
/obj_dir/
|
||||
|
@ -3,6 +3,9 @@
|
||||
|
||||
=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>
|
||||
|
||||
=head1 NAME
|
||||
|
@ -16,23 +16,23 @@
|
||||
# not be used as the script relies on Git revisions for caching.
|
||||
set -e
|
||||
|
||||
if [ -z ${VERILATOR_NUM_JOBS} ]; then
|
||||
if [ -z "${VERILATOR_NUM_JOBS}" ]; then
|
||||
VERILATOR_NUM_JOBS=$(nproc)
|
||||
fi
|
||||
|
||||
# Caching would be simpler if we installed without VERILATOR_ROOT, but
|
||||
# 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"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
if [ -z ${VERILATOR_CACHE} ]; then
|
||||
if [ -z "${VERILATOR_CACHE}" ]; then
|
||||
echo "VERILATOR_CACHE not set"
|
||||
exit -1
|
||||
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}"
|
||||
|
||||
CACHED_REV_FILE=${VERILATOR_CACHE}/.rev.txt
|
||||
@ -50,15 +50,15 @@ if [[ ! -f ${CACHED_REV_FILE} || \
|
||||
cd ${VERILATOR_ROOT}
|
||||
autoconf && ./configure ${VERILATOR_CONFIG_FLAGS} && make -j ${VERILATOR_NUM_JOBS}
|
||||
# Copy the Verilator build artifacts
|
||||
mkdir -p ${VERILATOR_CACHE}
|
||||
rm -rf ${VERILATOR_CACHE}/*
|
||||
cp bin/*bin* ${VERILATOR_CACHE}
|
||||
mkdir -p "${VERILATOR_CACHE}"
|
||||
rm -rf "${VERILATOR_CACHE}/*"
|
||||
cp bin/*bin* "${VERILATOR_CACHE}"
|
||||
# Remember the Git revision
|
||||
echo ${VERILATOR_REV} > ${CACHED_REV_FILE}
|
||||
else
|
||||
echo "Using cached Verilator"
|
||||
cd ${VERILATOR_ROOT}
|
||||
cd "${VERILATOR_ROOT}"
|
||||
# Create include/verilated_config.h and maybe other things
|
||||
autoconf && ./configure ${VERILATOR_CONFIG_FLAGS}
|
||||
cp ${VERILATOR_CACHE}/* bin
|
||||
cp "${VERILATOR_CACHE}/*" bin
|
||||
fi
|
||||
|
@ -162,7 +162,7 @@
|
||||
//=========================================================================
|
||||
// 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_unique_ptr std::unique_ptr
|
||||
// By default we use std:: types in C++11.
|
||||
|
@ -222,6 +222,7 @@ public:
|
||||
m_newRvEqnp->deleteTree();
|
||||
}
|
||||
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) {
|
||||
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.
|
||||
argp->v3warn(WIDTH, dispp->verilogKwd()<<"of %c format of > 8 bit value");
|
||||
}
|
||||
|
@ -253,7 +253,7 @@ public:
|
||||
// Xml output
|
||||
m_os<<"<module_files>\n";
|
||||
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()
|
||||
<<"\" filename=\""<<(*it)->filename()
|
||||
<<"\" language=\""<<(*it)->language().ascii()<<"\"/>\n";
|
||||
|
@ -384,7 +384,11 @@ void DfaGraph::nfaToDfa() {
|
||||
class DfaGraphReduce : GraphAlg<> {
|
||||
private:
|
||||
// METHODS
|
||||
#ifdef VL_CPPCHECK
|
||||
static int debug() { return 9; }
|
||||
#else
|
||||
static int debug() { return 0; }
|
||||
#endif
|
||||
DfaGraph* graphp() { return static_cast<DfaGraph*>(m_graphp); }
|
||||
|
||||
bool isDead(DfaVertex* vertexp) {
|
||||
|
@ -346,13 +346,12 @@ private:
|
||||
{
|
||||
m_lifep = ifLifep;
|
||||
iterateAndNextNull(nodep->ifsp());
|
||||
m_lifep = prevLifep;
|
||||
}
|
||||
{
|
||||
m_lifep = elseLifep;
|
||||
iterateAndNextNull(nodep->elsesp());
|
||||
m_lifep = prevLifep;
|
||||
}
|
||||
m_lifep = prevLifep;
|
||||
UINFO(4," join "<<endl);
|
||||
// Find sets on both flows
|
||||
m_lifep->dualBranch(ifLifep, elseLifep);
|
||||
|
@ -1121,7 +1121,7 @@ class LinkDotFindVisitor : public AstNVisitor {
|
||||
ins = true;
|
||||
} else if (findvarp != nodep) {
|
||||
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
|
||||
nodep->v3error("Duplicate declaration of enum value: "<<nodep->prettyName()<<endl
|
||||
<<nodep->warnContextPrimary()<<endl
|
||||
|
@ -648,7 +648,7 @@ void ParamVisitor::visitCell(AstCell* nodep, const string& hierName) {
|
||||
<<modvarp->prettyNameQ());
|
||||
} else {
|
||||
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.
|
||||
// This prevents making additional modules, and makes coverage more
|
||||
// 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
|
||||
len = (max_size-got);
|
||||
}
|
||||
strncpy(buf+got, front.c_str(), len);
|
||||
memcpy(buf+got, front.c_str(), len);
|
||||
got += len;
|
||||
}
|
||||
if (debug()>=9) {
|
||||
|
@ -505,7 +505,6 @@ void V3TSP::tspSort(const V3TSP::StateVec& states, V3TSP::StateVec* resultp) {
|
||||
|
||||
if (max_cost_idx == resultp->size() - 1) {
|
||||
// List is already rotated for minimum cost. stop.
|
||||
UASSERT(resultp->size() == resultp->size(), "sizes should match");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -756,7 +756,6 @@ public:
|
||||
m_chgSubStmts = 0;
|
||||
m_activityNumber = 0;
|
||||
m_code = 0;
|
||||
m_finding = false;
|
||||
m_funcNum = 0;
|
||||
iterate(nodep);
|
||||
}
|
||||
|
@ -435,7 +435,6 @@ private:
|
||||
// ARRAYSEL(...) -> ARRAYSEL(COND(LT(bit<maxbit), bit, 0))
|
||||
AstNRelinker replaceHandle;
|
||||
AstNode* bitp = nodep->bitp()->unlinkFrBack(&replaceHandle);
|
||||
V3Number zeronum (nodep, bitp->width(), 0);
|
||||
AstNode* newp = new AstCondBound(bitp->fileline(),
|
||||
condp, bitp,
|
||||
new AstConst(bitp->fileline(),
|
||||
|
@ -23,7 +23,7 @@ void clockit(int clk1, int clk0) {
|
||||
topp->c0 = clk0;
|
||||
#endif
|
||||
#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
|
||||
topp->eval();
|
||||
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[1].a = (~vec[1].a);
|
||||
vec[2].a = (~vec[2].a) & 0x7fffffff;
|
||||
vec[0].b = vec[0].b;
|
||||
vec[1].b = vec[1].b;
|
||||
vec[2].b = vec[2].b;
|
||||
//vec[0].b = vec[0].b;
|
||||
//vec[1].b = vec[1].b;
|
||||
//vec[2].b = vec[2].b;
|
||||
#else
|
||||
vec[0].aval = (~vec[0].aval);
|
||||
vec[1].aval = (~vec[1].aval);
|
||||
vec[2].aval = (~vec[2].aval) & 0x7fffffff;
|
||||
vec[0].bval = vec[0].bval;
|
||||
vec[1].bval = vec[1].bval;
|
||||
vec[2].bval = vec[2].bval;
|
||||
//vec[0].bval = vec[0].bval;
|
||||
//vec[1].bval = vec[1].bval;
|
||||
//vec[2].bval = vec[2].bval;
|
||||
#endif
|
||||
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();
|
||||
void mon_register_done() {
|
||||
const char* modp = svGetNameFromScope(svGetScope());
|
||||
#ifdef TEST_VERBOSE
|
||||
const char* modp = svGetNameFromScope(svGetScope());
|
||||
VL_PRINTF("- mon_register_done('%s');\n", modp);
|
||||
#endif
|
||||
// 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 o = 0;
|
||||
(void)dpix_a_task(i, op);
|
||||
return 0;
|
||||
}
|
||||
|
@ -41,7 +41,8 @@ int main(int argc, char **argv, char **env) {
|
||||
++main_time;
|
||||
|
||||
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
|
||||
VL_PRINTF("---------------------------------------------\n");
|
||||
VL_PRINTF("Scope = %s\n", it->first);
|
||||
|
Loading…
Reference in New Issue
Block a user