mirror of
https://github.com/verilator/verilator.git
synced 2026-10-06 01:54:01 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8bc1e75d9f | ||
|
|
a1c7adcffc | ||
|
|
8867169957 | ||
|
|
79eac1e6b0 | ||
|
|
87533b13e1 | ||
|
|
a2ffe86a36 | ||
|
|
22bde7d461 | ||
|
|
f23203dc96 | ||
|
|
a94f1c779b | ||
|
|
6412aff82d | ||
|
|
99bc1f92c9 | ||
|
|
891edad53a | ||
|
|
98e35b02ad | ||
|
|
8075372675 | ||
|
|
10e34ca48e | ||
|
|
329808afff | ||
|
|
7fc3e6c168 | ||
|
|
199b32709c | ||
|
|
1775da5f43 | ||
|
|
45c202f78f | ||
|
|
a77b58dba9 | ||
|
|
c300ab6dd9 | ||
|
|
9ac0f1accb | ||
|
|
7990e5d4b1 | ||
|
|
fb2cb3c49d | ||
|
|
c4b1bc2506 | ||
|
|
551393d443 | ||
|
|
79d305f3e8 | ||
|
|
822956e769 | ||
|
|
a681a6a6d5 | ||
|
|
5f6d69affd | ||
|
|
4a9bea6980 | ||
|
|
bfddd80f43 | ||
|
|
84a778719a | ||
|
|
829d80d5b5 | ||
|
|
d6a5c97f3a | ||
|
|
4ba00bd256 | ||
|
|
c18f9da400 | ||
|
|
5b620a8dc5 | ||
|
|
9c968c590c | ||
|
|
dff5d5c4e4 | ||
|
|
1265e8cce8 | ||
|
|
2b5d7eeb50 |
+2
-2
@@ -4,13 +4,13 @@
|
|||||||
#
|
#
|
||||||
# This file is part of Verilator.
|
# This file is part of Verilator.
|
||||||
#
|
#
|
||||||
# Author: Wilson Snyder <[email protected]> or <[email protected]>
|
# Author: Wilson Snyder <[email protected]>
|
||||||
#
|
#
|
||||||
# Code available from: http://www.veripool.com/verilator
|
# Code available from: http://www.veripool.com/verilator
|
||||||
#
|
#
|
||||||
#*****************************************************************************
|
#*****************************************************************************
|
||||||
#
|
#
|
||||||
# Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
# Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
# redistribute it and/or modify it under the terms of either the GNU
|
# redistribute it and/or modify it under the terms of either the GNU
|
||||||
# General Public License or the Perl Artistic License.
|
# General Public License or the Perl Artistic License.
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -1,167 +0,0 @@
|
|||||||
1 Verilator
|
|
||||||
***********
|
|
||||||
|
|
||||||
This is the Verilator Package.
|
|
||||||
|
|
||||||
1.1 Copyright
|
|
||||||
=============
|
|
||||||
|
|
||||||
This package is Copyright 2003-2007 by Wilson Snyder
|
|
||||||
<[email protected]>.
|
|
||||||
|
|
||||||
You may distribute under the terms of either the GNU General Public
|
|
||||||
License or the Artistic License, as specified in the Perl README file.
|
|
||||||
|
|
||||||
This code is provided with no warranty of any kind, and is used
|
|
||||||
entirely at your own risk.
|
|
||||||
|
|
||||||
1.2 Description
|
|
||||||
===============
|
|
||||||
|
|
||||||
Verilator converts synthesizable (not behavioral) Verilog code into C++
|
|
||||||
or SystemC code. It is not a complete simulator, just a translator.
|
|
||||||
|
|
||||||
Verilator is invoked with parameters similar to GCC or Synopsys's
|
|
||||||
VCS. It reads the specified Verilog code, lints it, and optionally
|
|
||||||
adds coverage code. For C++ format, it outputs .cpp and .h files. For
|
|
||||||
SystemC format, it outputs .sp files for the SystemPerl preprocessor
|
|
||||||
available at http://veripool.com.
|
|
||||||
|
|
||||||
The resulting files are then compiled with C++. The user writes a
|
|
||||||
little C++ wrapper file, which instantiates the top level module. This
|
|
||||||
is compiled in C++, and linked with the Verilated files.
|
|
||||||
|
|
||||||
The resulting executable will perform the actual simulation.
|
|
||||||
|
|
||||||
1.3 Obtaining Distribution
|
|
||||||
==========================
|
|
||||||
|
|
||||||
The latest version is available at `http://veripool.com/verilator.htm'
|
|
||||||
|
|
||||||
Download the latest package from that site, and decompress. `gunzip
|
|
||||||
verilator_version.tar.gz ; tar xvf verilator_version.tar'
|
|
||||||
|
|
||||||
1.4 Directory Structure
|
|
||||||
=======================
|
|
||||||
|
|
||||||
The directories after de-taring are as follows:
|
|
||||||
|
|
||||||
* bin/verilator => Compiler Wrapper invoked on user Verilog code
|
|
||||||
|
|
||||||
* include/ => Files that should be in your -I compiler
|
|
||||||
path
|
|
||||||
|
|
||||||
* include/verilated.cpp => Global routines to link into your
|
|
||||||
simulator
|
|
||||||
|
|
||||||
* include/verilated.h => Global headers
|
|
||||||
|
|
||||||
* include/verilated.v => Stub defines for linting
|
|
||||||
|
|
||||||
* include/verilated.mk => Common makefile
|
|
||||||
|
|
||||||
* src/ => Translator source code
|
|
||||||
|
|
||||||
* test_v => Example Verilog code for other test dirs
|
|
||||||
|
|
||||||
* test_c => Example Verilog->C++ conversion
|
|
||||||
|
|
||||||
* test_sc => Example Verilog->SystemC conversion
|
|
||||||
|
|
||||||
* test_sp => Example Verilog->SystemPerl conversion
|
|
||||||
|
|
||||||
* test_vcs => Example Verilog->VCS conversion (test the
|
|
||||||
test)
|
|
||||||
|
|
||||||
* test_verilated => Internal tests
|
|
||||||
|
|
||||||
* test_regress => Internal tests
|
|
||||||
|
|
||||||
1.5 Supported Systems
|
|
||||||
=====================
|
|
||||||
|
|
||||||
This version of verilator has been built and tested on:
|
|
||||||
|
|
||||||
* SuSE AMD64 i686-linux-2.6.5
|
|
||||||
|
|
||||||
Other users report success with Redhat Linux 2.4, Windows under
|
|
||||||
Cygwin, HPUX and Solaris. It should run with minor porting on any Unix
|
|
||||||
system.
|
|
||||||
|
|
||||||
1.6 Installation
|
|
||||||
================
|
|
||||||
|
|
||||||
1. If you will be using SystemC (vs straight C++ output), download
|
|
||||||
SystemC 2.0.1 from `http://www.systemc.org'. Follow their
|
|
||||||
installation instructions. As described in the System-Perl README,
|
|
||||||
you will need to set SYSTEMC and/or SYSTEMC_KIT to point to this
|
|
||||||
download. Also, set SYSTEMC_ARCH to the architecture name you used
|
|
||||||
with SystemC, generally 'linux' or 'cygwin'.
|
|
||||||
|
|
||||||
2. If you will be using SystemC, download and install Verilog-Perl,
|
|
||||||
`http://search.cpan.org/search?module=Verilog::Language'.
|
|
||||||
|
|
||||||
3. If you will be using SystemC, download and install System-Perl,
|
|
||||||
`http://search.cpan.org/search?module=SystemC::Netlist'. Note
|
|
||||||
you'll need to set a `SYSTEMPERL' environment variable to point to
|
|
||||||
the downloaded kit (not the installed files.) Also, make sure to
|
|
||||||
do a `make sc_patch'.
|
|
||||||
|
|
||||||
4. `cd' to the Verilator directory containing this README.
|
|
||||||
|
|
||||||
5. Type `./configure' to configure Verilator for your system.
|
|
||||||
|
|
||||||
6. Type `make' to compile Verilator.
|
|
||||||
|
|
||||||
On Cygwin (Windows) you may get a error about libperl.a not being
|
|
||||||
found. You need to copy your perl libraries as follows.
|
|
||||||
|
|
||||||
1. Type `perl -MExtUtils::Embed -e ldopts'
|
|
||||||
|
|
||||||
2. It will show a directory name ending in /CORE. cd to that
|
|
||||||
directory.
|
|
||||||
|
|
||||||
3. `cp libperl5_6_1.a libperl.a'
|
|
||||||
|
|
||||||
4. `cp libperl5_6_1.dll libperl.dll'
|
|
||||||
|
|
||||||
5. `cp libperl5_6_1.def libperl.def'
|
|
||||||
|
|
||||||
7. Type `make test' to check the compilation.
|
|
||||||
|
|
||||||
You may get a error about the Bit::Vector perl package. You will
|
|
||||||
need to install it if you want the tests to pass. (Try `make
|
|
||||||
test_c' for a smaller test that doesn't require it.)
|
|
||||||
|
|
||||||
You may get a error about a typedef conflict for uint32_t. Edit
|
|
||||||
verilated.h to change the typedef to work, probably to `typedef
|
|
||||||
unsigned long uint32_t;'.
|
|
||||||
|
|
||||||
If you get warnings, you might want to edit `include/verilated.mk'
|
|
||||||
to delete the lines that define VK_CPPFLAGS_WALL.
|
|
||||||
|
|
||||||
8. There is no installation at present; this package runs from the
|
|
||||||
distribution directory. Programs should set the environment
|
|
||||||
variable VERILATOR_ROOT to point to this distribution, then execute
|
|
||||||
$VERILATOR_ROOT/bin/verilator, which will find the path to all
|
|
||||||
needed files.
|
|
||||||
|
|
||||||
Verilator assumes you did a make in the SystemC kit directory. If
|
|
||||||
not, you will need to populate `$SYSTEMC/include' and
|
|
||||||
`$SYSTEMC/lib-linux' appropriately.
|
|
||||||
|
|
||||||
If you will be modifying Verilator, you will probably want a second
|
|
||||||
stable copy of this kit for others to use while you experiment.
|
|
||||||
|
|
||||||
9. Detailed documentation and the man page can be seen by running:
|
|
||||||
|
|
||||||
bin/verilator -help
|
|
||||||
|
|
||||||
or reading verilator.txt in the same directory as this README.
|
|
||||||
|
|
||||||
|
|
||||||
1.7 Limitations
|
|
||||||
===============
|
|
||||||
|
|
||||||
See verilator.txt (or execute `bin/verilator --help') for limitations.
|
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
// $Id$
|
// $Id$
|
||||||
// DESCRIPTION: Verilator: List of To Do issues.
|
// DESCRIPTION: Verilator: List of To Do issues.
|
||||||
//
|
//
|
||||||
// Copyright 2004-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2004-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
|
|
||||||
@@ -25,6 +25,7 @@ Features:
|
|||||||
Coverage
|
Coverage
|
||||||
Points should be per-scope like everything else rather then per-module
|
Points should be per-scope like everything else rather then per-module
|
||||||
Expression coverage (see notes)
|
Expression coverage (see notes)
|
||||||
|
Constant functions for widths, etc, IE "input [log2(PARAM):0] xx;"
|
||||||
More Verilog 2001 Support
|
More Verilog 2001 Support
|
||||||
(* *) Attributes (just ignore -- preprocessor?)
|
(* *) Attributes (just ignore -- preprocessor?)
|
||||||
Real numbers (NEVER)
|
Real numbers (NEVER)
|
||||||
@@ -103,6 +104,12 @@ Performance:
|
|||||||
If floped(a) & flopped(b) and no other a&b, then instead flop(a&b).
|
If floped(a) & flopped(b) and no other a&b, then instead flop(a&b).
|
||||||
Sort by output bitselects so can combine more assignments (see DDP example dx_dm signal)
|
Sort by output bitselects so can combine more assignments (see DDP example dx_dm signal)
|
||||||
|
|
||||||
|
All of the temp vars that get set, exp pre_ vars and never feedback
|
||||||
|
(not flops) don't need to be stored in the structs, but instead can
|
||||||
|
be per-invocation, and even better register-colored-like to reuse
|
||||||
|
the space. This will greatly reduce the data footprint.
|
||||||
|
|
||||||
|
|
||||||
//**********************************************************************
|
//**********************************************************************
|
||||||
//* Detailed notes on 'todo' features
|
//* Detailed notes on 'todo' features
|
||||||
|
|
||||||
|
|||||||
+153
-28
@@ -4,7 +4,7 @@ eval 'exec perl -wS $0 ${1+"$@"}'
|
|||||||
# $Id$
|
# $Id$
|
||||||
######################################################################
|
######################################################################
|
||||||
#
|
#
|
||||||
# Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
# Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
# redistribute it and/or modify it under the terms of either the GNU
|
# redistribute it and/or modify it under the terms of either the GNU
|
||||||
# General Public License or the Perl Artistic License.
|
# General Public License or the Perl Artistic License.
|
||||||
#
|
#
|
||||||
@@ -214,6 +214,66 @@ C++, and linked with the Verilated files.
|
|||||||
|
|
||||||
The resulting executable will perform the actual simulation.
|
The resulting executable will perform the actual simulation.
|
||||||
|
|
||||||
|
=head1 ARGUMENT SUMMARY
|
||||||
|
|
||||||
|
This is a short summary of the arguments to Verilator. See the detailed
|
||||||
|
descriptions in the next sections for more information.
|
||||||
|
|
||||||
|
{file.v} Verilog top level filenames
|
||||||
|
{file.c/cc/cpp} Optional C++ files to link in
|
||||||
|
|
||||||
|
--assert Enable all assertions
|
||||||
|
--bin <filename> Override Verilator binary
|
||||||
|
--cc Create C++ output
|
||||||
|
--compiler <compiler-name> Tune for specified C++ compiler
|
||||||
|
--coverage Enable all coverage
|
||||||
|
--coverage-line Enable line coverage
|
||||||
|
--coverage-user Enable PSL/SVL user coverage
|
||||||
|
-D<var>[=<value>] Set preprocessor define
|
||||||
|
--debug Enable debugging
|
||||||
|
--debug-check Enable debugging assertions
|
||||||
|
--dump-tree Enable dumping .tree files
|
||||||
|
-E Preprocess, but do not compile
|
||||||
|
--exe Link to create executable
|
||||||
|
-f <file> Parse options from a file
|
||||||
|
--help Display this help.
|
||||||
|
-I<dir> Directory to search for includes
|
||||||
|
--inhibit-sim Create function to turn off sim
|
||||||
|
--inline-mult <value> Tune module inlining
|
||||||
|
--lint-only Lint, but do not make output
|
||||||
|
--MMD Create .d dependency files
|
||||||
|
--MP Create phony dependency targets
|
||||||
|
--Mdir <directory> Name of output object directory
|
||||||
|
--mod-prefix <topname> Name to prepend to lower classes
|
||||||
|
--no-skip-identical Disable skipping identical output
|
||||||
|
-O0 Disable optimizations
|
||||||
|
-O3 High performance optimizations
|
||||||
|
-O<optimization-letter> Selectable optimizations
|
||||||
|
--output-split <bytes> Split .cpp files into pieces
|
||||||
|
--output-split-cfuncs <statements> Split .ccp functions
|
||||||
|
--pins64 Use uint64_t's for 33-64 bit sigs
|
||||||
|
--prefix <topname> Name of top level class
|
||||||
|
--profile-cfuncs Name functions for profiling
|
||||||
|
--private Debugging; see docs
|
||||||
|
--psl Enable PSL parsing
|
||||||
|
--public Debugging; see docs
|
||||||
|
--sc Create SystemC output
|
||||||
|
--sp Create SystemPerl output
|
||||||
|
--stats Create statistics file
|
||||||
|
--trace Enable waveform creation
|
||||||
|
--trace-depth <levels> Depth of tracing
|
||||||
|
-U<var> Undefine preprocessor define
|
||||||
|
--underline-zero Zero signals with leading _'s
|
||||||
|
-v <filename> Verilog library
|
||||||
|
-Werror-<message> Convert warning to error
|
||||||
|
-Wno-<message> Disable warning
|
||||||
|
-x-assign <mode> Initially assign Xs to this value
|
||||||
|
-y <dir> Directory to search for modules
|
||||||
|
|
||||||
|
+define+<var>+<value> Set preprocessor define
|
||||||
|
+incdir+<dir> Directory to search for includes
|
||||||
|
+libext+<ext>+[ext]... Extensions for finding modules
|
||||||
|
|
||||||
=head1 ARGUMENTS
|
=head1 ARGUMENTS
|
||||||
|
|
||||||
=over 4
|
=over 4
|
||||||
@@ -320,6 +380,12 @@ internal assertions, debugging messages, and intermediate form dump files.
|
|||||||
Rarely needed. Enable internal debugging assertion checks, without
|
Rarely needed. Enable internal debugging assertion checks, without
|
||||||
changing debug verbosity. Enabled automatically when --debug specified.
|
changing debug verbosity. Enabled automatically when --debug specified.
|
||||||
|
|
||||||
|
=item --dump-tree
|
||||||
|
|
||||||
|
Rarely needed. Enable writing .tree debug files. This is enabled with
|
||||||
|
--debug, so "--debug --no-dump-tree" may be useful if the dump files are
|
||||||
|
large and not desired.
|
||||||
|
|
||||||
=item -E
|
=item -E
|
||||||
|
|
||||||
Preprocess the source code, but do not compile, as with 'gcc -E'. Output
|
Preprocess the source code, but do not compile, as with 'gcc -E'. Output
|
||||||
@@ -345,7 +411,7 @@ change the SystemC modules instantiated.
|
|||||||
=item --inline-mult I<value>
|
=item --inline-mult I<value>
|
||||||
|
|
||||||
Tune the inlining of modules. The default value of 2000 specifies that up
|
Tune the inlining of modules. The default value of 2000 specifies that up
|
||||||
to 2000 new operations may be added to the model by inlining, if more then
|
to 2000 new operations may be added to the model by inlining, if more than
|
||||||
this number of operations would result, the module is not inlined. Larger
|
this number of operations would result, the module is not inlined. Larger
|
||||||
values, or a value <= 1 will inline everything, will lead to longer compile
|
values, or a value <= 1 will inline everything, will lead to longer compile
|
||||||
times, but potentially faster runtimes. This setting is ignored for very
|
times, but potentially faster runtimes. This setting is ignored for very
|
||||||
@@ -472,9 +538,12 @@ Creates a dump file with statistics on the design in {prefix}__stats.txt.
|
|||||||
|
|
||||||
=item --trace
|
=item --trace
|
||||||
|
|
||||||
Adds waveform tracing code to the model. Having tracing compiled in may
|
Adds waveform tracing code to the model, this will create additional
|
||||||
result in some small performance losses, even when waveforms are not turned
|
{prefix}__Trace*.cpp files you will need to add to your Makefiles, if
|
||||||
on during model execution.
|
you're not using the ones generated for you.
|
||||||
|
|
||||||
|
Having tracing compiled in may result in some small performance losses,
|
||||||
|
even when waveforms are not turned on during model execution.
|
||||||
|
|
||||||
=item --trace-depth I<levels>
|
=item --trace-depth I<levels>
|
||||||
|
|
||||||
@@ -500,6 +569,17 @@ example C<-Werror-NOUNOPTFLAT>.
|
|||||||
|
|
||||||
Disable the specified warning message.
|
Disable the specified warning message.
|
||||||
|
|
||||||
|
=item -Wno-lint
|
||||||
|
|
||||||
|
Disable all lint related warning messages. This is equivelent to
|
||||||
|
"-Wno-CASEINCOMPLETE -Wno-CASEOVERLAP -Wno-CASEX -Wno-CMPCONST
|
||||||
|
-Wno-IMPLICIT -Wno-UNDRIVEN -Wno-UNSIGNED -Wno-UNUSED -Wno-VARHIDDEN
|
||||||
|
-Wno-WIDTH".
|
||||||
|
|
||||||
|
It is strongly recommended you cleanup your code rather than using this
|
||||||
|
option, it is only intended to be use when running test-cases of code
|
||||||
|
received from third parties.
|
||||||
|
|
||||||
=item -x-assign 0
|
=item -x-assign 0
|
||||||
|
|
||||||
=item -x-assign 1
|
=item -x-assign 1
|
||||||
@@ -577,7 +657,7 @@ We'll compile this example into C++.
|
|||||||
int main(int argc, char **argv, char **env) {
|
int main(int argc, char **argv, char **env) {
|
||||||
Vour* top = new Vour;
|
Vour* top = new Vour;
|
||||||
while (!Verilated::gotFinish()) { top->eval(); }
|
while (!Verilated::gotFinish()) { top->eval(); }
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
@@ -637,7 +717,7 @@ This is an example similar to the above, but using SystemPerl.
|
|||||||
top = new Vour("top"); // SP_CELL (top, Vour);
|
top = new Vour("top"); // SP_CELL (top, Vour);
|
||||||
top->clk(clk); // SP_PIN (top, clk, clk);
|
top->clk(clk); // SP_PIN (top, clk, clk);
|
||||||
while (!Verilated::gotFinish()) { sc_start(1); }
|
while (!Verilated::gotFinish()) { sc_start(1); }
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
@@ -761,6 +841,7 @@ For -sp mode, instead of .cpp and .h it creates:
|
|||||||
|
|
||||||
In certain optimization modes, it also creates:
|
In certain optimization modes, it also creates:
|
||||||
|
|
||||||
|
{prefix}__Inlines.h // Inline support functions
|
||||||
{prefix}__Slow.cpp // Constructors and infrequent routines
|
{prefix}__Slow.cpp // Constructors and infrequent routines
|
||||||
{prefix}__Syms.cpp // Global symbol table C++
|
{prefix}__Syms.cpp // Global symbol table C++
|
||||||
{prefix}__Syms.h // Global symbol table header
|
{prefix}__Syms.h // Global symbol table header
|
||||||
@@ -917,7 +998,7 @@ To support this, none of the files that Verilator produces will reference
|
|||||||
any configure generated build-system specific files, such as config.h
|
any configure generated build-system specific files, such as config.h
|
||||||
(which is renamed in Verilator to config_build.h to reduce confusion.) The
|
(which is renamed in Verilator to config_build.h to reduce confusion.) The
|
||||||
disadvantage of this approach is that include/verilatedos.h must
|
disadvantage of this approach is that include/verilatedos.h must
|
||||||
self-detect the requirements of the target system, rather then using
|
self-detect the requirements of the target system, rather than using
|
||||||
configure.
|
configure.
|
||||||
|
|
||||||
The target system may also require edits to the Makefiles, the simple
|
The target system may also require edits to the Makefiles, the simple
|
||||||
@@ -944,12 +1025,14 @@ Verilator currently has very minimal support for SystemVerilog. As
|
|||||||
SystemVerilog features enter common usage they will be added. Contact the
|
SystemVerilog features enter common usage they will be added. Contact the
|
||||||
author if a feature you need is missing.
|
author if a feature you need is missing.
|
||||||
|
|
||||||
Verilator implements the full SystemVerilog 1800-2005 preprocessor subset,
|
Verilator implements the full SystemVerilog 1800-2005 preprocessor,
|
||||||
including function call-like preprocessor defines.
|
including function call-like preprocessor defines.
|
||||||
|
|
||||||
Verilator supports $bits, $countones, $error, $fatal, $info, $isunknown,
|
Verilator supports ==? and !=? operators, $bits, $countones, $error,
|
||||||
$onehot, $onehot0, $warning, always_comb, always_ff, always_latch,
|
$fatal, $info, $isunknown, $onehot, $onehot0, $warning, always_comb,
|
||||||
do-while, and final. It also supports .name and .* interconnection.
|
always_ff, always_latch, do-while, and final.
|
||||||
|
|
||||||
|
It also supports .name and .* interconnection.
|
||||||
|
|
||||||
Verilator partially supports assert.
|
Verilator partially supports assert.
|
||||||
|
|
||||||
@@ -1030,7 +1113,7 @@ call C++ functions from your Verilog code.
|
|||||||
String arguments will be put directly into the output C++ code. Expression
|
String arguments will be put directly into the output C++ code. Expression
|
||||||
arguments will have the code to evaluate the expression inserted. Thus to
|
arguments will have the code to evaluate the expression inserted. Thus to
|
||||||
call a C++ function, $c("func(",a,")") will result in 'func(a)' in the
|
call a C++ function, $c("func(",a,")") will result in 'func(a)' in the
|
||||||
output C++ code. For input arguments, rather then hard-coding variable
|
output C++ code. For input arguments, rather than hard-coding variable
|
||||||
names in the string $c("func(a)"), instead pass the variable as an
|
names in the string $c("func(a)"), instead pass the variable as an
|
||||||
expression $c("func(",a,")"). This will allow the call to work inside
|
expression $c("func(",a,")"). This will allow the call to work inside
|
||||||
Verilog functions where the variable is flattened out, and also enable
|
Verilog functions where the variable is flattened out, and also enable
|
||||||
@@ -1195,7 +1278,7 @@ lint_restore*/. For example:
|
|||||||
If SOME_WARNING was on before the lint_off, it will now be restored to on,
|
If SOME_WARNING was on before the lint_off, it will now be restored to on,
|
||||||
and if it was off before the lint_off it will remain off.
|
and if it was off before the lint_off it will remain off.
|
||||||
|
|
||||||
=item /*verilator no_inline_task*/
|
=item /*verilator no_inline_task*/
|
||||||
|
|
||||||
Used in a function or task variable definition section to specify the
|
Used in a function or task variable definition section to specify the
|
||||||
function or task should not be inlined into where it is used. This may
|
function or task should not be inlined into where it is used. This may
|
||||||
@@ -1397,7 +1480,7 @@ When initializing an array, you need to use non-delayed assignments. This
|
|||||||
is done in the interest of speed; if delayed assignments were used, the
|
is done in the interest of speed; if delayed assignments were used, the
|
||||||
simulator would have to copy large arrays every cycle. (In smaller loops,
|
simulator would have to copy large arrays every cycle. (In smaller loops,
|
||||||
loop unrolling allows the delayed assignment to work, though it's a bit
|
loop unrolling allows the delayed assignment to work, though it's a bit
|
||||||
slower then a non-delayed assignment.) Here's an example
|
slower than a non-delayed assignment.) Here's an example
|
||||||
|
|
||||||
always @ (posedge clk)
|
always @ (posedge clk)
|
||||||
if (~reset_l) begin
|
if (~reset_l) begin
|
||||||
@@ -1484,7 +1567,7 @@ MCDs, which includes the mode parameter to $fopen being mandatory.
|
|||||||
Verilator will convert the integer used to hold the file descriptor into a
|
Verilator will convert the integer used to hold the file descriptor into a
|
||||||
internal FILE*. To prevent core dumps due to mis-use, and because integers
|
internal FILE*. To prevent core dumps due to mis-use, and because integers
|
||||||
are 32 bits while FILE*s may be 64 bits, the descriptor must be stored in a
|
are 32 bits while FILE*s may be 64 bits, the descriptor must be stored in a
|
||||||
reg [63:0] rather then an integer. The define `verilator_file_descriptor in
|
reg [63:0] rather than an integer. The define `verilator_file_descriptor in
|
||||||
verilated.v can be used to hide this difference.
|
verilated.v can be used to hide this difference.
|
||||||
|
|
||||||
=item $fullskew, $hold, $nochange, $period, $recovery, $recrem, $removal,
|
=item $fullskew, $hold, $nochange, $period, $recovery, $recrem, $removal,
|
||||||
@@ -1650,6 +1733,16 @@ not really needed. The best solution is to insure that each module is in a
|
|||||||
unique file by the same name. Otherwise, make sure all library files are
|
unique file by the same name. Otherwise, make sure all library files are
|
||||||
read in as libraries with -v, instead of automatically with -y.
|
read in as libraries with -v, instead of automatically with -y.
|
||||||
|
|
||||||
|
=item STMTDLY
|
||||||
|
|
||||||
|
Warns that you have a statement with a delayed time in front of it, for
|
||||||
|
example:
|
||||||
|
|
||||||
|
#100 $finish;
|
||||||
|
|
||||||
|
Ignoring this warning may make Verilator simulations differ from other
|
||||||
|
simulators.
|
||||||
|
|
||||||
=item TASKNSVAR
|
=item TASKNSVAR
|
||||||
|
|
||||||
Error when a call to a task or function has a output from that task tied to
|
Error when a call to a task or function has a output from that task tied to
|
||||||
@@ -1781,7 +1874,7 @@ correctly.
|
|||||||
Warns that based on width rules of Verilog, two operands have different
|
Warns that based on width rules of Verilog, two operands have different
|
||||||
widths. Verilator generally can intuit the common usages of widths, and
|
widths. Verilator generally can intuit the common usages of widths, and
|
||||||
you shouldn't need to disable this message like you do with most lint
|
you shouldn't need to disable this message like you do with most lint
|
||||||
programs. Generally other then simple mistakes, you have two solutions:
|
programs. Generally other than simple mistakes, you have two solutions:
|
||||||
|
|
||||||
If it's a constant 0 that's 32 bits or less, simply leave it
|
If it's a constant 0 that's 32 bits or less, simply leave it
|
||||||
unwidthed. Verilator considers zero to be any width needed.
|
unwidthed. Verilator considers zero to be any width needed.
|
||||||
@@ -1850,13 +1943,13 @@ Visual C++ Version 7 or newer, but this is not tested by the author.
|
|||||||
|
|
||||||
=item Can you provide binaries?
|
=item Can you provide binaries?
|
||||||
|
|
||||||
At this time I'd prefer to get patches out quickly then have to generate
|
At this time I'd prefer to get patches out quickly than have to generate
|
||||||
myriad binaries for many different OS flavors. People have generally
|
myriad binaries for many different OS flavors. People have generally
|
||||||
requested binaries when they are having problems with their C++
|
requested binaries when they are having problems with their C++
|
||||||
compiler. Alas, binaries won't help this, as in the end a fully working C++
|
compiler. Alas, binaries won't help this, as in the end a fully working C++
|
||||||
compiler is required to compile the output of Verilator.
|
compiler is required to compile the output of Verilator.
|
||||||
|
|
||||||
=item How can it be faster then (name-the-simulator)?
|
=item How can it be faster than (name-the-simulator)?
|
||||||
|
|
||||||
Generally, the implied part of the question is "... with all of their
|
Generally, the implied part of the question is "... with all of their
|
||||||
manpower they can put into it."
|
manpower they can put into it."
|
||||||
@@ -1870,9 +1963,28 @@ so your simulator shouldn't have to be -- and Verilator is closer to the
|
|||||||
synthesis interpretation, so this is a good thing for getting working
|
synthesis interpretation, so this is a good thing for getting working
|
||||||
silicon.
|
silicon.
|
||||||
|
|
||||||
=item How do I generate waveforms (traces) in C++?
|
=item May programs I create with Verilator remain under my own copyright?
|
||||||
|
|
||||||
See the next question for SystemC mode.
|
Yes, it's just like using GCC on your programs. If you change Verilator
|
||||||
|
itself, you must make the source code available under the GNU Public
|
||||||
|
License. However, the include and generated files use the GNU Lesser
|
||||||
|
Public License, which means that files using them are NOT required to be released.
|
||||||
|
|
||||||
|
You also have the option of using the Perl Artistic License, which again
|
||||||
|
does not require you release your Verilog or generated code.
|
||||||
|
|
||||||
|
=item Why is running Verilator so slow?
|
||||||
|
|
||||||
|
Verilator needs more memory than the resulting simulator will require, as
|
||||||
|
Verilator creates internally all of the state of the resulting simulator in
|
||||||
|
order to optimize it. If it takes more than a minute or so (and you're not
|
||||||
|
using --debug), see if your machine is paging; most likely you need to run
|
||||||
|
it on a machine with more memory. Verilator is a full 64 bit application
|
||||||
|
and may use more than 4GB, but about 1GB is the maximum typically needed.
|
||||||
|
|
||||||
|
=item How do I generate waveforms (traces) in C++ or SystemC?
|
||||||
|
|
||||||
|
See the next question for tracing in SystemPerl mode.
|
||||||
|
|
||||||
Add the --trace switch to Verilator, and make sure the SystemPerl package
|
Add the --trace switch to Verilator, and make sure the SystemPerl package
|
||||||
is installed. SystemC itself does not need to be installed for C++ only
|
is installed. SystemC itself does not need to be installed for C++ only
|
||||||
@@ -1881,13 +1993,15 @@ the SystemPerl kit and point the SYSTEMPERL environment variable to the
|
|||||||
untarred directory.
|
untarred directory.
|
||||||
|
|
||||||
In your top level C code, call Verilated::traceEverOn(true). Then create a
|
In your top level C code, call Verilated::traceEverOn(true). Then create a
|
||||||
SpTraceVcdC object. For an example, see the call to SpTraceVcdC in the
|
SpTraceVcdC object, and in your main loop call "trace_object->dump(time)"
|
||||||
test_c/sc_main.cpp file of the distribution.
|
every time step, and finally call "trace_object->close()". For an example,
|
||||||
|
see the call to SpTraceVcdC in the test_c/sim_main.cpp file of the
|
||||||
|
distribution.
|
||||||
|
|
||||||
You also need to compile SpTraceVcdC.cpp and add it to your link. This is
|
You also need to compile SpTraceVcdC.cpp and add it to your link. This is
|
||||||
done for you if using the Verilator --exe flag.
|
done for you if using the Verilator --exe flag.
|
||||||
|
|
||||||
=item How do I generate waveforms (traces) in SystemC?
|
=item How do I generate waveforms (traces) in SystemPerl?
|
||||||
|
|
||||||
Add the --trace switch to Verilator, and make sure the SystemPerl package
|
Add the --trace switch to Verilator, and make sure the SystemPerl package
|
||||||
is installed.
|
is installed.
|
||||||
@@ -1914,6 +2028,17 @@ the "verilator" define for you, so just wrap the code in a ifndef region:
|
|||||||
Something_Verilator_Dislikes;
|
Something_Verilator_Dislikes;
|
||||||
`endif
|
`endif
|
||||||
|
|
||||||
|
=item Why do I get "unexpected `do'" or "unexpected `bit'" errors?
|
||||||
|
|
||||||
|
Do, bit, ref, and other words are now SystemVerilog keywords. You should
|
||||||
|
change your code to not use them to insure it works with newer tools.
|
||||||
|
Alternatively, surround them by the Verilog 2005/SystemVerilog
|
||||||
|
begin_keywords pragma to indicate Verilog 2001 code.
|
||||||
|
|
||||||
|
`begin_keywords "1364-2001"
|
||||||
|
integer bit; initial bit = 1;
|
||||||
|
`end_keywords
|
||||||
|
|
||||||
=item How do I prevent my assertions from firing during reset?
|
=item How do I prevent my assertions from firing during reset?
|
||||||
|
|
||||||
Call Verilated::assertOn(false) before you first call the model, then turn
|
Call Verilated::assertOn(false) before you first call the model, then turn
|
||||||
@@ -1974,7 +2099,7 @@ bit long longs that fits the width of the signal. Generally, you can use
|
|||||||
just uint32_t's for 1 to 32 bits, or uint64_t for 1 to 64 bits, and the
|
just uint32_t's for 1 to 32 bits, or uint64_t for 1 to 64 bits, and the
|
||||||
compiler will properly up-convert smaller entities.
|
compiler will properly up-convert smaller entities.
|
||||||
|
|
||||||
Signals wider then 64 bits are stored as an array of 32-bit uint32_t's.
|
Signals wider than 64 bits are stored as an array of 32-bit uint32_t's.
|
||||||
Thus to read bits 31:0, access signal[0], and for bits 63:32, access
|
Thus to read bits 31:0, access signal[0], and for bits 63:32, access
|
||||||
signal[1]. Unused bits (for example bit numbers 65-96 of a 65 bit vector)
|
signal[1]. Unused bits (for example bit numbers 65-96 of a 65 bit vector)
|
||||||
will always be zero. if you change the value you must make sure to pack
|
will always be zero. if you change the value you must make sure to pack
|
||||||
@@ -2065,8 +2190,8 @@ scratch in C++. This added many optimizations, yielding about a 2-5x
|
|||||||
performance gain.
|
performance gain.
|
||||||
|
|
||||||
Currently, various language features and performance enhancements are added
|
Currently, various language features and performance enhancements are added
|
||||||
as the need arises. Verilator is now about 2x faster then in 2002, and is
|
as the need arises. Verilator is now about 2x faster than in 2002, and is
|
||||||
faster then many popular commercial simulators.
|
faster than many popular commercial simulators.
|
||||||
|
|
||||||
=head1 CONTRIBUTORS
|
=head1 CONTRIBUTORS
|
||||||
|
|
||||||
@@ -2093,7 +2218,7 @@ Eugene Weber, Leon Wildman, and Mat Zeno.
|
|||||||
|
|
||||||
The latest version is available from L<http://www.veripool.com/>.
|
The latest version is available from L<http://www.veripool.com/>.
|
||||||
|
|
||||||
Copyright 2003-2007 by Wilson Snyder. Verilator is free software; you can
|
Copyright 2003-2008 by Wilson Snyder. Verilator is free software; you can
|
||||||
redistribute it and/or modify it under the terms of either the GNU Lesser
|
redistribute it and/or modify it under the terms of either the GNU Lesser
|
||||||
General Public License or the Perl Artistic License.
|
General Public License or the Perl Artistic License.
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ eval 'exec perl -wS $0 ${1+"$@"}'
|
|||||||
# $Id$
|
# $Id$
|
||||||
######################################################################
|
######################################################################
|
||||||
#
|
#
|
||||||
# Copyright 2005-2007 by Wilson Snyder <[email protected]>. This
|
# Copyright 2005-2008 by Wilson Snyder <[email protected]>. This
|
||||||
# program is free software; you can redistribute it and/or modify it under
|
# program is free software; you can redistribute it and/or modify it under
|
||||||
# the terms of either the GNU Lesser General Public License or the Perl
|
# the terms of either the GNU Lesser General Public License or the Perl
|
||||||
# Artistic License.
|
# Artistic License.
|
||||||
@@ -180,7 +180,7 @@ Displays this message and program version and exits.
|
|||||||
|
|
||||||
The latest version is available from L<http://www.veripool.com/>.
|
The latest version is available from L<http://www.veripool.com/>.
|
||||||
|
|
||||||
Copyright 2005-2007 by Wilson Snyder. This package is free software; you
|
Copyright 2005-2008 by Wilson Snyder. This package is free software; you
|
||||||
can redistribute it and/or modify it under the terms of either the GNU
|
can redistribute it and/or modify it under the terms of either the GNU
|
||||||
Lesser General Public License or the Perl Artistic License.
|
Lesser General Public License or the Perl Artistic License.
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ eval 'exec perl -wS $0 ${1+"$@"}'
|
|||||||
# $Id$
|
# $Id$
|
||||||
# DESCRIPTION: Print include statements for each ARGV
|
# DESCRIPTION: Print include statements for each ARGV
|
||||||
#
|
#
|
||||||
# Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
# Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
# redistribute it and/or modify it under the terms of either the GNU
|
# redistribute it and/or modify it under the terms of either the GNU
|
||||||
# General Public License or the Perl Artistic License.
|
# General Public License or the Perl Artistic License.
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ eval 'exec perl -wS $0 ${1+"$@"}'
|
|||||||
# $Id$
|
# $Id$
|
||||||
######################################################################
|
######################################################################
|
||||||
#
|
#
|
||||||
# Copyright 2007-2007 by Wilson Snyder <[email protected]>. This
|
# Copyright 2007-2008 by Wilson Snyder <[email protected]>. This
|
||||||
# program is free software; you can redistribute it and/or modify it under
|
# program is free software; you can redistribute it and/or modify it under
|
||||||
# the terms of either the GNU Lesser General Public License or the Perl
|
# the terms of either the GNU Lesser General Public License or the Perl
|
||||||
# Artistic License.
|
# Artistic License.
|
||||||
@@ -191,7 +191,7 @@ Displays this message and program version and exits.
|
|||||||
|
|
||||||
The latest version is available from L<http://www.veripool.com/>.
|
The latest version is available from L<http://www.veripool.com/>.
|
||||||
|
|
||||||
Copyright 2007-2007 by Wilson Snyder. This package is free software; you
|
Copyright 2007-2008 by Wilson Snyder. This package is free software; you
|
||||||
can redistribute it and/or modify it under the terms of either the GNU
|
can redistribute it and/or modify it under the terms of either the GNU
|
||||||
Lesser General Public License or the Perl Artistic License.
|
Lesser General Public License or the Perl Artistic License.
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
dnl $Id$
|
dnl $Id$
|
||||||
dnl DESCRIPTION: Process this file with autoconf to produce a configure script.
|
dnl DESCRIPTION: Process this file with autoconf to produce a configure script.
|
||||||
dnl Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
dnl Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
dnl redistribute it and/or modify it under the terms of either the GNU
|
dnl redistribute it and/or modify it under the terms of either the GNU
|
||||||
dnl General Public License or the Perl Artistic License.
|
dnl General Public License or the Perl Artistic License.
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
// $Id$ -*- C++ -*-
|
// $Id$ -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// Lesser General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
// Verilator is distributed in the hope that it will be useful,
|
// Verilator is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
//===========================================================================
|
//===========================================================================
|
||||||
// Global variables
|
// Global variables
|
||||||
|
|
||||||
int Verilated::s_randReset = false;
|
int Verilated::s_randReset = 0;
|
||||||
int Verilated::s_debug = 1;
|
int Verilated::s_debug = 1;
|
||||||
bool Verilated::s_calcUnusedSigs = false;
|
bool Verilated::s_calcUnusedSigs = false;
|
||||||
bool Verilated::s_gotFinish = false;
|
bool Verilated::s_gotFinish = false;
|
||||||
|
|||||||
+26
-89
@@ -1,9 +1,9 @@
|
|||||||
// $Id$ -*- C++ -*-
|
// $Id$ -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// Lesser General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
// Verilator is distributed in the hope that it will be useful,
|
// Verilator is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
@@ -210,9 +210,9 @@ inline void VL_READMEM_I(bool hex, int width, int depth, int array_lsb, int fnwo
|
|||||||
// Base macros
|
// Base macros
|
||||||
|
|
||||||
/// Return true if data[bit] set
|
/// Return true if data[bit] set
|
||||||
#define VL_BITISSET_I(data,bit) (data & (1UL<<VL_BITBIT_I(bit)))
|
#define VL_BITISSET_I(data,bit) (data & (VL_UL(1)<<VL_BITBIT_I(bit)))
|
||||||
#define VL_BITISSET_Q(data,bit) (data & (VL_ULL(1)<<VL_BITBIT_Q(bit)))
|
#define VL_BITISSET_Q(data,bit) (data & (VL_ULL(1)<<VL_BITBIT_Q(bit)))
|
||||||
#define VL_BITISSET_W(data,bit) (data[VL_BITWORD_I(bit)] & (1UL<<VL_BITBIT_I(bit)))
|
#define VL_BITISSET_W(data,bit) (data[VL_BITWORD_I(bit)] & (VL_UL(1)<<VL_BITBIT_I(bit)))
|
||||||
|
|
||||||
/// Create two 32-bit words from quadword
|
/// Create two 32-bit words from quadword
|
||||||
#define VL_SET_WQ(decl,data) { decl[0]=(data); decl[1]=((data)>>VL_WORDSIZE); }
|
#define VL_SET_WQ(decl,data) { decl[0]=(data); decl[1]=((data)>>VL_WORDSIZE); }
|
||||||
@@ -225,13 +225,13 @@ static inline QData VL_CVT_FP_Q(FILE* fp) { union { FILE* fp; QData q; } u; u.q
|
|||||||
|
|
||||||
// Sign extend such that if MSB set, we get ffff_ffff, else 0s
|
// Sign extend such that if MSB set, we get ffff_ffff, else 0s
|
||||||
// (Requires clean input)
|
// (Requires clean input)
|
||||||
#define VL_SIGN_I(nbits,lhs) ((lhs) >> VL_BITBIT_I((nbits) - 1UL))
|
#define VL_SIGN_I(nbits,lhs) ((lhs) >> VL_BITBIT_I((nbits) - VL_UL(1)))
|
||||||
#define VL_SIGN_Q(nbits,lhs) ((lhs) >> VL_BITBIT_Q((nbits) - VL_ULL(1)))
|
#define VL_SIGN_Q(nbits,lhs) ((lhs) >> VL_BITBIT_Q((nbits) - VL_ULL(1)))
|
||||||
#define VL_SIGNONES_I(nbits,lhs) (-(VL_SIGN_I(nbits,lhs)))
|
#define VL_SIGNONES_I(nbits,lhs) (-(VL_SIGN_I(nbits,lhs)))
|
||||||
|
|
||||||
// Sign bit extended up to MSB, doesn't include unsigned portion
|
// Sign bit extended up to MSB, doesn't include unsigned portion
|
||||||
// Optimization bug in GCC 3.3 returns different bitmasks to later states for
|
// Optimization bug in GCC 3.3 returns different bitmasks to later states for
|
||||||
static inline IData VL_EXTENDSIGN_I(int lbits, IData lhs) { return (-((lhs)&(1UL<<(lbits-1)))); }
|
static inline IData VL_EXTENDSIGN_I(int lbits, IData lhs) { return (-((lhs)&(VL_UL(1)<<(lbits-1)))); }
|
||||||
static inline QData VL_EXTENDSIGN_Q(int lbits, QData lhs) { return (-((lhs)&(VL_ULL(1)<<(lbits-1)))); }
|
static inline QData VL_EXTENDSIGN_Q(int lbits, QData lhs) { return (-((lhs)&(VL_ULL(1)<<(lbits-1)))); }
|
||||||
|
|
||||||
// Debugging prints
|
// Debugging prints
|
||||||
@@ -304,15 +304,15 @@ static inline WDataOutP VL_ASSIGN_W(int obits, WDataOutP owp,WDataInP lwp){
|
|||||||
|
|
||||||
// EMIT_RULE: VL_ASSIGNBIT: rclean=clean;
|
// EMIT_RULE: VL_ASSIGNBIT: rclean=clean;
|
||||||
static inline void VL_ASSIGNBIT_II(int, int bit, CData& lhsr, IData rhs) {
|
static inline void VL_ASSIGNBIT_II(int, int bit, CData& lhsr, IData rhs) {
|
||||||
lhsr = ((lhsr & ~(1UL<<VL_BITBIT_I(bit)))
|
lhsr = ((lhsr & ~(VL_UL(1)<<VL_BITBIT_I(bit)))
|
||||||
| (rhs<<VL_BITBIT_I(bit)));
|
| (rhs<<VL_BITBIT_I(bit)));
|
||||||
}
|
}
|
||||||
static inline void VL_ASSIGNBIT_II(int, int bit, SData& lhsr, IData rhs) {
|
static inline void VL_ASSIGNBIT_II(int, int bit, SData& lhsr, IData rhs) {
|
||||||
lhsr = ((lhsr & ~(1UL<<VL_BITBIT_I(bit)))
|
lhsr = ((lhsr & ~(VL_UL(1)<<VL_BITBIT_I(bit)))
|
||||||
| (rhs<<VL_BITBIT_I(bit)));
|
| (rhs<<VL_BITBIT_I(bit)));
|
||||||
}
|
}
|
||||||
static inline void VL_ASSIGNBIT_II(int, int bit, IData& lhsr, IData rhs) {
|
static inline void VL_ASSIGNBIT_II(int, int bit, IData& lhsr, IData rhs) {
|
||||||
lhsr = ((lhsr & ~(1UL<<VL_BITBIT_I(bit)))
|
lhsr = ((lhsr & ~(VL_UL(1)<<VL_BITBIT_I(bit)))
|
||||||
| (rhs<<VL_BITBIT_I(bit)));
|
| (rhs<<VL_BITBIT_I(bit)));
|
||||||
}
|
}
|
||||||
static inline void VL_ASSIGNBIT_QI(int, int bit, QData& lhsr, QData rhs) {
|
static inline void VL_ASSIGNBIT_QI(int, int bit, QData& lhsr, QData rhs) {
|
||||||
@@ -321,25 +321,25 @@ static inline void VL_ASSIGNBIT_QI(int, int bit, QData& lhsr, QData rhs) {
|
|||||||
}
|
}
|
||||||
static inline void VL_ASSIGNBIT_WI(int, int bit, WDataOutP owp, IData rhs) {
|
static inline void VL_ASSIGNBIT_WI(int, int bit, WDataOutP owp, IData rhs) {
|
||||||
IData orig = owp[VL_BITWORD_I(bit)];
|
IData orig = owp[VL_BITWORD_I(bit)];
|
||||||
owp[VL_BITWORD_I(bit)] = (orig & ~(1UL<<VL_BITBIT_I(bit))
|
owp[VL_BITWORD_I(bit)] = (orig & ~(VL_UL(1)<<VL_BITBIT_I(bit))
|
||||||
| (rhs<<VL_BITBIT_I(bit)));
|
| (rhs<<VL_BITBIT_I(bit)));
|
||||||
}
|
}
|
||||||
// Alternative form that is an instruction faster when rhs is constant one.
|
// Alternative form that is an instruction faster when rhs is constant one.
|
||||||
static inline void VL_ASSIGNBIT_IO(int, int bit, CData& lhsr, IData) {
|
static inline void VL_ASSIGNBIT_IO(int, int bit, CData& lhsr, IData) {
|
||||||
lhsr = (lhsr | (1UL<<VL_BITBIT_I(bit)));
|
lhsr = (lhsr | (VL_UL(1)<<VL_BITBIT_I(bit)));
|
||||||
}
|
}
|
||||||
static inline void VL_ASSIGNBIT_IO(int, int bit, SData& lhsr, IData) {
|
static inline void VL_ASSIGNBIT_IO(int, int bit, SData& lhsr, IData) {
|
||||||
lhsr = (lhsr | (1UL<<VL_BITBIT_I(bit)));
|
lhsr = (lhsr | (VL_UL(1)<<VL_BITBIT_I(bit)));
|
||||||
}
|
}
|
||||||
static inline void VL_ASSIGNBIT_IO(int, int bit, IData& lhsr, IData) {
|
static inline void VL_ASSIGNBIT_IO(int, int bit, IData& lhsr, IData) {
|
||||||
lhsr = (lhsr | (1UL<<VL_BITBIT_I(bit)));
|
lhsr = (lhsr | (VL_UL(1)<<VL_BITBIT_I(bit)));
|
||||||
}
|
}
|
||||||
static inline void VL_ASSIGNBIT_QO(int, int bit, QData& lhsr, IData) {
|
static inline void VL_ASSIGNBIT_QO(int, int bit, QData& lhsr, IData) {
|
||||||
lhsr = (lhsr | (VL_ULL(1)<<VL_BITBIT_Q(bit)));
|
lhsr = (lhsr | (VL_ULL(1)<<VL_BITBIT_Q(bit)));
|
||||||
}
|
}
|
||||||
static inline void VL_ASSIGNBIT_WO(int, int bit, WDataOutP owp, IData) {
|
static inline void VL_ASSIGNBIT_WO(int, int bit, WDataOutP owp, IData) {
|
||||||
IData orig = owp[VL_BITWORD_I(bit)];
|
IData orig = owp[VL_BITWORD_I(bit)];
|
||||||
owp[VL_BITWORD_I(bit)] = (orig | (1UL<<VL_BITBIT_I(bit)));
|
owp[VL_BITWORD_I(bit)] = (orig | (VL_UL(1)<<VL_BITBIT_I(bit)));
|
||||||
}
|
}
|
||||||
|
|
||||||
//===================================================================
|
//===================================================================
|
||||||
@@ -1164,7 +1164,7 @@ static inline IData VL_BITSEL_IWII(int, int lbits, int, int, WDataInP lwp, IData
|
|||||||
int word = VL_BITWORD_I(rd);
|
int word = VL_BITWORD_I(rd);
|
||||||
if ((int)rd>lbits) {
|
if ((int)rd>lbits) {
|
||||||
return ~0; // Spec says you can go outside the range of a array. Don't coredump if so.
|
return ~0; // Spec says you can go outside the range of a array. Don't coredump if so.
|
||||||
// We return all 1's as that's more likely to find bugs (?) then 0's.
|
// We return all 1's as that's more likely to find bugs (?) than 0's.
|
||||||
} else {
|
} else {
|
||||||
return (lwp[word]>>VL_BITBIT_I(rd));
|
return (lwp[word]>>VL_BITBIT_I(rd));
|
||||||
}
|
}
|
||||||
@@ -1288,123 +1288,60 @@ static inline WDataOutP VL_COND_WIWW(int obits, int, int, int,
|
|||||||
// VL_CONST_W_#X(int obits, WDataOutP owp, IData data0, .... IData data(#-1))
|
// VL_CONST_W_#X(int obits, WDataOutP owp, IData data0, .... IData data(#-1))
|
||||||
// Sets wide vector words to specified constant words, zeros upper data.
|
// Sets wide vector words to specified constant words, zeros upper data.
|
||||||
|
|
||||||
|
// If changing the number of functions here, also change EMITCINLINES_NUM_CONSTW
|
||||||
|
|
||||||
#define I IData
|
#define I IData
|
||||||
#define _END(obits,wordsSet) \
|
#define _END(obits,wordsSet) \
|
||||||
for(int i=(wordsSet);i<VL_WORDS_I(obits);i++) o[i] = (IData)0x0; \
|
for(int i=(wordsSet);i<VL_WORDS_I(obits);i++) o[i] = (IData)0x0; \
|
||||||
return o
|
return o
|
||||||
|
|
||||||
|
#define VL_HAVE_CONST_W_1X
|
||||||
static inline WDataOutP VL_CONST_W_1X(int obits, WDataOutP o,
|
static inline WDataOutP VL_CONST_W_1X(int obits, WDataOutP o,
|
||||||
I d0) {
|
I d0) {
|
||||||
o[0]=d0;
|
o[0]=d0;
|
||||||
_END(obits,1); }
|
_END(obits,1); }
|
||||||
|
#define VL_HAVE_CONST_W_2X
|
||||||
static inline WDataOutP VL_CONST_W_2X(int obits, WDataOutP o,
|
static inline WDataOutP VL_CONST_W_2X(int obits, WDataOutP o,
|
||||||
I d1,I d0) {
|
I d1,I d0) {
|
||||||
o[0]=d0; o[1]=d1;
|
o[0]=d0; o[1]=d1;
|
||||||
_END(obits,2); }
|
_END(obits,2); }
|
||||||
|
#define VL_HAVE_CONST_W_3X
|
||||||
static inline WDataOutP VL_CONST_W_3X(int obits, WDataOutP o,
|
static inline WDataOutP VL_CONST_W_3X(int obits, WDataOutP o,
|
||||||
I d2,I d1,I d0) {
|
I d2,I d1,I d0) {
|
||||||
o[0]=d0; o[1]=d1; o[2]=d2;
|
o[0]=d0; o[1]=d1; o[2]=d2;
|
||||||
_END(obits,3); }
|
_END(obits,3); }
|
||||||
|
#define VL_HAVE_CONST_W_4X
|
||||||
static inline WDataOutP VL_CONST_W_4X(int obits, WDataOutP o,
|
static inline WDataOutP VL_CONST_W_4X(int obits, WDataOutP o,
|
||||||
I d3,I d2,I d1,I d0) {
|
I d3,I d2,I d1,I d0) {
|
||||||
o[0]=d0; o[1]=d1; o[2]=d2; o[3]=d3;
|
o[0]=d0; o[1]=d1; o[2]=d2; o[3]=d3;
|
||||||
_END(obits,4); }
|
_END(obits,4); }
|
||||||
|
#define VL_HAVE_CONST_W_5X
|
||||||
static inline WDataOutP VL_CONST_W_5X(int obits, WDataOutP o,
|
static inline WDataOutP VL_CONST_W_5X(int obits, WDataOutP o,
|
||||||
I d4,I d3,I d2,I d1,I d0) {
|
I d4,I d3,I d2,I d1,I d0) {
|
||||||
o[0]=d0; o[1]=d1; o[2]=d2; o[3]=d3; o[4]=d4;
|
o[0]=d0; o[1]=d1; o[2]=d2; o[3]=d3; o[4]=d4;
|
||||||
_END(obits,5); }
|
_END(obits,5); }
|
||||||
|
#define VL_HAVE_CONST_W_6X
|
||||||
static inline WDataOutP VL_CONST_W_6X(int obits, WDataOutP o,
|
static inline WDataOutP VL_CONST_W_6X(int obits, WDataOutP o,
|
||||||
I d5,I d4,I d3,I d2,I d1,I d0) {
|
I d5,I d4,I d3,I d2,I d1,I d0) {
|
||||||
o[0]=d0; o[1]=d1; o[2]=d2; o[3]=d3; o[4]=d4; o[5]=d5;
|
o[0]=d0; o[1]=d1; o[2]=d2; o[3]=d3; o[4]=d4; o[5]=d5;
|
||||||
_END(obits,6); }
|
_END(obits,6); }
|
||||||
|
#define VL_HAVE_CONST_W_7X
|
||||||
static inline WDataOutP VL_CONST_W_7X(int obits, WDataOutP o,
|
static inline WDataOutP VL_CONST_W_7X(int obits, WDataOutP o,
|
||||||
I d6,I d5,I d4,I d3,I d2,I d1,I d0) {
|
I d6,I d5,I d4,I d3,I d2,I d1,I d0) {
|
||||||
o[0]=d0; o[1]=d1; o[2]=d2; o[3]=d3; o[4]=d4; o[5]=d5; o[6]=d6;
|
o[0]=d0; o[1]=d1; o[2]=d2; o[3]=d3; o[4]=d4; o[5]=d5; o[6]=d6;
|
||||||
_END(obits,7); }
|
_END(obits,7); }
|
||||||
|
#define VL_HAVE_CONST_W_8X
|
||||||
static inline WDataOutP VL_CONST_W_8X(int obits, WDataOutP o,
|
static inline WDataOutP VL_CONST_W_8X(int obits, WDataOutP o,
|
||||||
I d7,I d6,I d5,I d4,I d3,I d2,I d1,I d0) {
|
I d7,I d6,I d5,I d4,I d3,I d2,I d1,I d0) {
|
||||||
o[0]=d0; o[1]=d1; o[2]=d2; o[3]=d3; o[4]=d4; o[5]=d5; o[6]=d6; o[7]=d7;
|
o[0]=d0; o[1]=d1; o[2]=d2; o[3]=d3; o[4]=d4; o[5]=d5; o[6]=d6; o[7]=d7;
|
||||||
_END(obits,8); }
|
_END(obits,8); }
|
||||||
|
#define VL_HAVE_CONST_W_9X
|
||||||
static inline WDataOutP VL_CONST_W_9X(int obits, WDataOutP o,
|
static inline WDataOutP VL_CONST_W_9X(int obits, WDataOutP o,
|
||||||
I d8,
|
I d8,
|
||||||
I d7,I d6,I d5,I d4,I d3,I d2,I d1,I d0) {
|
I d7,I d6,I d5,I d4,I d3,I d2,I d1,I d0) {
|
||||||
o[0]=d0; o[1]=d1; o[2]=d2; o[3]=d3; o[4]=d4; o[5]=d5; o[6]=d6; o[7]=d7;
|
o[0]=d0; o[1]=d1; o[2]=d2; o[3]=d3; o[4]=d4; o[5]=d5; o[6]=d6; o[7]=d7;
|
||||||
o[8]=d8;
|
o[8]=d8;
|
||||||
_END(obits,9); }
|
_END(obits,9); }
|
||||||
static inline WDataOutP VL_CONST_W_10X(int obits, WDataOutP o,
|
|
||||||
I d9,I d8,
|
|
||||||
I d7,I d6,I d5,I d4,I d3,I d2,I d1,I d0) {
|
|
||||||
o[0]=d0; o[1]=d1; o[2]=d2; o[3]=d3; o[4]=d4; o[5]=d5; o[6]=d6; o[7]=d7;
|
|
||||||
o[8]=d8; o[9]=d9;
|
|
||||||
_END(obits,10); }
|
|
||||||
static inline WDataOutP VL_CONST_W_11X(int obits, WDataOutP o,
|
|
||||||
I d10,I d9,I d8,
|
|
||||||
I d7,I d6,I d5,I d4,I d3,I d2,I d1,I d0) {
|
|
||||||
o[0]=d0; o[1]=d1; o[2]=d2; o[3]=d3; o[4]=d4; o[5]=d5; o[6]=d6; o[7]=d7;
|
|
||||||
o[8]=d8; o[9]=d9; o[10]=d10;
|
|
||||||
_END(obits,11); }
|
|
||||||
static inline WDataOutP VL_CONST_W_12X(int obits, WDataOutP o,
|
|
||||||
I d11,I d10,I d9,I d8,
|
|
||||||
I d7,I d6,I d5,I d4,I d3,I d2,I d1,I d0) {
|
|
||||||
o[0]=d0; o[1]=d1; o[2]=d2; o[3]=d3; o[4]=d4; o[5]=d5; o[6]=d6; o[7]=d7;
|
|
||||||
o[8]=d8; o[9]=d9; o[10]=d10; o[11]=d11;
|
|
||||||
_END(obits,12); }
|
|
||||||
static inline WDataOutP VL_CONST_W_16X(int obits, WDataOutP o,
|
|
||||||
I d15,I d14,I d13,I d12,I d11,I d10,I d9,I d8,
|
|
||||||
I d7,I d6,I d5,I d4,I d3,I d2,I d1,I d0) {
|
|
||||||
o[0]=d0; o[1]=d1; o[2]=d2; o[3]=d3; o[4]=d4; o[5]=d5; o[6]=d6; o[7]=d7;
|
|
||||||
o[8]=d8; o[9]=d9; o[10]=d10; o[11]=d11; o[12]=d12; o[13]=d13; o[14]=d14; o[15]=d15;
|
|
||||||
_END(obits,16); }
|
|
||||||
static inline WDataOutP VL_CONST_W_17X(int obits, WDataOutP o,
|
|
||||||
I d16,
|
|
||||||
I d15,I d14,I d13,I d12,I d11,I d10,I d9,I d8,
|
|
||||||
I d7,I d6,I d5,I d4,I d3,I d2,I d1,I d0) {
|
|
||||||
o[0]=d0; o[1]=d1; o[2]=d2; o[3]=d3; o[4]=d4; o[5]=d5; o[6]=d6; o[7]=d7;
|
|
||||||
o[8]=d8; o[9]=d9; o[10]=d10; o[11]=d11; o[12]=d12; o[13]=d13; o[14]=d14; o[15]=d15;
|
|
||||||
o[16]=d16;
|
|
||||||
_END(obits,17); }
|
|
||||||
static inline WDataOutP VL_CONST_W_18X(int obits, WDataOutP o,
|
|
||||||
I d17,I d16,
|
|
||||||
I d15,I d14,I d13,I d12,I d11,I d10,I d9,I d8,
|
|
||||||
I d7,I d6,I d5,I d4,I d3,I d2,I d1,I d0) {
|
|
||||||
o[0]=d0; o[1]=d1; o[2]=d2; o[3]=d3; o[4]=d4; o[5]=d5; o[6]=d6; o[7]=d7;
|
|
||||||
o[8]=d8; o[9]=d9; o[10]=d10; o[11]=d11; o[12]=d12; o[13]=d13; o[14]=d14; o[15]=d15;
|
|
||||||
o[16]=d16; o[17]=d17;
|
|
||||||
_END(obits,18); }
|
|
||||||
static inline WDataOutP VL_CONST_W_19X(int obits, WDataOutP o,
|
|
||||||
I d18,I d17,I d16,
|
|
||||||
I d15,I d14,I d13,I d12,I d11,I d10,I d9,I d8,
|
|
||||||
I d7,I d6,I d5,I d4,I d3,I d2,I d1,I d0) {
|
|
||||||
o[0]=d0; o[1]=d1; o[2]=d2; o[3]=d3; o[4]=d4; o[5]=d5; o[6]=d6; o[7]=d7;
|
|
||||||
o[8]=d8; o[9]=d9; o[10]=d10; o[11]=d11; o[12]=d12; o[13]=d13; o[14]=d14; o[15]=d15;
|
|
||||||
o[16]=d16; o[17]=d17; o[18]=d18;
|
|
||||||
_END(obits,19); }
|
|
||||||
static inline WDataOutP VL_CONST_W_20X(int obits, WDataOutP o,
|
|
||||||
I d19,I d18,I d17,I d16,
|
|
||||||
I d15,I d14,I d13,I d12,I d11,I d10,I d9,I d8,
|
|
||||||
I d7,I d6,I d5,I d4,I d3,I d2,I d1,I d0) {
|
|
||||||
o[0]=d0; o[1]=d1; o[2]=d2; o[3]=d3; o[4]=d4; o[5]=d5; o[6]=d6; o[7]=d7;
|
|
||||||
o[8]=d8; o[9]=d9; o[10]=d10; o[11]=d11; o[12]=d12; o[13]=d13; o[14]=d14; o[15]=d15;
|
|
||||||
o[16]=d16; o[17]=d17; o[18]=d18; o[19]=d19;
|
|
||||||
_END(obits,20); }
|
|
||||||
static inline WDataOutP VL_CONST_W_24X(int obits, WDataOutP o,
|
|
||||||
I d23,I d22,I d21,I d20,I d19,I d18,I d17,I d16,
|
|
||||||
I d15,I d14,I d13,I d12,I d11,I d10,I d9,I d8,
|
|
||||||
I d7,I d6,I d5,I d4,I d3,I d2,I d1,I d0) {
|
|
||||||
o[0]=d0; o[1]=d1; o[2]=d2; o[3]=d3; o[4]=d4; o[5]=d5; o[6]=d6; o[7]=d7;
|
|
||||||
o[8]=d8; o[9]=d9; o[10]=d10; o[11]=d11; o[12]=d12; o[13]=d13; o[14]=d14; o[15]=d15;
|
|
||||||
o[16]=d16; o[17]=d17; o[18]=d18; o[19]=d19; o[20]=d20; o[21]=d21; o[22]=d22; o[23]=d23;
|
|
||||||
_END(obits,24); }
|
|
||||||
static inline WDataOutP VL_CONST_W_28X(int obits, WDataOutP o,
|
|
||||||
I d27,I d26,I d25,I d24,
|
|
||||||
I d23,I d22,I d21,I d20,I d19,I d18,I d17,I d16,
|
|
||||||
I d15,I d14,I d13,I d12,I d11,I d10,I d9,I d8,
|
|
||||||
I d7,I d6,I d5,I d4,I d3,I d2,I d1,I d0) {
|
|
||||||
o[0]=d0; o[1]=d1; o[2]=d2; o[3]=d3; o[4]=d4; o[5]=d5; o[6]=d6; o[7]=d7;
|
|
||||||
o[8]=d8; o[9]=d9; o[10]=d10; o[11]=d11; o[12]=d12; o[13]=d13; o[14]=d14; o[15]=d15;
|
|
||||||
o[16]=d16; o[17]=d17; o[18]=d18; o[19]=d19; o[20]=d20; o[21]=d21; o[22]=d22; o[23]=d23;
|
|
||||||
o[24]=d24; o[25]=d25; o[26]=d26; o[27]=d27;
|
|
||||||
_END(obits,28); }
|
|
||||||
|
|
||||||
#undef _END
|
#undef _END
|
||||||
#undef I
|
#undef I
|
||||||
|
|||||||
+14
-3
@@ -2,9 +2,9 @@
|
|||||||
######################################################################
|
######################################################################
|
||||||
# DESCRIPTION: Makefile commands for all verilated target files
|
# DESCRIPTION: Makefile commands for all verilated target files
|
||||||
#
|
#
|
||||||
# Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
# Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
# redistribute it and/or modify it under the terms of either the GNU
|
# redistribute it and/or modify it under the terms of either the GNU
|
||||||
# General Public License or the Perl Artistic License.
|
# Lesser General Public License or the Perl Artistic License.
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
PERL = @PERL@
|
PERL = @PERL@
|
||||||
@@ -77,7 +77,6 @@ VM_SUPPORT += $(VM_SUPPORT_FAST) $(VM_SUPPORT_SLOW)
|
|||||||
ifeq ($(VM_SP_OR_SC),1)
|
ifeq ($(VM_SP_OR_SC),1)
|
||||||
CPPFLAGS += $(SYSTEMC_CXX_FLAGS) -I$(SYSTEMC)/include
|
CPPFLAGS += $(SYSTEMC_CXX_FLAGS) -I$(SYSTEMC)/include
|
||||||
LDFLAGS += $(SYSTEMC_CXX_FLAGS) -L$(SYSTEMC)/lib-$(VM_SC_TARGET_ARCH)
|
LDFLAGS += $(SYSTEMC_CXX_FLAGS) -L$(SYSTEMC)/lib-$(VM_SC_TARGET_ARCH)
|
||||||
LIBS += -lm -lstdc++
|
|
||||||
SC_LIBS = -lsystemc
|
SC_LIBS = -lsystemc
|
||||||
ifneq ($(wildcard $(SYSTEMC)/lib-$(VM_SC_TARGET_ARCH)/*numeric_bit*),)
|
ifneq ($(wildcard $(SYSTEMC)/lib-$(VM_SC_TARGET_ARCH)/*numeric_bit*),)
|
||||||
# Systemc 1.2.1beta
|
# Systemc 1.2.1beta
|
||||||
@@ -91,6 +90,7 @@ endif
|
|||||||
ifeq ($(VM_SP),1)
|
ifeq ($(VM_SP),1)
|
||||||
CPPFLAGS += -I$(SYSTEMPERL)/src -DSYSTEMPERL
|
CPPFLAGS += -I$(SYSTEMPERL)/src -DSYSTEMPERL
|
||||||
VPATH += $(SYSTEMPERL)/src
|
VPATH += $(SYSTEMPERL)/src
|
||||||
|
LIBS += -lm -lstdc++
|
||||||
|
|
||||||
VK_CLASSES_SP = $(addsuffix .sp, $(VM_CLASSES))
|
VK_CLASSES_SP = $(addsuffix .sp, $(VM_CLASSES))
|
||||||
|
|
||||||
@@ -103,6 +103,17 @@ else
|
|||||||
preproc:
|
preproc:
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
#######################################################################
|
||||||
|
##### SystemC w/o SystemPerl builds
|
||||||
|
|
||||||
|
ifeq ($(VM_SC),1)
|
||||||
|
LIBS += -lm -lstdc++
|
||||||
|
ifeq ($(VM_TRACE),1)
|
||||||
|
CPPFLAGS += -I$(SYSTEMPERL)/src
|
||||||
|
VPATH += $(SYSTEMPERL)/src
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
##### C/H builds
|
##### C/H builds
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -5,9 +5,9 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// Lesser General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
// This is distributed in the hope that it will be useful,
|
// This is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
// $Id$ -*- C++ -*-
|
// $Id$ -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// Lesser General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
// Verilator is distributed in the hope that it will be useful,
|
// Verilator is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
@@ -46,8 +46,8 @@
|
|||||||
# define VL_ATTR_ALIGNED(alignment) ///< Align structure to specified byte alignment
|
# define VL_ATTR_ALIGNED(alignment) ///< Align structure to specified byte alignment
|
||||||
# define VL_ATTR_NORETURN ///< Function does not ever return
|
# define VL_ATTR_NORETURN ///< Function does not ever return
|
||||||
# define VL_ATTR_UNUSED ///< Function that may be never used
|
# define VL_ATTR_UNUSED ///< Function that may be never used
|
||||||
# define VL_LIKELY(x) (!!(x)) ///< Boolean expression more often true then false
|
# define VL_LIKELY(x) (!!(x)) ///< Boolean expression more often true than false
|
||||||
# define VL_UNLIKELY(x) (!!(x)) ///< Boolean expression more often false then true
|
# define VL_UNLIKELY(x) (!!(x)) ///< Boolean expression more often false than true
|
||||||
# define VL_PREFETCH_RD(p) ///< Prefetch data with read intent
|
# define VL_PREFETCH_RD(p) ///< Prefetch data with read intent
|
||||||
# define VL_PREFETCH_RW(p) ///< Prefetch data with read/write intent
|
# define VL_PREFETCH_RW(p) ///< Prefetch data with read/write intent
|
||||||
#endif
|
#endif
|
||||||
@@ -68,6 +68,9 @@
|
|||||||
# define VL_ULL(c) (c##ULL) ///< Add appropriate suffix to 64-bit constant
|
# define VL_ULL(c) (c##ULL) ///< Add appropriate suffix to 64-bit constant
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// This is not necessarily the same as #UL, depending on what the IData typedef is.
|
||||||
|
#define VL_UL(c) ((IData)(c##UL)) ///< Add appropriate suffix to 32-bit constant
|
||||||
|
|
||||||
//=========================================================================
|
//=========================================================================
|
||||||
// Basic integer types
|
// Basic integer types
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
#$Id$
|
#$Id$
|
||||||
######################################################################
|
######################################################################
|
||||||
#
|
#
|
||||||
# Copyright 2007-2007 by Wilson Snyder.
|
# Copyright 2007-2008 by Wilson Snyder.
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of either the GNU General Public License or the
|
||||||
|
|||||||
+2
-2
@@ -2,7 +2,7 @@
|
|||||||
# $Id$
|
# $Id$
|
||||||
######################################################################
|
######################################################################
|
||||||
#
|
#
|
||||||
# Copyright 2005-2007 by Wilson Snyder <[email protected]>. This
|
# Copyright 2005-2008 by Wilson Snyder <[email protected]>. This
|
||||||
# program is free software; you can redistribute it and/or modify it under
|
# program is free software; you can redistribute it and/or modify it under
|
||||||
# the terms of either the GNU Lesser General Public License or the Perl
|
# the terms of either the GNU Lesser General Public License or the Perl
|
||||||
# Artistic License.
|
# Artistic License.
|
||||||
@@ -156,7 +156,7 @@ Displays this message and program version and exits.
|
|||||||
|
|
||||||
=head1 DISTRIBUTION
|
=head1 DISTRIBUTION
|
||||||
|
|
||||||
Copyright 2005-2007 by Wilson Snyder. This package is free software; you
|
Copyright 2005-2008 by Wilson Snyder. This package is free software; you
|
||||||
can redistribute it and/or modify it under the terms of either the GNU
|
can redistribute it and/or modify it under the terms of either the GNU
|
||||||
Lesser General Public License or the Perl Artistic License.
|
Lesser General Public License or the Perl Artistic License.
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -2,7 +2,7 @@
|
|||||||
# $Id$
|
# $Id$
|
||||||
######################################################################
|
######################################################################
|
||||||
#
|
#
|
||||||
# Copyright 2005-2007 by Wilson Snyder <[email protected]>. This
|
# Copyright 2005-2008 by Wilson Snyder <[email protected]>. This
|
||||||
# program is free software; you can redistribute it and/or modify it under
|
# program is free software; you can redistribute it and/or modify it under
|
||||||
# the terms of either the GNU Lesser General Public License or the Perl
|
# the terms of either the GNU Lesser General Public License or the Perl
|
||||||
# Artistic License.
|
# Artistic License.
|
||||||
@@ -197,7 +197,7 @@ Displays this message and program version and exits.
|
|||||||
|
|
||||||
=head1 DISTRIBUTION
|
=head1 DISTRIBUTION
|
||||||
|
|
||||||
Copyright 2005-2007 by Wilson Snyder. This package is free software; you
|
Copyright 2005-2008 by Wilson Snyder. This package is free software; you
|
||||||
can redistribute it and/or modify it under the terms of either the GNU
|
can redistribute it and/or modify it under the terms of either the GNU
|
||||||
Lesser General Public License or the Perl Artistic License.
|
Lesser General Public License or the Perl Artistic License.
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# $Id$
|
# $Id$
|
||||||
######################################################################
|
######################################################################
|
||||||
#
|
#
|
||||||
# Copyright 2007-2007 by Wilson Snyder <[email protected]>. This
|
# Copyright 2007-2008 by Wilson Snyder <[email protected]>. This
|
||||||
# program is free software; you can redistribute it and/or modify it under
|
# program is free software; you can redistribute it and/or modify it under
|
||||||
# the terms of either the GNU Lesser General Public License or the Perl
|
# the terms of either the GNU Lesser General Public License or the Perl
|
||||||
# Artistic License.
|
# Artistic License.
|
||||||
@@ -52,7 +52,7 @@ invoke_ncverilog - Invoke tool under "modules" command
|
|||||||
|
|
||||||
=head1 DISTRIBUTION
|
=head1 DISTRIBUTION
|
||||||
|
|
||||||
Copyright 2007-2007 by Wilson Snyder. This package is free software; you
|
Copyright 2007-2008 by Wilson Snyder. This package is free software; you
|
||||||
can redistribute it and/or modify it under the terms of either the GNU
|
can redistribute it and/or modify it under the terms of either the GNU
|
||||||
Lesser General Public License or the Perl Artistic License.
|
Lesser General Public License or the Perl Artistic License.
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# $Id$
|
# $Id$
|
||||||
######################################################################
|
######################################################################
|
||||||
#
|
#
|
||||||
# Copyright 2005-2007 by Wilson Snyder <[email protected]>. This
|
# Copyright 2005-2008 by Wilson Snyder <[email protected]>. This
|
||||||
# program is free software; you can redistribute it and/or modify it under
|
# program is free software; you can redistribute it and/or modify it under
|
||||||
# the terms of either the GNU Lesser General Public License or the Perl
|
# the terms of either the GNU Lesser General Public License or the Perl
|
||||||
# Artistic License.
|
# Artistic License.
|
||||||
@@ -344,7 +344,7 @@ Displays this message and program version and exits.
|
|||||||
|
|
||||||
=head1 DISTRIBUTION
|
=head1 DISTRIBUTION
|
||||||
|
|
||||||
Copyright 2005-2007 by Wilson Snyder. This package is free software; you
|
Copyright 2005-2008 by Wilson Snyder. This package is free software; you
|
||||||
can redistribute it and/or modify it under the terms of either the GNU
|
can redistribute it and/or modify it under the terms of either the GNU
|
||||||
Lesser General Public License or the Perl Artistic License.
|
Lesser General Public License or the Perl Artistic License.
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -27,7 +27,7 @@ This is the Verilator Package.
|
|||||||
@node Copyright, Description, Top, Top
|
@node Copyright, Description, Top, Top
|
||||||
@section Copyright
|
@section Copyright
|
||||||
|
|
||||||
This package is Copyright 2003-2007 by Wilson Snyder @email{wsnyder@@wsnyder.org}.
|
This package is Copyright 2003-2008 by Wilson Snyder @email{wsnyder@@wsnyder.org}.
|
||||||
|
|
||||||
You may distribute under the terms of either the GNU General Public License
|
You may distribute under the terms of either the GNU General Public License
|
||||||
or the Artistic License, as specified in the Perl README file.
|
or the Artistic License, as specified in the Perl README file.
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@
|
|||||||
#
|
#
|
||||||
#*****************************************************************************
|
#*****************************************************************************
|
||||||
#
|
#
|
||||||
# Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
# Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
# redistribute it and/or modify it under the terms of either the GNU
|
# redistribute it and/or modify it under the terms of either the GNU
|
||||||
# General Public License or the Perl Artistic License.
|
# General Public License or the Perl Artistic License.
|
||||||
#
|
#
|
||||||
|
|||||||
+2
-1
@@ -7,7 +7,7 @@
|
|||||||
#
|
#
|
||||||
#*****************************************************************************
|
#*****************************************************************************
|
||||||
#
|
#
|
||||||
# Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
# Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
# redistribute it and/or modify it under the terms of either the GNU
|
# redistribute it and/or modify it under the terms of either the GNU
|
||||||
# General Public License or the Perl Artistic License.
|
# General Public License or the Perl Artistic License.
|
||||||
#
|
#
|
||||||
@@ -121,6 +121,7 @@ RAW_OBJS = \
|
|||||||
V3DepthBlock.o \
|
V3DepthBlock.o \
|
||||||
V3Descope.o \
|
V3Descope.o \
|
||||||
V3EmitC.o \
|
V3EmitC.o \
|
||||||
|
V3EmitCInlines.o \
|
||||||
V3EmitCSyms.o \
|
V3EmitCSyms.o \
|
||||||
V3EmitMk.o \
|
V3EmitMk.o \
|
||||||
V3EmitV.o \
|
V3EmitV.o \
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+4
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2005-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2005-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
@@ -63,6 +63,9 @@ private:
|
|||||||
AstNode* timesp = nodep->exprsp(); if (timesp) timesp->unlinkFrBack();
|
AstNode* timesp = nodep->exprsp(); if (timesp) timesp->unlinkFrBack();
|
||||||
timesp = timesp->addNext(new AstTime(nodep->fileline()));
|
timesp = timesp->addNext(new AstTime(nodep->fileline()));
|
||||||
nodep->exprsp(timesp);
|
nodep->exprsp(timesp);
|
||||||
|
if (!nodep->scopeNamep() && nodep->name().find("%m") != string::npos) {
|
||||||
|
nodep->scopeNamep(new AstScopeName(nodep->fileline()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AstNode* newIfAssertOn(AstNode* nodep) {
|
AstNode* newIfAssertOn(AstNode* nodep) {
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2005-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2005-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2005-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2005-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2005-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2005-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+22
-3
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
@@ -134,6 +134,7 @@ inline void AstNode::debugTreeChange(const char* prefix, int lineno, bool next)
|
|||||||
// Called on all major tree changers.
|
// Called on all major tree changers.
|
||||||
// Only for use for those really nasty bugs relating to internals
|
// Only for use for those really nasty bugs relating to internals
|
||||||
// Note this may be null.
|
// Note this may be null.
|
||||||
|
//if (debug()) cout<<"-treeChange: V3Ast.cpp:"<<lineno<<" Tree Change for "<<prefix<<": "<<(void*)this<<endl;
|
||||||
//if (debug()) {
|
//if (debug()) {
|
||||||
// cout<<"-treeChange: V3Ast.cpp:"<<lineno<<" Tree Change for "<<prefix<<endl;
|
// cout<<"-treeChange: V3Ast.cpp:"<<lineno<<" Tree Change for "<<prefix<<endl;
|
||||||
// v3Global.rootp()->dumpTree(cout,"-treeChange: ");
|
// v3Global.rootp()->dumpTree(cout,"-treeChange: ");
|
||||||
@@ -458,7 +459,7 @@ void AstNode::relink(AstNRelinker* linkerp) {
|
|||||||
if (linkerp->m_iterpp) {
|
if (linkerp->m_iterpp) {
|
||||||
// If we're iterating over a next() link, we need to follow links off the
|
// If we're iterating over a next() link, we need to follow links off the
|
||||||
// NEW node. Thus we pass iteration information via a pointer in the node.
|
// NEW node. Thus we pass iteration information via a pointer in the node.
|
||||||
// This adds a unfortunate 4 bytes to every AstNode, but is faster then passing
|
// This adds a unfortunate 4 bytes to every AstNode, but is faster than passing
|
||||||
// across every function.
|
// across every function.
|
||||||
// If anyone has a cleaner way, I'd be grateful.
|
// If anyone has a cleaner way, I'd be grateful.
|
||||||
*(linkerp->m_iterpp) = newp;
|
*(linkerp->m_iterpp) = newp;
|
||||||
@@ -586,11 +587,29 @@ void AstNode::deleteTree() {
|
|||||||
// unlinkFromBack or unlinkFromBackWithNext as appropriate before calling this.
|
// unlinkFromBack or unlinkFromBackWithNext as appropriate before calling this.
|
||||||
if (!this) return;
|
if (!this) return;
|
||||||
UASSERT(m_backp==NULL,"Delete called on node with backlink still set\n");
|
UASSERT(m_backp==NULL,"Delete called on node with backlink still set\n");
|
||||||
this->debugTreeChange("-delete: ", __LINE__, true);
|
this->debugTreeChange("-delTree: ", __LINE__, true);
|
||||||
// MUST be depth first!
|
// MUST be depth first!
|
||||||
deleteTreeIter();
|
deleteTreeIter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//======================================================================
|
||||||
|
// Memory checks
|
||||||
|
|
||||||
|
#ifdef VL_LEAK_CHECKS
|
||||||
|
void* AstNode::operator new(size_t size) {
|
||||||
|
AstNode* objp = static_cast<AstNode*>(::operator new(size));
|
||||||
|
V3Broken::addNewed(objp);
|
||||||
|
return objp;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AstNode::operator delete(void* objp, size_t size) {
|
||||||
|
if (!objp) return;
|
||||||
|
AstNode* nodep = static_cast<AstNode*>(objp);
|
||||||
|
V3Broken::deleted(nodep);
|
||||||
|
::operator delete(objp);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//======================================================================
|
//======================================================================
|
||||||
// Iterators
|
// Iterators
|
||||||
|
|
||||||
|
|||||||
+5
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
@@ -538,6 +538,10 @@ public:
|
|||||||
|
|
||||||
// CONSTRUCTORS
|
// CONSTRUCTORS
|
||||||
virtual ~AstNode();
|
virtual ~AstNode();
|
||||||
|
#ifdef VL_LEAK_CHECKS
|
||||||
|
static void* operator new(size_t size);
|
||||||
|
static void operator delete(void* obj, size_t size);
|
||||||
|
#endif
|
||||||
|
|
||||||
// CONSTANT ACCESSORS
|
// CONSTANT ACCESSORS
|
||||||
static int instrCountBranch() { return 4; } ///< Instruction cycles to branch
|
static int instrCountBranch() { return 4; } ///< Instruction cycles to branch
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+52
-6
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
@@ -1271,11 +1271,8 @@ public:
|
|||||||
bool addNewline() const { return displayType().addNewline(); } // * = Add a newline for $display
|
bool addNewline() const { return displayType().addNewline(); } // * = Add a newline for $display
|
||||||
AstNode* filep() const { return op2p(); }
|
AstNode* filep() const { return op2p(); }
|
||||||
void filep(AstNodeVarRef* nodep) { setNOp2p(nodep); }
|
void filep(AstNodeVarRef* nodep) { setNOp2p(nodep); }
|
||||||
AstNode* scopeAttrp() const { return op3p(); }
|
AstScopeName* scopeNamep() const { return op3p()->castScopeName(); }
|
||||||
AstText* scopeTextp() const { return op3p()->castText(); }
|
void scopeNamep(AstNode* nodep) { setNOp3p(nodep); }
|
||||||
void scopeAttrp(AstNode* nodep) { addOp3p(nodep); }
|
|
||||||
bool needScopeTracking() { return (displayType().needScopeTracking()
|
|
||||||
|| name().find("%m") != string::npos); }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct AstFClose : public AstNodeStmt {
|
struct AstFClose : public AstNodeStmt {
|
||||||
@@ -1726,6 +1723,22 @@ public:
|
|||||||
int dimension() const { return m_dimension; }
|
int dimension() const { return m_dimension; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct AstScopeName : public AstNode {
|
||||||
|
// For display %m
|
||||||
|
// Parents: DISPLAY
|
||||||
|
// Children: TEXT
|
||||||
|
AstScopeName(FileLine* fl)
|
||||||
|
: AstNode(fl) {}
|
||||||
|
virtual ~AstScopeName() {}
|
||||||
|
virtual AstType type() const { return AstType::SCOPENAME;}
|
||||||
|
virtual AstNode* clone() { return new AstScopeName(*this); }
|
||||||
|
virtual void accept(AstNVisitor& v, AstNUser* vup=NULL) { v.visit(this,vup); }
|
||||||
|
virtual V3Hash sameHash() const { return V3Hash(); }
|
||||||
|
virtual bool same(AstNode* samep) const { return true; }
|
||||||
|
AstText* scopeAttrp() const { return op1p()->castText(); }
|
||||||
|
void scopeAttrp(AstNode* nodep) { addOp1p(nodep); }
|
||||||
|
};
|
||||||
|
|
||||||
//======================================================================
|
//======================================================================
|
||||||
// non-ary ops
|
// non-ary ops
|
||||||
|
|
||||||
@@ -2593,6 +2606,39 @@ struct AstNeqCase : public AstNodeBiCom {
|
|||||||
virtual bool cleanLhs() {return true;} virtual bool cleanRhs() {return true;}
|
virtual bool cleanLhs() {return true;} virtual bool cleanRhs() {return true;}
|
||||||
virtual bool sizeMattersLhs() {return false;} virtual bool sizeMattersRhs() {return false;}
|
virtual bool sizeMattersLhs() {return false;} virtual bool sizeMattersRhs() {return false;}
|
||||||
};
|
};
|
||||||
|
struct AstEqWild : public AstNodeBiop {
|
||||||
|
// Note wildcard operator rhs differs from lhs
|
||||||
|
AstEqWild(FileLine* fl, AstNode* lhsp, AstNode* rhsp) : AstNodeBiop(fl, lhsp, rhsp) {
|
||||||
|
width(1,1); }
|
||||||
|
virtual ~AstEqWild() {}
|
||||||
|
virtual AstType type() const { return AstType::EQWILD;}
|
||||||
|
virtual AstNode* clone() { return new AstEqWild(*this); }
|
||||||
|
virtual void accept(AstNVisitor& v, AstNUser* vup=NULL) { v.visit(this,vup); }
|
||||||
|
virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) { out.opWildEq(lhs,rhs); }
|
||||||
|
virtual string emitVerilog() { return "%k(%l %k==? %r)"; }
|
||||||
|
virtual string emitOperator() { return "VL_EQ"; } // Until have 4 state anyways
|
||||||
|
virtual string emitSimpleOperator() { return "=="; }
|
||||||
|
virtual bool emitWordForm() { return true; }
|
||||||
|
virtual bool cleanOut() {return true;}
|
||||||
|
virtual bool cleanLhs() {return true;} virtual bool cleanRhs() {return true;}
|
||||||
|
virtual bool sizeMattersLhs() {return false;} virtual bool sizeMattersRhs() {return false;}
|
||||||
|
};
|
||||||
|
struct AstNeqWild : public AstNodeBiop {
|
||||||
|
AstNeqWild(FileLine* fl, AstNode* lhsp, AstNode* rhsp) : AstNodeBiop(fl, lhsp, rhsp) {
|
||||||
|
width(1,1); }
|
||||||
|
virtual ~AstNeqWild() {}
|
||||||
|
virtual AstType type() const { return AstType::NEQWILD;}
|
||||||
|
virtual AstNode* clone() { return new AstNeqWild(*this); }
|
||||||
|
virtual void accept(AstNVisitor& v, AstNUser* vup=NULL) { v.visit(this,vup); }
|
||||||
|
virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) { out.opWildNeq(lhs,rhs); }
|
||||||
|
virtual string emitVerilog() { return "%k(%l %k!=? %r)"; }
|
||||||
|
virtual string emitOperator() { return "VL_NEQ"; } // Until have 4 state anyways
|
||||||
|
virtual string emitSimpleOperator() { return "!="; }
|
||||||
|
virtual bool emitWordForm() { return true; }
|
||||||
|
virtual bool cleanOut() {return true;}
|
||||||
|
virtual bool cleanLhs() {return true;} virtual bool cleanRhs() {return true;}
|
||||||
|
virtual bool sizeMattersLhs() {return false;} virtual bool sizeMattersRhs() {return false;}
|
||||||
|
};
|
||||||
struct AstConcat : public AstNodeBiop {
|
struct AstConcat : public AstNodeBiop {
|
||||||
// If you're looking for {#{}}, see AstReplicate
|
// If you're looking for {#{}}, see AstReplicate
|
||||||
AstConcat(FileLine* fl, AstNode* lhsp, AstNode* rhsp) : AstNodeBiop(fl, lhsp, rhsp) {
|
AstConcat(FileLine* fl, AstNode* lhsp, AstNode* rhsp) : AstNodeBiop(fl, lhsp, rhsp) {
|
||||||
|
|||||||
+3
-3
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
@@ -131,10 +131,10 @@ private:
|
|||||||
nodep->replaceWith(newp);
|
nodep->replaceWith(newp);
|
||||||
nodep->deleteTree(); nodep=NULL;
|
nodep->deleteTree(); nodep=NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstDisplay* nodep, AstNUser*) {
|
virtual void visit(AstScopeName* nodep, AstNUser*) {
|
||||||
// If there's a %m in the display text, we add a special node that will contain the name()
|
// If there's a %m in the display text, we add a special node that will contain the name()
|
||||||
// Similar code in V3Inline
|
// Similar code in V3Inline
|
||||||
if (m_beginScope != "" && nodep->needScopeTracking()) {
|
if (m_beginScope != "") {
|
||||||
// To keep correct visual order, must add before other Text's
|
// To keep correct visual order, must add before other Text's
|
||||||
AstNode* afterp = nodep->scopeAttrp();
|
AstNode* afterp = nodep->scopeAttrp();
|
||||||
if (afterp) afterp->unlinkFrBackWithNext();
|
if (afterp) afterp->unlinkFrBackWithNext();
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+2
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
// BRANCH TRANSFORMATIONS:
|
// BRANCH TRANSFORMATIONS:
|
||||||
// At each IF/(IF else).
|
// At each IF/(IF else).
|
||||||
// Count underneath $display/$stop statements.
|
// Count underneath $display/$stop statements.
|
||||||
// If more on if then else, this branch is unlikely, or vice-versa.
|
// If more on if than else, this branch is unlikely, or vice-versa.
|
||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+103
-17
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <set>
|
#include <map>
|
||||||
|
|
||||||
#include "V3Global.h"
|
#include "V3Global.h"
|
||||||
#include "V3Broken.h"
|
#include "V3Broken.h"
|
||||||
@@ -45,19 +45,100 @@ class BrokenTable : public AstNVisitor {
|
|||||||
private:
|
private:
|
||||||
// MEMBERS
|
// MEMBERS
|
||||||
// For each node, we keep if it exists or not.
|
// For each node, we keep if it exists or not.
|
||||||
typedef set<const AstNode*> NodeSet;
|
typedef map<const AstNode*,int> NodeMap;
|
||||||
static NodeSet s_nodes; // Set of all nodes that exist
|
static NodeMap s_nodes; // Set of all nodes that exist
|
||||||
|
// BITMASK
|
||||||
|
static const int FLAG_ALLOCATED = 0x01; // new() and not delete()ed
|
||||||
|
static const int FLAG_IN_TREE = 0x02; // Is in netlist tree
|
||||||
|
static const int FLAG_LINKABLE = 0x04; // Is in netlist tree, can be linked to
|
||||||
|
static const int FLAG_LEAKED = 0x08; // Known to have been leaked
|
||||||
public:
|
public:
|
||||||
// METHODS
|
// METHODS
|
||||||
static void add(const AstNode* nodep) {
|
static void deleted(const AstNode* nodep) {
|
||||||
s_nodes.insert(nodep);
|
// Called by operator delete on any node - only if VL_LEAK_CHECKS
|
||||||
|
if (debug()) cout<<"-nodeDel: "<<(void*)(nodep)<<endl;
|
||||||
|
NodeMap::iterator iter = s_nodes.find(nodep);
|
||||||
|
if (iter==s_nodes.end() || !(iter->second & FLAG_ALLOCATED)) {
|
||||||
|
((AstNode*)(nodep))->v3fatalSrc("Deleting AstNode object that was never tracked or already deleted\n");
|
||||||
|
}
|
||||||
|
if (iter!=s_nodes.end()) s_nodes.erase(iter);
|
||||||
}
|
}
|
||||||
static bool exists(const AstNode* nodep) {
|
static void addNewed(const AstNode* nodep) {
|
||||||
NodeSet::iterator iter = s_nodes.find(nodep);
|
// Called by operator new on any node - only if VL_LEAK_CHECKS
|
||||||
return (iter != s_nodes.end());
|
if (debug()) cout<<"-nodeNew: "<<(void*)(nodep)<<endl;
|
||||||
|
NodeMap::iterator iter = s_nodes.find(nodep);
|
||||||
|
if (iter!=s_nodes.end() || (iter->second & FLAG_ALLOCATED)) {
|
||||||
|
((AstNode*)(nodep))->v3fatalSrc("Newing AstNode object that is already allocated\n");
|
||||||
|
}
|
||||||
|
if (iter == s_nodes.end()) {
|
||||||
|
s_nodes.insert(make_pair(nodep,FLAG_ALLOCATED));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
static void clear() {
|
static void addInTree(AstNode* nodep, bool linkable) {
|
||||||
|
#ifndef VL_LEAK_CHECKS
|
||||||
|
if (!linkable) return; // save some time, else the map will get huge!
|
||||||
|
#endif
|
||||||
|
NodeMap::iterator iter = s_nodes.find(nodep);
|
||||||
|
if (iter == s_nodes.end()) {
|
||||||
|
#ifdef VL_LEAK_CHECKS
|
||||||
|
nodep->v3fatalSrc("AstNode is in tree, but not allocated\n");
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
if (!(iter->second & FLAG_ALLOCATED)) {
|
||||||
|
#ifdef VL_LEAK_CHECKS
|
||||||
|
nodep->v3fatalSrc("AstNode is in tree, but not allocated\n");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
if (iter->second & FLAG_IN_TREE) {
|
||||||
|
nodep->v3fatalSrc("AstNode is already in tree at another location\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int or_flags = FLAG_IN_TREE | (linkable?FLAG_LINKABLE:0);
|
||||||
|
if (iter == s_nodes.end()) {
|
||||||
|
s_nodes.insert(make_pair(nodep,or_flags));
|
||||||
|
} else {
|
||||||
|
iter->second |= or_flags;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static bool okIfLinkedTo(const AstNode* nodep) {
|
||||||
|
// Someone has a pointer to this node. Is it kosher?
|
||||||
|
NodeMap::iterator iter = s_nodes.find(nodep);
|
||||||
|
if (iter == s_nodes.end()) return false;
|
||||||
|
#ifdef VL_LEAK_CHECKS
|
||||||
|
if (!(iter->second & FLAG_ALLOCATED)) return false;
|
||||||
|
#endif
|
||||||
|
if (!(iter->second & FLAG_IN_TREE)) return false;
|
||||||
|
if (!(iter->second & FLAG_LINKABLE)) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
static void prepForTree() {
|
||||||
|
#ifndef VL_LEAK_CHECKS
|
||||||
s_nodes.clear();
|
s_nodes.clear();
|
||||||
|
#endif
|
||||||
|
for (NodeMap::iterator it = s_nodes.begin(); it != s_nodes.end(); ++it) {
|
||||||
|
it->second &= ~FLAG_IN_TREE;
|
||||||
|
it->second &= ~FLAG_LINKABLE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void doneWithTree() {
|
||||||
|
for (int backs=0; backs<2; backs++) { // Those with backp() are probably under one leaking without
|
||||||
|
for (NodeMap::iterator it = s_nodes.begin(); it != s_nodes.end(); ++it) {
|
||||||
|
if ((it->second & FLAG_ALLOCATED)
|
||||||
|
&& !(it->second & FLAG_IN_TREE)
|
||||||
|
&& !(it->second & FLAG_LEAKED)
|
||||||
|
&& (it->first->backp() ? backs==1 : backs==0)) {
|
||||||
|
// Use only AstNode::dump instead of the virtual one, as there
|
||||||
|
// may be varp() and other cross links that are bad.
|
||||||
|
if (debug()) {
|
||||||
|
cout<<"%Error: LeakedNode"<<(it->first->backp()?"Back: ":": ");
|
||||||
|
((AstNode*)(it->first))->AstNode::dump(cout);
|
||||||
|
cout<<endl;
|
||||||
|
V3Error::incErrors();
|
||||||
|
}
|
||||||
|
it->second |= FLAG_LEAKED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
// CONSTUCTORS
|
// CONSTUCTORS
|
||||||
@@ -65,11 +146,11 @@ public:
|
|||||||
virtual ~BrokenTable() {}
|
virtual ~BrokenTable() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
BrokenTable::NodeSet BrokenTable::s_nodes;
|
BrokenTable::NodeMap BrokenTable::s_nodes;
|
||||||
|
|
||||||
bool AstNode::brokeExists() const {
|
bool AstNode::brokeExists() const {
|
||||||
// Called by node->broken() routines to do table lookup
|
// Called by node->broken() routines to do table lookup
|
||||||
return BrokenTable::exists(this);
|
return BrokenTable::okIfLinkedTo(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
//######################################################################
|
//######################################################################
|
||||||
@@ -82,9 +163,7 @@ private:
|
|||||||
// // so userp and friends may not be used
|
// // so userp and friends may not be used
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep, AstNUser*) {
|
||||||
if (nodep->maybePointedTo()) {
|
BrokenTable::addInTree(nodep, nodep->maybePointedTo());
|
||||||
BrokenTable::add(nodep);
|
|
||||||
}
|
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
@@ -127,8 +206,15 @@ public:
|
|||||||
|
|
||||||
void V3Broken::brokenAll(AstNetlist* nodep) {
|
void V3Broken::brokenAll(AstNetlist* nodep) {
|
||||||
//UINFO(9,__FUNCTION__<<": "<<endl);
|
//UINFO(9,__FUNCTION__<<": "<<endl);
|
||||||
BrokenTable::clear();
|
BrokenTable::prepForTree();
|
||||||
BrokenMarkVisitor mvisitor (nodep);
|
BrokenMarkVisitor mvisitor (nodep);
|
||||||
BrokenCheckVisitor cvisitor (nodep);
|
BrokenCheckVisitor cvisitor (nodep);
|
||||||
BrokenTable::clear();
|
BrokenTable::doneWithTree();
|
||||||
|
}
|
||||||
|
|
||||||
|
void V3Broken::addNewed(AstNode* nodep) {
|
||||||
|
BrokenTable::addNewed(nodep);
|
||||||
|
}
|
||||||
|
void V3Broken::deleted(AstNode* nodep) {
|
||||||
|
BrokenTable::deleted(nodep);
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
@@ -31,6 +31,8 @@
|
|||||||
class V3Broken {
|
class V3Broken {
|
||||||
public:
|
public:
|
||||||
static void brokenAll(AstNetlist* nodep);
|
static void brokenAll(AstNetlist* nodep);
|
||||||
|
static void addNewed(AstNode* nodep);
|
||||||
|
static void deleted(AstNode* nodep);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // Guard
|
#endif // Guard
|
||||||
|
|||||||
+10
-4
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
@@ -218,7 +218,10 @@ private:
|
|||||||
a++, b++) {
|
a++, b++) {
|
||||||
if (m_valueItem[a] != m_valueItem[b]) { same=false; break; }
|
if (m_valueItem[a] != m_valueItem[b]) { same=false; break; }
|
||||||
}
|
}
|
||||||
if (same) return tree0p;
|
if (same) {
|
||||||
|
tree1p->deleteTree(); tree1p=NULL;
|
||||||
|
return tree0p;
|
||||||
|
}
|
||||||
|
|
||||||
// Must have differing logic, so make a selection
|
// Must have differing logic, so make a selection
|
||||||
|
|
||||||
@@ -245,8 +248,7 @@ private:
|
|||||||
// CASEx(cexpr,....
|
// CASEx(cexpr,....
|
||||||
// -> tree of IF(msb, IF(msb-1, 11, 10)
|
// -> tree of IF(msb, IF(msb-1, 11, 10)
|
||||||
// IF(msb-1, 01, 00))
|
// IF(msb-1, 01, 00))
|
||||||
AstNode* cexprp = nodep->exprp();
|
AstNode* cexprp = nodep->exprp()->unlinkFrBack();
|
||||||
cexprp->unlinkFrBack();
|
|
||||||
|
|
||||||
if (debug()>=9) {
|
if (debug()>=9) {
|
||||||
for (uint32_t i=0; i<(1UL<<m_caseWidth); i++) {
|
for (uint32_t i=0; i<(1UL<<m_caseWidth); i++) {
|
||||||
@@ -264,6 +266,8 @@ private:
|
|||||||
|
|
||||||
if (ifrootp) nodep->replaceWith(ifrootp);
|
if (ifrootp) nodep->replaceWith(ifrootp);
|
||||||
else nodep->unlinkFrBack();
|
else nodep->unlinkFrBack();
|
||||||
|
nodep->deleteTree(); nodep=NULL;
|
||||||
|
cexprp->deleteTree(); cexprp=NULL;
|
||||||
if (debug()>=9) ifrootp->dumpTree(cout," _simp: ");
|
if (debug()>=9) ifrootp->dumpTree(cout," _simp: ");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -304,6 +308,7 @@ private:
|
|||||||
and2p = new AstAnd(itemp->fileline(),
|
and2p = new AstAnd(itemp->fileline(),
|
||||||
new AstConst(itemp->fileline(), numval),
|
new AstConst(itemp->fileline(), numval),
|
||||||
new AstConst(itemp->fileline(), nummask));
|
new AstConst(itemp->fileline(), nummask));
|
||||||
|
icondp->deleteTree(); icondp=NULL; iconstp=NULL;
|
||||||
} else {
|
} else {
|
||||||
// Not a caseX mask, we can simply build CASEEQ(cexpr icond)
|
// Not a caseX mask, we can simply build CASEEQ(cexpr icond)
|
||||||
and1p = cexprp->cloneTree(false);
|
and1p = cexprp->cloneTree(false);
|
||||||
@@ -320,6 +325,7 @@ private:
|
|||||||
itemp->condsp(ifexprp);
|
itemp->condsp(ifexprp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
cexprp->deleteTree(); cexprp=NULL;
|
||||||
if (!hadDefault) {
|
if (!hadDefault) {
|
||||||
// If there was no default, add a empty one, this greatly simplifies below code
|
// If there was no default, add a empty one, this greatly simplifies below code
|
||||||
// and constant propagation will just eliminate it for us later.
|
// and constant propagation will just eliminate it for us later.
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+21
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2004-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2004-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
@@ -60,6 +60,7 @@ class CastVisitor : public AstNVisitor {
|
|||||||
private:
|
private:
|
||||||
// NODE STATE
|
// NODE STATE
|
||||||
// Entire netlist:
|
// Entire netlist:
|
||||||
|
// AstNode::user() // bool. Indicates node is of known size
|
||||||
|
|
||||||
// STATE
|
// STATE
|
||||||
//int debug() { return 9; }
|
//int debug() { return 9; }
|
||||||
@@ -76,6 +77,7 @@ private:
|
|||||||
//if (debug()>8) castp->dumpTree(cout,"-castins: ");
|
//if (debug()>8) castp->dumpTree(cout,"-castins: ");
|
||||||
//
|
//
|
||||||
insureLower32Cast(castp);
|
insureLower32Cast(castp);
|
||||||
|
nodep->user(1); // Now must be of known size
|
||||||
}
|
}
|
||||||
int castSize (AstNode* nodep) {
|
int castSize (AstNode* nodep) {
|
||||||
if (nodep->isQuad()) return VL_QUADSIZE;
|
if (nodep->isQuad()) return VL_QUADSIZE;
|
||||||
@@ -84,7 +86,8 @@ private:
|
|||||||
else return VL_WORDSIZE;
|
else return VL_WORDSIZE;
|
||||||
}
|
}
|
||||||
void insureCast(AstNode* nodep) {
|
void insureCast(AstNode* nodep) {
|
||||||
if (castSize(nodep->backp()) != castSize(nodep)) {
|
if (castSize(nodep->backp()) != castSize(nodep)
|
||||||
|
|| !nodep->user()) {
|
||||||
insertCast(nodep, castSize(nodep->backp()));
|
insertCast(nodep, castSize(nodep->backp()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -102,15 +105,21 @@ private:
|
|||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNodeUniop* nodep, AstNUser*) {
|
virtual void visit(AstNodeUniop* nodep, AstNUser*) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
|
nodep->user(nodep->lhsp()->user());
|
||||||
if (nodep->sizeMattersLhs()) insureCast(nodep->lhsp());
|
if (nodep->sizeMattersLhs()) insureCast(nodep->lhsp());
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeBiop* nodep, AstNUser*) {
|
virtual void visit(AstNodeBiop* nodep, AstNUser*) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
|
nodep->user(nodep->lhsp()->user()
|
||||||
|
| nodep->rhsp()->user());
|
||||||
if (nodep->sizeMattersLhs()) insureCast(nodep->lhsp());
|
if (nodep->sizeMattersLhs()) insureCast(nodep->lhsp());
|
||||||
if (nodep->sizeMattersRhs()) insureCast(nodep->rhsp());
|
if (nodep->sizeMattersRhs()) insureCast(nodep->rhsp());
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeTriop* nodep, AstNUser*) {
|
virtual void visit(AstNodeTriop* nodep, AstNUser*) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
|
nodep->user(nodep->lhsp()->user()
|
||||||
|
| nodep->rhsp()->user()
|
||||||
|
| nodep->thsp()->user());
|
||||||
if (nodep->sizeMattersLhs()) insureCast(nodep->lhsp());
|
if (nodep->sizeMattersLhs()) insureCast(nodep->lhsp());
|
||||||
if (nodep->sizeMattersRhs()) insureCast(nodep->rhsp());
|
if (nodep->sizeMattersRhs()) insureCast(nodep->rhsp());
|
||||||
if (nodep->sizeMattersThs()) insureCast(nodep->thsp());
|
if (nodep->sizeMattersThs()) insureCast(nodep->thsp());
|
||||||
@@ -118,9 +127,11 @@ private:
|
|||||||
virtual void visit(AstCast* nodep, AstNUser*) {
|
virtual void visit(AstCast* nodep, AstNUser*) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
insureLower32Cast(nodep);
|
insureLower32Cast(nodep);
|
||||||
|
nodep->user(1);
|
||||||
}
|
}
|
||||||
virtual void visit(AstUnaryMin* nodep, AstNUser*) {
|
virtual void visit(AstUnaryMin* nodep, AstNUser*) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
|
nodep->user(nodep->lhsp()->user());
|
||||||
if (nodep->lhsp()->widthMin()==1) {
|
if (nodep->lhsp()->widthMin()==1) {
|
||||||
// We want to avoid a GCC "converting of negative value" warning
|
// We want to avoid a GCC "converting of negative value" warning
|
||||||
// from our expansion of
|
// from our expansion of
|
||||||
@@ -140,6 +151,13 @@ private:
|
|||||||
// CData x=3; out = (QData)(x<<30);
|
// CData x=3; out = (QData)(x<<30);
|
||||||
insertCast (nodep, castSize(nodep));
|
insertCast (nodep, castSize(nodep));
|
||||||
}
|
}
|
||||||
|
nodep->user(1);
|
||||||
|
}
|
||||||
|
virtual void visit(AstConst* nodep, AstNUser*) {
|
||||||
|
// Constants are of unknown size if smaller than 33 bits, becase
|
||||||
|
// we're too lazy to wrap every constant in the universe in
|
||||||
|
// ((IData)#).
|
||||||
|
nodep->user(nodep->isQuad() || nodep->isWide());
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOPs
|
// NOPs
|
||||||
@@ -154,6 +172,7 @@ private:
|
|||||||
public:
|
public:
|
||||||
// CONSTUCTORS
|
// CONSTUCTORS
|
||||||
CastVisitor(AstNetlist* nodep) {
|
CastVisitor(AstNetlist* nodep) {
|
||||||
|
AstNode::userClearTree();
|
||||||
nodep->accept(*this);
|
nodep->accept(*this);
|
||||||
}
|
}
|
||||||
virtual ~CastVisitor() {}
|
virtual ~CastVisitor() {}
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2004-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2004-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+4
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
@@ -196,6 +196,9 @@ private:
|
|||||||
virtual void visit(AstText* nodep, AstNUser*) {
|
virtual void visit(AstText* nodep, AstNUser*) {
|
||||||
setClean (nodep, true);
|
setClean (nodep, true);
|
||||||
}
|
}
|
||||||
|
virtual void visit(AstScopeName* nodep, AstNUser*) {
|
||||||
|
setClean (nodep, true);
|
||||||
|
}
|
||||||
virtual void visit(AstSel* nodep, AstNUser*) {
|
virtual void visit(AstSel* nodep, AstNUser*) {
|
||||||
operandTriop(nodep);
|
operandTriop(nodep);
|
||||||
setClean (nodep, nodep->cleanOut());
|
setClean (nodep, nodep->cleanOut());
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+81
-6
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
@@ -384,6 +384,8 @@ private:
|
|||||||
int shift1 = shift1p->castConst()->asInt(); if (lhsp->castShiftR()) shift1=-shift1;
|
int shift1 = shift1p->castConst()->asInt(); if (lhsp->castShiftR()) shift1=-shift1;
|
||||||
int shift2 = shift2p->castConst()->asInt(); if (nodep->castShiftR()) shift2=-shift2;
|
int shift2 = shift2p->castConst()->asInt(); if (nodep->castShiftR()) shift2=-shift2;
|
||||||
int newshift = shift1+shift2;
|
int newshift = shift1+shift2;
|
||||||
|
shift1p->deleteTree(); shift1p=NULL;
|
||||||
|
shift2p->deleteTree(); shift1p=NULL;
|
||||||
AstNode* newp;
|
AstNode* newp;
|
||||||
V3Number mask1 (nodep->fileline(), nodep->width());
|
V3Number mask1 (nodep->fileline(), nodep->width());
|
||||||
V3Number ones (nodep->fileline(), nodep->width());
|
V3Number ones (nodep->fileline(), nodep->width());
|
||||||
@@ -524,7 +526,8 @@ private:
|
|||||||
if (debug()>=9) asn1p->dumpTree(cout," _new: ");
|
if (debug()>=9) asn1p->dumpTree(cout," _new: ");
|
||||||
if (debug()>=9) asn2p->dumpTree(cout," _new: ");
|
if (debug()>=9) asn2p->dumpTree(cout," _new: ");
|
||||||
// Cleanup
|
// Cleanup
|
||||||
nodep->unlinkFrBack()->deleteTree();
|
nodep->unlinkFrBack()->deleteTree(); nodep=NULL;
|
||||||
|
conp->deleteTree(); conp=NULL;
|
||||||
// Further reduce, either node may have more reductions.
|
// Further reduce, either node may have more reductions.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -637,6 +640,7 @@ private:
|
|||||||
// If bp was a concat, then we have this exact same form again!
|
// If bp was a concat, then we have this exact same form again!
|
||||||
// Recurse rather then calling node->iterate to prevent 2^n recursion!
|
// Recurse rather then calling node->iterate to prevent 2^n recursion!
|
||||||
if (operandConcatMove(abConcp)) moveConcat(abConcp);
|
if (operandConcatMove(abConcp)) moveConcat(abConcp);
|
||||||
|
bcConcp->deleteTree(); bcConcp=NULL;
|
||||||
} else {
|
} else {
|
||||||
AstConcat* abConcp = nodep->lhsp()->castConcat(); abConcp->unlinkFrBack();
|
AstConcat* abConcp = nodep->lhsp()->castConcat(); abConcp->unlinkFrBack();
|
||||||
AstNode* ap = abConcp->lhsp()->unlinkFrBack();
|
AstNode* ap = abConcp->lhsp()->unlinkFrBack();
|
||||||
@@ -647,6 +651,7 @@ private:
|
|||||||
nodep->lhsp(ap);
|
nodep->lhsp(ap);
|
||||||
nodep->rhsp(bcConcp);
|
nodep->rhsp(bcConcp);
|
||||||
if (operandConcatMove(bcConcp)) moveConcat(bcConcp);
|
if (operandConcatMove(bcConcp)) moveConcat(bcConcp);
|
||||||
|
abConcp->deleteTree(); abConcp=NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -677,6 +682,8 @@ private:
|
|||||||
if (lsb1p->castConst() && lsb2p->castConst()) {
|
if (lsb1p->castConst() && lsb2p->castConst()) {
|
||||||
newlsbp = new AstConst(lsb1p->fileline(),
|
newlsbp = new AstConst(lsb1p->fileline(),
|
||||||
lsb1p->castConst()->asInt() + lsb2p->castConst()->asInt());
|
lsb1p->castConst()->asInt() + lsb2p->castConst()->asInt());
|
||||||
|
lsb1p->deleteTree(); lsb1p=NULL;
|
||||||
|
lsb2p->deleteTree(); lsb2p=NULL;
|
||||||
} else {
|
} else {
|
||||||
// Width is important, we need the width of the fromp's
|
// Width is important, we need the width of the fromp's
|
||||||
// expression, not the potentially smaller lsb1p's width
|
// expression, not the potentially smaller lsb1p's width
|
||||||
@@ -802,7 +809,12 @@ private:
|
|||||||
if (nodep->sensp()->castConst()
|
if (nodep->sensp()->castConst()
|
||||||
|| (nodep->varrefp() && nodep->varrefp()->varp()->isParam())) {
|
|| (nodep->varrefp() && nodep->varrefp()->varp()->isParam())) {
|
||||||
// Constants in sensitivity lists may be removed (we'll simplify later)
|
// Constants in sensitivity lists may be removed (we'll simplify later)
|
||||||
AstSenItem* newp = new AstSenItem(nodep->fileline(), AstSenItem::Never());
|
AstSenItem* newp;
|
||||||
|
if (nodep->isClocked()) { // A constant can never get a pos/negexge
|
||||||
|
newp = new AstSenItem(nodep->fileline(), AstSenItem::Never());
|
||||||
|
} else { // Otherwise it may compute a result that needs to settle out
|
||||||
|
newp = new AstSenItem(nodep->fileline(), AstSenItem::Combo());
|
||||||
|
}
|
||||||
nodep->replaceWith(newp);
|
nodep->replaceWith(newp);
|
||||||
nodep->deleteTree(); nodep=NULL;
|
nodep->deleteTree(); nodep=NULL;
|
||||||
} else if (nodep->sensp()->castNot()) {
|
} else if (nodep->sensp()->castNot()) {
|
||||||
@@ -855,7 +867,7 @@ private:
|
|||||||
new AstAssign(nodep->fileline(),
|
new AstAssign(nodep->fileline(),
|
||||||
varrefp, exprp));
|
varrefp, exprp));
|
||||||
m_modp->addStmtp(newinitp);
|
m_modp->addStmtp(newinitp);
|
||||||
nodep->unlinkFrBack(); nodep=NULL;
|
nodep->unlinkFrBack()->deleteTree(); nodep=NULL;
|
||||||
// Set the initial value right in the variable so we can constant propagate
|
// Set the initial value right in the variable so we can constant propagate
|
||||||
AstNode* initvaluep = exprp->cloneTree(false);
|
AstNode* initvaluep = exprp->cloneTree(false);
|
||||||
varrefp->varp()->initp(initvaluep);
|
varrefp->varp()->initp(initvaluep);
|
||||||
@@ -938,6 +950,63 @@ private:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void visit(AstDisplay* nodep, AstNUser*) {
|
||||||
|
// Substitute constants into displays. The main point of this is to
|
||||||
|
// simplify assertion methodologies which call functions with display's.
|
||||||
|
// This eliminates a pile of wide temps, and makes the C a whole lot more readable.
|
||||||
|
nodep->iterateChildren(*this);
|
||||||
|
bool anyconst = false;
|
||||||
|
for (AstNode* argp = nodep->exprsp(); argp; argp=argp->nextp()) {
|
||||||
|
if (argp->castConst()) { anyconst=true; break; }
|
||||||
|
}
|
||||||
|
if (anyconst) {
|
||||||
|
//UINFO(9," Display in "<<nodep->text()<<endl);
|
||||||
|
string dispout = "";
|
||||||
|
string fmt = "";
|
||||||
|
bool inPct = false;
|
||||||
|
AstNode* argp = nodep->exprsp();
|
||||||
|
for (const char* inp = nodep->text().c_str(); *inp; inp++) {
|
||||||
|
char ch = *inp; // Breaks with iterators...
|
||||||
|
if (!inPct && ch=='%') {
|
||||||
|
inPct = true;
|
||||||
|
fmt = ch;
|
||||||
|
} else if (inPct && isdigit(ch)) {
|
||||||
|
fmt += ch;
|
||||||
|
} else if (inPct) {
|
||||||
|
inPct = false;
|
||||||
|
fmt += ch;
|
||||||
|
switch (tolower(ch)) {
|
||||||
|
case '%': break; // %% - just output a %
|
||||||
|
case 'm': break; // %m - auto insert "name"
|
||||||
|
default: // Most operators, just move to next argument
|
||||||
|
if (argp) {
|
||||||
|
AstNode* nextp=argp->nextp();
|
||||||
|
if (argp && argp->castConst()) { // Convert it
|
||||||
|
string out = argp->castConst()->num().displayed(fmt);
|
||||||
|
UINFO(9," DispConst: "<<fmt<<" -> "<<out<<" for "<<argp<<endl);
|
||||||
|
{ // fmt = out w/ replace % with %% as it must be literal.
|
||||||
|
fmt = "";
|
||||||
|
for (string::iterator pos = out.begin(); pos != out.end(); pos++) {
|
||||||
|
if (*pos == '%') fmt += '%';
|
||||||
|
fmt += *pos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
argp->unlinkFrBack()->deleteTree();
|
||||||
|
}
|
||||||
|
argp=nextp;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
} // switch
|
||||||
|
dispout += fmt;
|
||||||
|
} else {
|
||||||
|
dispout += ch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nodep->text(dispout);
|
||||||
|
//UINFO(9," Display out "<<nodep->text()<<endl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
virtual void visit(AstWhile* nodep, AstNUser*) {
|
virtual void visit(AstWhile* nodep, AstNUser*) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (nodep->condp()->isZero()) {
|
if (nodep->condp()->isZero()) {
|
||||||
@@ -954,7 +1023,7 @@ private:
|
|||||||
// Below lines are magic expressions processed by astgen
|
// Below lines are magic expressions processed by astgen
|
||||||
// "AstNODETYPE { # bracket not paren
|
// "AstNODETYPE { # bracket not paren
|
||||||
// $accessor_name, ...
|
// $accessor_name, ...
|
||||||
// # ,, gets replaced with a , rather then &&
|
// # ,, gets replaced with a , rather than &&
|
||||||
// }" # bracket not paren
|
// }" # bracket not paren
|
||||||
// ,"function to call"
|
// ,"function to call"
|
||||||
// or ,"AstREPLACEMENT_TYPE{ $accessor }"
|
// or ,"AstREPLACEMENT_TYPE{ $accessor }"
|
||||||
@@ -1048,6 +1117,10 @@ private:
|
|||||||
TREEOP ("AstLogNot{$lhsp.castEqCase}", "AstNeqCase{$lhsp->op1p(),$lhsp->op2p()}");
|
TREEOP ("AstLogNot{$lhsp.castEqCase}", "AstNeqCase{$lhsp->op1p(),$lhsp->op2p()}");
|
||||||
TREEOPV("AstNot {$lhsp.castNeqCase, $lhsp.width1}","AstEqCase {$lhsp->op1p(),$lhsp->op2p()}");
|
TREEOPV("AstNot {$lhsp.castNeqCase, $lhsp.width1}","AstEqCase {$lhsp->op1p(),$lhsp->op2p()}");
|
||||||
TREEOP ("AstLogNot{$lhsp.castNeqCase}", "AstEqCase {$lhsp->op1p(),$lhsp->op2p()}");
|
TREEOP ("AstLogNot{$lhsp.castNeqCase}", "AstEqCase {$lhsp->op1p(),$lhsp->op2p()}");
|
||||||
|
TREEOPV("AstNot {$lhsp.castEqWild, $lhsp.width1}","AstNeqWild{$lhsp->op1p(),$lhsp->op2p()}");
|
||||||
|
TREEOP ("AstLogNot{$lhsp.castEqWild}", "AstNeqWild{$lhsp->op1p(),$lhsp->op2p()}");
|
||||||
|
TREEOPV("AstNot {$lhsp.castNeqWild, $lhsp.width1}","AstEqWild {$lhsp->op1p(),$lhsp->op2p()}");
|
||||||
|
TREEOP ("AstLogNot{$lhsp.castNeqWild}", "AstEqWild {$lhsp->op1p(),$lhsp->op2p()}");
|
||||||
TREEOPV("AstNot {$lhsp.castEq, $lhsp.width1}", "AstNeq {$lhsp->op1p(),$lhsp->op2p()}");
|
TREEOPV("AstNot {$lhsp.castEq, $lhsp.width1}", "AstNeq {$lhsp->op1p(),$lhsp->op2p()}");
|
||||||
TREEOP ("AstLogNot{$lhsp.castEq}", "AstNeq {$lhsp->op1p(),$lhsp->op2p()}");
|
TREEOP ("AstLogNot{$lhsp.castEq}", "AstNeq {$lhsp->op1p(),$lhsp->op2p()}");
|
||||||
TREEOPV("AstNot {$lhsp.castNeq, $lhsp.width1}", "AstEq {$lhsp->op1p(),$lhsp->op2p()}");
|
TREEOPV("AstNot {$lhsp.castNeq, $lhsp.width1}", "AstEq {$lhsp->op1p(),$lhsp->op2p()}");
|
||||||
@@ -1089,6 +1162,7 @@ private:
|
|||||||
TREEOP("AstXor {operandsSame($lhsp,,$rhsp)}", "replaceZero(nodep)");
|
TREEOP("AstXor {operandsSame($lhsp,,$rhsp)}", "replaceZero(nodep)");
|
||||||
TREEOP("AstEq {operandsSame($lhsp,,$rhsp)}", "replaceNum(nodep,1)"); // We let X==X -> 1, although in a true 4-state sim it's X.
|
TREEOP("AstEq {operandsSame($lhsp,,$rhsp)}", "replaceNum(nodep,1)"); // We let X==X -> 1, although in a true 4-state sim it's X.
|
||||||
TREEOP("AstEqCase {operandsSame($lhsp,,$rhsp)}", "replaceNum(nodep,1)");
|
TREEOP("AstEqCase {operandsSame($lhsp,,$rhsp)}", "replaceNum(nodep,1)");
|
||||||
|
TREEOP("AstEqWild {operandsSame($lhsp,,$rhsp)}", "replaceNum(nodep,1)");
|
||||||
TREEOP("AstGt {operandsSame($lhsp,,$rhsp)}", "replaceZero(nodep)");
|
TREEOP("AstGt {operandsSame($lhsp,,$rhsp)}", "replaceZero(nodep)");
|
||||||
TREEOP("AstGtS {operandsSame($lhsp,,$rhsp)}", "replaceZero(nodep)");
|
TREEOP("AstGtS {operandsSame($lhsp,,$rhsp)}", "replaceZero(nodep)");
|
||||||
TREEOP("AstGte {operandsSame($lhsp,,$rhsp)}", "replaceNum(nodep,1)");
|
TREEOP("AstGte {operandsSame($lhsp,,$rhsp)}", "replaceNum(nodep,1)");
|
||||||
@@ -1099,6 +1173,7 @@ private:
|
|||||||
TREEOP("AstLteS {operandsSame($lhsp,,$rhsp)}", "replaceNum(nodep,1)");
|
TREEOP("AstLteS {operandsSame($lhsp,,$rhsp)}", "replaceNum(nodep,1)");
|
||||||
TREEOP("AstNeq {operandsSame($lhsp,,$rhsp)}", "replaceZero(nodep)");
|
TREEOP("AstNeq {operandsSame($lhsp,,$rhsp)}", "replaceZero(nodep)");
|
||||||
TREEOP("AstNeqCase{operandsSame($lhsp,,$rhsp)}", "replaceZero(nodep)");
|
TREEOP("AstNeqCase{operandsSame($lhsp,,$rhsp)}", "replaceZero(nodep)");
|
||||||
|
TREEOP("AstNeqWild{operandsSame($lhsp,,$rhsp)}", "replaceZero(nodep)");
|
||||||
TREEOP("AstLogAnd {operandsSame($lhsp,,$rhsp), $lhsp.width1}", "replaceWLhs(nodep)");
|
TREEOP("AstLogAnd {operandsSame($lhsp,,$rhsp), $lhsp.width1}", "replaceWLhs(nodep)");
|
||||||
TREEOP("AstLogOr {operandsSame($lhsp,,$rhsp), $lhsp.width1}", "replaceWLhs(nodep)");
|
TREEOP("AstLogOr {operandsSame($lhsp,,$rhsp), $lhsp.width1}", "replaceWLhs(nodep)");
|
||||||
///=== Verilog operators
|
///=== Verilog operators
|
||||||
@@ -1129,7 +1204,7 @@ private:
|
|||||||
TREEOPV("AstRedXor{$lhsp->castExtend()}", "AstRedXor{$lhsp->castExtend()->lhsp()}");
|
TREEOPV("AstRedXor{$lhsp->castExtend()}", "AstRedXor{$lhsp->castExtend()->lhsp()}");
|
||||||
TREEOPV("AstOneHot{$lhsp.width1}", "replaceWLhs(nodep)");
|
TREEOPV("AstOneHot{$lhsp.width1}", "replaceWLhs(nodep)");
|
||||||
TREEOPV("AstOneHot0{$lhsp.width1}", "replaceNum(nodep,1)");
|
TREEOPV("AstOneHot0{$lhsp.width1}", "replaceNum(nodep,1)");
|
||||||
// Binary AND/OR is faster then logical and/or (usually)
|
// Binary AND/OR is faster than logical and/or (usually)
|
||||||
TREEOPV("AstLogAnd{$lhsp.width1, $rhsp.width1}", "AstAnd{$lhsp,$rhsp}");
|
TREEOPV("AstLogAnd{$lhsp.width1, $rhsp.width1}", "AstAnd{$lhsp,$rhsp}");
|
||||||
TREEOPV("AstLogOr {$lhsp.width1, $rhsp.width1}", "AstOr{$lhsp,$rhsp}");
|
TREEOPV("AstLogOr {$lhsp.width1, $rhsp.width1}", "AstOr{$lhsp,$rhsp}");
|
||||||
TREEOPV("AstLogNot{$lhsp.width1}", "AstNot{$lhsp}");
|
TREEOPV("AstLogNot{$lhsp.width1}", "AstNot{$lhsp}");
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+13
-14
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
@@ -110,18 +110,6 @@ private:
|
|||||||
}
|
}
|
||||||
AstVarScope* createVarSc(AstVarScope* oldvarscp, string name, int width/*0==fromoldvar*/) {
|
AstVarScope* createVarSc(AstVarScope* oldvarscp, string name, int width/*0==fromoldvar*/) {
|
||||||
// Because we've already scoped it, we may need to add both the AstVar and the AstVarScope
|
// Because we've already scoped it, we may need to add both the AstVar and the AstVarScope
|
||||||
AstRange* rangep = NULL;
|
|
||||||
if (width==0) {
|
|
||||||
rangep = new AstRange(oldvarscp->fileline(),
|
|
||||||
oldvarscp->varp()->msb(),
|
|
||||||
oldvarscp->varp()->lsb());
|
|
||||||
} else if (width==1) {
|
|
||||||
rangep = NULL;
|
|
||||||
} else {
|
|
||||||
rangep = new AstRange(oldvarscp->fileline(),
|
|
||||||
width-1, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!oldvarscp->scopep()) oldvarscp->v3fatalSrc("Var unscoped");
|
if (!oldvarscp->scopep()) oldvarscp->v3fatalSrc("Var unscoped");
|
||||||
AstVar* varp;
|
AstVar* varp;
|
||||||
AstModule* addmodp = oldvarscp->scopep()->modp();
|
AstModule* addmodp = oldvarscp->scopep()->modp();
|
||||||
@@ -131,6 +119,17 @@ private:
|
|||||||
// Created module's AstVar earlier under some other scope
|
// Created module's AstVar earlier under some other scope
|
||||||
varp = iter->second;
|
varp = iter->second;
|
||||||
} else {
|
} else {
|
||||||
|
AstRange* rangep = NULL;
|
||||||
|
if (width==0) {
|
||||||
|
rangep = new AstRange(oldvarscp->fileline(),
|
||||||
|
oldvarscp->varp()->msb(),
|
||||||
|
oldvarscp->varp()->lsb());
|
||||||
|
} else if (width==1) {
|
||||||
|
rangep = NULL;
|
||||||
|
} else {
|
||||||
|
rangep = new AstRange(oldvarscp->fileline(),
|
||||||
|
width-1, 0);
|
||||||
|
}
|
||||||
varp = new AstVar (oldvarscp->fileline(), AstVarType::BLOCKTEMP, name, rangep);
|
varp = new AstVar (oldvarscp->fileline(), AstVarType::BLOCKTEMP, name, rangep);
|
||||||
if (width==0) varp->widthSignedFrom(oldvarscp);
|
if (width==0) varp->widthSignedFrom(oldvarscp);
|
||||||
addmodp->addStmtp(varp);
|
addmodp->addStmtp(varp);
|
||||||
@@ -226,7 +225,7 @@ private:
|
|||||||
|
|
||||||
if (nodep->user5p()) {
|
if (nodep->user5p()) {
|
||||||
// Simplistic optimization. If the previous statement in same scope was also a =>,
|
// Simplistic optimization. If the previous statement in same scope was also a =>,
|
||||||
// then we told this nodep->user5 we can use its Vdlyvset rather then making a new one.
|
// then we told this nodep->user5 we can use its Vdlyvset rather than making a new one.
|
||||||
// This is good for code like:
|
// This is good for code like:
|
||||||
// for (i=0; i<5; i++) vector[i] <= something;
|
// for (i=0; i<5; i++) vector[i] <= something;
|
||||||
sharedVset = true;
|
sharedVset = true;
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+23
-12
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
@@ -254,7 +254,7 @@ public:
|
|||||||
virtual void visit(AstReadMem* nodep, AstNUser*) {
|
virtual void visit(AstReadMem* nodep, AstNUser*) {
|
||||||
puts("VL_READMEM_");
|
puts("VL_READMEM_");
|
||||||
emitIQW(nodep->filenamep());
|
emitIQW(nodep->filenamep());
|
||||||
puts(" ("); // We take a void* rather then emitIQW(nodep->memp());
|
puts(" ("); // We take a void* rather than emitIQW(nodep->memp());
|
||||||
puts(nodep->isHex()?"true":"false");
|
puts(nodep->isHex()?"true":"false");
|
||||||
putbs(",");
|
putbs(",");
|
||||||
puts(cvtToStr(nodep->memp()->widthMin())); // Need real storage width
|
puts(cvtToStr(nodep->memp()->widthMin())); // Need real storage width
|
||||||
@@ -388,7 +388,7 @@ public:
|
|||||||
}
|
}
|
||||||
virtual void visit(AstMulS* nodep, AstNUser* vup) {
|
virtual void visit(AstMulS* nodep, AstNUser* vup) {
|
||||||
if (nodep->widthWords() > VL_MULS_MAX_WORDS) {
|
if (nodep->widthWords() > VL_MULS_MAX_WORDS) {
|
||||||
nodep->v3error("Signed multiply of "<<nodep->width()<<" bits exceeds hardcoded limit VL_MULS_MAX_WORDS in verilatedos.h\n");
|
nodep->v3error("Unsupported: Signed multiply of "<<nodep->width()<<" bits exceeds hardcoded limit VL_MULS_MAX_WORDS in verilatedos.h\n");
|
||||||
}
|
}
|
||||||
visit(nodep->castNodeBiop(), vup);
|
visit(nodep->castNodeBiop(), vup);
|
||||||
}
|
}
|
||||||
@@ -1052,16 +1052,17 @@ void EmitCStmts::visit(AstDisplay* nodep, AstNUser*) {
|
|||||||
// Spec: h d o b c l
|
// Spec: h d o b c l
|
||||||
case 'b': displayArg(nodep,&elistp,fmt,'b'); break;
|
case 'b': displayArg(nodep,&elistp,fmt,'b'); break;
|
||||||
case 'c': displayArg(nodep,&elistp,fmt,'c'); break;
|
case 'c': displayArg(nodep,&elistp,fmt,'c'); break;
|
||||||
|
case 't':
|
||||||
case 'd': displayArg(nodep,&elistp,fmt,'u'); break; // Unsigned decimal
|
case 'd': displayArg(nodep,&elistp,fmt,'u'); break; // Unsigned decimal
|
||||||
case 'o': displayArg(nodep,&elistp,fmt,'o'); break;
|
case 'o': displayArg(nodep,&elistp,fmt,'o'); break;
|
||||||
case 'h':
|
case 'h':
|
||||||
case 'x': displayArg(nodep,&elistp,fmt,'x'); break;
|
case 'x': displayArg(nodep,&elistp,fmt,'x'); break;
|
||||||
case 's': displayArg(nodep,&elistp,fmt,'s'); break;
|
case 's': displayArg(nodep,&elistp,fmt,'s'); break;
|
||||||
case 't': displayArg(nodep,&elistp,fmt,'u'); break;
|
|
||||||
case 'm': {
|
case 'm': {
|
||||||
emitDispState.pushFormat("%s");
|
emitDispState.pushFormat("%s");
|
||||||
emitDispState.pushArg(NULL, "vlSymsp->name(");
|
emitDispState.pushArg(NULL, "vlSymsp->name(");
|
||||||
for (AstText* textp=nodep->scopeTextp(); textp; textp=textp->nextp()->castText()) {
|
if (!nodep->scopeNamep()) nodep->v3fatalSrc("Display with %m but no AstScopeName");
|
||||||
|
for (AstText* textp=nodep->scopeNamep()->scopeAttrp(); textp; textp=textp->nextp()->castText()) {
|
||||||
emitDispState.pushFormat(textp->text());
|
emitDispState.pushFormat(textp->text());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1213,7 +1214,7 @@ void EmitCImp::emitConfigureImp(AstModule* modp) {
|
|||||||
void EmitCImp::emitCoverageImp(AstModule* modp) {
|
void EmitCImp::emitCoverageImp(AstModule* modp) {
|
||||||
if (m_coverIds.size()) {
|
if (m_coverIds.size()) {
|
||||||
puts("\n// Coverage\n");
|
puts("\n// Coverage\n");
|
||||||
// Rather then putting out SP_COVER_INSERT calls directly, we do it via this function
|
// Rather than putting out SP_COVER_INSERT calls directly, we do it via this function
|
||||||
// This gets around gcc slowness constructing all of the template arguments
|
// This gets around gcc slowness constructing all of the template arguments
|
||||||
puts("void "+modClassName(m_modp)+"::__vlCoverInsert(SpZeroed<uint32_t>* countp, const char* filename, int lineno, int column,\n");
|
puts("void "+modClassName(m_modp)+"::__vlCoverInsert(SpZeroed<uint32_t>* countp, const char* filename, int lineno, int column,\n");
|
||||||
puts( "const char* hier, const char* type, const char* comment) {\n");
|
puts( "const char* hier, const char* type, const char* comment) {\n");
|
||||||
@@ -1427,6 +1428,9 @@ void EmitCImp::emitInt(AstModule* modp) {
|
|||||||
if (v3Global.opt.coverage()) {
|
if (v3Global.opt.coverage()) {
|
||||||
puts("#include \"SpCoverage.h\"\n");
|
puts("#include \"SpCoverage.h\"\n");
|
||||||
}
|
}
|
||||||
|
if (v3Global.needHInlines()) { // Set by V3EmitCInlines; should have been called before us
|
||||||
|
puts("#include \""+topClassName()+"__Inlines.h\"\n");
|
||||||
|
}
|
||||||
|
|
||||||
// Declare foreign instances up front to make C++ happy
|
// Declare foreign instances up front to make C++ happy
|
||||||
puts("class "+symClassName()+";\n");
|
puts("class "+symClassName()+";\n");
|
||||||
@@ -1435,6 +1439,13 @@ void EmitCImp::emitInt(AstModule* modp) {
|
|||||||
puts("class "+modClassName(cellp->modp())+";\n");
|
puts("class "+modClassName(cellp->modp())+";\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (v3Global.opt.trace()) {
|
||||||
|
if (optSystemPerl()) {
|
||||||
|
puts("class SpTraceVcd;\n");
|
||||||
|
} else {
|
||||||
|
puts("class SpTraceVcdCFile;\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
puts("\n//----------\n\n");
|
puts("\n//----------\n\n");
|
||||||
emitTextSection(AstType::SCHDR);
|
emitTextSection(AstType::SCHDR);
|
||||||
@@ -1525,9 +1536,9 @@ void EmitCImp::emitInt(AstModule* modp) {
|
|||||||
} else {
|
} else {
|
||||||
puts(modClassName(modp)+"(const char* name=\"TOP\");\n");
|
puts(modClassName(modp)+"(const char* name=\"TOP\");\n");
|
||||||
puts("~"+modClassName(modp)+"();\n");
|
puts("~"+modClassName(modp)+"();\n");
|
||||||
if (v3Global.opt.trace()) {
|
}
|
||||||
puts("void\ttrace (SpTraceVcdCFile* tfp, int levels, int options=0);\n");
|
if (v3Global.opt.trace() && !optSystemPerl()) {
|
||||||
}
|
puts("void\ttrace (SpTraceVcdCFile* tfp, int levels, int options=0);\n");
|
||||||
}
|
}
|
||||||
puts("void\t__Vconfigure("+symClassName()+"* symsp);\n");
|
puts("void\t__Vconfigure("+symClassName()+"* symsp);\n");
|
||||||
if (optSystemPerl()) puts("/*AUTOMETHODS*/\n");
|
if (optSystemPerl()) puts("/*AUTOMETHODS*/\n");
|
||||||
@@ -1613,7 +1624,7 @@ void EmitCImp::emitImp(AstModule* modp) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (m_fast && m_splitFilenum==0) {
|
if (m_fast && m_splitFilenum==0) {
|
||||||
if (v3Global.opt.trace() && optSystemC() && m_modp->isTop()) {
|
if (v3Global.opt.trace() && optSystemPerl() && m_modp->isTop()) {
|
||||||
puts("\n");
|
puts("\n");
|
||||||
puts("\n/*AUTOTRACE(__MODULE__,recurse,activity,exists)*/\n\n");
|
puts("\n/*AUTOTRACE(__MODULE__,recurse,activity,exists)*/\n\n");
|
||||||
}
|
}
|
||||||
@@ -1700,7 +1711,7 @@ class EmitCTrace : EmitCStmts {
|
|||||||
// METHODS
|
// METHODS
|
||||||
void emitTraceHeader() {
|
void emitTraceHeader() {
|
||||||
// Includes
|
// Includes
|
||||||
if (optSystemC()) {
|
if (optSystemPerl()) {
|
||||||
puts("#include \"SpTraceVcd.h\"\n");
|
puts("#include \"SpTraceVcd.h\"\n");
|
||||||
}
|
}
|
||||||
puts("#include \"SpTraceVcdC.h\"\n");
|
puts("#include \"SpTraceVcdC.h\"\n");
|
||||||
@@ -1712,7 +1723,7 @@ class EmitCTrace : EmitCStmts {
|
|||||||
puts("\n//======================\n\n");
|
puts("\n//======================\n\n");
|
||||||
|
|
||||||
puts("void "+topClassName()+"::trace (");
|
puts("void "+topClassName()+"::trace (");
|
||||||
if (optSystemC()) {
|
if (optSystemPerl()) {
|
||||||
puts("SpTraceFile* tfp, int, int) {\n");
|
puts("SpTraceFile* tfp, int, int) {\n");
|
||||||
} else {
|
} else {
|
||||||
puts("SpTraceVcdCFile* tfp, int, int) {\n");
|
puts("SpTraceVcdCFile* tfp, int, int) {\n");
|
||||||
|
|||||||
+2
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
@@ -31,6 +31,7 @@
|
|||||||
class V3EmitC {
|
class V3EmitC {
|
||||||
public:
|
public:
|
||||||
static void emitc();
|
static void emitc();
|
||||||
|
static void emitcInlines();
|
||||||
static void emitcSyms();
|
static void emitcSyms();
|
||||||
static void emitcTrace();
|
static void emitcTrace();
|
||||||
};
|
};
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -0,0 +1,126 @@
|
|||||||
|
// $Id$
|
||||||
|
//*************************************************************************
|
||||||
|
// DESCRIPTION: Verilator: Emit C++ for tree
|
||||||
|
//
|
||||||
|
// Code available from: http://www.veripool.com/verilator
|
||||||
|
//
|
||||||
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
|
//
|
||||||
|
//*************************************************************************
|
||||||
|
//
|
||||||
|
// Copyright 2003-2008 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.
|
||||||
|
//
|
||||||
|
// Verilator is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
//*************************************************************************
|
||||||
|
|
||||||
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <math.h>
|
||||||
|
#include <map>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "V3Global.h"
|
||||||
|
#include "V3EmitC.h"
|
||||||
|
#include "V3EmitCBase.h"
|
||||||
|
#include "V3Stats.h"
|
||||||
|
|
||||||
|
#define EMITCINLINES_NUM_CONSTW 10 // Number of VL_CONST_W_*X's in verilated.h (IE VL_CONST_W_9X is last)
|
||||||
|
|
||||||
|
//######################################################################
|
||||||
|
|
||||||
|
class EmitCInlines : EmitCBaseVisitor {
|
||||||
|
// STATE
|
||||||
|
vector<V3Double0> m_wordWidths; // What sizes are used?
|
||||||
|
|
||||||
|
// METHODS
|
||||||
|
void emitInt();
|
||||||
|
|
||||||
|
// VISITORS
|
||||||
|
virtual void visit(AstVar* nodep, AstNUser*) {
|
||||||
|
// All wide constants load into variables, so we can just hunt for them
|
||||||
|
if (nodep->widthWords() >= EMITCINLINES_NUM_CONSTW ) {
|
||||||
|
if (int(m_wordWidths.size()) <= nodep->widthWords()) {
|
||||||
|
m_wordWidths.resize(nodep->widthWords()+5);
|
||||||
|
}
|
||||||
|
++ m_wordWidths.at(nodep->widthWords());
|
||||||
|
v3Global.needHInlines(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOPs
|
||||||
|
virtual void visit(AstNodeStmt*, AstNUser*) {}
|
||||||
|
// Default
|
||||||
|
virtual void visit(AstNode* nodep, AstNUser*) {
|
||||||
|
nodep->iterateChildren(*this);
|
||||||
|
}
|
||||||
|
//---------------------------------------
|
||||||
|
// ACCESSORS
|
||||||
|
public:
|
||||||
|
EmitCInlines(AstNetlist* nodep) {
|
||||||
|
nodep->accept(*this);
|
||||||
|
if (v3Global.needHInlines()) {
|
||||||
|
emitInt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
void EmitCInlines::emitInt() {
|
||||||
|
string filename = v3Global.opt.makeDir()+"/"+topClassName()+"__Inlines.h";
|
||||||
|
newCFile(filename, false/*slow*/, false/*source*/);
|
||||||
|
V3OutCFile hf (filename);
|
||||||
|
m_ofp = &hf;
|
||||||
|
|
||||||
|
ofp()->putsHeader();
|
||||||
|
puts("#ifndef _"+topClassName()+"__Inlines_H_\n");
|
||||||
|
puts("#define _"+topClassName()+"__Inlines_H_\n");
|
||||||
|
puts("\n");
|
||||||
|
|
||||||
|
puts("#include \"verilated.h\"\n");
|
||||||
|
|
||||||
|
puts("\n//======================\n\n");
|
||||||
|
|
||||||
|
for (unsigned words=0; words<m_wordWidths.size(); words++) {
|
||||||
|
if (m_wordWidths.at(words)) {
|
||||||
|
puts("#ifndef VL_HAVE_CONST_W_"+cvtToStr(words)+"X\n");
|
||||||
|
puts("# define VL_HAVE_CONST_W_"+cvtToStr(words)+"X\n");
|
||||||
|
puts("static inline WDataOutP VL_CONST_W_"+cvtToStr(words)+"X(int obits, WDataOutP o\n");
|
||||||
|
puts("\t");
|
||||||
|
for (int i=words-1; i>=0; --i) {
|
||||||
|
puts(",IData d"+cvtToStr(i));
|
||||||
|
if (i && (i % 8 == 0)) puts("\n\t");
|
||||||
|
}
|
||||||
|
puts(") {\n");
|
||||||
|
puts(" ");
|
||||||
|
for (int i=words-1; i>=0; --i) {
|
||||||
|
puts(" o["+cvtToStr(i)+"]=d"+cvtToStr(i)+";");
|
||||||
|
if (i && (i % 8 == 0)) puts("\n ");
|
||||||
|
}
|
||||||
|
puts("\n");
|
||||||
|
puts(" for(int i="+cvtToStr(words)+";i<VL_WORDS_I(obits);i++) o[i] = (IData)0x0;\n");
|
||||||
|
puts(" return o;\n");
|
||||||
|
puts("}\n");
|
||||||
|
puts("#endif\n");
|
||||||
|
puts("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
puts("//======================\n\n");
|
||||||
|
puts("#endif /*guard*/\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
//######################################################################
|
||||||
|
// EmitC class functions
|
||||||
|
|
||||||
|
void V3EmitC::emitcInlines() {
|
||||||
|
UINFO(2,__FUNCTION__<<": "<<endl);
|
||||||
|
EmitCInlines syms (v3Global.rootp());
|
||||||
|
}
|
||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+2
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2004-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2004-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
@@ -138,7 +138,7 @@ public:
|
|||||||
|
|
||||||
of.puts("\n# Link rules...\n");
|
of.puts("\n# Link rules...\n");
|
||||||
of.puts(v3Global.opt.prefix()+": $(VK_USER_OBJS) $(SP_SRCS) $(VM_PREFIX)__ALL.a\n");
|
of.puts(v3Global.opt.prefix()+": $(VK_USER_OBJS) $(SP_SRCS) $(VM_PREFIX)__ALL.a\n");
|
||||||
of.puts("\t$(LINK) $(LDFLAGS) $^ $(LOADLIBES) $(LDLIBS) -o $@ $(LIBS) 2>&1 | c++filt\n");
|
of.puts("\t$(LINK) $(LDFLAGS) $^ $(LOADLIBES) $(LDLIBS) -o $@ $(LIBS) $(SC_LIBS) 2>&1 | c++filt\n");
|
||||||
of.puts("\n");
|
of.puts("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+3
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2004-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2004-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
@@ -246,6 +246,8 @@ public:
|
|||||||
virtual void visit(AstText* nodep, AstNUser*) {
|
virtual void visit(AstText* nodep, AstNUser*) {
|
||||||
ofp()->putsNoTracking(nodep->text());
|
ofp()->putsNoTracking(nodep->text());
|
||||||
}
|
}
|
||||||
|
virtual void visit(AstScopeName* nodep, AstNUser*) {
|
||||||
|
}
|
||||||
virtual void visit(AstCStmt* nodep, AstNUser*) {
|
virtual void visit(AstCStmt* nodep, AstNUser*) {
|
||||||
putbs("$_CSTMT(");
|
putbs("$_CSTMT(");
|
||||||
nodep->bodysp()->iterateAndNext(*this);
|
nodep->bodysp()->iterateAndNext(*this);
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+77
-8
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
@@ -22,6 +22,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <set>
|
||||||
#include "V3Error.h"
|
#include "V3Error.h"
|
||||||
#ifndef _V3ERROR_NO_GLOBAL_
|
#ifndef _V3ERROR_NO_GLOBAL_
|
||||||
# include "V3Ast.h"
|
# include "V3Ast.h"
|
||||||
@@ -34,7 +35,8 @@
|
|||||||
|
|
||||||
FileLine FileLine::s_defaultFileLine = FileLine(EmptySecret());
|
FileLine FileLine::s_defaultFileLine = FileLine(EmptySecret());
|
||||||
|
|
||||||
int V3Error::s_errcnt = 0;
|
int V3Error::s_errCount = 0;
|
||||||
|
int V3Error::s_warnCount = 0;
|
||||||
int V3Error::s_debugDefault = 0;
|
int V3Error::s_debugDefault = 0;
|
||||||
ostringstream V3Error::s_errorStr; // Error string being formed
|
ostringstream V3Error::s_errorStr; // Error string being formed
|
||||||
V3ErrorCode V3Error::s_errorCode = V3ErrorCode::FATAL;
|
V3ErrorCode V3Error::s_errorCode = V3ErrorCode::FATAL;
|
||||||
@@ -100,9 +102,16 @@ bool FileLine::warnOff(const string& msg, bool flag) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FileLine::warnLintOff(bool flag) {
|
||||||
|
for (int codei=V3ErrorCode::FIRST_WARN; codei<V3ErrorCode::MAX; codei++) {
|
||||||
|
V3ErrorCode code = (V3ErrorCode)codei;
|
||||||
|
if (code.lintError()) warnOff(code, flag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FileLine* FileLine::copyOrSameFileLine() {
|
FileLine* FileLine::copyOrSameFileLine() {
|
||||||
// Return this, or a copy of this
|
// Return this, or a copy of this
|
||||||
// There are often more then one token per line, thus we use the
|
// There are often more than one token per line, thus we use the
|
||||||
// same pointer as long as we're on the same line.
|
// same pointer as long as we're on the same line.
|
||||||
static FileLine* lastNewp = NULL;
|
static FileLine* lastNewp = NULL;
|
||||||
if (lastNewp && *lastNewp == *this) {
|
if (lastNewp && *lastNewp == *this) {
|
||||||
@@ -162,6 +171,46 @@ void FileLine::v3errorEnd(ostringstream& str) {
|
|||||||
V3Error::v3errorEnd(str);
|
V3Error::v3errorEnd(str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef VL_LEAK_CHECKS
|
||||||
|
typedef set<FileLine*> FileLineCheckSet;
|
||||||
|
FileLineCheckSet fileLineLeakChecks;
|
||||||
|
|
||||||
|
void* FileLine::operator new(size_t size) {
|
||||||
|
FileLine* objp = static_cast<FileLine*>(::operator new(size));
|
||||||
|
fileLineLeakChecks.insert(objp);
|
||||||
|
return objp;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FileLine::operator delete(void* objp, size_t size) {
|
||||||
|
if (!objp) return;
|
||||||
|
FileLine* flp = static_cast<FileLine*>(objp);
|
||||||
|
FileLineCheckSet::iterator it = fileLineLeakChecks.find(flp);
|
||||||
|
if (it != fileLineLeakChecks.end()) {
|
||||||
|
fileLineLeakChecks.erase(it);
|
||||||
|
} else {
|
||||||
|
flp->v3fatalSrc("Deleting FileLine object that was never tracked\n");
|
||||||
|
}
|
||||||
|
::operator delete(objp);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void FileLine::deleteAllRemaining() {
|
||||||
|
#ifdef VL_LEAK_CHECKS
|
||||||
|
// FileLines are allocated, but never nicely freed, as it's much faster
|
||||||
|
// that way. Unfortunately this makes our leak checking a big mess, so
|
||||||
|
// only when leak checking we'll track them all and cleanup.
|
||||||
|
while (1) {
|
||||||
|
FileLineCheckSet::iterator it=fileLineLeakChecks.begin();
|
||||||
|
if (it==fileLineLeakChecks.end()) break;
|
||||||
|
delete *it;
|
||||||
|
// Operator delete will remove the iterated object from the list.
|
||||||
|
// Eventually the list will be empty and terminate the loop.
|
||||||
|
}
|
||||||
|
fileLineLeakChecks.clear();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
//######################################################################
|
//######################################################################
|
||||||
// V3Error class functions
|
// V3Error class functions
|
||||||
|
|
||||||
@@ -187,8 +236,13 @@ string V3Error::lineStr (const char* filename, int lineno) {
|
|||||||
return out.str();
|
return out.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void V3Error::incWarnings() {
|
||||||
|
s_warnCount++;
|
||||||
|
// We don't exit on a lot of warnings.
|
||||||
|
}
|
||||||
|
|
||||||
void V3Error::incErrors() {
|
void V3Error::incErrors() {
|
||||||
s_errcnt++;
|
s_errCount++;
|
||||||
if (errorCount() == MAX_ERRORS) { // Not >= as would otherwise recurse
|
if (errorCount() == MAX_ERRORS) { // Not >= as would otherwise recurse
|
||||||
v3fatal ("Exiting due to too many errors encountered\n");
|
v3fatal ("Exiting due to too many errors encountered\n");
|
||||||
}
|
}
|
||||||
@@ -196,16 +250,30 @@ void V3Error::incErrors() {
|
|||||||
|
|
||||||
void V3Error::abortIfErrors() {
|
void V3Error::abortIfErrors() {
|
||||||
if (errorCount()) {
|
if (errorCount()) {
|
||||||
v3fatal ("Exiting due to "<<dec<<errorCount()<<" warning(s)\n");
|
v3fatal ("Exiting due to "<<dec<<errorOrWarnCount()<<" warning(s)\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void V3Error::abortIfWarnings() {
|
||||||
|
if (errorOrWarnCount()) {
|
||||||
|
v3fatal ("Exiting due to "<<dec<<errorOrWarnCount()<<" warning(s)\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool V3Error::isError(V3ErrorCode code) {
|
||||||
|
if (code==V3ErrorCode::SUPPRESS) return false;
|
||||||
|
else if (code==V3ErrorCode::FATAL) return true;
|
||||||
|
else if (code==V3ErrorCode::ERROR) return true;
|
||||||
|
else if (code<V3ErrorCode::FIRST_WARN
|
||||||
|
|| s_pretendError[code]) return true;
|
||||||
|
else return false;
|
||||||
|
}
|
||||||
|
|
||||||
string V3Error::msgPrefix(V3ErrorCode code) {
|
string V3Error::msgPrefix(V3ErrorCode code) {
|
||||||
if (code==V3ErrorCode::SUPPRESS) return "-arning-suppressed: ";
|
if (code==V3ErrorCode::SUPPRESS) return "-arning-suppressed: ";
|
||||||
else if (code==V3ErrorCode::FATAL) return "%Error: ";
|
else if (code==V3ErrorCode::FATAL) return "%Error: ";
|
||||||
else if (code==V3ErrorCode::ERROR) return "%Error: ";
|
else if (code==V3ErrorCode::ERROR) return "%Error: ";
|
||||||
else if (code<V3ErrorCode::FIRST_WARN
|
else if (isError(code)) return "%Error-"+(string)code.ascii()+": ";
|
||||||
|| s_pretendError[code]) return "%Error-"+(string)code.ascii()+": ";
|
|
||||||
else return "%Warning-"+(string)code.ascii()+": ";
|
else return "%Warning-"+(string)code.ascii()+": ";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -258,7 +326,8 @@ void V3Error::v3errorEnd (ostringstream& sstr) {
|
|||||||
cerr<<msgPrefix()<<"else you may end up with different sim results."<<endl;
|
cerr<<msgPrefix()<<"else you may end up with different sim results."<<endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
incErrors();
|
if (isError(s_errorCode)) incErrors();
|
||||||
|
else incWarnings();
|
||||||
if (s_errorCode==V3ErrorCode::FATAL) {
|
if (s_errorCode==V3ErrorCode::FATAL) {
|
||||||
static bool inFatal = false;
|
static bool inFatal = false;
|
||||||
if (!inFatal) {
|
if (!inFatal) {
|
||||||
|
|||||||
+30
-8
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
@@ -48,6 +48,7 @@ public:
|
|||||||
CASEX, // Casex
|
CASEX, // Casex
|
||||||
CMPCONST, // Comparison is constant due to limited range
|
CMPCONST, // Comparison is constant due to limited range
|
||||||
COMBDLY, // Combinatorial delayed assignment
|
COMBDLY, // Combinatorial delayed assignment
|
||||||
|
STMTDLY, // Delayed statement
|
||||||
GENCLK, // Generated Clock
|
GENCLK, // Generated Clock
|
||||||
IMPLICIT, // Implicit wire
|
IMPLICIT, // Implicit wire
|
||||||
IMPURE, // Impure function not being inlined
|
IMPURE, // Impure function not being inlined
|
||||||
@@ -76,7 +77,7 @@ public:
|
|||||||
" FIRST_WARN",
|
" FIRST_WARN",
|
||||||
"BLKANDNBLK",
|
"BLKANDNBLK",
|
||||||
"CASEINCOMPLETE", "CASEOVERLAP", "CASEX", "CMPCONST",
|
"CASEINCOMPLETE", "CASEOVERLAP", "CASEX", "CMPCONST",
|
||||||
"COMBDLY", "GENCLK", "IMPLICIT", "IMPURE",
|
"COMBDLY", "STMTDLY", "GENCLK", "IMPLICIT", "IMPURE",
|
||||||
"MULTIDRIVEN",
|
"MULTIDRIVEN",
|
||||||
"UNDRIVEN", "UNOPT", "UNOPTFLAT", "UNSIGNED", "UNUSED",
|
"UNDRIVEN", "UNOPT", "UNOPTFLAT", "UNSIGNED", "UNUSED",
|
||||||
"VARHIDDEN", "WIDTH",
|
"VARHIDDEN", "WIDTH",
|
||||||
@@ -89,6 +90,13 @@ public:
|
|||||||
// Warnings we'll present to the user as errors
|
// Warnings we'll present to the user as errors
|
||||||
// Later -Werror- options may make more of these.
|
// Later -Werror- options may make more of these.
|
||||||
bool pretendError() const { return ( m_e==BLKANDNBLK || m_e==IMPURE); };
|
bool pretendError() const { return ( m_e==BLKANDNBLK || m_e==IMPURE); };
|
||||||
|
// Warnings that are lint only
|
||||||
|
bool lintError() const { return ( m_e==CASEINCOMPLETE || m_e==CASEOVERLAP
|
||||||
|
|| m_e==CASEX || m_e==CMPCONST
|
||||||
|
|| m_e==IMPLICIT
|
||||||
|
|| m_e==UNDRIVEN || m_e==UNSIGNED
|
||||||
|
|| m_e==UNUSED || m_e==VARHIDDEN
|
||||||
|
|| m_e==WIDTH); };
|
||||||
};
|
};
|
||||||
inline bool operator== (V3ErrorCode lhs, V3ErrorCode rhs) { return (lhs.m_e == rhs.m_e); }
|
inline bool operator== (V3ErrorCode lhs, V3ErrorCode rhs) { return (lhs.m_e == rhs.m_e); }
|
||||||
inline bool operator== (V3ErrorCode lhs, V3ErrorCode::en rhs) { return (lhs.m_e == rhs); }
|
inline bool operator== (V3ErrorCode lhs, V3ErrorCode::en rhs) { return (lhs.m_e == rhs); }
|
||||||
@@ -104,11 +112,11 @@ class V3Error {
|
|||||||
static bool s_describedEachWarn[V3ErrorCode::MAX]; // Told user specifics about this warning
|
static bool s_describedEachWarn[V3ErrorCode::MAX]; // Told user specifics about this warning
|
||||||
static bool s_pretendError[V3ErrorCode::MAX]; // Pretend this warning is an error
|
static bool s_pretendError[V3ErrorCode::MAX]; // Pretend this warning is an error
|
||||||
static int s_debugDefault; // Default debugging level
|
static int s_debugDefault; // Default debugging level
|
||||||
static int s_errcnt; // Error count
|
static int s_errCount; // Error count
|
||||||
|
static int s_warnCount; // Error count
|
||||||
static ostringstream s_errorStr; // Error string being formed
|
static ostringstream s_errorStr; // Error string being formed
|
||||||
static V3ErrorCode s_errorCode; // Error string being formed will abort
|
static V3ErrorCode s_errorCode; // Error string being formed will abort
|
||||||
enum MaxErrors { MAX_ERRORS = 50 }; // Fatal after this may errors
|
enum MaxErrors { MAX_ERRORS = 50 }; // Fatal after this may errors
|
||||||
static void incErrors();
|
|
||||||
|
|
||||||
V3Error() { cerr<<("Static class"); abort(); }
|
V3Error() { cerr<<("Static class"); abort(); }
|
||||||
|
|
||||||
@@ -118,12 +126,18 @@ class V3Error {
|
|||||||
static void debugDefault(int level) { s_debugDefault = level; }
|
static void debugDefault(int level) { s_debugDefault = level; }
|
||||||
static int debugDefault() { return s_debugDefault; }
|
static int debugDefault() { return s_debugDefault; }
|
||||||
static string msgPrefix(V3ErrorCode code=s_errorCode); // returns %Error/%Warn
|
static string msgPrefix(V3ErrorCode code=s_errorCode); // returns %Error/%Warn
|
||||||
static int errorCount() { return s_errcnt; }
|
static int errorCount() { return s_errCount; }
|
||||||
|
static int warnCount() { return s_warnCount; }
|
||||||
|
static int errorOrWarnCount() { return errorCount()+warnCount(); }
|
||||||
// METHODS
|
// METHODS
|
||||||
|
static void incErrors();
|
||||||
|
static void incWarnings();
|
||||||
static void init();
|
static void init();
|
||||||
static void abortIfErrors();
|
static void abortIfErrors();
|
||||||
|
static void abortIfWarnings();
|
||||||
static void suppressThisWarning(); // Suppress next %Warn if user has it off
|
static void suppressThisWarning(); // Suppress next %Warn if user has it off
|
||||||
static void pretendError(V3ErrorCode code, bool flag) { s_pretendError[code]=flag; }
|
static void pretendError(V3ErrorCode code, bool flag) { s_pretendError[code]=flag; }
|
||||||
|
static bool isError(V3ErrorCode code);
|
||||||
static string v3sform (const char* format, ...);
|
static string v3sform (const char* format, ...);
|
||||||
static string lineStr (const char* filename, int lineno);
|
static string lineStr (const char* filename, int lineno);
|
||||||
static V3ErrorCode errorCode() { return s_errorCode; }
|
static V3ErrorCode errorCode() { return s_errorCode; }
|
||||||
@@ -185,9 +199,14 @@ protected:
|
|||||||
void incLineno() { m_lineno++; }
|
void incLineno() { m_lineno++; }
|
||||||
FileLine* copyOrSameFileLine();
|
FileLine* copyOrSameFileLine();
|
||||||
public:
|
public:
|
||||||
FileLine (const string& filename, int lineno) { m_lineno=lineno; m_filename = filename; m_warnOff=s_defaultFileLine.m_warnOff;}
|
FileLine (const string& filename, int lineno) { m_lineno=lineno; m_filename = filename; m_warnOff=s_defaultFileLine.m_warnOff; }
|
||||||
FileLine (FileLine* fromp) { m_lineno=fromp->lineno(); m_filename = fromp->filename(); m_warnOff=fromp->m_warnOff;};
|
FileLine (FileLine* fromp) { m_lineno=fromp->lineno(); m_filename = fromp->filename(); m_warnOff=fromp->m_warnOff; }
|
||||||
FileLine (EmptySecret) { m_lineno=0; m_filename="COMMAND_LINE"; m_warnOff=0; } // Only for static constructor
|
FileLine (EmptySecret) { m_lineno=0; m_filename="COMMAND_LINE"; m_warnOff=0; }
|
||||||
|
~FileLine() { }
|
||||||
|
#ifdef VL_LEAK_CHECKS
|
||||||
|
static void* operator new(size_t size);
|
||||||
|
static void operator delete(void* obj, size_t size);
|
||||||
|
#endif
|
||||||
static FileLine& defaultFileLine() { return s_defaultFileLine; }
|
static FileLine& defaultFileLine() { return s_defaultFileLine; }
|
||||||
int lineno () const { return m_lineno; }
|
int lineno () const { return m_lineno; }
|
||||||
string ascii() const;
|
string ascii() const;
|
||||||
@@ -198,11 +217,14 @@ public:
|
|||||||
void warnOff(V3ErrorCode code, bool flag) { m_warnOff.set(code,flag); } // Turn on/off warning messages on this line.
|
void warnOff(V3ErrorCode code, bool flag) { m_warnOff.set(code,flag); } // Turn on/off warning messages on this line.
|
||||||
bool warnOff(const string& code, bool flag); // Returns 1 if ok
|
bool warnOff(const string& code, bool flag); // Returns 1 if ok
|
||||||
bool warnIsOff(V3ErrorCode code);
|
bool warnIsOff(V3ErrorCode code);
|
||||||
|
void warnLintOff(bool flag);
|
||||||
void warnStateFrom(const FileLine& from) { m_warnOff=from.m_warnOff; }
|
void warnStateFrom(const FileLine& from) { m_warnOff=from.m_warnOff; }
|
||||||
void warnResetDefault() { warnStateFrom(s_defaultFileLine); }
|
void warnResetDefault() { warnStateFrom(s_defaultFileLine); }
|
||||||
|
|
||||||
void v3errorEnd(ostringstream& str);
|
void v3errorEnd(ostringstream& str);
|
||||||
inline bool operator==(FileLine rhs) { return (m_lineno==rhs.m_lineno && m_filename==rhs.m_filename); }
|
inline bool operator==(FileLine rhs) { return (m_lineno==rhs.m_lineno && m_filename==rhs.m_filename); }
|
||||||
|
|
||||||
|
static void deleteAllRemaining();
|
||||||
};
|
};
|
||||||
ostream& operator<<(ostream& os, FileLine* fileline);
|
ostream& operator<<(ostream& os, FileLine* fileline);
|
||||||
|
|
||||||
|
|||||||
+4
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2004-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2004-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
@@ -531,6 +531,8 @@ private:
|
|||||||
rhsp, lsb)));
|
rhsp, lsb)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
rhsp->deleteTree(); rhsp=NULL;
|
||||||
|
destp->deleteTree(); destp=NULL;
|
||||||
} else {
|
} else {
|
||||||
UINFO(8," ASSIGNSEL(const,narrow) "<<nodep<<endl);
|
UINFO(8," ASSIGNSEL(const,narrow) "<<nodep<<endl);
|
||||||
if (destp->isQuad() && !rhsp->isQuad()) rhsp = new AstCast(nodep->fileline(), rhsp, nodep);
|
if (destp->isQuad() && !rhsp->isQuad()) rhsp = new AstCast(nodep->fileline(), rhsp, nodep);
|
||||||
@@ -803,7 +805,7 @@ private:
|
|||||||
for (int w=0; w<nodep->lhsp()->widthWords(); w++) {
|
for (int w=0; w<nodep->lhsp()->widthWords(); w++) {
|
||||||
AstNode* eqp = newAstWordSelClone (nodep->lhsp(), w);
|
AstNode* eqp = newAstWordSelClone (nodep->lhsp(), w);
|
||||||
if (w==nodep->lhsp()->widthWords()-1) {
|
if (w==nodep->lhsp()->widthWords()-1) {
|
||||||
// Rather then doing a (slowish) ==##, we OR in the bits that aren't part of the mask
|
// Rather than doing a (slowish) ==##, we OR in the bits that aren't part of the mask
|
||||||
eqp = new AstOr (nodep->fileline(),
|
eqp = new AstOr (nodep->fileline(),
|
||||||
new AstConst (nodep->fileline(), notWideMask(nodep->lhsp())),
|
new AstConst (nodep->fileline(), notWideMask(nodep->lhsp())),
|
||||||
eqp);
|
eqp);
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+3
-3
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
@@ -341,7 +341,7 @@ private:
|
|||||||
if (!varscp) nodep->v3fatalSrc("Var didn't get varscoped in V3Scope.cpp\n");
|
if (!varscp) nodep->v3fatalSrc("Var didn't get varscoped in V3Scope.cpp\n");
|
||||||
GateVarVertex* varvertexp = makeVarVertex(varscp);
|
GateVarVertex* varvertexp = makeVarVertex(varscp);
|
||||||
UINFO(5," VARREF to "<<varscp<<endl);
|
UINFO(5," VARREF to "<<varscp<<endl);
|
||||||
// We use weight of one; if we ref the var more then once, when we simplify,
|
// We use weight of one; if we ref the var more than once, when we simplify,
|
||||||
// the weight will increase
|
// the weight will increase
|
||||||
if (nodep->lvalue()) {
|
if (nodep->lvalue()) {
|
||||||
new V3GraphEdge(&m_graph, m_logicVertexp, varvertexp, 1);
|
new V3GraphEdge(&m_graph, m_logicVertexp, varvertexp, 1);
|
||||||
@@ -433,7 +433,7 @@ void GateVisitor::optimizeSignals(bool allowMultiIn) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!vvertexp->inSize1()) {
|
else if (!vvertexp->inSize1()) {
|
||||||
vvertexp->clearReducible("size!1"); // Can't deal with more then one src
|
vvertexp->clearReducible("size!1"); // Can't deal with more than one src
|
||||||
}
|
}
|
||||||
// Reduce it?
|
// Reduce it?
|
||||||
if (!vvertexp->reducible()) {
|
if (!vvertexp->reducible()) {
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+7
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
@@ -42,8 +42,10 @@ class V3Global {
|
|||||||
AstNetlist* m_rootp; // Root of entire netlist
|
AstNetlist* m_rootp; // Root of entire netlist
|
||||||
int m_debugFileNumber; // Number to append to debug files created
|
int m_debugFileNumber; // Number to append to debug files created
|
||||||
bool m_assertWidthsSame; // Tree should have width()==widthMin()
|
bool m_assertWidthsSame; // Tree should have width()==widthMin()
|
||||||
// Options
|
bool m_needHInlines; // Need a __Inlines file
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
// Options
|
||||||
V3Options opt; // All options; let user see them directly
|
V3Options opt; // All options; let user see them directly
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -52,6 +54,7 @@ public:
|
|||||||
m_rootp = new AstNetlist;
|
m_rootp = new AstNetlist;
|
||||||
m_debugFileNumber = 0;
|
m_debugFileNumber = 0;
|
||||||
m_assertWidthsSame = false;
|
m_assertWidthsSame = false;
|
||||||
|
m_needHInlines = false;
|
||||||
}
|
}
|
||||||
void clear() {
|
void clear() {
|
||||||
if (m_rootp) m_rootp->deleteTree(); m_rootp=NULL;
|
if (m_rootp) m_rootp->deleteTree(); m_rootp=NULL;
|
||||||
@@ -70,6 +73,8 @@ public:
|
|||||||
char digits[100]; sprintf(digits, "%02d", m_debugFileNumber);
|
char digits[100]; sprintf(digits, "%02d", m_debugFileNumber);
|
||||||
return opt.makeDir()+"/"+opt.prefix()+"_"+digits+"_"+nameComment;
|
return opt.makeDir()+"/"+opt.prefix()+"_"+digits+"_"+nameComment;
|
||||||
}
|
}
|
||||||
|
bool needHInlines() const { return m_needHInlines; }
|
||||||
|
void needHInlines(bool flag) { m_needHInlines=flag; }
|
||||||
};
|
};
|
||||||
|
|
||||||
extern V3Global v3Global;
|
extern V3Global v3Global;
|
||||||
|
|||||||
+4
-4
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
@@ -177,10 +177,10 @@ void V3Graph::clear() {
|
|||||||
void V3Graph::userClearVertices() {
|
void V3Graph::userClearVertices() {
|
||||||
// Clear user() in all of tree
|
// Clear user() in all of tree
|
||||||
// We may use the userCnt trick in V3Ast later... For now we don't call this often, and
|
// We may use the userCnt trick in V3Ast later... For now we don't call this often, and
|
||||||
// the extra code on each read of user() would probably slow things down more then help.
|
// the extra code on each read of user() would probably slow things down more than help.
|
||||||
for (V3GraphVertex* vertexp = verticesBeginp(); vertexp; vertexp=vertexp->verticesNextp()) {
|
for (V3GraphVertex* vertexp = verticesBeginp(); vertexp; vertexp=vertexp->verticesNextp()) {
|
||||||
vertexp->user(0);
|
vertexp->user(0);
|
||||||
vertexp->userp(NULL); // Its a union, but might be different size then user()
|
vertexp->userp(NULL); // Its a union, but might be different size than user()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,7 +189,7 @@ void V3Graph::userClearEdges() {
|
|||||||
for (V3GraphVertex* vertexp = verticesBeginp(); vertexp; vertexp=vertexp->verticesNextp()) {
|
for (V3GraphVertex* vertexp = verticesBeginp(); vertexp; vertexp=vertexp->verticesNextp()) {
|
||||||
for (V3GraphEdge* edgep = vertexp->outBeginp(); edgep; edgep=edgep->outNextp()) {
|
for (V3GraphEdge* edgep = vertexp->outBeginp(); edgep; edgep=edgep->outNextp()) {
|
||||||
edgep->user(0);
|
edgep->user(0);
|
||||||
edgep->userp(NULL); // Its a union, but might be different size then user()
|
edgep->userp(NULL); // Its a union, but might be different size than user()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+2
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
@@ -440,7 +440,7 @@ void GraphAcyc::place() {
|
|||||||
UINFO(4, " Cutable edges = "<<numEdges<<endl);
|
UINFO(4, " Cutable edges = "<<numEdges<<endl);
|
||||||
|
|
||||||
vector<V3GraphEdge*> edges; // List of all edges to be processed
|
vector<V3GraphEdge*> edges; // List of all edges to be processed
|
||||||
edges.reserve(numEdges+1); // Make the vector properly sized right off the bat -- faster then reallocating
|
edges.reserve(numEdges+1); // Make the vector properly sized right off the bat -- faster than reallocating
|
||||||
for (V3GraphVertex* vertexp = m_breakGraph.verticesBeginp(); vertexp; vertexp=vertexp->verticesNextp()) {
|
for (V3GraphVertex* vertexp = m_breakGraph.verticesBeginp(); vertexp; vertexp=vertexp->verticesNextp()) {
|
||||||
vertexp->user(0); // Clear in prep of next step
|
vertexp->user(0); // Clear in prep of next step
|
||||||
for (V3GraphEdge* edgep = vertexp->outBeginp(); edgep; edgep=edgep->outNextp()) {
|
for (V3GraphEdge* edgep = vertexp->outBeginp(); edgep; edgep=edgep->outNextp()) {
|
||||||
|
|||||||
+4
-4
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
@@ -58,7 +58,7 @@ void V3Graph::deleteCutableOnlyEdges() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Pass 2, delete those marked
|
// Pass 2, delete those marked
|
||||||
// Rather then doing a delete() we set the weight to 0 which disconnects the edge.
|
// Rather than doing a delete() we set the weight to 0 which disconnects the edge.
|
||||||
for (V3GraphVertex* vertexp = verticesBeginp(); vertexp; vertexp=vertexp->verticesNextp()) {
|
for (V3GraphVertex* vertexp = verticesBeginp(); vertexp; vertexp=vertexp->verticesNextp()) {
|
||||||
if (vertexp->user()) {
|
if (vertexp->user()) {
|
||||||
//UINFO(7,"Disconnect "<<vertexp->name()<<endl);
|
//UINFO(7,"Disconnect "<<vertexp->name()<<endl);
|
||||||
@@ -99,9 +99,9 @@ private:
|
|||||||
} else { // Duplicate
|
} else { // Duplicate
|
||||||
bool saveOld = true;
|
bool saveOld = true;
|
||||||
if (prevEdgep->cutable() && !edgep->cutable()) {
|
if (prevEdgep->cutable() && !edgep->cutable()) {
|
||||||
saveOld = false; // new !cutable more important then old
|
saveOld = false; // new !cutable more important than old
|
||||||
} else if (!prevEdgep->cutable() && edgep->cutable()) {
|
} else if (!prevEdgep->cutable() && edgep->cutable()) {
|
||||||
saveOld = true; // old !cutable more important then new
|
saveOld = true; // old !cutable more important than new
|
||||||
} else {
|
} else {
|
||||||
saveOld = true;
|
saveOld = true;
|
||||||
if (!m_sumWeights && (prevEdgep->weight() < edgep->weight())) { // Keep max weight
|
if (!m_sumWeights && (prevEdgep->weight() < edgep->weight())) { // Keep max weight
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2005-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2005-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+2
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
@@ -83,7 +83,7 @@ public:
|
|||||||
|
|
||||||
class DfaVertex : public V3GraphVertex {
|
class DfaVertex : public V3GraphVertex {
|
||||||
// Each DFA state is captured in this vertex.
|
// Each DFA state is captured in this vertex.
|
||||||
// Start and accepting are members, rather then the more intuitive
|
// Start and accepting are members, rather than the more intuitive
|
||||||
// subclasses, as subclassing them would make it harder to inherit from here.
|
// subclasses, as subclassing them would make it harder to inherit from here.
|
||||||
bool m_start; // Start state
|
bool m_start; // Start state
|
||||||
bool m_accepting; // Accepting state?
|
bool m_accepting; // Accepting state?
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2005-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2005-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+6
-6
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
@@ -151,7 +151,7 @@ private:
|
|||||||
// Remove the cell
|
// Remove the cell
|
||||||
newmodp->deleteTree(); newmodp=NULL; // Clear any leftover ports, etc
|
newmodp->deleteTree(); newmodp=NULL; // Clear any leftover ports, etc
|
||||||
nodep->unlinkFrBack();
|
nodep->unlinkFrBack();
|
||||||
nodep = NULL;
|
pushDeletep(nodep); nodep = NULL;
|
||||||
if (debug()>=9) { m_modp->dumpTree(cout,"donemod:"); }
|
if (debug()>=9) { m_modp->dumpTree(cout,"donemod:"); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -233,10 +233,10 @@ private:
|
|||||||
}
|
}
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstDisplay* nodep, AstNUser*) {
|
virtual void visit(AstScopeName* nodep, AstNUser*) {
|
||||||
// If there's a %m in the display text, we add a special node that will contain the name()
|
// If there's a %m in the display text, we add a special node that will contain the name()
|
||||||
// Similar code in V3Begin
|
// Similar code in V3Begin
|
||||||
if (m_cellp && nodep->needScopeTracking()) {
|
if (m_cellp) {
|
||||||
// To keep correct visual order, must add before other Text's
|
// To keep correct visual order, must add before other Text's
|
||||||
AstNode* afterp = nodep->scopeAttrp();
|
AstNode* afterp = nodep->scopeAttrp();
|
||||||
if (afterp) afterp->unlinkFrBackWithNext();
|
if (afterp) afterp->unlinkFrBackWithNext();
|
||||||
@@ -332,14 +332,14 @@ private:
|
|||||||
} else {
|
} else {
|
||||||
m_modp->user(1);
|
m_modp->user(1);
|
||||||
}
|
}
|
||||||
nodep->unlinkFrBack(); nodep=NULL; // Remove so don't propagate to upper cell...
|
nodep->unlinkFrBack()->deleteTree(); nodep=NULL; // Remove so don't propagate to upper cell...
|
||||||
} else if (nodep->pragType() == AstPragmaType::NO_INLINE_MODULE) {
|
} else if (nodep->pragType() == AstPragmaType::NO_INLINE_MODULE) {
|
||||||
if (!m_modp) {
|
if (!m_modp) {
|
||||||
nodep->v3error("Inline pragma not under a module");
|
nodep->v3error("Inline pragma not under a module");
|
||||||
} else {
|
} else {
|
||||||
cantInline("Pragma NO_INLINE_MODULE");
|
cantInline("Pragma NO_INLINE_MODULE");
|
||||||
}
|
}
|
||||||
nodep->unlinkFrBack(); nodep=NULL; // Remove so don't propagate to upper cell...
|
nodep->unlinkFrBack()->deleteTree(); nodep=NULL; // Remove so don't propagate to upper cell...
|
||||||
} else {
|
} else {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2007 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
// redistribute it and/or modify it under the terms of either the GNU
|
// redistribute it and/or modify it under the terms of either the GNU
|
||||||
// General Public License or the Perl Artistic License.
|
// General Public License or the Perl Artistic License.
|
||||||
//
|
//
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user