From 73594e5aa51e27416b634f01425b4444b892e326 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Wed, 19 Mar 2008 00:44:54 +0000 Subject: [PATCH] Fix definitions in main file.v, referenced in library. [Stefan Thiede] git-svn-id: file://localhost/svn/verilator/trunk/verilator@999 77ca24e4-aefa-0310-84f0-b9a241c72d87 --- Changes | 2 ++ Makefile.in | 1 + src/Verilator.cpp | 7 +++++-- test_regress/Makefile | 1 + test_regress/t/t_pp_lib.pl | 20 ++++++++++++++++++++ test_regress/t/t_pp_lib.v | 11 +++++++++++ test_regress/t/t_pp_lib_inc.v | 7 +++++++ test_regress/t/t_pp_lib_library.v | 13 +++++++++++++ 8 files changed, 60 insertions(+), 2 deletions(-) create mode 100755 test_regress/t/t_pp_lib.pl create mode 100644 test_regress/t/t_pp_lib.v create mode 100644 test_regress/t/t_pp_lib_inc.v create mode 100644 test_regress/t/t_pp_lib_library.v diff --git a/Changes b/Changes index 755208d3f..433a02fae 100644 --- a/Changes +++ b/Changes @@ -12,6 +12,8 @@ indicates the contributor was also the author of the fix; Thanks! **** Fix assignments to inputs inside functions/tasks. [Patricio Kaplan] +**** Fix definitions in main file.v, referenced in library. [Stefan Thiede] + * Verilator 3.658 2008/02/25 **** Fix unistd compile error in 3.657. [Patricio Kaplan, Jonathan Kimmitt] diff --git a/Makefile.in b/Makefile.in index 7e53496d1..973da059b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -141,6 +141,7 @@ msg_test: @echo "Type 'make test' to test." @echo +.PHONY:test ifeq ($(VERILATOR_AUTHOR_SITE),1) # Local... Else don't burden users test: test_vcs test_c test_sc test_sp test_verilated test_regress else diff --git a/src/Verilator.cpp b/src/Verilator.cpp index ecff59b30..3c9cb8415 100644 --- a/src/Verilator.cpp +++ b/src/Verilator.cpp @@ -90,14 +90,17 @@ V3Global v3Global; void V3Global::readFiles() { V3Read reader (m_rootp); + // Read top module + reader.readFile(new FileLine("CommandLine",0), opt.top(), false); + // Read libraries + // To be compatible with other simulators, + // this needs to be done after the top file is read for (V3StringSet::iterator it = v3Global.opt.libraryFiles().begin(); it != v3Global.opt.libraryFiles().end(); ++it) { string filename = *it; reader.readFile(new FileLine("CommandLine",0), filename, true); } - // Read top module - reader.readFile(new FileLine("CommandLine",0), opt.top(), false); V3Error::abortIfErrors(); } diff --git a/test_regress/Makefile b/test_regress/Makefile index 525372b48..dd7e1a52b 100644 --- a/test_regress/Makefile +++ b/test_regress/Makefile @@ -39,6 +39,7 @@ endif ###################################################################### +.PHONY: test test: $(PERL) driver.pl $(DRIVER_FLAGS) $(PRODUCTS) diff --git a/test_regress/t/t_pp_lib.pl b/test_regress/t/t_pp_lib.pl new file mode 100755 index 000000000..3af4cfb73 --- /dev/null +++ b/test_regress/t/t_pp_lib.pl @@ -0,0 +1,20 @@ +#!/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. + +compile ( + v_flags2 => ['-v', 't/t_pp_lib_library.v'], + ); + +execute ( + check_finished=>1, + ); + +ok(1); +1; + diff --git a/test_regress/t/t_pp_lib.v b/test_regress/t/t_pp_lib.v new file mode 100644 index 000000000..4e3646910 --- /dev/null +++ b/test_regress/t/t_pp_lib.v @@ -0,0 +1,11 @@ +// $Id$ +// DESCRIPTION: Verilator: Verilog Test module +// +// This file ONLY is placed into the Public Domain, for any use, +// without warranty, 2008 by Wilson Snyder. + +`include "t_pp_lib_inc.v" +module t(); + wire [`WIDTH-1:0] a; + library_cell n1(a); +endmodule diff --git a/test_regress/t/t_pp_lib_inc.v b/test_regress/t/t_pp_lib_inc.v new file mode 100644 index 000000000..50f55aade --- /dev/null +++ b/test_regress/t/t_pp_lib_inc.v @@ -0,0 +1,7 @@ +// $Id$ +// DESCRIPTION: Verilator: Verilog Test module +// +// This file ONLY is placed into the Public Domain, for any use, +// without warranty, 2008 by Wilson Snyder. + +`define WIDTH 10 diff --git a/test_regress/t/t_pp_lib_library.v b/test_regress/t/t_pp_lib_library.v new file mode 100644 index 000000000..4c231a010 --- /dev/null +++ b/test_regress/t/t_pp_lib_library.v @@ -0,0 +1,13 @@ +// $Id$ +// DESCRIPTION: Verilator: Verilog Test module +// +// This file ONLY is placed into the Public Domain, for any use, +// without warranty, 2008 by Wilson Snyder. + +module library_cell(a); + input [`WIDTH-1:0] a; + initial begin + $write("*-* All Finished *-*\n"); + $finish; + end +endmodule