mirror of
https://github.com/verilator/verilator.git
synced 2026-10-06 01:54:01 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c14818ebb3 | ||
|
|
58dc91605b | ||
|
|
b5b1d94d4a | ||
|
|
5a65f6debb | ||
|
|
58b1ad1439 | ||
|
|
94d0aa2058 | ||
|
|
1d6495e2dc | ||
|
|
42883e7b6a | ||
|
|
dc6a164e01 | ||
|
|
26bab12257 | ||
|
|
8714ee591f | ||
|
|
11335fae5f | ||
|
|
ce531c5a67 | ||
|
|
52e36fb434 | ||
|
|
100d5b386c | ||
|
|
699563c9bd | ||
|
|
a599fbea18 | ||
|
|
c5f0ed9c99 | ||
|
|
2ce30e78a1 | ||
|
|
3b554f4c5b | ||
|
|
cf40fd356f | ||
|
|
8848469bf9 | ||
|
|
4100417f83 | ||
|
|
bd6d743f9c | ||
|
|
857ac24ba7 | ||
|
|
5672b99203 | ||
|
|
3d8de3194c | ||
|
|
8b91a9f898 | ||
|
|
038ee69a96 | ||
|
|
8986d1f16f | ||
|
|
86c8e7b3e6 | ||
|
|
9026118a7c | ||
|
|
58fc922737 | ||
|
|
3b5c791332 | ||
|
|
6e16bc1b7b | ||
|
|
1aba0f6379 | ||
|
|
11cfa3c072 | ||
|
|
59141b1678 | ||
|
|
2083c071ce | ||
|
|
3ad5872d30 | ||
|
|
ea6bb21cdc | ||
|
|
3d4fe0364a |
@@ -3,17 +3,58 @@ Revision history for Verilator
|
|||||||
The contributors that suggested a given feature are shown in []. [by ...]
|
The contributors that suggested a given feature are shown in []. [by ...]
|
||||||
indicates the contributor was also the author of the fix; Thanks!
|
indicates the contributor was also the author of the fix; Thanks!
|
||||||
|
|
||||||
* Verilator 3.62**
|
* Verilator 3.631 1/2/2007
|
||||||
|
|
||||||
**** Fix link error when using --exe with --trace. [Eugene Weber]
|
** Support standard NAME[#] for cells created by arraying or generate for.
|
||||||
|
This replaces the non-standard name__# syntax used in earlier versions.
|
||||||
|
|
||||||
**** Public functions now allow > 64 bit arguments.
|
**** Fix again dotted references into generate cells. [David Hewson]
|
||||||
|
Verilator no longer accepts duplicated variables inside unique
|
||||||
|
generate blocks as this is illegal according to the specification.
|
||||||
|
|
||||||
**** Don't core dump on errors when not under --debug. [Allan Cochrane]
|
**** Fix $readmem* with filenames < 8 characters. [Emerson Suguimoto]
|
||||||
|
|
||||||
|
* Verilator 3.630 12/19/2006
|
||||||
|
|
||||||
|
** Support $readmemb and $readmemh. [Eugene Weber, Arthur Kahlich]
|
||||||
|
|
||||||
|
*** Fixed configure and compiling under Solaris. [Bob Farrell]
|
||||||
|
|
||||||
|
*** When dotted signal lookup fails, help the user by showing known scopes.
|
||||||
|
|
||||||
|
*** Reduce depth of priority encoded case statements. [Eugene Weber]
|
||||||
|
|
||||||
|
**** Fix dotted references inside generated cells. [David Hewson]
|
||||||
|
|
||||||
|
**** Fix missed split optimization points underneath other re-split blocks.
|
||||||
|
|
||||||
|
* Verilator 3.623 12/05/2006
|
||||||
|
|
||||||
|
*** Add --output-split-cfuncs for accelerating GCC compile. [Eugene Weber]
|
||||||
|
|
||||||
|
**** Fix $signed mis-extending when input has a WIDTH violation. [Eugene Weber]
|
||||||
|
|
||||||
|
**** Add M32 make variable to support -m32 compiles. [Eugene Weber]
|
||||||
|
|
||||||
|
* Verilator 3.622 10/17/2006 Stable
|
||||||
|
|
||||||
|
**** Fix --skip-identical without --debug, broken in 3.621. [Andy Meier]
|
||||||
|
|
||||||
|
* Verilator 3.621 10/11/2006 Beta
|
||||||
|
|
||||||
|
** Add /*verilator no_inline_task*/ to prevent over-expansion. [Eugene Weber]
|
||||||
|
|
||||||
|
*** Public functions now allow > 64 bit arguments.
|
||||||
|
|
||||||
**** Remove .vpp intermediate files when not under --debug.
|
**** Remove .vpp intermediate files when not under --debug.
|
||||||
|
|
||||||
* Verilator 3.620 10/04/2006
|
**** Fix link error when using --exe with --trace. [Eugene Weber]
|
||||||
|
|
||||||
|
**** Fix mis-optimization of wide concats with constants.
|
||||||
|
|
||||||
|
**** Fix core dump on printing error when not under --debug. [Allan Cochrane]
|
||||||
|
|
||||||
|
* Verilator 3.620 10/04/2006 Stable
|
||||||
|
|
||||||
*** Support simple inout task ports. [Eugene Weber]
|
*** Support simple inout task ports. [Eugene Weber]
|
||||||
|
|
||||||
@@ -436,7 +477,7 @@ indicates the contributor was also the author of the fix; Thanks!
|
|||||||
**** Added NC Verilog as alternative to VCS for reference tests.
|
**** Added NC Verilog as alternative to VCS for reference tests.
|
||||||
|
|
||||||
**** Support implicit wire declarations on input-only signals.
|
**** Support implicit wire declarations on input-only signals.
|
||||||
(Dangerous, as leads to wires without drivers, but allowed by spec.)
|
(Dangerous, as leads to wires without drivers, but allowed by spec.)
|
||||||
|
|
||||||
**** Fixed compile warnings on Suse 9.1
|
**** Fixed compile warnings on Suse 9.1
|
||||||
|
|
||||||
@@ -972,7 +1013,7 @@ $Id$
|
|||||||
|
|
||||||
This uses outline mode in Emacs. See C-h m [M-x describe-mode].
|
This uses outline mode in Emacs. See C-h m [M-x describe-mode].
|
||||||
|
|
||||||
Copyright 2001-2006 by Wilson Snyder. This program is free software;
|
Copyright 2001-2007 by Wilson Snyder. This program is free software;
|
||||||
you can redistribute it and/or modify it under the terms of either the GNU
|
you can 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.
|
||||||
|
|
||||||
|
|||||||
+12
-13
@@ -10,7 +10,7 @@
|
|||||||
#
|
#
|
||||||
#*****************************************************************************
|
#*****************************************************************************
|
||||||
#
|
#
|
||||||
# Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
# Copyright 2003-2007 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.
|
||||||
#
|
#
|
||||||
@@ -78,7 +78,6 @@ datadir = @datadir@
|
|||||||
infodir = @infodir@
|
infodir = @infodir@
|
||||||
|
|
||||||
# Directory in which to install package specific files
|
# Directory in which to install package specific files
|
||||||
# Note this gets coded into v3c/config.h also
|
|
||||||
pkgdatadir = @pkgdatadir@
|
pkgdatadir = @pkgdatadir@
|
||||||
|
|
||||||
#### End of system configuration section. ####
|
#### End of system configuration section. ####
|
||||||
@@ -95,7 +94,7 @@ DISTDEP = info Makefile
|
|||||||
# Files to distribute.
|
# Files to distribute.
|
||||||
DISTBIN = $(wildcard bin/verilator-*)
|
DISTBIN = $(wildcard bin/verilator-*)
|
||||||
|
|
||||||
DISTFILES_INC = $(INFOS) .cvsignore COPYING *.in \
|
DISTFILES_INC = $(INFOS) .cvsignore COPYING *.in *.ac \
|
||||||
Changes README TODO \
|
Changes README TODO \
|
||||||
bin/* \
|
bin/* \
|
||||||
install-sh configure mkinstalldirs *.texi \
|
install-sh configure mkinstalldirs *.texi \
|
||||||
@@ -156,15 +155,15 @@ test_vcs: all_nomsg
|
|||||||
test_c: all_nomsg
|
test_c: all_nomsg
|
||||||
@(cd test_c && $(MAKE))
|
@(cd test_c && $(MAKE))
|
||||||
test_c_debug: all_nomsg
|
test_c_debug: all_nomsg
|
||||||
@(cd test_c && $(MAKE) debug)
|
@(cd test_c && $(MAKE) test_debug)
|
||||||
test_sc: all_nomsg
|
test_sc: all_nomsg
|
||||||
@(cd test_sc && $(MAKE))
|
@(cd test_sc && $(MAKE))
|
||||||
test_sc_debug: all_nomsg
|
test_sc_debug: all_nomsg
|
||||||
@(cd test_sc && $(MAKE) debug)
|
@(cd test_sc && $(MAKE) test_debug)
|
||||||
test_sp: all_nomsg
|
test_sp: all_nomsg
|
||||||
@(cd test_sp && $(MAKE))
|
@(cd test_sp && $(MAKE))
|
||||||
test_sp_debug: all_nomsg
|
test_sp_debug: all_nomsg
|
||||||
@(cd test_sp && $(MAKE) debug)
|
@(cd test_sp && $(MAKE) test_debug)
|
||||||
test_verilated: all_nomsg
|
test_verilated: all_nomsg
|
||||||
@(cd test_verilated && $(MAKE))
|
@(cd test_verilated && $(MAKE))
|
||||||
test_regress: all_nomsg
|
test_regress: all_nomsg
|
||||||
@@ -265,16 +264,16 @@ uninstall:
|
|||||||
-cd $(mandir)/man1 && rm -f $(VL_INST_MAN_FILES)
|
-cd $(mandir)/man1 && rm -f $(VL_INST_MAN_FILES)
|
||||||
-cd $(bindir) && rm -f $(VL_INST_BIN_FILES)
|
-cd $(bindir) && rm -f $(VL_INST_BIN_FILES)
|
||||||
|
|
||||||
# autoheader might not change config.h.in, so touch a stamp file.
|
# autoheader might not change config_build.h.in, so touch a stamp file.
|
||||||
IN_WILD := ${srcdir}/*.in ${srcdir}/*/*.in ${srcdir}/*/*/*.in \
|
IN_WILD := ${srcdir}/*.in ${srcdir}/*/*.in ${srcdir}/*/*/*.in \
|
||||||
*.in */*.in */*.in
|
*.in */*.in */*.in
|
||||||
|
|
||||||
${srcdir}/config.h.in: stamp-h.in
|
${srcdir}/config_build.h.in: stamp-h.in
|
||||||
${srcdir}/stamp-h.in: configure.in $(wildcard $(IN_WILD))
|
${srcdir}/stamp-h.in: configure.ac $(wildcard $(IN_WILD))
|
||||||
cd ${srcdir} && autoheader
|
cd ${srcdir} && autoheader
|
||||||
echo timestamp > ${srcdir}/stamp-h.in
|
echo timestamp > ${srcdir}/stamp-h.in
|
||||||
config.h: stamp-h
|
config_build.h: stamp-h
|
||||||
stamp-h: config.h.in config.status
|
stamp-h: config_build.h.in config.status
|
||||||
./config.status
|
./config.status
|
||||||
Makefile: Makefile.in config.status
|
Makefile: Makefile.in config.status
|
||||||
./config.status
|
./config.status
|
||||||
@@ -282,7 +281,7 @@ src/Makefile: src/Makefile.in config.status
|
|||||||
./config.status
|
./config.status
|
||||||
config.status: configure
|
config.status: configure
|
||||||
./config.status --recheck
|
./config.status --recheck
|
||||||
configure: configure.in
|
configure: configure.ac
|
||||||
autoconf
|
autoconf
|
||||||
|
|
||||||
maintainer-clean::
|
maintainer-clean::
|
||||||
@@ -317,7 +316,7 @@ TAGS: $(TAGFILES)
|
|||||||
######################################################################
|
######################################################################
|
||||||
# Distributions
|
# Distributions
|
||||||
|
|
||||||
DISTCONFIG = src/config.h.in
|
DISTCONFIG = src/config_build.h.in
|
||||||
|
|
||||||
DISTTITLE := $(shell sed -e '/DTVERSION/!d' -e 's/[^0-9]*\([0-9.a-z]*\).*/verilator-\1/' -e 's/v/V/' -e q $(DISTCONFIG))
|
DISTTITLE := $(shell sed -e '/DTVERSION/!d' -e 's/[^0-9]*\([0-9.a-z]*\).*/verilator-\1/' -e 's/v/V/' -e q $(DISTCONFIG))
|
||||||
DISTNAME := $(shell sed -e '/DTVERSION/!d' -e 's/[^0-9]*\([0-9.a-z]*\).*/verilator-\1/' -e q $(DISTCONFIG))
|
DISTNAME := $(shell sed -e '/DTVERSION/!d' -e 's/[^0-9]*\([0-9.a-z]*\).*/verilator-\1/' -e q $(DISTCONFIG))
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ This is the Verilator Package.
|
|||||||
1.1 Copyright
|
1.1 Copyright
|
||||||
=============
|
=============
|
||||||
|
|
||||||
This package is Copyright 2003-2006 by Wilson Snyder
|
This package is Copyright 2003-2007 by Wilson Snyder
|
||||||
<[email protected]>.
|
<[email protected]>.
|
||||||
|
|
||||||
You may distribute under the terms of either the GNU General Public
|
You may distribute under the terms of either the GNU General Public
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// $Id$
|
// $Id$
|
||||||
// DESCRIPTION: Verilator: List of To Do issues.
|
// DESCRIPTION: Verilator: List of To Do issues.
|
||||||
//
|
//
|
||||||
// Copyright 2004-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2004-2007 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.
|
||||||
|
|
||||||
|
|||||||
+165
-48
@@ -4,7 +4,7 @@ eval 'exec perl -wS $0 ${1+"$@"}'
|
|||||||
# $Id$
|
# $Id$
|
||||||
######################################################################
|
######################################################################
|
||||||
#
|
#
|
||||||
# Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
# Copyright 2003-2007 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.
|
||||||
#
|
#
|
||||||
@@ -377,9 +377,18 @@ C++ file exceeds the specified number of operations, a new file will be
|
|||||||
created. In addition, any slow routines will be placed into __Slow files.
|
created. In addition, any slow routines will be placed into __Slow files.
|
||||||
This accelerates compilation by as optimization can be disabled on the slow
|
This accelerates compilation by as optimization can be disabled on the slow
|
||||||
routines, and the remaining files can be compiled on parallel machines.
|
routines, and the remaining files can be compiled on parallel machines.
|
||||||
|
Using --output-split should have only a trivial impact on performance.
|
||||||
With GCC 3.3 on a 2GHz Opteron, --output-split 20000 will result in
|
With GCC 3.3 on a 2GHz Opteron, --output-split 20000 will result in
|
||||||
splitting into approximately one-minute-compile chunks.
|
splitting into approximately one-minute-compile chunks.
|
||||||
|
|
||||||
|
=item --output-split-cfuncs I<statements>
|
||||||
|
|
||||||
|
Enables splitting functions in the output .cpp/.sp files into multiple
|
||||||
|
functions. When a generated function exceeds the specified number of
|
||||||
|
operations, a new function will be created. With --output-split, this will
|
||||||
|
enable GCC to compile faster, at a small loss in performance that increases
|
||||||
|
with smaller statement values.
|
||||||
|
|
||||||
=item --pins64
|
=item --pins64
|
||||||
|
|
||||||
Specifies SystemC outputs of 33-64 bits wide should use uint64_t instead of
|
Specifies SystemC outputs of 33-64 bits wide should use uint64_t instead of
|
||||||
@@ -407,7 +416,7 @@ compatibility.
|
|||||||
|
|
||||||
=item --psl
|
=item --psl
|
||||||
|
|
||||||
Enable PSL parsing. Without this switch, psl meta-comments are ignored.
|
Enable PSL parsing. Without this switch, PSL meta-comments are ignored.
|
||||||
See the --assert flag to enable all assertions, and --coverage-user to
|
See the --assert flag to enable all assertions, and --coverage-user to
|
||||||
enable functional coverage.
|
enable functional coverage.
|
||||||
|
|
||||||
@@ -609,7 +618,7 @@ Then we convert the SystemPerl output to SystemC.
|
|||||||
$SYSTEMPERL/sp_preproc --preproc *.sp
|
$SYSTEMPERL/sp_preproc --preproc *.sp
|
||||||
|
|
||||||
(You can also skip the above sp_preproc by getting pure SystemC from
|
(You can also skip the above sp_preproc by getting pure SystemC from
|
||||||
verilator by replacing the verilator --sp flag in the previous step with
|
Verilator by replacing the verilator --sp flag in the previous step with
|
||||||
-sc.)
|
-sc.)
|
||||||
|
|
||||||
We then can compile it
|
We then can compile it
|
||||||
@@ -846,6 +855,34 @@ Lower modules are not pure SystemC code. This is a feature, as using the
|
|||||||
SystemC pin interconnect scheme everywhere would reduce performance by an
|
SystemC pin interconnect scheme everywhere would reduce performance by an
|
||||||
order of magnitude.
|
order of magnitude.
|
||||||
|
|
||||||
|
=head1 CROSS COMPILATION
|
||||||
|
|
||||||
|
Verilator supports cross-compling Verilated code. This is generally used
|
||||||
|
to run Verilator on a Linux system and produce C++ code that is then compiled
|
||||||
|
on Windows.
|
||||||
|
|
||||||
|
Cross compilation involves up to three different OSes. The build system is
|
||||||
|
where you configured and compiled Verilator, the host system where you run
|
||||||
|
Verilator, and the target system where you compile the Verilated code and
|
||||||
|
run the simulation.
|
||||||
|
|
||||||
|
Currently, Verilator requires the build and host system type to be the
|
||||||
|
same, though the target system type may be different. To support this,
|
||||||
|
./configure and make Verilator on the build system. Then, run Verilator on
|
||||||
|
the host system. Finally, the output of Verilator may be compiled on the
|
||||||
|
different target system.
|
||||||
|
|
||||||
|
To support this, none of the files that Verilator produces will reference
|
||||||
|
any configure generated build-system specific files, such as config.h
|
||||||
|
(which is renamed in Verilator to config_build.h to reduce confusion.) The
|
||||||
|
disadvantage of this approach is that include/verilatedos.h must
|
||||||
|
self-detect the requirements of the target system, rather then using
|
||||||
|
configure.
|
||||||
|
|
||||||
|
The target system may also require edits to the Makefiles, the simple
|
||||||
|
Makefiles produced by Verilator presume the target system is the same type
|
||||||
|
as the build system.
|
||||||
|
|
||||||
=head1 VERILOG 2001 SUPPORT
|
=head1 VERILOG 2001 SUPPORT
|
||||||
|
|
||||||
Verilator supports the more common Verilog 2001 language features. This
|
Verilator supports the more common Verilog 2001 language features. This
|
||||||
@@ -938,7 +975,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 hardcoding variable
|
output C++ code. For input arguments, rather then 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
|
||||||
@@ -959,16 +996,6 @@ Verilog standard, %x prints a number with the natural width, %0x prints a
|
|||||||
number with minimum width, however %5x prints 5 digits per the C standard
|
number with minimum width, however %5x prints 5 digits per the C standard
|
||||||
(it's unspecified in Verilog).
|
(it's unspecified in Verilog).
|
||||||
|
|
||||||
=item $fopen, $fclose, $fdisplay, $fwrite
|
|
||||||
|
|
||||||
File descriptors passed to the file PLI calls must be file descriptors, not
|
|
||||||
MCDs, which includes the mode parameter to $fopen being mandatory.
|
|
||||||
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
|
|
||||||
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
|
|
||||||
verilated.v can be used to hide this difference.
|
|
||||||
|
|
||||||
=item `coverage_block_off
|
=item `coverage_block_off
|
||||||
|
|
||||||
Specifies the entire begin/end block should be ignored for coverage analysis.
|
Specifies the entire begin/end block should be ignored for coverage analysis.
|
||||||
@@ -1056,6 +1083,14 @@ Disable the specified warning message for any warnings following the comment.
|
|||||||
|
|
||||||
Re-enable the specified warning message for any warnings following the comment.
|
Re-enable the specified warning message for any warnings following the comment.
|
||||||
|
|
||||||
|
=item /*verilator no_inline_task*/
|
||||||
|
|
||||||
|
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
|
||||||
|
reduce the size of the final executable when a task is used a very large
|
||||||
|
number of times. For this flag to work, the task and tasks below it must
|
||||||
|
be pure; they cannot reference any variables outside the task itself.
|
||||||
|
|
||||||
=item /*verilator sc_clock*/
|
=item /*verilator sc_clock*/
|
||||||
|
|
||||||
Used after a input declaration to indicate the signal should be declared in
|
Used after a input declaration to indicate the signal should be declared in
|
||||||
@@ -1134,25 +1169,21 @@ always @* to prevent these issues.)
|
|||||||
|
|
||||||
Verilator supports dotted references to variables, functions and tasks in
|
Verilator supports dotted references to variables, functions and tasks in
|
||||||
different modules. However, references into named blocks and function-local
|
different modules. However, references into named blocks and function-local
|
||||||
variables are not supported. References into arrayed and generated
|
variables are not supported. The portion before the dot must have a
|
||||||
instances work, but still require some work-arounds in the Verilog code:
|
constant value; for example a[2].b is acceptable, while a[x].b is not.
|
||||||
|
|
||||||
References into arrayed instances use different names from the Verilog
|
References into generated and arrayed instances use the instance names
|
||||||
standard; arrayed instances are named {cellName}__{instanceNumber}. For
|
specified in the Verilog standard; arrayed instances are named
|
||||||
example a[2] is instead a__2. Thus you cannot use a parameter or variable
|
{cellName}[{instanceNumber}] in Verilog, which becomes
|
||||||
to select the index number; expand it into a case statement manually.
|
{cellname}__BRA__{instanceNumber}__KET__ inside the generated C++ code.
|
||||||
|
|
||||||
References into generate statements also use different names from the
|
Verilator creates numbered "genblk" when a begin: name is not specified
|
||||||
Verilog standard; the top level generate, any begin statement, and any
|
around a block inside a generate statement. These numbers may differ
|
||||||
place where there is a implied begin statement (under each generate-if or
|
between other simulators, but the Verilog specification does not allow
|
||||||
generate-case) adds a hierarchy level named genblkI<instanceNumber>. And
|
users to use these names, so it should not matter.
|
||||||
each generate-for adds genforI<loopCount>. The best bet is to comment out
|
|
||||||
the references and run with --debug and look in the at the _begin.tree
|
If you are having trouble determining where a dotted path goes wrong, note
|
||||||
file, and see the hierarchy by looking at the names of all of the CELLs in
|
that Verilator will print a list of known scopes to help your debugging.
|
||||||
question. Replace __DOT__ with . in your program. For example most cells
|
|
||||||
under a for loop would be something like
|
|
||||||
"genblk__DOT__genfor0__DOT__I<cellname>"; so use genblk.genfor0.I<cellname> to
|
|
||||||
see inside that cell.
|
|
||||||
|
|
||||||
=head2 Latches
|
=head2 Latches
|
||||||
|
|
||||||
@@ -1271,7 +1302,28 @@ appropriate width.
|
|||||||
$display and friends must have a constant format string as the first
|
$display and friends must have a constant format string as the first
|
||||||
argument (as with C's printf), you cannot simply list variables standalone.
|
argument (as with C's printf), you cannot simply list variables standalone.
|
||||||
|
|
||||||
=head1 ERRORS
|
=item $displayb, $displayh, $displayo, $writeb, $writeh, $writeo, etc
|
||||||
|
|
||||||
|
The sized display functions are rarely used and so not supported. Replace
|
||||||
|
them with a $write with the appropriate format specifier.
|
||||||
|
|
||||||
|
=item $fopen, $fclose, $fdisplay, $fwrite
|
||||||
|
|
||||||
|
File descriptors passed to the file PLI calls must be file descriptors, not
|
||||||
|
MCDs, which includes the mode parameter to $fopen being mandatory.
|
||||||
|
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
|
||||||
|
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
|
||||||
|
verilated.v can be used to hide this difference.
|
||||||
|
|
||||||
|
=item $readmemb, $readmemh
|
||||||
|
|
||||||
|
Read memory commands should work properly. Note Verilator and the Verilog
|
||||||
|
specification does not include support for readmem to multi-dimensional
|
||||||
|
arrays.
|
||||||
|
|
||||||
|
=head1 ERRORS AND WARNINGS
|
||||||
|
|
||||||
Warnings may be disabled in two ways. First, when the warning is
|
Warnings may be disabled in two ways. First, when the warning is
|
||||||
printed it will include a warning code. Simply surround the offending
|
printed it will include a warning code. Simply surround the offending
|
||||||
@@ -1281,13 +1333,13 @@ line with a warn_off/warn_on pair:
|
|||||||
if (`DEF_THAT_IS_EQ_ZERO <= 3) $stop;
|
if (`DEF_THAT_IS_EQ_ZERO <= 3) $stop;
|
||||||
// verilator lint_on UNSIGNED
|
// verilator lint_on UNSIGNED
|
||||||
|
|
||||||
They may also be globally disabled by invoking Verilator with the
|
Warnings may also be globally disabled by invoking Verilator with the
|
||||||
C<-Wno-I<warning>> switch. This should be avoided, as it removes
|
C<-Wno-I<warning>> switch. This should be avoided, as it removes all
|
||||||
all checking across the designs, and prevents other users from
|
checking across the designs, and prevents other users from compiling your
|
||||||
compiling your code without knowing the magic set of disables needed
|
code without knowing the magic set of disables needed to successfully
|
||||||
to successfully compile your design.
|
compile your design.
|
||||||
|
|
||||||
Warnings:
|
List of all warnings:
|
||||||
|
|
||||||
=over 4
|
=over 4
|
||||||
|
|
||||||
@@ -1344,12 +1396,41 @@ signal before it is implicitly declared by a cell, and can lead to dangling
|
|||||||
nets. A better option is the /*AUTOWIRE*/ feature of Verilog-Mode for
|
nets. A better option is the /*AUTOWIRE*/ feature of Verilog-Mode for
|
||||||
Emacs, available from L<http://www.veripool.com/>
|
Emacs, available from L<http://www.veripool.com/>
|
||||||
|
|
||||||
|
=item IMPURE
|
||||||
|
|
||||||
|
Warns that a task or function that has been marked with /*verilator
|
||||||
|
no_inline_task*/ references variables that are not local to the task.
|
||||||
|
Verilator cannot schedule these variables correctly.
|
||||||
|
|
||||||
=item MULTIDRIVEN
|
=item MULTIDRIVEN
|
||||||
|
|
||||||
Warns that the specified signal comes from multiple always blocks. This is
|
Warns that the specified signal comes from multiple always blocks. This is
|
||||||
often unsupported by synthesis tools, and is considered bad style. It will
|
often unsupported by synthesis tools, and is considered bad style. It will
|
||||||
also cause longer runtimes due to reduced optimizations.
|
also cause longer runtimes due to reduced optimizations.
|
||||||
|
|
||||||
|
=item TASKNSVAR
|
||||||
|
|
||||||
|
Error when a call to a task or function has a output from that task tied to
|
||||||
|
a non-simple signal. Instead connect the task output to a temporary signal
|
||||||
|
of the appropriate width, and use that signal to set the appropriate
|
||||||
|
expression as the next statement. For example:
|
||||||
|
|
||||||
|
task foo; output sig; ... endtask
|
||||||
|
always @* begin
|
||||||
|
foo(bus_we_select_from[2]); // Will get TASKNSVAR error
|
||||||
|
end
|
||||||
|
|
||||||
|
Change this to:
|
||||||
|
|
||||||
|
reg foo_temp_out;
|
||||||
|
always @* begin
|
||||||
|
foo(foo_temp_out);
|
||||||
|
bus_we_select_from[2] = foo_temp_out;
|
||||||
|
end
|
||||||
|
|
||||||
|
Verilator doesn't do this conversion for you, as some more complicated
|
||||||
|
cases would result in simulator mismatches.
|
||||||
|
|
||||||
=item UNDRIVEN
|
=item UNDRIVEN
|
||||||
|
|
||||||
Warns that the specified signal is never sourced.
|
Warns that the specified signal is never sourced.
|
||||||
@@ -1375,11 +1456,11 @@ may be only one particular usage of a multiply instantiated block. The
|
|||||||
construct should be cleaned up to improve runtime; two times better
|
construct should be cleaned up to improve runtime; two times better
|
||||||
performance may be possible by fixing these warnings.
|
performance may be possible by fixing these warnings.
|
||||||
|
|
||||||
Unlike UNOPT this occurs after netlist flattening, and indicates a more
|
Unlike the UNOPT warning, this occurs after netlist flattening, and
|
||||||
basic problem, as the less obvious case described under UNOPT does not
|
indicates a more basic problem, as the less obvious case described under
|
||||||
apply.
|
UNOPT does not apply.
|
||||||
|
|
||||||
Often this is caused by logic that isn't truly circular as viewed by
|
Often UNOPTFLAT is caused by logic that isn't truly circular as viewed by
|
||||||
synthesis which analyzes interconnection per-bit, but is circular to
|
synthesis which analyzes interconnection per-bit, but is circular to
|
||||||
simulation which analyzes per-bus:
|
simulation which analyzes per-bus:
|
||||||
|
|
||||||
@@ -1387,12 +1468,31 @@ simulation which analyzes per-bus:
|
|||||||
|
|
||||||
This statement needs to be evaluated multiple times, as a change in
|
This statement needs to be evaluated multiple times, as a change in
|
||||||
"shift_in" requires "x" to be computed 3 times before it becomes stable.
|
"shift_in" requires "x" to be computed 3 times before it becomes stable.
|
||||||
|
This is because a change in "x" requires "x" itself to change value, which
|
||||||
|
causes the warning.
|
||||||
|
|
||||||
For significantly better performance, split this into 2 separate signals:
|
For significantly better performance, split this into 2 separate signals:
|
||||||
|
|
||||||
wire [2:1] x_21 = x[1:0];
|
wire [2:0] xout = {x[1:0],shift_in};
|
||||||
wire [0:0] x_0 = shift_in;
|
|
||||||
|
|
||||||
This warning may also be due to clock enables. To fix these, use the
|
and change all receiving logic to instead receive "xout". Alternatively,
|
||||||
|
change it to
|
||||||
|
|
||||||
|
wire [2:0] x = {xin[1:0],shift_in};
|
||||||
|
|
||||||
|
and change all driving logic to instead drive "xin".
|
||||||
|
|
||||||
|
With this change this assignment needs to be evaluated only once. These
|
||||||
|
sort of changes may also speed up your traditional event driven simulator,
|
||||||
|
as it will result in fewer events per cycle.
|
||||||
|
|
||||||
|
The most complicated UNOPTFLAT path we've seen was due to low bits of a bus
|
||||||
|
being generated from an always statement that consumed high bits of the
|
||||||
|
same bus processed by another series of always blocks. The fix is the
|
||||||
|
same; split it into two separate signals generated from each block.
|
||||||
|
|
||||||
|
The UNOPTFLAT warning may also be due to clock enables, identified from the
|
||||||
|
reported path going through a clock gating cell. To fix these, use the
|
||||||
clock_enable meta comment described above.
|
clock_enable meta comment described above.
|
||||||
|
|
||||||
=item UNSIGNED
|
=item UNSIGNED
|
||||||
@@ -1450,8 +1550,8 @@ that is not yet supported in Verilator. See the Limitations chapter.
|
|||||||
=item Verilated model didn't converge
|
=item Verilated model didn't converge
|
||||||
|
|
||||||
Verilator sometimes has to evaluate combinatorial logic multiple times,
|
Verilator sometimes has to evaluate combinatorial logic multiple times,
|
||||||
usually around code where a UNOPT warning was issued, but disabled. For
|
usually around code where a UNOPTFLAT warning was issued, but disabled.
|
||||||
example:
|
For example:
|
||||||
|
|
||||||
always @ (a) b=~a;
|
always @ (a) b=~a;
|
||||||
always @ (b) a=b
|
always @ (b) a=b
|
||||||
@@ -1524,6 +1624,12 @@ create a SpTraceFile object as you would create a normal SystemC trace
|
|||||||
file. For an example, see the call to SpTraceFile in the
|
file. For an example, see the call to SpTraceFile in the
|
||||||
test_sp/sc_main.cpp file of the distribution.
|
test_sp/sc_main.cpp file of the distribution.
|
||||||
|
|
||||||
|
=item How do I view waveforms (traces)?
|
||||||
|
|
||||||
|
Verilator makes standard VCD (Value Change Dump) files. They are viewable
|
||||||
|
with the public domain Dinotrace or GtkWave programs, or any of the many
|
||||||
|
commercial offerings.
|
||||||
|
|
||||||
=item Where is the translate_off command? (How do I ignore a construct?)
|
=item Where is the translate_off command? (How do I ignore a construct?)
|
||||||
|
|
||||||
Translate on/off pragmas are generally a bad idea, as it's easy to have
|
Translate on/off pragmas are generally a bad idea, as it's easy to have
|
||||||
@@ -1546,6 +1652,11 @@ controlled by --assert are disabled.
|
|||||||
In C++ (non SystemC) code you need to define this function so that the
|
In C++ (non SystemC) code you need to define this function so that the
|
||||||
simulator knows the current time. See the "CONNECTING TO C++" examples.
|
simulator knows the current time. See the "CONNECTING TO C++" examples.
|
||||||
|
|
||||||
|
=item Why do I get "undefined reference to `VL_RAND_RESET_I' or `Verilated::...'"?
|
||||||
|
|
||||||
|
You need to link your compiled Verilated code against the verilated.cpp
|
||||||
|
file found in the include directory of the Verilator kit.
|
||||||
|
|
||||||
=item Is the PLI supported?
|
=item Is the PLI supported?
|
||||||
|
|
||||||
No.
|
No.
|
||||||
@@ -1556,6 +1667,12 @@ complex, since Verilator emits standard C++ code, you can simply write your
|
|||||||
own C++ routines that can access and modify signal values without needing
|
own C++ routines that can access and modify signal values without needing
|
||||||
any PLI interface code, and call it with $c("{any_c++_statement}").
|
any PLI interface code, and call it with $c("{any_c++_statement}").
|
||||||
|
|
||||||
|
=item How do I make a Verilog module that contain a C++ object?
|
||||||
|
|
||||||
|
You need to add the object to the structure that Verilator creates, then
|
||||||
|
use $c to call a method inside your object. The
|
||||||
|
test_regress/t/t_extend_class files show an example of how to do this.
|
||||||
|
|
||||||
=item How do I get faster build times?
|
=item How do I get faster build times?
|
||||||
|
|
||||||
Between GCC 3.0 to 3.3, each compiled progressively slower, thus if you can
|
Between GCC 3.0 to 3.3, each compiled progressively slower, thus if you can
|
||||||
@@ -1703,7 +1820,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-2006 by Wilson Snyder. Verilator is free software; you can
|
Copyright 2003-2007 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-2006 by Wilson Snyder <[email protected]>. This
|
# Copyright 2005-2007 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.
|
||||||
@@ -46,6 +46,9 @@ if (! GetOptions (
|
|||||||
defined $Opt_A or die "%Error: No old diff filename\n";
|
defined $Opt_A or die "%Error: No old diff filename\n";
|
||||||
defined $Opt_B or die "%Error: No new diff filename\n";
|
defined $Opt_B or die "%Error: No new diff filename\n";
|
||||||
|
|
||||||
|
-e $Opt_A or die "%Error: No old diff filename found: $Opt_A\n";
|
||||||
|
-e $Opt_B or die "%Error: No new diff filename found: $Opt_B\n";
|
||||||
|
|
||||||
if (-d $Opt_A && -d $Opt_B) {
|
if (-d $Opt_A && -d $Opt_B) {
|
||||||
diff_dir ($Opt_A, $Opt_B);
|
diff_dir ($Opt_A, $Opt_B);
|
||||||
} elsif (-f $Opt_A && -f $Opt_B) {
|
} elsif (-f $Opt_A && -f $Opt_B) {
|
||||||
@@ -176,7 +179,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-2006 by Wilson Snyder. This package is free software; you
|
Copyright 2005-2007 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-2006 by Wilson Snyder. This program is free software; you can
|
# Copyright 2003-2007 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,12 +1,12 @@
|
|||||||
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-2006 by Wilson Snyder. This program is free software; you can
|
dnl Copyright 2003-2007 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.
|
||||||
|
|
||||||
AC_REVISION($Revision$)dnl
|
AC_REVISION($Revision$)dnl
|
||||||
AC_INIT(src/Verilator.cpp)
|
AC_INIT(src/Verilator.cpp)
|
||||||
AC_CONFIG_HEADER(src/config.h)
|
AC_CONFIG_HEADER(src/config_build.h)
|
||||||
|
|
||||||
dnl Special Substitutions
|
dnl Special Substitutions
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ dnl Checks for libraries.
|
|||||||
dnl Checks for header files.
|
dnl Checks for header files.
|
||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
AC_HEADER_SYS_WAIT
|
AC_HEADER_SYS_WAIT
|
||||||
AC_CHECK_HEADERS(fcntl.h unistd.h sys/file.h sys/time.h sys/un.h math.h stdint.h mingw/stdint.h)
|
AC_CHECK_HEADERS(fcntl.h unistd.h inttypes.h sys/file.h sys/time.h sys/un.h math.h stdint.h mingw/stdint.h)
|
||||||
|
|
||||||
dnl Checks for typedefs, structures
|
dnl Checks for typedefs, structures
|
||||||
AC_CHECK_TYPE(size_t,unsigned int)
|
AC_CHECK_TYPE(size_t,unsigned int)
|
||||||
+109
-1
@@ -1,7 +1,7 @@
|
|||||||
// $Id$ -*- C++ -*-
|
// $Id$ -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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.
|
||||||
//
|
//
|
||||||
@@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include "verilated.h"
|
#include "verilated.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#define VL_VALUE_STRING_MAX_WIDTH 1024 ///< Max static char array for VL_VALUE_STRING
|
#define VL_VALUE_STRING_MAX_WIDTH 1024 ///< Max static char array for VL_VALUE_STRING
|
||||||
|
|
||||||
@@ -238,6 +239,113 @@ QData VL_FOPEN_WI(int fnwords, WDataInP filenamep, IData mode) {
|
|||||||
return VL_CVT_FP_Q(fopen(filenamez,modez));
|
return VL_CVT_FP_Q(fopen(filenamez,modez));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VL_READMEM_Q(bool hex, int width, int depth, int array_lsb, int,
|
||||||
|
QData ofilename, void* memp, IData start, IData end) {
|
||||||
|
IData fnw[2]; VL_SET_WQ(fnw, ofilename);
|
||||||
|
return VL_READMEM_W(hex,width,depth,array_lsb,2, fnw,memp,start,end);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VL_READMEM_W(bool hex, int width, int depth, int array_lsb, int fnwords,
|
||||||
|
WDataInP ofilenamep, void* memp, IData start, IData end) {
|
||||||
|
char ofilenamez[VL_TO_STRING_MAX_WORDS*VL_WORDSIZE+1];
|
||||||
|
_VL_VINT_TO_STRING(fnwords*VL_WORDSIZE, ofilenamez, ofilenamep);
|
||||||
|
FILE* fp = fopen(ofilenamez, "r");
|
||||||
|
if (!fp) {
|
||||||
|
// We don't report the Verilog source filename as it slow to have to pass it down
|
||||||
|
vl_fatal (ofilenamez, 0, "", "$readmem file not found");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Prep for reading
|
||||||
|
IData addr = start;
|
||||||
|
int linenum = 1;
|
||||||
|
bool innum = false;
|
||||||
|
bool ignore_to_eol = false;
|
||||||
|
bool ignore_to_cmt = false;
|
||||||
|
bool needinc = false;
|
||||||
|
bool reading_addr = false;
|
||||||
|
int lastc = ' ';
|
||||||
|
// Read the data
|
||||||
|
// We process a character at a time, as then we don't need to deal
|
||||||
|
// with changing buffer sizes dynamically, etc.
|
||||||
|
while (1) {
|
||||||
|
int c = fgetc(fp);
|
||||||
|
if (c==EOF) break;
|
||||||
|
//printf("%d: Got '%c' Addr%x IN%d IgE%d IgC%d ninc%d\n", linenum, c, addr, innum, ignore_to_eol, ignore_to_cmt, needinc);
|
||||||
|
if (c=='\n') { linenum++; ignore_to_eol=false; if (innum) reading_addr=false; innum=false; }
|
||||||
|
else if (c=='\t' || c==' ' || c=='\r' || c=='\f') { if (innum) reading_addr=false; innum=false; }
|
||||||
|
// Skip // comments and detect /* comments
|
||||||
|
else if (ignore_to_cmt && lastc=='*' && c=='/') {
|
||||||
|
ignore_to_cmt = false; if (innum) reading_addr=false; innum=false;
|
||||||
|
} else if (!ignore_to_eol && !ignore_to_cmt) {
|
||||||
|
if (lastc=='/' && c=='*') { ignore_to_cmt = true; }
|
||||||
|
else if (lastc=='/' && c=='/') { ignore_to_eol = true; }
|
||||||
|
else if (c=='/') {} // Part of /* or //
|
||||||
|
else if (c=='_') {}
|
||||||
|
else if (c=='@') { reading_addr = true; innum=false; needinc=false; }
|
||||||
|
// Check for hex or binary digits as file format requests
|
||||||
|
else if (isxdigit(c)) {
|
||||||
|
c = tolower(c);
|
||||||
|
int value = (c >= 'a' ? (c-'a'+10) : (c-'0'));
|
||||||
|
if (!innum) { // Prep for next number
|
||||||
|
if (needinc) { addr++; needinc=false; }
|
||||||
|
}
|
||||||
|
if (reading_addr) {
|
||||||
|
// Decode @ addresses
|
||||||
|
if (!innum) addr=0;
|
||||||
|
addr = (addr<<4) + value;
|
||||||
|
} else {
|
||||||
|
needinc = true;
|
||||||
|
//printf(" Value width=%d @%x = %c\n", width, addr, c);
|
||||||
|
if (addr >= (IData)(depth+array_lsb) || addr < (IData)(array_lsb)) {
|
||||||
|
vl_fatal (ofilenamez, linenum, "", "$readmem file address beyond bounds of array");
|
||||||
|
} else {
|
||||||
|
int entry = addr - array_lsb;
|
||||||
|
QData shift = hex ? VL_ULL(4) : VL_ULL(1);
|
||||||
|
// Shift value in
|
||||||
|
if (width<=8) {
|
||||||
|
CData* datap = &((CData*)(memp))[entry];
|
||||||
|
if (!innum) { *datap = 0; }
|
||||||
|
*datap = ((*datap << shift) + value) & VL_MASK_I(width);
|
||||||
|
} else if (width<=16) {
|
||||||
|
SData* datap = &((SData*)(memp))[entry];
|
||||||
|
if (!innum) { *datap = 0; }
|
||||||
|
*datap = ((*datap << shift) + value) & VL_MASK_I(width);
|
||||||
|
} else if (width<=VL_WORDSIZE) {
|
||||||
|
IData* datap = &((IData*)(memp))[entry];
|
||||||
|
if (!innum) { *datap = 0; }
|
||||||
|
*datap = ((*datap << shift) + value) & VL_MASK_I(width);
|
||||||
|
} else if (width<=VL_QUADSIZE) {
|
||||||
|
QData* datap = &((QData*)(memp))[entry];
|
||||||
|
if (!innum) { *datap = 0; }
|
||||||
|
*datap = ((*datap << (QData)(shift)) + (QData)(value)) & VL_MASK_Q(width);
|
||||||
|
} else {
|
||||||
|
WDataOutP datap = &((WDataOutP)(memp))[ entry*VL_WORDS_I(width) ];
|
||||||
|
if (!innum) { VL_ZERO_RESET_W(width, datap); }
|
||||||
|
_VL_SHIFTL_INPLACE_W(width, datap, shift);
|
||||||
|
datap[0] |= value;
|
||||||
|
}
|
||||||
|
if (value>=(1<<shift)) {
|
||||||
|
vl_fatal (ofilenamez, linenum, "", "$readmemb (binary) file contains hex characters");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
innum = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
vl_fatal (ofilenamez, linenum, "", "$readmem file syntax error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lastc = c;
|
||||||
|
}
|
||||||
|
if (needinc) { addr++; needinc=false; }
|
||||||
|
|
||||||
|
// Final checks
|
||||||
|
fclose(fp);
|
||||||
|
if (end != (IData)(~ VL_ULL(0)) && addr != (end+1)) {
|
||||||
|
vl_fatal (ofilenamez, linenum, "", "$readmem file ended before specified ending-address");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
// Verilated:: Methods
|
// Verilated:: Methods
|
||||||
|
|
||||||
|
|||||||
+63
-4
@@ -1,7 +1,7 @@
|
|||||||
// $Id$ -*- C++ -*-
|
// $Id$ -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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.
|
||||||
//
|
//
|
||||||
@@ -194,9 +194,17 @@ inline const char* VL_VALUE_FORMATTED_I(int obits, char fmt, bool drop0, IData l
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// File I/O
|
/// File I/O
|
||||||
extern QData VL_FOPEN_WI(int fnwords, WDataInP filename, IData mode);
|
extern QData VL_FOPEN_WI(int fnwords, WDataInP ofilename, IData mode);
|
||||||
extern QData VL_FOPEN_QI(QData filename, IData mode);
|
extern QData VL_FOPEN_QI(QData ofilename, IData mode);
|
||||||
inline QData VL_FOPEN_II(IData filename, IData mode) { return VL_FOPEN_QI(filename,mode); }
|
inline QData VL_FOPEN_II(IData ofilename, IData mode) { return VL_FOPEN_QI(ofilename,mode); }
|
||||||
|
|
||||||
|
extern void VL_READMEM_W(bool hex, int width, int depth, int array_lsb, int fnwords,
|
||||||
|
WDataInP ofilename, void* memp, IData start, IData end);
|
||||||
|
extern void VL_READMEM_Q(bool hex, int width, int depth, int array_lsb, int fnwords,
|
||||||
|
QData ofilename, void* memp, IData start, IData end);
|
||||||
|
inline void VL_READMEM_I(bool hex, int width, int depth, int array_lsb, int fnwords,
|
||||||
|
IData ofilename, void* memp, IData start, IData end) {
|
||||||
|
VL_READMEM_Q(hex, width,depth,array_lsb,fnwords, ofilename,memp,start,end); }
|
||||||
|
|
||||||
//=========================================================================
|
//=========================================================================
|
||||||
// Base macros
|
// Base macros
|
||||||
@@ -226,6 +234,13 @@ static inline QData VL_CVT_FP_Q(FILE* fp) { union { FILE* fp; QData q; } u; u.q
|
|||||||
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)&(1UL<<(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
|
||||||
|
static inline void _VL_DEBUG_PRINT_W(int lbits, WDataInP iwp) {
|
||||||
|
printf(" Data: w%d: ", lbits);
|
||||||
|
for (int i=VL_WORDS_I(lbits)-1; i>=0; i--) { printf("%08x ",iwp[i]); }
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
//=========================================================================
|
//=========================================================================
|
||||||
// Pli macros
|
// Pli macros
|
||||||
|
|
||||||
@@ -1035,6 +1050,18 @@ static inline WDataOutP VL_CONCAT_WWW(int obits,int lbits,int rbits,WDataOutP ow
|
|||||||
//===================================================================
|
//===================================================================
|
||||||
// Shifts
|
// Shifts
|
||||||
|
|
||||||
|
// Static shift, used by internal functions
|
||||||
|
// The output is the same as the input - it overlaps!
|
||||||
|
static inline void _VL_SHIFTL_INPLACE_W(int obits,WDataOutP iowp,IData rd/*1 or 4*/) {
|
||||||
|
int words = VL_WORDS_I(obits);
|
||||||
|
IData linsmask = VL_MASK_I(rd);
|
||||||
|
for (int i=words-1; i>=1; i--) {
|
||||||
|
iowp[i] = ((iowp[i]<<rd) & ~linsmask) | ((iowp[i-1] >> (32-rd)) & linsmask);
|
||||||
|
}
|
||||||
|
iowp[0] = ((iowp[0]<<rd) & ~linsmask);
|
||||||
|
iowp[VL_WORDS_I(obits)-1] &= VL_MASK_I(obits);
|
||||||
|
}
|
||||||
|
|
||||||
// EMIT_RULE: VL_SHIFTL: oclean=lclean; rclean==clean;
|
// EMIT_RULE: VL_SHIFTL: oclean=lclean; rclean==clean;
|
||||||
// Important: Unlike most other funcs, the shift might well be a computed
|
// Important: Unlike most other funcs, the shift might well be a computed
|
||||||
// expression. Thus consider this when optimizing. (And perhaps have 2 funcs?)
|
// expression. Thus consider this when optimizing. (And perhaps have 2 funcs?)
|
||||||
@@ -1328,6 +1355,38 @@ static inline WDataOutP VL_CONST_W_16X(int obits, WDataOutP o,
|
|||||||
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[9]=d9; o[10]=d10; o[11]=d11; o[12]=d12; o[13]=d13; o[14]=d14; o[15]=d15;
|
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); }
|
_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,
|
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 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 d15,I d14,I d13,I d12,I d11,I d10,I d9,I d8,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
######################################################################
|
######################################################################
|
||||||
# DESCRIPTION: Makefile commands for all verilated target files
|
# DESCRIPTION: Makefile commands for all verilated target files
|
||||||
#
|
#
|
||||||
# Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
# Copyright 2003-2007 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,9 @@ VPATH += $(VERILATOR_ROOT)/include
|
|||||||
#OPT = -ggdb -DPRINTINITSTR
|
#OPT = -ggdb -DPRINTINITSTR
|
||||||
CPPFLAGS += $(OPT)
|
CPPFLAGS += $(OPT)
|
||||||
|
|
||||||
|
CPPFLAGS += $(M32)
|
||||||
|
LDFLAGS += $(M32)
|
||||||
|
|
||||||
# See the benchmarking section of bin/verilator.
|
# See the benchmarking section of bin/verilator.
|
||||||
# Support class optimizations. This includes the tracing and symbol table.
|
# Support class optimizations. This includes the tracing and symbol table.
|
||||||
# SystemC takes minutes to optimize, thus it is off by default.
|
# SystemC takes minutes to optimize, thus it is off by default.
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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,7 +1,7 @@
|
|||||||
// $Id$ -*- C++ -*-
|
// $Id$ -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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.
|
||||||
//
|
//
|
||||||
@@ -15,9 +15,11 @@
|
|||||||
/// \file
|
/// \file
|
||||||
/// \brief Verilator: Common include for OS portability (verilated & verilator)
|
/// \brief Verilator: Common include for OS portability (verilated & verilator)
|
||||||
///
|
///
|
||||||
/// This header is used by both verilated code, and the verilator
|
/// This header is used by both the Verilator source code (run on the
|
||||||
/// program itself Code needed by only one goes into verilated.h or
|
/// build and host system), and the Verilated output (run on the target
|
||||||
/// config.h.in respectively.
|
/// system). Code needed by only the host system goes into
|
||||||
|
/// config_build.h.in, code needed by Verilated code only goes into
|
||||||
|
/// verilated.h, and code needed by both goes here (verilatedos.h).
|
||||||
///
|
///
|
||||||
/// Code available from: http://www.veripool.com/verilator
|
/// Code available from: http://www.veripool.com/verilator
|
||||||
///
|
///
|
||||||
|
|||||||
+2
-2
@@ -2,7 +2,7 @@
|
|||||||
# $Id$
|
# $Id$
|
||||||
######################################################################
|
######################################################################
|
||||||
#
|
#
|
||||||
# Copyright 2005-2006 by Wilson Snyder <[email protected]>. This
|
# Copyright 2005-2007 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-2006 by Wilson Snyder. This package is free software; you
|
Copyright 2005-2007 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-2006 by Wilson Snyder <[email protected]>. This
|
# Copyright 2005-2007 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-2006 by Wilson Snyder. This package is free software; you
|
Copyright 2005-2007 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-2006 by Wilson Snyder @email{wsnyder@@wsnyder.org}.
|
This package is Copyright 2003-2007 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
@@ -1,5 +1,5 @@
|
|||||||
*.old
|
*.old
|
||||||
config.h
|
config_build.h
|
||||||
Makefile
|
Makefile
|
||||||
Makefile_obj
|
Makefile_obj
|
||||||
.objcache*
|
.objcache*
|
||||||
|
|||||||
+2
-2
@@ -7,7 +7,7 @@
|
|||||||
#
|
#
|
||||||
#*****************************************************************************
|
#*****************************************************************************
|
||||||
#
|
#
|
||||||
# Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
# Copyright 2003-2007 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.
|
||||||
#
|
#
|
||||||
@@ -87,4 +87,4 @@ clean mostlyclean distclean maintainer-clean::
|
|||||||
-rm -f .objcache*
|
-rm -f .objcache*
|
||||||
|
|
||||||
distclean maintainer-clean::
|
distclean maintainer-clean::
|
||||||
-rm -f Makefile Makefile_obj
|
-rm -f Makefile Makefile_obj config_build.h
|
||||||
|
|||||||
+6
-5
@@ -7,7 +7,7 @@
|
|||||||
#
|
#
|
||||||
#*****************************************************************************
|
#*****************************************************************************
|
||||||
#
|
#
|
||||||
# Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
# Copyright 2003-2007 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.
|
||||||
#
|
#
|
||||||
@@ -28,6 +28,8 @@ CC = @CC@
|
|||||||
CXX = @CXX@
|
CXX = @CXX@
|
||||||
LINK = @CXX@
|
LINK = @CXX@
|
||||||
|
|
||||||
|
LDFLAGS += @LDFLAGS@
|
||||||
|
|
||||||
#### End of system configuration section. ####
|
#### End of system configuration section. ####
|
||||||
|
|
||||||
VPATH += . $(srcdir)
|
VPATH += . $(srcdir)
|
||||||
@@ -36,14 +38,12 @@ TGT = ../../verilator_bin
|
|||||||
#################
|
#################
|
||||||
ifeq ($(VL_DEBUG),)
|
ifeq ($(VL_DEBUG),)
|
||||||
# Optimize
|
# Optimize
|
||||||
LDFLAGS =
|
|
||||||
COPT = -O
|
COPT = -O
|
||||||
else
|
else
|
||||||
# Debug
|
# Debug
|
||||||
LDFLAGS =
|
|
||||||
COPT = -ggdb -DVL_DEBUG
|
COPT = -ggdb -DVL_DEBUG
|
||||||
# Debug & Profile:
|
# Debug & Profile:
|
||||||
#LDFLAGS = -pg -g
|
#LDFLAGS += -pg -g
|
||||||
#COPT = -ggdb -pg -g
|
#COPT = -ggdb -pg -g
|
||||||
endif
|
endif
|
||||||
#################
|
#################
|
||||||
@@ -89,7 +89,6 @@ clean mostlyclean distclean maintainer-clean::
|
|||||||
-rm -f obj_* .objcache*
|
-rm -f obj_* .objcache*
|
||||||
|
|
||||||
distclean maintainer-clean:: clean
|
distclean maintainer-clean:: clean
|
||||||
rm -f Makefile config.h
|
|
||||||
|
|
||||||
maintainer-clean::
|
maintainer-clean::
|
||||||
|
|
||||||
@@ -143,6 +142,8 @@ RAW_OBJS = \
|
|||||||
V3LinkCells.o \
|
V3LinkCells.o \
|
||||||
V3LinkDot.o \
|
V3LinkDot.o \
|
||||||
V3LinkLevel.o \
|
V3LinkLevel.o \
|
||||||
|
V3LinkLValue.o \
|
||||||
|
V3LinkParse.o \
|
||||||
V3LinkResolve.o \
|
V3LinkResolve.o \
|
||||||
V3Localize.o \
|
V3Localize.o \
|
||||||
V3Name.o \
|
V3Name.o \
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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,7 +31,8 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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,8 @@
|
|||||||
|
|
||||||
#ifndef _V3ACTIVE_H_
|
#ifndef _V3ACTIVE_H_
|
||||||
#define _V3ACTIVE_H_ 1
|
#define _V3ACTIVE_H_ 1
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include "V3Error.h"
|
#include "V3Error.h"
|
||||||
#include "V3Ast.h"
|
#include "V3Ast.h"
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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.
|
||||||
//
|
//
|
||||||
@@ -28,7 +28,8 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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,8 @@
|
|||||||
|
|
||||||
#ifndef _V3ACTIVETOP_H_
|
#ifndef _V3ACTIVETOP_H_
|
||||||
#define _V3ACTIVETOP_H_ 1
|
#define _V3ACTIVETOP_H_ 1
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include "V3Error.h"
|
#include "V3Error.h"
|
||||||
#include "V3Ast.h"
|
#include "V3Ast.h"
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2005-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2005-2007 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.
|
||||||
//
|
//
|
||||||
@@ -19,7 +19,8 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2005-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2005-2007 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,8 @@
|
|||||||
|
|
||||||
#ifndef _V3ASSERT_H_
|
#ifndef _V3ASSERT_H_
|
||||||
#define _V3ASSERT_H_ 1
|
#define _V3ASSERT_H_ 1
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include "V3Error.h"
|
#include "V3Error.h"
|
||||||
#include "V3Ast.h"
|
#include "V3Ast.h"
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2005-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2005-2007 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,7 +22,8 @@
|
|||||||
// Attach clocks to each assertion
|
// Attach clocks to each assertion
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2005-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2005-2007 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,8 @@
|
|||||||
|
|
||||||
#ifndef _V3ASSERTPRE_H_
|
#ifndef _V3ASSERTPRE_H_
|
||||||
#define _V3ASSERTPRE_H_ 1
|
#define _V3ASSERTPRE_H_ 1
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include "V3Error.h"
|
#include "V3Error.h"
|
||||||
#include "V3Ast.h"
|
#include "V3Ast.h"
|
||||||
|
|
||||||
|
|||||||
+16
-4
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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.
|
||||||
//
|
//
|
||||||
@@ -92,17 +92,29 @@ string AstNode::shortName() const {
|
|||||||
return pretty;
|
return pretty;
|
||||||
}
|
}
|
||||||
|
|
||||||
string AstNode::prettyName(const string& namein) {
|
string AstNode::dedotName(const string& namein) {
|
||||||
string pretty = namein;
|
string pretty = namein;
|
||||||
string::size_type pos;
|
string::size_type pos;
|
||||||
while ((pos=pretty.find("__DOT__")) != string::npos) {
|
while ((pos=pretty.find("__DOT__")) != string::npos) {
|
||||||
pretty.replace(pos, 7, ".");
|
pretty.replace(pos, 7, ".");
|
||||||
}
|
}
|
||||||
|
if (pretty.substr(0,4) == "TOP.") pretty.replace(0,4,"");
|
||||||
|
return pretty;
|
||||||
|
}
|
||||||
|
|
||||||
|
string AstNode::prettyName(const string& namein) {
|
||||||
|
string pretty = namein;
|
||||||
|
string::size_type pos;
|
||||||
|
while ((pos=pretty.find("__BRA__")) != string::npos) {
|
||||||
|
pretty.replace(pos, 7, "[");
|
||||||
|
}
|
||||||
|
while ((pos=pretty.find("__KET__")) != string::npos) {
|
||||||
|
pretty.replace(pos, 7, "]");
|
||||||
|
}
|
||||||
while ((pos=pretty.find("__PVT__")) != string::npos) {
|
while ((pos=pretty.find("__PVT__")) != string::npos) {
|
||||||
pretty.replace(pos, 7, "");
|
pretty.replace(pos, 7, "");
|
||||||
}
|
}
|
||||||
if (pretty.substr(0,4) == "TOP.") pretty.replace(0,4,"");
|
return AstNode::dedotName(pretty);
|
||||||
return pretty;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int AstNode::widthPow2() const {
|
int AstNode::widthPow2() const {
|
||||||
|
|||||||
+42
-8
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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,8 @@
|
|||||||
|
|
||||||
#ifndef _V3AST_H_
|
#ifndef _V3AST_H_
|
||||||
#define _V3AST_H_ 1
|
#define _V3AST_H_ 1
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include "V3Error.h"
|
#include "V3Error.h"
|
||||||
#include "V3Number.h"
|
#include "V3Number.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -57,6 +58,7 @@ public:
|
|||||||
COVERAGE_BLOCK_OFF,
|
COVERAGE_BLOCK_OFF,
|
||||||
INLINE_MODULE,
|
INLINE_MODULE,
|
||||||
NO_INLINE_MODULE,
|
NO_INLINE_MODULE,
|
||||||
|
NO_INLINE_TASK,
|
||||||
PUBLIC_MODULE,
|
PUBLIC_MODULE,
|
||||||
PUBLIC_TASK
|
PUBLIC_TASK
|
||||||
};
|
};
|
||||||
@@ -246,6 +248,33 @@ public:
|
|||||||
inline bool operator== (AstBranchPred::en lhs, AstBranchPred rhs) { return (lhs == rhs.m_e); }
|
inline bool operator== (AstBranchPred::en lhs, AstBranchPred rhs) { return (lhs == rhs.m_e); }
|
||||||
inline ostream& operator<<(ostream& os, AstBranchPred rhs) { return os<<rhs.ascii(); }
|
inline ostream& operator<<(ostream& os, AstBranchPred rhs) { return os<<rhs.ascii(); }
|
||||||
|
|
||||||
|
//######################################################################
|
||||||
|
|
||||||
|
class AstParseRefExp {
|
||||||
|
public:
|
||||||
|
enum en {
|
||||||
|
NONE, // Used in V3LinkParse only
|
||||||
|
VAR_MEM,
|
||||||
|
VAR_ANY,
|
||||||
|
TASK,
|
||||||
|
FUNC,
|
||||||
|
_ENUM_END
|
||||||
|
};
|
||||||
|
enum en m_e;
|
||||||
|
inline AstParseRefExp() : m_e(NONE) {};
|
||||||
|
inline AstParseRefExp (en _e) : m_e(_e) {};
|
||||||
|
explicit inline AstParseRefExp (int _e) : m_e(static_cast<en>(_e)) {};
|
||||||
|
operator en () const { return m_e; };
|
||||||
|
const char* ascii() const {
|
||||||
|
static const char* names[] = {
|
||||||
|
"","VAR_MEM","VAR_ANY","TASK","FUNC"};
|
||||||
|
return names[m_e];};
|
||||||
|
};
|
||||||
|
inline bool operator== (AstParseRefExp lhs, AstParseRefExp rhs) { return (lhs.m_e == rhs.m_e); }
|
||||||
|
inline bool operator== (AstParseRefExp lhs, AstParseRefExp::en rhs) { return (lhs.m_e == rhs); }
|
||||||
|
inline bool operator== (AstParseRefExp::en lhs, AstParseRefExp rhs) { return (lhs == rhs.m_e); }
|
||||||
|
inline ostream& operator<<(ostream& os, AstParseRefExp rhs) { return os<<rhs.ascii(); }
|
||||||
|
|
||||||
//######################################################################
|
//######################################################################
|
||||||
// AstNUser - Generic pointer base class for AST User nodes.
|
// AstNUser - Generic pointer base class for AST User nodes.
|
||||||
// - Also used to allow parameter passing up/down iterate calls
|
// - Also used to allow parameter passing up/down iterate calls
|
||||||
@@ -494,6 +523,7 @@ public:
|
|||||||
virtual string name() const { return ""; }
|
virtual string name() const { return ""; }
|
||||||
virtual string verilogKwd() const { return ""; }
|
virtual string verilogKwd() const { return ""; }
|
||||||
string shortName() const; // Name with __PVT__ removed for concatenating scopes
|
string shortName() const; // Name with __PVT__ removed for concatenating scopes
|
||||||
|
static string dedotName(const string& namein); // Name with dots removed
|
||||||
static string prettyName(const string& namein); // Name for printing out to the user
|
static string prettyName(const string& namein); // Name for printing out to the user
|
||||||
string prettyName() const { return prettyName(name()); }
|
string prettyName() const { return prettyName(name()); }
|
||||||
FileLine* fileline() const { return m_fileline; }
|
FileLine* fileline() const { return m_fileline; }
|
||||||
@@ -941,10 +971,10 @@ private:
|
|||||||
string m_dotted; // Dotted part of scope to task or ""
|
string m_dotted; // Dotted part of scope to task or ""
|
||||||
string m_inlinedDots; // Dotted hiearchy flattened out
|
string m_inlinedDots; // Dotted hiearchy flattened out
|
||||||
public:
|
public:
|
||||||
AstNodeFTaskRef(FileLine* fl, const string& name, const string& dotted, AstNode* pinsp)
|
AstNodeFTaskRef(FileLine* fl, AstNode* namep, AstNode* pinsp)
|
||||||
:AstNode(fl)
|
:AstNode(fl)
|
||||||
, m_taskp(NULL), m_name(name), m_dotted(dotted) {
|
, m_taskp(NULL) {
|
||||||
addNOp1p(pinsp);
|
setOp1p(namep); addNOp2p(pinsp);
|
||||||
}
|
}
|
||||||
virtual ~AstNodeFTaskRef() {}
|
virtual ~AstNodeFTaskRef() {}
|
||||||
virtual bool broken() const { return m_taskp && !m_taskp->brokeExists(); }
|
virtual bool broken() const { return m_taskp && !m_taskp->brokeExists(); }
|
||||||
@@ -959,9 +989,13 @@ public:
|
|||||||
void inlinedDots(const string& flag) { m_inlinedDots = flag; }
|
void inlinedDots(const string& flag) { m_inlinedDots = flag; }
|
||||||
AstNodeFTask* taskp() const { return m_taskp; } // [After Link] Pointer to variable
|
AstNodeFTask* taskp() const { return m_taskp; } // [After Link] Pointer to variable
|
||||||
void taskp(AstNodeFTask* taskp) { m_taskp=taskp; }
|
void taskp(AstNodeFTask* taskp) { m_taskp=taskp; }
|
||||||
// op1 = Pin interconnection list
|
void name(const string& name) { m_name = name; }
|
||||||
AstNode* pinsp() const { return op1p()->castNode(); }
|
void dotted(const string& name) { m_dotted = name; }
|
||||||
void addPinsp(AstNode* nodep) { addOp1p(nodep); }
|
// op1 = namep
|
||||||
|
AstNode* namep() const { return op1p(); }
|
||||||
|
// op2 = Pin interconnection list
|
||||||
|
AstNode* pinsp() const { return op2p()->castNode(); }
|
||||||
|
void addPinsp(AstNode* nodep) { addOp2p(nodep); }
|
||||||
};
|
};
|
||||||
|
|
||||||
//######################################################################
|
//######################################################################
|
||||||
|
|||||||
+11
-3
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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.
|
||||||
//
|
//
|
||||||
@@ -19,6 +19,8 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
@@ -349,7 +351,8 @@ void AstVar::dump(ostream& str) {
|
|||||||
if (isSigPublic()) str<<" [P]";
|
if (isSigPublic()) str<<" [P]";
|
||||||
if (attrClockEn()) str<<" [aCLKEN]";
|
if (attrClockEn()) str<<" [aCLKEN]";
|
||||||
if (attrFileDescr()) str<<" [aFD]";
|
if (attrFileDescr()) str<<" [aFD]";
|
||||||
if (isFuncLocal() || isFuncReturn()) str<<" [FUNC]";
|
if (isFuncReturn()) str<<" [FUNCRTN]";
|
||||||
|
else if (isFuncLocal()) str<<" [FUNC]";
|
||||||
str<<" "<<varType();
|
str<<" "<<varType();
|
||||||
}
|
}
|
||||||
void AstSenTree::dump(ostream& str) {
|
void AstSenTree::dump(ostream& str) {
|
||||||
@@ -358,7 +361,11 @@ void AstSenTree::dump(ostream& str) {
|
|||||||
}
|
}
|
||||||
void AstSenItem::dump(ostream& str) {
|
void AstSenItem::dump(ostream& str) {
|
||||||
this->AstNode::dump(str);
|
this->AstNode::dump(str);
|
||||||
str<<" ["<<m_edgeType.ascii()<<"]";
|
str<<" ["<<edgeType().ascii()<<"]";
|
||||||
|
}
|
||||||
|
void AstParseRef::dump(ostream& str) {
|
||||||
|
this->AstNode::dump(str);
|
||||||
|
str<<" ["<<expect().ascii()<<"]";
|
||||||
}
|
}
|
||||||
void AstActive::dump(ostream& str) {
|
void AstActive::dump(ostream& str) {
|
||||||
this->AstNode::dump(str);
|
this->AstNode::dump(str);
|
||||||
@@ -375,6 +382,7 @@ void AstNodeFTaskRef::dump(ostream& str) {
|
|||||||
}
|
}
|
||||||
void AstNodeFTask::dump(ostream& str) {
|
void AstNodeFTask::dump(ostream& str) {
|
||||||
this->AstNode::dump(str);
|
this->AstNode::dump(str);
|
||||||
|
if (taskPublic()) str<<" [PUBLIC]";
|
||||||
}
|
}
|
||||||
void AstCoverDecl::dump(ostream& str) {
|
void AstCoverDecl::dump(ostream& str) {
|
||||||
this->AstNode::dump(str);
|
this->AstNode::dump(str);
|
||||||
|
|||||||
+88
-12
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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.
|
||||||
//
|
//
|
||||||
@@ -756,6 +756,46 @@ struct AstGenerate : public AstNode {
|
|||||||
void addStmtp(AstNode* nodep) { addOp1p(nodep); }
|
void addStmtp(AstNode* nodep) { addOp1p(nodep); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct AstParseRef : public AstNode {
|
||||||
|
// A reference to a variable, function or task
|
||||||
|
// We don't know which at parse time due to bison constraints
|
||||||
|
// The link stages will replace this with AstVarRef, or AstTaskRef, etc.
|
||||||
|
// Parents: math|stmt
|
||||||
|
// Children: TEXT|DOT|SEL* (or expression under sel)
|
||||||
|
private:
|
||||||
|
AstParseRefExp m_expect; // Type we think it should resolve to
|
||||||
|
public:
|
||||||
|
AstParseRef(FileLine* fl, AstParseRefExp expect, AstNode* lhsp)
|
||||||
|
:AstNode(fl), m_expect(expect) { setOp1p(lhsp); }
|
||||||
|
virtual ~AstParseRef() {}
|
||||||
|
virtual AstType type() const { return AstType::PARSEREF;}
|
||||||
|
virtual AstNode* clone() { return new AstParseRef(*this);}
|
||||||
|
virtual void accept(AstNVisitor& v, AstNUser* vup=NULL) { v.visit(this,vup); }
|
||||||
|
virtual void dump(ostream& str);
|
||||||
|
virtual V3Hash sameHash() const { return V3Hash(m_expect); }
|
||||||
|
virtual bool same(AstNode* samep) const { return expect() == samep->castParseRef()->expect(); }
|
||||||
|
virtual string emitVerilog() { V3ERROR_NA; return ""; }
|
||||||
|
virtual string emitOperator() { V3ERROR_NA; return ""; }
|
||||||
|
AstParseRefExp expect() const { return m_expect; }
|
||||||
|
// op1 = Components
|
||||||
|
AstNode* lhsp() const { return op1p(); } // op1 = List of statements
|
||||||
|
};
|
||||||
|
|
||||||
|
struct AstDot : public AstNode {
|
||||||
|
// A dot separating paths in a AstXRef, AstFuncRef or AstTaskRef
|
||||||
|
// These are elimiated in the link stage
|
||||||
|
AstDot(FileLine* fl, AstNode* lhsp, AstNode* rhsp)
|
||||||
|
:AstNode(fl) { setOp1p(lhsp); setOp2p(rhsp); }
|
||||||
|
virtual ~AstDot() {}
|
||||||
|
virtual AstType type() const { return AstType::DOT;}
|
||||||
|
virtual AstNode* clone() { return new AstDot(*this);}
|
||||||
|
virtual void accept(AstNVisitor& v, AstNUser* vup=NULL) { v.visit(this,vup); }
|
||||||
|
virtual string emitVerilog() { V3ERROR_NA; return ""; }
|
||||||
|
virtual string emitOperator() { V3ERROR_NA; return ""; }
|
||||||
|
AstNode* lhsp() const { return op1p(); }
|
||||||
|
AstNode* rhsp() const { return op2p(); }
|
||||||
|
};
|
||||||
|
|
||||||
//######################################################################
|
//######################################################################
|
||||||
|
|
||||||
struct AstTask : public AstNodeFTask {
|
struct AstTask : public AstNodeFTask {
|
||||||
@@ -785,8 +825,8 @@ struct AstFunc : public AstNodeFTask {
|
|||||||
|
|
||||||
struct AstTaskRef : public AstNodeFTaskRef {
|
struct AstTaskRef : public AstNodeFTaskRef {
|
||||||
// A reference to a task
|
// A reference to a task
|
||||||
AstTaskRef(FileLine* fl, const string& name, const string& dotted, AstNode* pinsp)
|
AstTaskRef(FileLine* fl, AstParseRef* namep, AstNode* pinsp)
|
||||||
:AstNodeFTaskRef(fl, name, dotted, pinsp) {}
|
:AstNodeFTaskRef(fl, namep, pinsp) {}
|
||||||
virtual ~AstTaskRef() {}
|
virtual ~AstTaskRef() {}
|
||||||
virtual AstType type() const { return AstType::TASKREF;}
|
virtual AstType type() const { return AstType::TASKREF;}
|
||||||
virtual AstNode* clone() { return new AstTaskRef(*this);}
|
virtual AstNode* clone() { return new AstTaskRef(*this);}
|
||||||
@@ -795,8 +835,8 @@ struct AstTaskRef : public AstNodeFTaskRef {
|
|||||||
|
|
||||||
struct AstFuncRef : public AstNodeFTaskRef {
|
struct AstFuncRef : public AstNodeFTaskRef {
|
||||||
// A reference to a function
|
// A reference to a function
|
||||||
AstFuncRef(FileLine* fl, const string& name, const string& dotted, AstNode* pinsp)
|
AstFuncRef(FileLine* fl, AstParseRef* namep, AstNode* pinsp)
|
||||||
:AstNodeFTaskRef(fl, name, dotted, pinsp) {}
|
:AstNodeFTaskRef(fl, namep, pinsp) {}
|
||||||
virtual ~AstFuncRef() {}
|
virtual ~AstFuncRef() {}
|
||||||
virtual AstType type() const { return AstType::FUNCREF;}
|
virtual AstType type() const { return AstType::FUNCREF;}
|
||||||
virtual AstNode* clone() { return new AstFuncRef(*this);}
|
virtual AstNode* clone() { return new AstFuncRef(*this);}
|
||||||
@@ -816,8 +856,11 @@ public:
|
|||||||
class Settle {}; // for creator type-overload selection
|
class Settle {}; // for creator type-overload selection
|
||||||
class Never {}; // for creator type-overload selection
|
class Never {}; // for creator type-overload selection
|
||||||
AstSenItem(FileLine* fl, AstEdgeType edgeType, AstNodeVarRef* varrefp)
|
AstSenItem(FileLine* fl, AstEdgeType edgeType, AstNodeVarRef* varrefp)
|
||||||
: AstNode(fl) {
|
: AstNode(fl), m_edgeType(edgeType) {
|
||||||
m_edgeType = edgeType;
|
setOp1p(varrefp);
|
||||||
|
}
|
||||||
|
AstSenItem(FileLine* fl, AstEdgeType edgeType, AstParseRef* varrefp)
|
||||||
|
: AstNode(fl), m_edgeType(edgeType) {
|
||||||
setOp1p(varrefp);
|
setOp1p(varrefp);
|
||||||
}
|
}
|
||||||
AstSenItem(FileLine* fl, Combo)
|
AstSenItem(FileLine* fl, Combo)
|
||||||
@@ -1167,6 +1210,7 @@ public:
|
|||||||
virtual int instrCount() const { return widthInstrs()+instrCountBranch(); }
|
virtual int instrCount() const { return widthInstrs()+instrCountBranch(); }
|
||||||
AstNode* condsp() const { return op1p()->castNode(); } // op1= list of possible matching expressions
|
AstNode* condsp() const { return op1p()->castNode(); } // op1= list of possible matching expressions
|
||||||
AstNode* bodysp() const { return op2p()->castNode(); } // op2= what to do
|
AstNode* bodysp() const { return op2p()->castNode(); } // op2= what to do
|
||||||
|
void condsp(AstNode* nodep) { setOp1p(nodep); }
|
||||||
void addBodysp(AstNode* newp) { addOp2p(newp); }
|
void addBodysp(AstNode* newp) { addOp2p(newp); }
|
||||||
bool isDefault() const { return condsp()==NULL; }
|
bool isDefault() const { return condsp()==NULL; }
|
||||||
bool ignoreOverlap() const { return m_ignoreOverlap; }
|
bool ignoreOverlap() const { return m_ignoreOverlap; }
|
||||||
@@ -1174,10 +1218,12 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct AstDisplay : public AstNodePli {
|
struct AstDisplay : public AstNodePli {
|
||||||
|
// Parents: stmtlist
|
||||||
|
// Children: file which must be a varref, MATH to print
|
||||||
private:
|
private:
|
||||||
char m_newline;
|
char m_newline;
|
||||||
public:
|
public:
|
||||||
AstDisplay(FileLine* fileline, char newln, const string& text, AstNodeVarRef* filep, AstNode* exprsp)
|
AstDisplay(FileLine* fileline, char newln, const string& text, AstNode* filep, AstNode* exprsp)
|
||||||
: AstNodePli (fileline, text, exprsp) {
|
: AstNodePli (fileline, text, exprsp) {
|
||||||
setNOp2p(filep);
|
setNOp2p(filep);
|
||||||
m_newline = newln;
|
m_newline = newln;
|
||||||
@@ -1199,7 +1245,7 @@ public:
|
|||||||
&& text()==samep->castDisplay()->text(); }
|
&& text()==samep->castDisplay()->text(); }
|
||||||
// op1 used by AstNodePli
|
// op1 used by AstNodePli
|
||||||
char newline() const { return m_newline; } // * = Add a newline for $display
|
char newline() const { return m_newline; } // * = Add a newline for $display
|
||||||
AstNodeVarRef* filep() const { return op2p()->castVarRef(); }
|
AstNode* filep() const { return op2p(); }
|
||||||
void filep(AstNodeVarRef* nodep) { setNOp2p(nodep); }
|
void filep(AstNodeVarRef* nodep) { setNOp2p(nodep); }
|
||||||
AstNode* scopeAttrp() const { return op3p(); }
|
AstNode* scopeAttrp() const { return op3p(); }
|
||||||
AstText* scopeTextp() const { return op3p()->castText(); }
|
AstText* scopeTextp() const { return op3p()->castText(); }
|
||||||
@@ -1207,7 +1253,9 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct AstFClose : public AstNodeStmt {
|
struct AstFClose : public AstNodeStmt {
|
||||||
AstFClose(FileLine* fileline, AstNodeVarRef* filep)
|
// Parents: stmtlist
|
||||||
|
// Children: file which must be a varref
|
||||||
|
AstFClose(FileLine* fileline, AstNode* filep)
|
||||||
: AstNodeStmt (fileline) {
|
: AstNodeStmt (fileline) {
|
||||||
setNOp2p(filep);
|
setNOp2p(filep);
|
||||||
}
|
}
|
||||||
@@ -1223,7 +1271,7 @@ struct AstFClose : public AstNodeStmt {
|
|||||||
virtual bool isUnlikely() const { return true; }
|
virtual bool isUnlikely() const { return true; }
|
||||||
virtual V3Hash sameHash() const { return V3Hash(); }
|
virtual V3Hash sameHash() const { return V3Hash(); }
|
||||||
virtual bool same(AstNode* samep) const { return true; }
|
virtual bool same(AstNode* samep) const { return true; }
|
||||||
AstNodeVarRef* filep() const { return op2p()->castVarRef(); }
|
AstNode* filep() const { return op2p(); }
|
||||||
void filep(AstNodeVarRef* nodep) { setNOp2p(nodep); }
|
void filep(AstNodeVarRef* nodep) { setNOp2p(nodep); }
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1246,11 +1294,39 @@ struct AstFOpen : public AstNodeStmt {
|
|||||||
virtual bool isUnlikely() const { return true; }
|
virtual bool isUnlikely() const { return true; }
|
||||||
virtual V3Hash sameHash() const { return V3Hash(); }
|
virtual V3Hash sameHash() const { return V3Hash(); }
|
||||||
virtual bool same(AstNode* samep) const { return true; }
|
virtual bool same(AstNode* samep) const { return true; }
|
||||||
AstNodeVarRef* filep() const { return op1p()->castVarRef(); }
|
AstNode* filep() const { return op1p(); }
|
||||||
AstNode* filenamep() const { return op2p(); }
|
AstNode* filenamep() const { return op2p(); }
|
||||||
AstNode* modep() const { return op3p(); }
|
AstNode* modep() const { return op3p(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct AstReadMem : public AstNodeStmt {
|
||||||
|
private:
|
||||||
|
bool m_isHex; // readmemh, not readmemb
|
||||||
|
public:
|
||||||
|
AstReadMem(FileLine* fileline, bool hex,
|
||||||
|
AstNode* filenamep, AstNode* memp, AstNode* lsbp, AstNode* msbp)
|
||||||
|
: AstNodeStmt (fileline), m_isHex(hex) {
|
||||||
|
setOp1p(filenamep); setOp2p(memp); setNOp3p(lsbp); setNOp4p(msbp);
|
||||||
|
}
|
||||||
|
virtual ~AstReadMem() {}
|
||||||
|
virtual AstType type() const { return AstType::READMEM;}
|
||||||
|
virtual AstNode* clone() { return new AstReadMem(*this); }
|
||||||
|
virtual void accept(AstNVisitor& v, AstNUser* vup=NULL) { v.visit(this,vup); }
|
||||||
|
virtual string verilogKwd() const { return (isHex()?"$readmemh":"$readmemb"); };
|
||||||
|
virtual bool isGateOptimizable() const { return false; }
|
||||||
|
virtual bool isPredictOptimizable() const { return false; }
|
||||||
|
virtual bool isSplittable() const { return false; }
|
||||||
|
virtual bool isOutputter() const { return true; }
|
||||||
|
virtual bool isUnlikely() const { return true; }
|
||||||
|
virtual V3Hash sameHash() const { return V3Hash(); }
|
||||||
|
virtual bool same(AstNode* samep) const { return isHex()==samep->castReadMem()->isHex(); }
|
||||||
|
bool isHex() const { return m_isHex; }
|
||||||
|
AstNode* filenamep() const { return op1p()->castNode(); }
|
||||||
|
AstNode* memp() const { return op2p()->castNode(); }
|
||||||
|
AstNode* lsbp() const { return op3p()->castNode(); }
|
||||||
|
AstNode* msbp() const { return op4p()->castNode(); }
|
||||||
|
};
|
||||||
|
|
||||||
struct AstGenFor : public AstNodeFor {
|
struct AstGenFor : public AstNodeFor {
|
||||||
AstGenFor(FileLine* fileline, AstNode* initsp, AstNode* condp,
|
AstGenFor(FileLine* fileline, AstNode* initsp, AstNode* condp,
|
||||||
AstNode* incsp, AstNode* bodysp)
|
AstNode* incsp, AstNode* bodysp)
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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.
|
||||||
//
|
//
|
||||||
@@ -27,7 +27,8 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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,8 @@
|
|||||||
|
|
||||||
#ifndef _V3BEGIN_H_
|
#ifndef _V3BEGIN_H_
|
||||||
#define _V3BEGIN_H_ 1
|
#define _V3BEGIN_H_ 1
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include "V3Error.h"
|
#include "V3Error.h"
|
||||||
#include "V3Ast.h"
|
#include "V3Ast.h"
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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,7 +25,8 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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,8 @@
|
|||||||
|
|
||||||
#ifndef _V3BRANCH_H_
|
#ifndef _V3BRANCH_H_
|
||||||
#define _V3BRANCH_H_ 1
|
#define _V3BRANCH_H_ 1
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include "V3Error.h"
|
#include "V3Error.h"
|
||||||
#include "V3Ast.h"
|
#include "V3Ast.h"
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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.
|
||||||
//
|
//
|
||||||
@@ -26,7 +26,8 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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,8 @@
|
|||||||
|
|
||||||
#ifndef _V3BROKEN_H_
|
#ifndef _V3BROKEN_H_
|
||||||
#define _V3BROKEN_H_ 1
|
#define _V3BROKEN_H_ 1
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include "V3Error.h"
|
#include "V3Error.h"
|
||||||
#include "V3Ast.h"
|
#include "V3Ast.h"
|
||||||
|
|
||||||
|
|||||||
+66
-27
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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.
|
||||||
//
|
//
|
||||||
@@ -38,7 +38,8 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@@ -51,6 +52,7 @@
|
|||||||
|
|
||||||
#define CASE_OVERLAP_WIDTH 12 // Maximum width we can check for overlaps in
|
#define CASE_OVERLAP_WIDTH 12 // Maximum width we can check for overlaps in
|
||||||
#define CASE_BARF 999999 // Magic width when non-constant
|
#define CASE_BARF 999999 // Magic width when non-constant
|
||||||
|
#define CASE_ENCODER_GROUP_DEPTH 8 // Levels of priority to be ORed together in top IF tree
|
||||||
|
|
||||||
//######################################################################
|
//######################################################################
|
||||||
|
|
||||||
@@ -274,21 +276,15 @@ private:
|
|||||||
// IF((EQ (AND MASK cexpr) (AND MASK icond1)
|
// IF((EQ (AND MASK cexpr) (AND MASK icond1)
|
||||||
// ,istmts2, istmts3
|
// ,istmts2, istmts3
|
||||||
AstNode* cexprp = nodep->exprp()->unlinkFrBack();
|
AstNode* cexprp = nodep->exprp()->unlinkFrBack();
|
||||||
AstNode* ifrootp = NULL;
|
// We'll do this in two stages. First stage, convert the conditions to
|
||||||
AstNode* ifnextp = NULL;
|
// the appropriate IF AND terms.
|
||||||
|
if (debug()>=9) nodep->dumpTree(cout," _comp_IN: ");
|
||||||
|
bool hadDefault = false;
|
||||||
for (AstCaseItem* itemp = nodep->itemsp(); itemp; itemp=itemp->nextp()->castCaseItem()) {
|
for (AstCaseItem* itemp = nodep->itemsp(); itemp; itemp=itemp->nextp()->castCaseItem()) {
|
||||||
AstNode* istmtsp = itemp->bodysp(); // Maybe null -- no action.
|
|
||||||
if (istmtsp) istmtsp->unlinkFrBackWithNext();
|
|
||||||
if (!itemp->condsp()) {
|
if (!itemp->condsp()) {
|
||||||
// Default clause. We reordered in link, so default is always last
|
// Default clause. Just make true, we'll optimize it away later
|
||||||
if (ifnextp) {
|
itemp->condsp(new AstConst(itemp->fileline(), V3Number(itemp->fileline(), 1,1)));
|
||||||
if (istmtsp) ifnextp->castIf()->addElsesp(istmtsp);
|
hadDefault = true;
|
||||||
} else { // Just a empty case default: endcase
|
|
||||||
ifnextp = istmtsp;
|
|
||||||
}
|
|
||||||
if (!ifrootp) ifrootp = istmtsp;
|
|
||||||
ifnextp = istmtsp;
|
|
||||||
itemp = NULL; break;
|
|
||||||
} else {
|
} else {
|
||||||
// Expressioned clause
|
// Expressioned clause
|
||||||
AstNode* icondNextp = NULL;
|
AstNode* icondNextp = NULL;
|
||||||
@@ -323,24 +319,67 @@ private:
|
|||||||
ifexprp = new AstLogOr(itemp->fileline(), ifexprp, condp);
|
ifexprp = new AstLogOr(itemp->fileline(), ifexprp, condp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Replace expression in tree
|
||||||
// Make the new IF and attach in the tree
|
itemp->condsp(ifexprp);
|
||||||
if (ifexprp) {
|
|
||||||
AstIf* newp = new AstIf(itemp->fileline(), ifexprp, istmtsp, NULL);
|
|
||||||
if (ifnextp) {
|
|
||||||
ifnextp->castIf()->addElsesp(newp);
|
|
||||||
}
|
|
||||||
if (!ifrootp) ifrootp = newp;
|
|
||||||
ifnextp = newp;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!hadDefault) {
|
||||||
|
// If there was no default, add a empty one, this greatly simplifies below code
|
||||||
|
// and constant propagation will just eliminate it for us later.
|
||||||
|
nodep->addItemsp(new AstCaseItem(nodep->fileline(),
|
||||||
|
new AstConst(nodep->fileline(), V3Number(nodep->fileline(),1,1)),
|
||||||
|
NULL));
|
||||||
|
}
|
||||||
|
if (debug()>=9) nodep->dumpTree(cout," _comp_COND: ");
|
||||||
|
// Now build the IF statement tree
|
||||||
|
// The tree can be quite huge. Pull ever group of 8 out, and make a OR tree.
|
||||||
|
// This reduces the depth for the bottom elements, at the cost of some of the top elements.
|
||||||
|
// If we ever have profiling data, we should pull out the most common item from here and
|
||||||
|
// instead make it the first IF branch.
|
||||||
|
int depth = 0;
|
||||||
|
AstNode* grouprootp = NULL;
|
||||||
|
AstIf* groupnextp = NULL;
|
||||||
|
AstIf* itemnextp = NULL;
|
||||||
|
for (AstCaseItem* itemp = nodep->itemsp(); itemp; itemp=itemp->nextp()->castCaseItem()) {
|
||||||
|
AstNode* istmtsp = itemp->bodysp(); // Maybe null -- no action.
|
||||||
|
if (istmtsp) istmtsp->unlinkFrBackWithNext();
|
||||||
|
// Expressioned clause
|
||||||
|
AstNode* ifexprp = itemp->condsp()->unlinkFrBack();
|
||||||
|
{ // Prepare for next group
|
||||||
|
if (++depth > CASE_ENCODER_GROUP_DEPTH) depth = 1;
|
||||||
|
if (depth == 1) { // First group or starting new group
|
||||||
|
itemnextp = NULL;
|
||||||
|
AstIf* newp = new AstIf(itemp->fileline(), ifexprp->cloneTree(true), NULL, NULL);
|
||||||
|
if (groupnextp) groupnextp->addElsesp(newp);
|
||||||
|
else grouprootp = newp;
|
||||||
|
groupnextp = newp;
|
||||||
|
} else { // Continue group, modify if condition to OR in this new condition
|
||||||
|
AstNode* condp = groupnextp->condp()->unlinkFrBack();
|
||||||
|
groupnextp->condp(new AstOr(ifexprp->fileline(),
|
||||||
|
condp,
|
||||||
|
ifexprp->cloneTree(true)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{ // Make the new lower IF and attach in the tree
|
||||||
|
AstNode* itemexprp = ifexprp; ifexprp=NULL;
|
||||||
|
if (depth == (CASE_ENCODER_GROUP_DEPTH)) { // End of group - can skip the condition
|
||||||
|
itemexprp->deleteTree(); itemexprp=NULL;
|
||||||
|
itemexprp = new AstConst(itemp->fileline(), V3Number(itemp->fileline(),1,1));
|
||||||
|
}
|
||||||
|
AstIf* newp = new AstIf(itemp->fileline(), itemexprp, istmtsp, NULL);
|
||||||
|
if (itemnextp) itemnextp->addElsesp(newp);
|
||||||
|
else groupnextp->addIfsp(newp); // First in a new group
|
||||||
|
itemnextp = newp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (debug()>=9) nodep->dumpTree(cout," _comp_TREE: ");
|
||||||
// Handle any assertions
|
// Handle any assertions
|
||||||
replaceCaseParallel(nodep, false);
|
replaceCaseParallel(nodep, false);
|
||||||
// Replace the CASE... with IF...
|
// Replace the CASE... with IF...
|
||||||
if (ifrootp) nodep->replaceWith(ifrootp);
|
if (debug()>=9) grouprootp->dumpTree(cout," _new: ");
|
||||||
|
if (grouprootp) nodep->replaceWith(grouprootp);
|
||||||
else nodep->unlinkFrBack();
|
else nodep->unlinkFrBack();
|
||||||
if (debug()>=9) ifrootp->dumpTree(cout," _new: ");
|
nodep->deleteTree(); nodep=NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void replaceCaseParallel(AstCase* nodep, bool noOverlapsAllCovered) {
|
void replaceCaseParallel(AstCase* nodep, bool noOverlapsAllCovered) {
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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,8 @@
|
|||||||
|
|
||||||
#ifndef _V3CASE_H_
|
#ifndef _V3CASE_H_
|
||||||
#define _V3CASE_H_ 1
|
#define _V3CASE_H_ 1
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include "V3Error.h"
|
#include "V3Error.h"
|
||||||
#include "V3Ast.h"
|
#include "V3Ast.h"
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2004-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2004-2007 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,7 +42,8 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2004-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2004-2007 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,8 @@
|
|||||||
|
|
||||||
#ifndef _V3CAST_H_
|
#ifndef _V3CAST_H_
|
||||||
#define _V3CAST_H_ 1
|
#define _V3CAST_H_ 1
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include "V3Error.h"
|
#include "V3Error.h"
|
||||||
#include "V3Ast.h"
|
#include "V3Ast.h"
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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,7 +31,8 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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,8 @@
|
|||||||
|
|
||||||
#ifndef _V3CHANGED_H_
|
#ifndef _V3CHANGED_H_
|
||||||
#define _V3CHANGED_H_ 1
|
#define _V3CHANGED_H_ 1
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include "V3Error.h"
|
#include "V3Error.h"
|
||||||
#include "V3Ast.h"
|
#include "V3Ast.h"
|
||||||
|
|
||||||
|
|||||||
+7
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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.
|
||||||
//
|
//
|
||||||
@@ -28,7 +28,8 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@@ -239,6 +240,10 @@ private:
|
|||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
insureCleanAndNext (nodep->bodysp());
|
insureCleanAndNext (nodep->bodysp());
|
||||||
}
|
}
|
||||||
|
virtual void visit(AstCCall* nodep, AstNUser*) {
|
||||||
|
nodep->iterateChildren(*this);
|
||||||
|
insureCleanAndNext (nodep->argsp());
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------
|
//--------------------
|
||||||
// Default: Just iterate
|
// Default: Just iterate
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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,8 @@
|
|||||||
|
|
||||||
#ifndef _V3CLEAN_H_
|
#ifndef _V3CLEAN_H_
|
||||||
#define _V3CLEAN_H_ 1
|
#define _V3CLEAN_H_ 1
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include "V3Error.h"
|
#include "V3Error.h"
|
||||||
#include "V3Ast.h"
|
#include "V3Ast.h"
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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,8 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@@ -364,8 +365,7 @@ private:
|
|||||||
// Move statements to if
|
// Move statements to if
|
||||||
m_lastIfp->addIfsp(stmtsp);
|
m_lastIfp->addIfsp(stmtsp);
|
||||||
} else if (nodep->hasSettle()) {
|
} else if (nodep->hasSettle()) {
|
||||||
// Settlement
|
// Don't need to: clearLastSen();, as we're adding it to different cfunc
|
||||||
clearLastSen();
|
|
||||||
// Move statements to function
|
// Move statements to function
|
||||||
addToSettleLoop(stmtsp);
|
addToSettleLoop(stmtsp);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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,8 @@
|
|||||||
|
|
||||||
#ifndef _V3CLOCK_H_
|
#ifndef _V3CLOCK_H_
|
||||||
#define _V3CLOCK_H_ 1
|
#define _V3CLOCK_H_ 1
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include "V3Error.h"
|
#include "V3Error.h"
|
||||||
#include "V3Ast.h"
|
#include "V3Ast.h"
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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.
|
||||||
//
|
//
|
||||||
@@ -35,7 +35,8 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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,8 @@
|
|||||||
|
|
||||||
#ifndef _V3COMBINE_H_
|
#ifndef _V3COMBINE_H_
|
||||||
#define _V3COMBINE_H_ 1
|
#define _V3COMBINE_H_ 1
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include "V3Error.h"
|
#include "V3Error.h"
|
||||||
#include "V3Ast.h"
|
#include "V3Ast.h"
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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,7 +25,8 @@
|
|||||||
// If operands are constant, replace this node with constant.
|
// If operands are constant, replace this node with constant.
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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,8 @@
|
|||||||
|
|
||||||
#ifndef _V3CONST_H_
|
#ifndef _V3CONST_H_
|
||||||
#define _V3CONST_H_ 1
|
#define _V3CONST_H_ 1
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include "V3Error.h"
|
#include "V3Error.h"
|
||||||
#include "V3Ast.h"
|
#include "V3Ast.h"
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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.
|
||||||
//
|
//
|
||||||
@@ -29,7 +29,8 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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,8 @@
|
|||||||
|
|
||||||
#ifndef _V3COVERAGE_H_
|
#ifndef _V3COVERAGE_H_
|
||||||
#define _V3COVERAGE_H_ 1
|
#define _V3COVERAGE_H_ 1
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include "V3Error.h"
|
#include "V3Error.h"
|
||||||
#include "V3Ast.h"
|
#include "V3Ast.h"
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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.
|
||||||
//
|
//
|
||||||
@@ -24,7 +24,8 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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,8 @@
|
|||||||
|
|
||||||
#ifndef _V3DEAD_H_
|
#ifndef _V3DEAD_H_
|
||||||
#define _V3DEAD_H_ 1
|
#define _V3DEAD_H_ 1
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include "V3Error.h"
|
#include "V3Error.h"
|
||||||
#include "V3Ast.h"
|
#include "V3Ast.h"
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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,7 +52,8 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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,8 @@
|
|||||||
|
|
||||||
#ifndef _V3DELAYED_H_
|
#ifndef _V3DELAYED_H_
|
||||||
#define _V3DELAYED_H_ 1
|
#define _V3DELAYED_H_ 1
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include "V3Error.h"
|
#include "V3Error.h"
|
||||||
#include "V3Ast.h"
|
#include "V3Ast.h"
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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.
|
||||||
//
|
//
|
||||||
@@ -28,7 +28,8 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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,8 @@
|
|||||||
|
|
||||||
#ifndef _V3DEPTH_H_
|
#ifndef _V3DEPTH_H_
|
||||||
#define _V3DEPTH_H_ 1
|
#define _V3DEPTH_H_ 1
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include "V3Error.h"
|
#include "V3Error.h"
|
||||||
#include "V3Ast.h"
|
#include "V3Ast.h"
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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.
|
||||||
//
|
//
|
||||||
@@ -27,7 +27,8 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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,8 @@
|
|||||||
|
|
||||||
#ifndef _V3DESCOPE_H_
|
#ifndef _V3DESCOPE_H_
|
||||||
#define _V3DESCOPE_H_ 1
|
#define _V3DESCOPE_H_ 1
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include "V3Error.h"
|
#include "V3Error.h"
|
||||||
#include "V3Ast.h"
|
#include "V3Ast.h"
|
||||||
|
|
||||||
|
|||||||
+54
-20
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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.
|
||||||
//
|
//
|
||||||
@@ -19,7 +19,8 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@@ -96,22 +97,20 @@ public:
|
|||||||
string cFuncArgs(AstCFunc* nodep) {
|
string cFuncArgs(AstCFunc* nodep) {
|
||||||
// Return argument list for given C function
|
// Return argument list for given C function
|
||||||
string args = nodep->argTypes();
|
string args = nodep->argTypes();
|
||||||
if (args=="") {
|
// Might be a user function with argument list.
|
||||||
// Might be a user function with argument list.
|
for (AstNode* stmtp = nodep->argsp(); stmtp; stmtp=stmtp->nextp()) {
|
||||||
for (AstNode* stmtp = nodep->argsp(); stmtp; stmtp=stmtp->nextp()) {
|
if (AstVar* portp = stmtp->castVar()) {
|
||||||
if (AstVar* portp = stmtp->castVar()) {
|
if (portp->isIO() && !portp->isFuncReturn()) {
|
||||||
if (portp->isIO() && !portp->isFuncReturn()) {
|
if (args != "") args+= ", ";
|
||||||
if (args != "") args+= ", ";
|
if (portp->isWide()) {
|
||||||
if (portp->isWide()) {
|
if (portp->isInOnly()) args += "const ";
|
||||||
if (portp->isInOnly()) args += "const ";
|
args += portp->cType();
|
||||||
args += portp->cType();
|
args += " (& "+portp->name();
|
||||||
args += " (& "+portp->name();
|
args += ")["+cvtToStr(portp->widthWords())+"]";
|
||||||
args += ")["+cvtToStr(portp->widthWords())+"]";
|
} else {
|
||||||
} else {
|
args += portp->cType();
|
||||||
args += portp->cType();
|
if (portp->isOutput()) args += "&";
|
||||||
if (portp->isOutput()) args += "&";
|
args += " "+portp->name();
|
||||||
args += " "+portp->name();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -240,14 +239,49 @@ public:
|
|||||||
emitIQW(nodep->modep());
|
emitIQW(nodep->modep());
|
||||||
if (nodep->modep()->width()>4*8) nodep->modep()->v3error("$fopen mode should be <= 4 characters");
|
if (nodep->modep()->width()>4*8) nodep->modep()->v3error("$fopen mode should be <= 4 characters");
|
||||||
puts("(");
|
puts("(");
|
||||||
if (nodep->filenamep()->isWide()) puts(cvtToStr(nodep->filenamep()->widthWords()));
|
if (nodep->filenamep()->isWide()) {
|
||||||
|
puts(cvtToStr(nodep->filenamep()->widthWords()));
|
||||||
|
putbs(", ");
|
||||||
|
}
|
||||||
|
if (nodep->filenamep()->widthWords() > VL_TO_STRING_MAX_WORDS) {
|
||||||
|
nodep->v3error("String of "<<nodep->filenamep()->width()<<" bits exceeds hardcoded limit VL_TO_STRING_MAX_WORDS in verilatedos.h\n");
|
||||||
|
}
|
||||||
|
nodep->filenamep()->iterateAndNext(*this);
|
||||||
|
putbs(", ");
|
||||||
|
nodep->modep()->iterateAndNext(*this);
|
||||||
|
puts(");\n");
|
||||||
|
}
|
||||||
|
virtual void visit(AstReadMem* nodep, AstNUser*) {
|
||||||
|
puts("VL_READMEM_");
|
||||||
|
emitIQW(nodep->filenamep());
|
||||||
|
puts(" ("); // We take a void* rather then emitIQW(nodep->memp());
|
||||||
|
puts(nodep->isHex()?"true":"false");
|
||||||
|
putbs(",");
|
||||||
|
puts(cvtToStr(nodep->memp()->widthMin())); // Need real storage width
|
||||||
|
putbs(",");
|
||||||
|
uint32_t array_lsb = 0;
|
||||||
|
{
|
||||||
|
AstVarRef* varrefp = nodep->memp()->castVarRef();
|
||||||
|
if (!varrefp || !varrefp->varp()->arrayp(0)) { nodep->v3error("Readmem loading non-arrayed variable"); }
|
||||||
|
else {
|
||||||
|
puts(cvtToStr(varrefp->varp()->arrayElements()));
|
||||||
|
array_lsb = varrefp->varp()->arrayp(0)->lsbConst();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
putbs(", ");
|
||||||
|
puts(cvtToStr(array_lsb));
|
||||||
|
putbs(",");
|
||||||
|
puts(cvtToStr(nodep->filenamep()->widthWords()));
|
||||||
if (nodep->filenamep()->widthWords() > VL_TO_STRING_MAX_WORDS) {
|
if (nodep->filenamep()->widthWords() > VL_TO_STRING_MAX_WORDS) {
|
||||||
nodep->v3error("String of "<<nodep->filenamep()->width()<<" bits exceeds hardcoded limit VL_TO_STRING_MAX_WORDS in verilatedos.h\n");
|
nodep->v3error("String of "<<nodep->filenamep()->width()<<" bits exceeds hardcoded limit VL_TO_STRING_MAX_WORDS in verilatedos.h\n");
|
||||||
}
|
}
|
||||||
putbs(", ");
|
putbs(", ");
|
||||||
nodep->filenamep()->iterateAndNext(*this);
|
nodep->filenamep()->iterateAndNext(*this);
|
||||||
putbs(", ");
|
putbs(", ");
|
||||||
nodep->modep()->iterateAndNext(*this);
|
nodep->memp()->iterateAndNext(*this);
|
||||||
|
putbs(","); if (nodep->lsbp()) { nodep->lsbp()->iterateAndNext(*this); }
|
||||||
|
else puts(cvtToStr(array_lsb));
|
||||||
|
putbs(","); if (nodep->msbp()) { nodep->msbp()->iterateAndNext(*this); } else puts("~0");
|
||||||
puts(");\n");
|
puts(");\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstFClose* nodep, AstNUser*) {
|
virtual void visit(AstFClose* nodep, AstNUser*) {
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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,8 @@
|
|||||||
|
|
||||||
#ifndef _V3EMITC_H_
|
#ifndef _V3EMITC_H_
|
||||||
#define _V3EMITC_H_ 1
|
#define _V3EMITC_H_ 1
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include "V3Error.h"
|
#include "V3Error.h"
|
||||||
#include "V3Ast.h"
|
#include "V3Ast.h"
|
||||||
|
|
||||||
|
|||||||
+4
-3
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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,7 +22,8 @@
|
|||||||
#ifndef _V3EMITCBASE_H_
|
#ifndef _V3EMITCBASE_H_
|
||||||
#define _V3EMITCBASE_H_ 1
|
#define _V3EMITCBASE_H_ 1
|
||||||
|
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@@ -109,7 +110,7 @@ public:
|
|||||||
bool optSystemPerl() { return v3Global.opt.systemPerl(); }
|
bool optSystemPerl() { return v3Global.opt.systemPerl(); }
|
||||||
static string symClassName() { return v3Global.opt.prefix()+"__Syms"; }
|
static string symClassName() { return v3Global.opt.prefix()+"__Syms"; }
|
||||||
static string symClassVar() { return symClassName()+"* __restrict vlSymsp"; }
|
static string symClassVar() { return symClassName()+"* __restrict vlSymsp"; }
|
||||||
static string symTopAssign() { return v3Global.opt.prefix()+"* __restrict vlTOPp = vlSymsp->TOPp;"; }
|
static string symTopAssign() { return v3Global.opt.prefix()+"* __restrict vlTOPp VL_ATTR_UNUSED = vlSymsp->TOPp;"; }
|
||||||
static string modClassName(AstModule* modp) { // Return name of current module being processed
|
static string modClassName(AstModule* modp) { // Return name of current module being processed
|
||||||
if (modp->isTop()) {
|
if (modp->isTop()) {
|
||||||
return v3Global.opt.prefix();
|
return v3Global.opt.prefix();
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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.
|
||||||
//
|
//
|
||||||
@@ -19,7 +19,8 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2004-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2004-2007 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.
|
||||||
//
|
//
|
||||||
@@ -19,7 +19,8 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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,8 @@
|
|||||||
|
|
||||||
#ifndef _V3EMITMK_H_
|
#ifndef _V3EMITMK_H_
|
||||||
#define _V3EMITMK_H_ 1
|
#define _V3EMITMK_H_ 1
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include "V3Error.h"
|
#include "V3Error.h"
|
||||||
#include "V3Ast.h"
|
#include "V3Ast.h"
|
||||||
|
|
||||||
|
|||||||
+13
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2004-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2004-2007 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.
|
||||||
//
|
//
|
||||||
@@ -19,7 +19,8 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@@ -192,6 +193,16 @@ public:
|
|||||||
if (nodep->filep()) nodep->filep()->iterateChildren(*this);
|
if (nodep->filep()) nodep->filep()->iterateChildren(*this);
|
||||||
puts(");\n");
|
puts(");\n");
|
||||||
}
|
}
|
||||||
|
virtual void visit(AstReadMem* nodep, AstNUser*) {
|
||||||
|
putbs(nodep->verilogKwd());
|
||||||
|
putbs(" (");
|
||||||
|
if (nodep->filenamep()) nodep->filenamep()->iterateChildren(*this);
|
||||||
|
putbs(",");
|
||||||
|
if (nodep->memp()) nodep->memp()->iterateChildren(*this);
|
||||||
|
if (nodep->lsbp()) { putbs(","); nodep->lsbp()->iterateChildren(*this); }
|
||||||
|
if (nodep->msbp()) { putbs(","); nodep->msbp()->iterateChildren(*this); }
|
||||||
|
puts(");\n");
|
||||||
|
}
|
||||||
virtual void visit(AstNodeFor* nodep, AstNUser*) {
|
virtual void visit(AstNodeFor* nodep, AstNUser*) {
|
||||||
puts("for (");
|
puts("for (");
|
||||||
m_suppressSemi = true;
|
m_suppressSemi = true;
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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,8 @@
|
|||||||
|
|
||||||
#ifndef _V3EMITV_H_
|
#ifndef _V3EMITV_H_
|
||||||
#define _V3EMITV_H_ 1
|
#define _V3EMITV_H_ 1
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include "V3Error.h"
|
#include "V3Error.h"
|
||||||
#include "V3Ast.h"
|
#include "V3Ast.h"
|
||||||
|
|
||||||
|
|||||||
+6
-6
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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.
|
||||||
//
|
//
|
||||||
@@ -92,7 +92,7 @@ void FileLine::lineDirective(const char* textp) {
|
|||||||
|
|
||||||
bool FileLine::warnOff(const string& msg, bool flag) {
|
bool FileLine::warnOff(const string& msg, bool flag) {
|
||||||
V3ErrorCode code (msg.c_str());
|
V3ErrorCode code (msg.c_str());
|
||||||
if (code == V3ErrorCode::ERROR) {
|
if (code < V3ErrorCode::FIRST_WARN) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
warnOff(code, flag);
|
warnOff(code, flag);
|
||||||
@@ -168,9 +168,8 @@ void FileLine::v3errorEnd(ostringstream& str) {
|
|||||||
void V3Error::init() {
|
void V3Error::init() {
|
||||||
for (int i=0; i<V3ErrorCode::MAX; i++) {
|
for (int i=0; i<V3ErrorCode::MAX; i++) {
|
||||||
s_describedEachWarn[i] = false;
|
s_describedEachWarn[i] = false;
|
||||||
s_pretendError[i] = false;
|
s_pretendError[i] = V3ErrorCode(i).pretendError();
|
||||||
}
|
}
|
||||||
pretendError(V3ErrorCode::BLKANDNBLK, true);
|
|
||||||
|
|
||||||
if (string(V3ErrorCode(V3ErrorCode::MAX).ascii()) != " MAX") {
|
if (string(V3ErrorCode(V3ErrorCode::MAX).ascii()) != " MAX") {
|
||||||
v3fatalSrc("Enum table in V3ErrorCode::ascii() is munged");
|
v3fatalSrc("Enum table in V3ErrorCode::ascii() is munged");
|
||||||
@@ -204,8 +203,9 @@ void V3Error::abortIfErrors() {
|
|||||||
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
|
else if (code==V3ErrorCode::ERROR) return "%Error: ";
|
||||||
|| s_pretendError[code]) return "%Error: ";
|
else if (code<V3ErrorCode::FIRST_WARN
|
||||||
|
|| s_pretendError[code]) return "%Error-"+(string)code.ascii()+": ";
|
||||||
else return "%Warning-"+(string)code.ascii()+": ";
|
else return "%Warning-"+(string)code.ascii()+": ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+13
-4
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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,8 @@
|
|||||||
|
|
||||||
#ifndef _V3ERROR_H_
|
#ifndef _V3ERROR_H_
|
||||||
#define _V3ERROR_H_ 1
|
#define _V3ERROR_H_ 1
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
@@ -34,9 +35,12 @@ public:
|
|||||||
enum en {
|
enum en {
|
||||||
SUPPRESS, // Warning suppressed by user
|
SUPPRESS, // Warning suppressed by user
|
||||||
FATAL, // Kill the program
|
FATAL, // Kill the program
|
||||||
ERROR, // Error out, can't suppress
|
ERROR, // General error out, can't suppress
|
||||||
|
// Error codes:
|
||||||
|
TASKNSVAR, // Error: Task I/O not simple
|
||||||
// Warning codes:
|
// Warning codes:
|
||||||
FIRST_WARN, // Just a code so the program knows where to start warnings
|
FIRST_WARN, // Just a code so the program knows where to start warnings
|
||||||
|
//
|
||||||
BLKANDNBLK, // Blocked and non-blocking assignments to same variable
|
BLKANDNBLK, // Blocked and non-blocking assignments to same variable
|
||||||
CASEINCOMPLETE, // Case statement has missing values
|
CASEINCOMPLETE, // Case statement has missing values
|
||||||
CASEOVERLAP, // Case statements overlap
|
CASEOVERLAP, // Case statements overlap
|
||||||
@@ -45,6 +49,7 @@ public:
|
|||||||
COMBDLY, // Combinatorial delayed assignment
|
COMBDLY, // Combinatorial delayed assignment
|
||||||
GENCLK, // Generated Clock
|
GENCLK, // Generated Clock
|
||||||
IMPLICIT, // Implicit wire
|
IMPLICIT, // Implicit wire
|
||||||
|
IMPURE, // Impure function not being inlined
|
||||||
MULTIDRIVEN, // Driven from multiple blocks
|
MULTIDRIVEN, // Driven from multiple blocks
|
||||||
UNDRIVEN, // No drivers
|
UNDRIVEN, // No drivers
|
||||||
UNOPT, // Unoptimizable block
|
UNOPT, // Unoptimizable block
|
||||||
@@ -66,10 +71,11 @@ public:
|
|||||||
const char* names[] = {
|
const char* names[] = {
|
||||||
// Leading spaces indicate it can't be disabled.
|
// Leading spaces indicate it can't be disabled.
|
||||||
" SUPPRESS", " FATAL", " ERROR",
|
" SUPPRESS", " FATAL", " ERROR",
|
||||||
|
"TASKNSVAR",
|
||||||
" FIRST_WARN",
|
" FIRST_WARN",
|
||||||
"BLKANDNBLK",
|
"BLKANDNBLK",
|
||||||
"CASEINCOMPLETE", "CASEOVERLAP", "CASEX", "CMPCONST",
|
"CASEINCOMPLETE", "CASEOVERLAP", "CASEX", "CMPCONST",
|
||||||
"COMBDLY", "GENCLK", "IMPLICIT",
|
"COMBDLY", "GENCLK", "IMPLICIT", "IMPURE",
|
||||||
"MULTIDRIVEN",
|
"MULTIDRIVEN",
|
||||||
"UNDRIVEN", "UNOPT", "UNOPTFLAT", "UNSIGNED", "UNUSED",
|
"UNDRIVEN", "UNOPT", "UNOPTFLAT", "UNSIGNED", "UNUSED",
|
||||||
"VARHIDDEN", "WIDTH",
|
"VARHIDDEN", "WIDTH",
|
||||||
@@ -79,6 +85,9 @@ public:
|
|||||||
};
|
};
|
||||||
// Warnings that warn about nasty side effects
|
// Warnings that warn about nasty side effects
|
||||||
bool dangerous() const { return ( m_e==COMBDLY );};
|
bool dangerous() const { return ( m_e==COMBDLY );};
|
||||||
|
// Warnings we'll present to the user as errors
|
||||||
|
// Later -Werror- options may make more of these.
|
||||||
|
bool pretendError() const { return ( m_e==BLKANDNBLK || m_e==IMPURE); };
|
||||||
};
|
};
|
||||||
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); }
|
||||||
|
|||||||
+6
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2004-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2004-2007 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.
|
||||||
//
|
//
|
||||||
@@ -30,7 +30,8 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@@ -660,6 +661,9 @@ private:
|
|||||||
// Lhs or Rhs may be word, long, or quad.
|
// Lhs or Rhs may be word, long, or quad.
|
||||||
// newAstWordSelClone nicely abstracts the difference.
|
// newAstWordSelClone nicely abstracts the difference.
|
||||||
int rhsshift = rhsp->rhsp()->widthMin();
|
int rhsshift = rhsp->rhsp()->widthMin();
|
||||||
|
// Sometimes doing the words backwards is preferrable.
|
||||||
|
// When we have x={x,foo} backwards is better, when x={foo,x} forward is better
|
||||||
|
// However V3Subst tends to rip this up, so not worth optimizing now.
|
||||||
for (int w=0; w<rhsp->widthWords(); w++) {
|
for (int w=0; w<rhsp->widthWords(); w++) {
|
||||||
addWordAssign(nodep, w,
|
addWordAssign(nodep, w,
|
||||||
new AstOr (rhsp->fileline(),
|
new AstOr (rhsp->fileline(),
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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,8 @@
|
|||||||
|
|
||||||
#ifndef _V3EXPAND_H_
|
#ifndef _V3EXPAND_H_
|
||||||
#define _V3EXPAND_H_ 1
|
#define _V3EXPAND_H_ 1
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include "V3Error.h"
|
#include "V3Error.h"
|
||||||
#include "V3Ast.h"
|
#include "V3Ast.h"
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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.
|
||||||
//
|
//
|
||||||
@@ -19,7 +19,8 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|||||||
+6
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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,8 @@
|
|||||||
|
|
||||||
#ifndef _V3FILE_H_
|
#ifndef _V3FILE_H_
|
||||||
#define _V3FILE_H_ 1
|
#define _V3FILE_H_ 1
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include "V3Error.h"
|
#include "V3Error.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stack>
|
#include <stack>
|
||||||
@@ -42,6 +43,9 @@ public:
|
|||||||
}
|
}
|
||||||
static ofstream* new_ofstream(const string& filename, bool append=false) {
|
static ofstream* new_ofstream(const string& filename, bool append=false) {
|
||||||
addTgtDepend(filename);
|
addTgtDepend(filename);
|
||||||
|
return new_ofstream_nodepend (filename, append);
|
||||||
|
}
|
||||||
|
static ofstream* new_ofstream_nodepend(const string& filename, bool append=false) {
|
||||||
if (append) {
|
if (append) {
|
||||||
return new ofstream(filename.c_str(), ios::app);
|
return new ofstream(filename.c_str(), ios::app);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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.
|
||||||
//
|
//
|
||||||
@@ -26,7 +26,8 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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,8 @@
|
|||||||
|
|
||||||
#ifndef _V3GATE_H_
|
#ifndef _V3GATE_H_
|
||||||
#define _V3GATE_H_ 1
|
#define _V3GATE_H_ 1
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include "V3Error.h"
|
#include "V3Error.h"
|
||||||
#include "V3Ast.h"
|
#include "V3Ast.h"
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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.
|
||||||
//
|
//
|
||||||
@@ -24,7 +24,8 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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,8 @@
|
|||||||
|
|
||||||
#ifndef _V3GENCLK_H_
|
#ifndef _V3GENCLK_H_
|
||||||
#define _V3GENCLK_H_ 1
|
#define _V3GENCLK_H_ 1
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include "V3Error.h"
|
#include "V3Error.h"
|
||||||
#include "V3Ast.h"
|
#include "V3Ast.h"
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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,7 +22,8 @@
|
|||||||
#ifndef _V3GLOBAL_H_
|
#ifndef _V3GLOBAL_H_
|
||||||
#define _V3GLOBAL_H_ 1
|
#define _V3GLOBAL_H_ 1
|
||||||
|
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "V3Error.h"
|
#include "V3Error.h"
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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.
|
||||||
//
|
//
|
||||||
@@ -19,7 +19,8 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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,8 @@
|
|||||||
|
|
||||||
#ifndef _V3GRAPH_H_
|
#ifndef _V3GRAPH_H_
|
||||||
#define _V3GRAPH_H_ 1
|
#define _V3GRAPH_H_ 1
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include "V3Error.h"
|
#include "V3Error.h"
|
||||||
#include "V3List.h"
|
#include "V3List.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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.
|
||||||
//
|
//
|
||||||
@@ -19,7 +19,8 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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.
|
||||||
//
|
//
|
||||||
@@ -19,7 +19,8 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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,8 @@
|
|||||||
|
|
||||||
#ifndef _V3GRAPHALG_H_
|
#ifndef _V3GRAPHALG_H_
|
||||||
#define _V3GRAPHALG_H_ 1
|
#define _V3GRAPHALG_H_ 1
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
|
|
||||||
#include "V3Global.h"
|
#include "V3Global.h"
|
||||||
#include "V3Graph.h"
|
#include "V3Graph.h"
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2005-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2005-2007 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.
|
||||||
//
|
//
|
||||||
@@ -19,7 +19,8 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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,8 @@
|
|||||||
|
|
||||||
#ifndef _V3GRAPHDFA_H_
|
#ifndef _V3GRAPHDFA_H_
|
||||||
#define _V3GRAPHDFA_H_ 1
|
#define _V3GRAPHDFA_H_ 1
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "V3Global.h"
|
#include "V3Global.h"
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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.
|
||||||
//
|
//
|
||||||
@@ -19,7 +19,8 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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.
|
||||||
//
|
//
|
||||||
@@ -26,7 +26,8 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2005-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2005-2007 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,8 @@
|
|||||||
|
|
||||||
#ifndef _V3HASHED_H_
|
#ifndef _V3HASHED_H_
|
||||||
#define _V3HASHED_H_ 1
|
#define _V3HASHED_H_ 1
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include "V3Error.h"
|
#include "V3Error.h"
|
||||||
#include "V3Ast.h"
|
#include "V3Ast.h"
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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.
|
||||||
//
|
//
|
||||||
@@ -29,7 +29,8 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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,8 @@
|
|||||||
|
|
||||||
#ifndef _V3INLINE_H_
|
#ifndef _V3INLINE_H_
|
||||||
#define _V3INLINE_H_ 1
|
#define _V3INLINE_H_ 1
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include "V3Error.h"
|
#include "V3Error.h"
|
||||||
#include "V3Ast.h"
|
#include "V3Ast.h"
|
||||||
|
|
||||||
|
|||||||
+6
-5
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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.
|
||||||
//
|
//
|
||||||
@@ -26,7 +26,8 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@@ -162,8 +163,8 @@ private:
|
|||||||
// Somewhat illogically, we need to rename the orignal name of the cell too.
|
// Somewhat illogically, we need to rename the orignal name of the cell too.
|
||||||
// as that is the name users expect for dotting
|
// as that is the name users expect for dotting
|
||||||
// The spec says we add [x], but that won't work in C...
|
// The spec says we add [x], but that won't work in C...
|
||||||
newp->name(newp->name()+"__"+cvtToStr(m_instNum));
|
newp->name(newp->name()+"__BRA__"+cvtToStr(m_instNum)+"__KET__");
|
||||||
newp->origName(newp->origName()+"__"+cvtToStr(m_instNum));
|
newp->origName(newp->origName()+"__BRA__"+cvtToStr(m_instNum)+"__KET__");
|
||||||
// Fixup pins
|
// Fixup pins
|
||||||
newp->pinsp()->iterateAndNext(*this);
|
newp->pinsp()->iterateAndNext(*this);
|
||||||
if (debug()==9) { newp->dumpTree(cout,"newcell: "); cout<<endl; }
|
if (debug()==9) { newp->dumpTree(cout,"newcell: "); cout<<endl; }
|
||||||
@@ -200,7 +201,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Save some time
|
// Save some time
|
||||||
virtual void visit(AstNodeStmt*, AstNUser*) {}
|
virtual void visit(AstNodeMath*, AstNUser*) {}
|
||||||
//--------------------
|
//--------------------
|
||||||
// Default: Just iterate
|
// Default: Just iterate
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep, AstNUser*) {
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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,8 @@
|
|||||||
|
|
||||||
#ifndef _V3INST_H_
|
#ifndef _V3INST_H_
|
||||||
#define _V3INST_H_ 1
|
#define _V3INST_H_ 1
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include "V3Error.h"
|
#include "V3Error.h"
|
||||||
#include "V3Ast.h"
|
#include "V3Ast.h"
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2005-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2005-2007 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,8 @@
|
|||||||
|
|
||||||
#ifndef _V3LANGUAGEWORDS_H_
|
#ifndef _V3LANGUAGEWORDS_H_
|
||||||
#define _V3LANGUAGEWORDS_H_ 1
|
#define _V3LANGUAGEWORDS_H_ 1
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|||||||
+6
-3
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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.
|
||||||
//
|
//
|
||||||
@@ -28,7 +28,8 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@@ -374,7 +375,9 @@ private:
|
|||||||
//UINFO(4," CCALL "<<nodep<<endl);
|
//UINFO(4," CCALL "<<nodep<<endl);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
// Enter the function and trace it
|
// Enter the function and trace it
|
||||||
nodep->funcp()->accept(*this);
|
if (!nodep->funcp()->entryPoint()) { // else is non-inline or public function we optimize separately
|
||||||
|
nodep->funcp()->accept(*this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstUCFunc* nodep, AstNUser*) {
|
virtual void visit(AstUCFunc* nodep, AstNUser*) {
|
||||||
m_sideEffect = true; // If appears on assign RHS, don't ever delete the assignment
|
m_sideEffect = true; // If appears on assign RHS, don't ever delete the assignment
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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,8 @@
|
|||||||
|
|
||||||
#ifndef _V3LIFE_H_
|
#ifndef _V3LIFE_H_
|
||||||
#define _V3LIFE_H_ 1
|
#define _V3LIFE_H_ 1
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include "V3Error.h"
|
#include "V3Error.h"
|
||||||
#include "V3Ast.h"
|
#include "V3Ast.h"
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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.
|
||||||
//
|
//
|
||||||
@@ -29,7 +29,8 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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,8 @@
|
|||||||
|
|
||||||
#ifndef _V3LIFEPOST_H_
|
#ifndef _V3LIFEPOST_H_
|
||||||
#define _V3LIFEPOST_H_ 1
|
#define _V3LIFEPOST_H_ 1
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include "V3Error.h"
|
#include "V3Error.h"
|
||||||
#include "V3Ast.h"
|
#include "V3Ast.h"
|
||||||
|
|
||||||
|
|||||||
+18
-3
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2006 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2007 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.
|
||||||
//
|
//
|
||||||
@@ -26,7 +26,8 @@
|
|||||||
// Link to var they reference
|
// Link to var they reference
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config.h"
|
#include "config_build.h"
|
||||||
|
#include "verilatedos.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@@ -64,6 +65,7 @@ private:
|
|||||||
int m_paramNum; // Parameter number, for position based connection
|
int m_paramNum; // Parameter number, for position based connection
|
||||||
V3SymTable* m_curVarsp; // Symbol table of variables and tasks under table we're inserting into
|
V3SymTable* m_curVarsp; // Symbol table of variables and tasks under table we're inserting into
|
||||||
V3SymTable* m_cellVarsp; // Symbol table of variables under cell's module
|
V3SymTable* m_cellVarsp; // Symbol table of variables under cell's module
|
||||||
|
int m_beginNum; // Begin block number, 0=none seen
|
||||||
vector<V3SymTable*> m_delSymps; // Symbol tables to delete
|
vector<V3SymTable*> m_delSymps; // Symbol tables to delete
|
||||||
|
|
||||||
//int debug() { return 9; }
|
//int debug() { return 9; }
|
||||||
@@ -130,6 +132,7 @@ private:
|
|||||||
if (!m_curVarsp) nodep->v3fatalSrc("NULL");
|
if (!m_curVarsp) nodep->v3fatalSrc("NULL");
|
||||||
m_cellVarsp = NULL;
|
m_cellVarsp = NULL;
|
||||||
m_paramNum = 0;
|
m_paramNum = 0;
|
||||||
|
m_beginNum = 0;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
// Prep for next
|
// Prep for next
|
||||||
m_curVarsp = NULL;
|
m_curVarsp = NULL;
|
||||||
@@ -157,7 +160,7 @@ private:
|
|||||||
findvarp->combineType(nodep);
|
findvarp->combineType(nodep);
|
||||||
nodep->unlinkFrBack(); nodep=NULL;
|
nodep->unlinkFrBack(); nodep=NULL;
|
||||||
} else {
|
} else {
|
||||||
nodep->v3error("Duplicate declaration of signal.");
|
nodep->v3error("Duplicate declaration of signal: "<<nodep->prettyName());
|
||||||
findvarp->v3error("... Location of original declaration");
|
findvarp->v3error("... Location of original declaration");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -243,6 +246,16 @@ private:
|
|||||||
// Link variables underneath blocks
|
// Link variables underneath blocks
|
||||||
// Remember the existing symbol table scope
|
// Remember the existing symbol table scope
|
||||||
V3SymTable* upperVarsp = m_curVarsp;
|
V3SymTable* upperVarsp = m_curVarsp;
|
||||||
|
// Rename "genblk"s to include a number
|
||||||
|
// All blocks are numbered in the standard, IE we start with "genblk1" even if only one.
|
||||||
|
UINFO(8," "<<nodep<<endl);
|
||||||
|
if (m_idState==ID_FIND && nodep->name() == "genblk") {
|
||||||
|
++m_beginNum;
|
||||||
|
nodep->name(nodep->name()+cvtToStr(m_beginNum));
|
||||||
|
}
|
||||||
|
// Recurse
|
||||||
|
int oldNum = m_beginNum;
|
||||||
|
m_beginNum = 0;
|
||||||
{
|
{
|
||||||
// Create symbol table for the task's vars
|
// Create symbol table for the task's vars
|
||||||
if (V3SymTable* localVarsp = nodep->userp()->castSymTable()) {
|
if (V3SymTable* localVarsp = nodep->userp()->castSymTable()) {
|
||||||
@@ -255,6 +268,7 @@ private:
|
|||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
m_curVarsp = upperVarsp;
|
m_curVarsp = upperVarsp;
|
||||||
|
m_beginNum = oldNum;
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeFTaskRef* nodep, AstNUser*) {
|
virtual void visit(AstNodeFTaskRef* nodep, AstNUser*) {
|
||||||
// NodeFTaskRef: Resolve its reference
|
// NodeFTaskRef: Resolve its reference
|
||||||
@@ -398,6 +412,7 @@ public:
|
|||||||
m_cellVarsp = NULL;
|
m_cellVarsp = NULL;
|
||||||
m_modp = NULL;
|
m_modp = NULL;
|
||||||
m_paramNum = 0;
|
m_paramNum = 0;
|
||||||
|
m_beginNum = 0;
|
||||||
//
|
//
|
||||||
rootp->accept(*this);
|
rootp->accept(*this);
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user