From 59141b16787f0ecb6cdfbc332f5a69a3a3cb139d Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Thu, 12 Oct 2006 14:01:06 +0000 Subject: [PATCH] Fix --skip-identical git-svn-id: file://localhost/svn/verilator/trunk/verilator@820 77ca24e4-aefa-0310-84f0-b9a241c72d87 --- Changes | 4 ++++ src/V3File.h | 3 +++ src/V3Options.h | 1 + src/V3PreShell.cpp | 2 ++ src/V3Read.cpp | 2 +- test_regress/t/t_flag_skipidentical.pl | 30 ++++++++++++++++++++++++++ test_regress/t/t_flag_skipidentical.v | 9 ++++++++ 7 files changed, 50 insertions(+), 1 deletion(-) create mode 100755 test_regress/t/t_flag_skipidentical.pl create mode 100644 test_regress/t/t_flag_skipidentical.v diff --git a/Changes b/Changes index 20ae8b846..c9c02d3d2 100644 --- a/Changes +++ b/Changes @@ -3,6 +3,10 @@ Revision history for Verilator The contributors that suggested a given feature are shown in []. [by ...] indicates the contributor was also the author of the fix; Thanks! +* Verilator 3.62*** + +**** Fix --skip-identical without --debug, broken in 3.621. [Andy Meier] + * Verilator 3.621 10/11/2006 ** Add /*verilator no_inline_task*/ to prevent over-expansion. [Eugene Weber] diff --git a/src/V3File.h b/src/V3File.h index 8e48e20b0..8d2868fce 100644 --- a/src/V3File.h +++ b/src/V3File.h @@ -42,6 +42,9 @@ public: } static ofstream* new_ofstream(const string& filename, bool append=false) { addTgtDepend(filename); + return new_ofstream_nodepend (filename, append); + } + static ofstream* new_ofstream_nodepend(const string& filename, bool append=false) { if (append) { return new ofstream(filename.c_str(), ios::app); } else { diff --git a/src/V3Options.h b/src/V3Options.h index 3be6534dc..29fb5d86d 100644 --- a/src/V3Options.h +++ b/src/V3Options.h @@ -141,6 +141,7 @@ class V3Options { bool trace() const { return m_trace; } bool traceDups() const { return m_traceDups; } bool outFormatOk() const { return m_outFormatOk; } + bool keepTempFiles() const { return (V3Error::debugDefault()!=0); } bool pins64() const { return m_pins64; } bool profileCFuncs() const { return m_profileCFuncs; } bool psl() const { return m_psl; } diff --git a/src/V3PreShell.cpp b/src/V3PreShell.cpp index 5024f9b61..3020f6117 100644 --- a/src/V3PreShell.cpp +++ b/src/V3PreShell.cpp @@ -79,6 +79,8 @@ protected: ostream* osp; if (v3Global.opt.preprocOnly()) { osp = &cout; + } else if (!v3Global.opt.keepTempFiles()) { // Must match unlink rule in V3Read.cpp + osp = ofp = V3File::new_ofstream_nodepend(vppFilename); } else { osp = ofp = V3File::new_ofstream(vppFilename); } diff --git a/src/V3Read.cpp b/src/V3Read.cpp index 6e3f57a8c..b7b3ff011 100644 --- a/src/V3Read.cpp +++ b/src/V3Read.cpp @@ -92,7 +92,7 @@ void V3Read::readFile(FileLine* fileline, const string& modfilename, bool inLibr lexFile (vppfilename, modfilename); } - if (!V3Error::debugDefault()) { + if (!v3Global.opt.keepTempFiles()) { // Must match new_ofstream_nodepend rule in V3PreShell.cpp unlink (vppfilename.c_str()); } } diff --git a/test_regress/t/t_flag_skipidentical.pl b/test_regress/t/t_flag_skipidentical.pl new file mode 100755 index 000000000..9a15c393e --- /dev/null +++ b/test_regress/t/t_flag_skipidentical.pl @@ -0,0 +1,30 @@ +#!/usr/bin/perl +if (!$::Driver) { use FindBin; exec("./driver.pl", @ARGV, $0); die; } +# $Id$ +# DESCRIPTION: Verilator: Verilog Test driver/expect definition +# +# Copyright 2003 by Wilson Snyder. This program is free software; you can +# redistribute it and/or modify it under the terms of either the GNU +# General Public License or the Perl Artistic License. + +if ($Last_Self->{v3}) { + compile (); + + my $outfile = "obj_dir/V".$Last_Self->{name}.".cpp"; + my @oldstats = stat($outfile); + print "Old mtime=",$oldstats[9],"\n"; + $oldstats[9] or $Last_Self->error("No output file found: $outfile\n"); + + sleep (1); # Or else it might take < 1 second to compile and see no diff. + + compile (); + + my @newstats = stat($outfile); + print "New mtime=",$newstats[9],"\n"; + + ($oldstats[9] == $newstats[9]) + or $Last_Self->error("--skip-identical was ignored -- recompiled\n"); +} + +ok(1); +1; diff --git a/test_regress/t/t_flag_skipidentical.v b/test_regress/t/t_flag_skipidentical.v new file mode 100644 index 000000000..6c9e2d06b --- /dev/null +++ b/test_regress/t/t_flag_skipidentical.v @@ -0,0 +1,9 @@ +// $Id$ +// DESCRIPTION: Verilator: Verilog Test module +// +// This file ONLY is placed into the Public Domain, for any use, +// without warranty, 2006 by Wilson Snyder. + +module t (/*AUTOARG*/); + +endmodule