From d46074e0ad62199dadbd7b8e2eca725fc8e807aa Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sat, 16 Jan 2010 20:14:52 -0500 Subject: [PATCH] CDC: --cdc now implies early exit, to allow eventual set_logic_0/1 on sigs --- bin/verilator | 6 +++--- src/Verilator.cpp | 17 +++++++++++++---- test_regress/t/t_cdc_async_bad.pl | 2 +- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/bin/verilator b/bin/verilator index 75203b6ed..9d9c4d3e8 100755 --- a/bin/verilator +++ b/bin/verilator @@ -314,9 +314,9 @@ Specifies C++ without SystemC output mode; see also --sc and --sp. =item --cdc Experimental. Perform some clock domain crossing checks and issue related -warnings. Additional warning information is written to the file -{prefix}__cdc.txt. Generally used with --lint-only. Enables CDCRSTLOGIC -warning. +warnings (CDCRSTLOGIC) and then exit; if warnings other than CDC warnings +are needed make a second run with --lint-only. Additional warning +information is also written to the file {prefix}__cdc.txt. Currently only checks some items that other CDC tools missed; if you have interest in adding more traditional CDC checks, please contact the authors. diff --git a/src/Verilator.cpp b/src/Verilator.cpp index 587c0a836..867385f4d 100644 --- a/src/Verilator.cpp +++ b/src/Verilator.cpp @@ -356,6 +356,8 @@ void process () { // Clock domain crossing analysis if (v3Global.opt.cdc()) { V3Cdc::cdcAll(v3Global.rootp()); + V3Error::abortIfErrors(); + return; } // Reorder assignments in pipelined blocks @@ -527,6 +529,8 @@ void process () { // Makefile must be after all other emitters V3EmitMk::emitmk(v3Global.rootp()); } + + // Note early return above when opt.cdc() } //###################################################################### @@ -550,8 +554,11 @@ int main(int argc, char** argv, char** env) { if (v3Global.opt.coverage() && !v3Global.opt.systemPerl() && !v3Global.opt.lintOnly()) { v3fatal("Unsupported: Coverage analysis requires --sp output."); } - if (!v3Global.opt.outFormatOk() && !v3Global.opt.preprocOnly() && !v3Global.opt.lintOnly()) { - v3fatal("verilator: Need --cc, --sc, --sp, --lint-only or --E option"); + if (!v3Global.opt.outFormatOk() + && !v3Global.opt.preprocOnly() + && !v3Global.opt.lintOnly() + && !v3Global.opt.cdc()) { + v3fatal("verilator: Need --cc, --sc, --sp, --cdc, --lint-only or --E option"); } // Check environment V3Options::getenvSYSTEMC(); @@ -566,6 +573,7 @@ int main(int argc, char** argv, char** env) { if (v3Global.opt.skipIdentical() && !v3Global.opt.preprocOnly() && !v3Global.opt.lintOnly() + && !v3Global.opt.cdc() && V3File::checkTimes(v3Global.opt.makeDir()+"/"+v3Global.opt.prefix()+"__verFiles.dat", argString)) { UINFO(1,"--skip-identical: No change to any source files, exiting\n"); exit(0); @@ -593,10 +601,11 @@ int main(int argc, char** argv, char** env) { v3Global.rootp()->dumpTreeFile(v3Global.debugFilename("final.tree",99)); V3Error::abortIfWarnings(); - if (!v3Global.opt.lintOnly() && v3Global.opt.makeDepend()) { + if (!v3Global.opt.lintOnly() && !v3Global.opt.cdc() + && v3Global.opt.makeDepend()) { V3File::writeDepend(v3Global.opt.makeDir()+"/"+v3Global.opt.prefix()+"__ver.d"); } - if (!v3Global.opt.lintOnly() + if (!v3Global.opt.lintOnly() && !v3Global.opt.cdc() && (v3Global.opt.skipIdentical() || v3Global.opt.makeDepend())) { V3File::writeTimes(v3Global.opt.makeDir()+"/"+v3Global.opt.prefix()+"__verFiles.dat", argString); } diff --git a/test_regress/t/t_cdc_async_bad.pl b/test_regress/t/t_cdc_async_bad.pl index ccf4ac704..b3bfd4d88 100755 --- a/test_regress/t/t_cdc_async_bad.pl +++ b/test_regress/t/t_cdc_async_bad.pl @@ -8,7 +8,7 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di # Version 2.0. compile ( - v_flags => ['--cdc --lint-only'], + v_flags => ['--cdc'], verilator_make_gcc => 0, fails => 1, expect=>