mirror of
https://github.com/verilator/verilator.git
synced 2026-10-06 01:54:01 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3017f12238 | ||
|
|
23ee0342c6 | ||
|
|
499f98a51c | ||
|
|
3073db4e81 | ||
|
|
5703377a5f | ||
|
|
b85aa872cc | ||
|
|
5a1a5a7d97 | ||
|
|
52912c6329 | ||
|
|
056f72f27f | ||
|
|
bb038e86a2 | ||
|
|
cc6c71eb37 | ||
|
|
de4358f8d8 | ||
|
|
d6e9c72424 | ||
|
|
96608fb18d | ||
|
|
280b826d6d | ||
|
|
538d3d46f4 | ||
|
|
66b8ec8935 | ||
|
|
4f30025aa0 | ||
|
|
faad36a3ef | ||
|
|
0b461599d1 | ||
|
|
0cbab84143 | ||
|
|
a4e2a770f6 | ||
|
|
36e84973ec | ||
|
|
f6c8888ee2 | ||
|
|
f2bf6a037b | ||
|
|
9dade8fbd9 | ||
|
|
d2d38edf06 | ||
|
|
e0abd238e3 | ||
|
|
7edcc08886 | ||
|
|
0c73b547f1 | ||
|
|
73c3d4bb50 | ||
|
|
77f063367a | ||
|
|
8e812058cb | ||
|
|
506c36beed | ||
|
|
0110f0193e | ||
|
|
7b870f4b2a | ||
|
|
aa2630f837 | ||
|
|
e137e93f94 | ||
|
|
215bdfccc2 | ||
|
|
956a0a9c99 | ||
|
|
ab83717b7d | ||
|
|
61e876e4bf | ||
|
|
9ca3dbc140 | ||
|
|
a02e2e25bb | ||
|
|
a9281f2c37 | ||
|
|
95395a8b87 | ||
|
|
ecdbd72fa1 | ||
|
|
3a2f8224e4 | ||
|
|
15841fe5f6 | ||
|
|
7e5a7b65a0 | ||
|
|
549bf876e4 | ||
|
|
bd60cf12f8 | ||
|
|
61fbab1910 | ||
|
|
957f495314 | ||
|
|
280eb48ba4 | ||
|
|
ebe5711b40 | ||
|
|
a16477d84f | ||
|
|
f6fb2362c6 | ||
|
|
170427bba1 | ||
|
|
93531e520a | ||
|
|
aa2db8fdde | ||
|
|
7c3c2af90b | ||
|
|
6dca9b4ba4 | ||
|
|
ede37bb9d8 | ||
|
|
4a1729eaab | ||
|
|
b1565f5b89 | ||
|
|
4fb8dcfd4e | ||
|
|
16d1f2b835 | ||
|
|
73594e5aa5 | ||
|
|
c0a365bd34 | ||
|
|
45940ff820 | ||
|
|
d545ae242c | ||
|
|
e862aaf2e1 | ||
|
|
30c3540086 | ||
|
|
663a084ca4 | ||
|
|
b4d9ccd9af | ||
|
|
98fff6a4ce | ||
|
|
4977a5e1d9 | ||
|
|
e4297486ef | ||
|
|
ad591767c9 |
@@ -7,7 +7,7 @@
|
|||||||
*.1
|
*.1
|
||||||
*.tmp
|
*.tmp
|
||||||
*.tex
|
*.tex
|
||||||
Makefile
|
/Makefile
|
||||||
README
|
README
|
||||||
config.cache
|
config.cache
|
||||||
config.status
|
config.status
|
||||||
@@ -3,6 +3,130 @@ 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.665 2008/06/25
|
||||||
|
|
||||||
|
**** Ignore "// verilator" comments alone on endif lines. [Rodney Sinclair]
|
||||||
|
|
||||||
|
**** "Make install" now installs verilator_includer and verilator_profcfunc.
|
||||||
|
|
||||||
|
**** Fix tracing missing changes on undriven public wires. [Rodney Sinclair]
|
||||||
|
|
||||||
|
**** Fix syntax error when "`include `defname" is ifdefed. [John Dickol]
|
||||||
|
|
||||||
|
**** Fix error when macro call has commas in concatenate. [John Dickol]
|
||||||
|
|
||||||
|
**** Fix compile errors under Fedora 9, GCC 4.3.0. [by Jeremy Bennett]
|
||||||
|
|
||||||
|
**** Fix Makefile to find headers/libraries under prefix. [by Holger_Waechtler]
|
||||||
|
|
||||||
|
* Verilator 3.664 2008/05/08
|
||||||
|
|
||||||
|
**** Fix missing file in kit.
|
||||||
|
|
||||||
|
* Verilator 3.663 2008/05/07
|
||||||
|
|
||||||
|
**** Add DESTDIR to Makefiles to assist RPM construction. [Gunter Dannoritzer]
|
||||||
|
|
||||||
|
**** Fix compiler warnings under GCC 4.2.1.
|
||||||
|
|
||||||
|
**** Fix preprocessor `else after series of `elsif. [Mark Nodine]
|
||||||
|
|
||||||
|
**** Fix parametrized defines calling define with comma. [Joshua Wise]
|
||||||
|
|
||||||
|
**** Fix comma separated list of primitives. [by Bryan Brady]
|
||||||
|
|
||||||
|
* Verilator 3.662 2008/04/25
|
||||||
|
|
||||||
|
*** Add Verilog 2005 $clog2() function.
|
||||||
|
This is useful in calculating bus-widths from parameters.
|
||||||
|
|
||||||
|
*** Support /**/ comments in -f option files. [Stefan Thiede]
|
||||||
|
|
||||||
|
**** Add error message when modules have duplicate names. [Stefan Thiede]
|
||||||
|
|
||||||
|
**** Support defines terminated in EOF, though against spec. [Stefan Thiede]
|
||||||
|
|
||||||
|
**** Support optional argument to $finish and $stop. [by Stefan Thiede]
|
||||||
|
|
||||||
|
**** Support ranges on gate primitive instantiations. [Stefan Thiede]
|
||||||
|
|
||||||
|
**** Ignore old standard(ish) Verilog-XL defines. [by Stefan Thiede]
|
||||||
|
|
||||||
|
**** Fix "always @ ((a) or (b))" syntax error. [by Niranjan Prabhu]
|
||||||
|
|
||||||
|
**** Fix "output reg name=expr;" syntax error. [Martin Scharrer]
|
||||||
|
|
||||||
|
**** Fix multiple .v files being read in random order. [Stefan Thiede]
|
||||||
|
|
||||||
|
**** Fix internal error when params get non-constants. [Johan Wouters]
|
||||||
|
|
||||||
|
**** Fix bug introduced in 3.661 with parametrized defines.
|
||||||
|
|
||||||
|
* Verilator 3.661 2008/04/04
|
||||||
|
|
||||||
|
*** The --enable-defenv configure option added in 3.660 is now the default.
|
||||||
|
This hard-codes a default for VERILATOR_ROOT etc in the executables.
|
||||||
|
|
||||||
|
*** Add --language option for supporting older code. [Stefan Thiede]
|
||||||
|
|
||||||
|
*** Add --top-module option to select between multiple tops. [Stefan Thiede]
|
||||||
|
|
||||||
|
*** Unsized concatenates now give WIDTHCONCAT warnings. [Jonathan Kimmitt]
|
||||||
|
Previously they threw fatal errors, which in most cases is correct
|
||||||
|
according to spec, but can be incorrect in presence of parameter values.
|
||||||
|
|
||||||
|
**** Support functions with "input integer". [Johan Wouters]
|
||||||
|
|
||||||
|
**** Ignore delays attached to gate UDPs. [Stefan Thiede]
|
||||||
|
|
||||||
|
**** Fix SystemVerilog parameterized defines with `` expansion,
|
||||||
|
and fix extra whitespace inserted on substitution. [Vladimir Matveyenko]
|
||||||
|
|
||||||
|
**** Fix no-module include files on command line. [Stefan Thiede]
|
||||||
|
|
||||||
|
**** Fix dropping of backslash quoted-quote at end of $display.
|
||||||
|
|
||||||
|
**** Fix task output pin connected to non-variables. [Jonathan Kimmitt]
|
||||||
|
|
||||||
|
**** Fix missing test_v in install datadir. [Holger Waechtler]
|
||||||
|
|
||||||
|
**** Fix internal error after MSB < LSB error reported to user. [Stefan Thiede]
|
||||||
|
|
||||||
|
* Verilator 3.660 2008/03/23
|
||||||
|
|
||||||
|
*** Add support for hard-coding VERILATOR_ROOT etc in the executables,
|
||||||
|
to enable easier use of Verilator RPMs. [Gunter Dannoritzer]
|
||||||
|
|
||||||
|
*** Allow multiple .v files on command line. [Stefan Thiede]
|
||||||
|
|
||||||
|
*** Convert re-defining macro error to warning. [Stefan Thiede]
|
||||||
|
|
||||||
|
*** Add --error-limit option. [Stefan Thiede]
|
||||||
|
|
||||||
|
*** Allow __ in cell names by quoting them in C. [Stefan Thiede]
|
||||||
|
|
||||||
|
**** Fix genvar to be signed, so "< 0" works properly. [Niranjan Prabhu]
|
||||||
|
|
||||||
|
**** Fix assignments to inputs inside functions/tasks. [Patricio Kaplan]
|
||||||
|
|
||||||
|
**** Fix definitions in main file.v, referenced in library. [Stefan Thiede]
|
||||||
|
|
||||||
|
**** Fix undefined assigns to be implicit warnings. [Stefan Thiede]
|
||||||
|
|
||||||
|
* Verilator 3.658 2008/02/25
|
||||||
|
|
||||||
|
**** Fix unistd compile error in 3.657. [Patricio Kaplan, Jonathan Kimmitt]
|
||||||
|
|
||||||
|
* Verilator 3.657 2008/02/20
|
||||||
|
|
||||||
|
**** Fix assignments of {a,b,c} = {c,b,a}. [Jonathan Kimmitt]
|
||||||
|
|
||||||
|
**** Fix Perl warning with --lint-only. [by Ding Xiaoliang]
|
||||||
|
|
||||||
|
**** Avoid creating obj_dir with --lint-only. [Ding Xiaoliang]
|
||||||
|
|
||||||
|
**** Fix parsing of always @(*). [Patricio Kaplan]
|
||||||
|
|
||||||
* Verilator 3.656 2008/01/18
|
* Verilator 3.656 2008/01/18
|
||||||
|
|
||||||
**** Wide VL_CONST_W_#X functions are now made automatically. [Bernard Deadman]
|
**** Wide VL_CONST_W_#X functions are now made automatically. [Bernard Deadman]
|
||||||
@@ -1128,8 +1252,6 @@ of input ports exists for tracing.
|
|||||||
**** First code written.
|
**** First code written.
|
||||||
|
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
$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].
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
^CVS/
|
||||||
|
/CVS/
|
||||||
|
\.git/
|
||||||
|
\.svn/
|
||||||
|
\.(bak|old)/
|
||||||
|
\.(bak|old)$
|
||||||
|
\bMakefile$
|
||||||
|
\.tar\.
|
||||||
|
.*\.tgz
|
||||||
|
.*\.log
|
||||||
|
.*\.tmp
|
||||||
|
.*\.tex
|
||||||
|
.*\.key
|
||||||
|
.*\.vcd
|
||||||
|
/obj_dir/
|
||||||
|
/obj_dbg/
|
||||||
|
/obj_opt/
|
||||||
|
/logs/
|
||||||
|
Makefile
|
||||||
|
src/Makefile_obj
|
||||||
|
include/verilated.mk
|
||||||
|
config.cache
|
||||||
|
config.status
|
||||||
|
verilator_bin.*
|
||||||
|
autom4te\.cache/
|
||||||
|
nodist/
|
||||||
+72
-38
@@ -1,24 +1,23 @@
|
|||||||
# $Id$
|
|
||||||
#*****************************************************************************
|
#*****************************************************************************
|
||||||
# DESCRIPTION: Verilator top level: Makefile pre-configure version
|
# DESCRIPTION: Verilator top level: Makefile pre-configure version
|
||||||
#
|
#
|
||||||
# This file is part of Verilator.
|
# This file is part of Verilator.
|
||||||
#
|
#
|
||||||
# Author: Wilson Snyder <[email protected]>
|
# Author: Wilson Snyder <[email protected]>
|
||||||
#
|
#
|
||||||
# Code available from: http://www.veripool.com/verilator
|
# Code available from: http://www.veripool.org/verilator
|
||||||
#
|
#
|
||||||
#*****************************************************************************
|
#*****************************************************************************
|
||||||
#
|
#
|
||||||
# Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
# Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
# redistribute it and/or modify it under the terms of either the GNU
|
# redistribute it and/or modify it under the terms of either the GNU
|
||||||
# General Public License or the Perl Artistic License.
|
# General Public License or the Perl Artistic License.
|
||||||
#
|
#
|
||||||
# Verilator is distributed in the hope that it will be useful,
|
# Verilator is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
#****************************************************************************/
|
#****************************************************************************/
|
||||||
#
|
#
|
||||||
# make all to compile and build Verilator.
|
# make all to compile and build Verilator.
|
||||||
@@ -38,7 +37,7 @@
|
|||||||
# source and built the program without creating any other files,
|
# source and built the program without creating any other files,
|
||||||
# `make distclean' should leave only the files that were in the
|
# `make distclean' should leave only the files that were in the
|
||||||
# distribution.
|
# distribution.
|
||||||
#
|
#
|
||||||
# make maintainer-clean
|
# make maintainer-clean
|
||||||
# Delete everything from the current directory that can be
|
# Delete everything from the current directory that can be
|
||||||
# reconstructed with this Makefile. This typically includes
|
# reconstructed with this Makefile. This typically includes
|
||||||
@@ -61,6 +60,9 @@ MAKEINFO = makeinfo
|
|||||||
TEXI2DVI = texi2dvi
|
TEXI2DVI = texi2dvi
|
||||||
PERL = @PERL@
|
PERL = @PERL@
|
||||||
|
|
||||||
|
# Destination prefix for RPMs
|
||||||
|
DESTDIR =
|
||||||
|
|
||||||
#### Don't edit: You're much better using configure switches to set these
|
#### Don't edit: You're much better using configure switches to set these
|
||||||
prefix = @prefix@
|
prefix = @prefix@
|
||||||
exec_prefix = @exec_prefix@
|
exec_prefix = @exec_prefix@
|
||||||
@@ -78,8 +80,12 @@ datadir = @datadir@
|
|||||||
infodir = @infodir@
|
infodir = @infodir@
|
||||||
|
|
||||||
# Directory in which to install package specific files
|
# Directory in which to install package specific files
|
||||||
|
# Generally ${prefix}/share/verilator
|
||||||
pkgdatadir = @pkgdatadir@
|
pkgdatadir = @pkgdatadir@
|
||||||
|
|
||||||
|
# Directory in which to install data across multiple architectures
|
||||||
|
datarootdir = @datarootdir@
|
||||||
|
|
||||||
#### End of system configuration section. ####
|
#### End of system configuration section. ####
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
@@ -94,21 +100,27 @@ DISTDEP = info Makefile
|
|||||||
# Files to distribute.
|
# Files to distribute.
|
||||||
DISTBIN = $(wildcard bin/verilator-*)
|
DISTBIN = $(wildcard bin/verilator-*)
|
||||||
|
|
||||||
DISTFILES_INC = $(INFOS) .cvsignore COPYING *.in *.ac \
|
DISTFILES_INC = $(INFOS) .gitignore COPYING *.in *.ac \
|
||||||
Changes README TODO \
|
Changes README TODO \
|
||||||
|
MANIFEST.SKIP \
|
||||||
bin/* \
|
bin/* \
|
||||||
install-sh configure mkinstalldirs *.texi \
|
install-sh configure mkinstalldirs *.texi \
|
||||||
include/verilated.[chv]* \
|
include/verilated.[chv]* \
|
||||||
include/verilatedos.[chv]* \
|
include/verilatedos.[chv]* \
|
||||||
include/*.in \
|
include/*.in \
|
||||||
src/.cvsignore src/*.in src/*.cpp src/*.[chly] src/astgen src/flexfix \
|
include/.*ignore \
|
||||||
|
.*attributes */.*attributes */*/.*attributes \
|
||||||
|
src/.*ignore src/*.in src/*.cpp src/*.[chly] src/astgen src/*fix \
|
||||||
src/*.pl \
|
src/*.pl \
|
||||||
test_*/.cvsignore test_*/Makefile* test_*/*.cpp \
|
test_*/.*ignore test_*/Makefile* test_*/*.cpp \
|
||||||
test_*/*.pl test_*/*.v test_*/*.vc test_*/vlint \
|
test_*/*.pl test_*/*.v test_*/*.vc test_*/vlint \
|
||||||
test_verilated/vgen*.pl \
|
test_verilated/vgen*.pl \
|
||||||
test_regress/t/*.v* \
|
test_regress/t/*.cpp \
|
||||||
test_regress/t/*.pl \
|
test_regress/t/*.h \
|
||||||
|
test_regress/t/*.mem \
|
||||||
test_regress/t/*.out \
|
test_regress/t/*.out \
|
||||||
|
test_regress/t/*.pl \
|
||||||
|
test_regress/t/*.v* \
|
||||||
verilator.* \
|
verilator.* \
|
||||||
|
|
||||||
INST_PROJ_FILES = \
|
INST_PROJ_FILES = \
|
||||||
@@ -140,6 +152,7 @@ msg_test:
|
|||||||
@echo "Type 'make test' to test."
|
@echo "Type 'make test' to test."
|
||||||
@echo
|
@echo
|
||||||
|
|
||||||
|
.PHONY:test
|
||||||
ifeq ($(VERILATOR_AUTHOR_SITE),1) # Local... Else don't burden users
|
ifeq ($(VERILATOR_AUTHOR_SITE),1) # Local... Else don't burden users
|
||||||
test: test_vcs test_c test_sc test_sp test_verilated test_regress
|
test: test_vcs test_c test_sc test_sp test_verilated test_regress
|
||||||
else
|
else
|
||||||
@@ -184,16 +197,18 @@ verilator.html: bin/verilator
|
|||||||
verilator.pdf: bin/verilator $(DISTCONFIG)
|
verilator.pdf: bin/verilator $(DISTCONFIG)
|
||||||
pod2latex --full --out verilator.tex bin/verilator
|
pod2latex --full --out verilator.tex bin/verilator
|
||||||
cat < verilator.tex \
|
cat < verilator.tex \
|
||||||
|
| sed 's/\\begin{document}/\\usepackage[left=1.7in,right=1.7in,top=1.3in,bottom=1.3in]{geometry}\n\\begin{document}/' \
|
||||||
|
| sed 's/\\begin{document}/\\usepackage[pdftex,bookmarks=true,bookmarksnumbered=true,hypertexnames=false,breaklinks=true,linkbordercolor={0 0 1}]{hyperref}\n\\begin{document}/' \
|
||||||
| sed 's/\\begin{document}/\\usepackage{fancyhdr} \\pagestyle{fancy}\n\\begin{document}/' \
|
| sed 's/\\begin{document}/\\usepackage{fancyhdr} \\pagestyle{fancy}\n\\begin{document}/' \
|
||||||
| sed 's/\\begin{document}/\\setlength{\\parindent}{0pt} \\setlength{\\parskip}{\\baselineskip}\n\\begin{document}/' \
|
| sed 's/\\begin{document}/\\setlength{\\parindent}{0pt} \\setlength{\\parskip}{\\baselineskip}\n\\begin{document}/' \
|
||||||
| sed 's/\\begin{document}/\\title{$(DISTTITLE)} \\date{${DISTDATE}} \\author{Wilson Snyder\\\\ http:\/\/www.veripool.com}\n\\begin{document}/' \
|
| sed 's/\\begin{document}/\\title{$(DISTTITLE)} \\date{${DISTDATE}} \\author{Wilson Snyder\\\\ http:\/\/www.veripool.org}\n\\begin{document}/' \
|
||||||
| sed 's/\\begin{document}/\\lhead[$(DISTTITLE)]{$(DISTTITLE)}\n\\begin{document}/' \
|
| sed 's/\\begin{document}/\\lhead[$(DISTTITLE)]{$(DISTTITLE)}\n\\begin{document}/' \
|
||||||
| sed 's/\\tableofcontents/\\begin{titlepage} \\maketitle \\end{titlepage}\n\\tableofcontents/' \
|
| sed 's/\\tableofcontents/\\begin{titlepage} \\maketitle \\end{titlepage}\n\\tableofcontents/' \
|
||||||
> verilator2.tex
|
> verilator2.tex
|
||||||
mv verilator2.tex verilator.tex
|
mv verilator2.tex verilator.tex
|
||||||
pdflatex verilator.tex
|
pdflatex verilator.tex
|
||||||
pdflatex verilator.tex
|
pdflatex verilator.tex
|
||||||
-rm -f verilator.toc verilator.aux verilator.idx
|
-rm -f verilator.toc verilator.aux verilator.idx verilator.out
|
||||||
|
|
||||||
INSTALL: install.texi
|
INSTALL: install.texi
|
||||||
$(MAKEINFO) -I$(srcdir) $(srcdir)/install.texi --output=$@ \
|
$(MAKEINFO) -I$(srcdir) $(srcdir)/install.texi --output=$@ \
|
||||||
@@ -203,21 +218,35 @@ README: readme.texi
|
|||||||
$(MAKEINFO) -I$(srcdir) $(srcdir)/readme.texi --output=$@ \
|
$(MAKEINFO) -I$(srcdir) $(srcdir)/readme.texi --output=$@ \
|
||||||
--no-headers --no-validate
|
--no-headers --no-validate
|
||||||
|
|
||||||
installdirs:
|
|
||||||
$(SHELL) ${srcdir}/mkinstalldirs $(bindir) $(infodir)
|
|
||||||
|
|
||||||
# See uninstall also
|
# See uninstall also
|
||||||
VL_INST_BIN_FILES = verilator
|
VL_INST_BIN_FILES = verilator verilator_bin verilator_bin_dbg \
|
||||||
|
verilator_includer verilator_profcfunc
|
||||||
installbin:
|
installbin:
|
||||||
( cd bin ; $(INSTALL_PROGRAM) verilator $(bindir)/verilator )
|
$(SHELL) ${srcdir}/mkinstalldirs $(DESTDIR)$(bindir)
|
||||||
|
( cd bin ; $(INSTALL_PROGRAM) verilator $(DESTDIR)$(bindir)/verilator )
|
||||||
|
( cd bin ; $(INSTALL_PROGRAM) verilator_includer $(DESTDIR)$(bindir)/verilator_includer )
|
||||||
|
( cd bin ; $(INSTALL_PROGRAM) verilator_profcfunc $(DESTDIR)$(bindir)/verilator_profcfunc )
|
||||||
|
( $(INSTALL_PROGRAM) verilator_bin $(DESTDIR)$(bindir)/verilator_bin )
|
||||||
|
( $(INSTALL_PROGRAM) verilator_bin_dbg $(DESTDIR)$(bindir)/verilator_bin_dbg )
|
||||||
|
|
||||||
VL_INST_MAN_FILES = verilator.1
|
VL_INST_MAN_FILES = verilator.1
|
||||||
installman:
|
installman:
|
||||||
|
$(SHELL) ${srcdir}/mkinstalldirs $(DESTDIR)$(mandir)/man1
|
||||||
for p in $(VL_INST_MAN_FILES) ; do \
|
for p in $(VL_INST_MAN_FILES) ; do \
|
||||||
$(INSTALL_PROGRAM) $$p $(mandir)/man1/$$p; \
|
$(INSTALL_PROGRAM) $$p $(DESTDIR)$(mandir)/man1/$$p; \
|
||||||
done
|
done
|
||||||
|
|
||||||
install: all_nomsg installdirs installbin installman install-msg
|
installdata:
|
||||||
|
$(SHELL) ${srcdir}/mkinstalldirs $(DESTDIR)$(pkgdatadir)/examples
|
||||||
|
cp -r include $(DESTDIR)$(pkgdatadir)
|
||||||
|
cp -r src $(DESTDIR)$(pkgdatadir)
|
||||||
|
cp -r test_c $(DESTDIR)$(pkgdatadir)/examples
|
||||||
|
cp -r test_sc $(DESTDIR)$(pkgdatadir)/examples
|
||||||
|
cp -r test_sp $(DESTDIR)$(pkgdatadir)/examples
|
||||||
|
cp -r test_v $(DESTDIR)$(pkgdatadir)/examples
|
||||||
|
|
||||||
|
VL_INST_DATA_FILES = verilator.1
|
||||||
|
install: all_nomsg installbin installman installdata install-msg
|
||||||
|
|
||||||
install-here: installman ftp
|
install-here: installman ftp
|
||||||
|
|
||||||
@@ -232,8 +261,8 @@ install-project: dist
|
|||||||
for p in verilator.1 ; do \
|
for p in verilator.1 ; do \
|
||||||
$(INSTALL_PROGRAM) -m 0666 $$p $(DIRPROJECT_PREFIX)/man/man1/$$p; \
|
$(INSTALL_PROGRAM) -m 0666 $$p $(DIRPROJECT_PREFIX)/man/man1/$$p; \
|
||||||
done
|
done
|
||||||
$(INST_PROJ_CVS) $(DISTNAME).tar.gz $(DIRPROJECT)/hw/utils/verilator/verilator.tgz
|
$(INST_PROJ_CVS) $(DISTNAME).tgz $(DIRPROJECT)/hw/utils/verilator/verilator.tgz
|
||||||
rm $(DISTNAME).tar.gz
|
rm $(DISTNAME).tgz
|
||||||
|
|
||||||
install-project-quick:
|
install-project-quick:
|
||||||
@echo "Install-project-quick (no strip) to $(DIRPROJECT)"
|
@echo "Install-project-quick (no strip) to $(DIRPROJECT)"
|
||||||
@@ -246,9 +275,6 @@ install-project-quick:
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ftp: info
|
ftp: info
|
||||||
echo "http://www.veripool.com/verilator3.html"
|
|
||||||
cp verilator.html verilator_man.html
|
|
||||||
ftp_tree --password $(VERIPOOL_PW) --user $(VERIPOOL_USER) verilator_man.html webftp.veripool.com:/web
|
|
||||||
|
|
||||||
install-msg:
|
install-msg:
|
||||||
@echo "Installed!"
|
@echo "Installed!"
|
||||||
@@ -261,8 +287,9 @@ install-msg:
|
|||||||
@echo
|
@echo
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
-cd $(mandir)/man1 && rm -f $(VL_INST_MAN_FILES)
|
-cd $(DESTDIR)$(mandir)/man1 && rm -f $(VL_INST_MAN_FILES)
|
||||||
-cd $(bindir) && rm -f $(VL_INST_BIN_FILES)
|
-cd $(DESTDIR)$(bindir) && rm -f $(VL_INST_BIN_FILES)
|
||||||
|
-rm -f $(DESTDIR)$(pkgdatadir)
|
||||||
|
|
||||||
# autoheader might not change config_build.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 \
|
||||||
@@ -287,7 +314,7 @@ configure: configure.ac
|
|||||||
maintainer-clean::
|
maintainer-clean::
|
||||||
@echo "This command is intended for maintainers to use;"
|
@echo "This command is intended for maintainers to use;"
|
||||||
@echo "rebuilding the deleted files requires makeinfo."
|
@echo "rebuilding the deleted files requires makeinfo."
|
||||||
rm -f *.info* $(INFOS) faq.html verilator.html configure bin/*
|
rm -f *.info* $(INFOS) faq.html verilator.html configure
|
||||||
|
|
||||||
clean mostlyclean distclean maintainer-clean maintainer-copy::
|
clean mostlyclean distclean maintainer-clean maintainer-copy::
|
||||||
for dir in $(SUBDIRS); do \
|
for dir in $(SUBDIRS); do \
|
||||||
@@ -296,7 +323,7 @@ clean mostlyclean distclean maintainer-clean maintainer-copy::
|
|||||||
done
|
done
|
||||||
|
|
||||||
clean mostlyclean distclean maintainer-clean::
|
clean mostlyclean distclean maintainer-clean::
|
||||||
rm -f $(SCRIPTS) *.tmp
|
rm -f $(SCRIPTS) *.tmp
|
||||||
rm -f *.aux *.cp *.cps *.dvi *.fn *.fns *.ky *.kys *.log
|
rm -f *.aux *.cp *.cps *.dvi *.fn *.fns *.ky *.kys *.log
|
||||||
rm -f *.pg *.pgs *.toc *.tp *.tps *.vr *.vrs *.idx
|
rm -f *.pg *.pgs *.toc *.tp *.tps *.vr *.vrs *.idx
|
||||||
rm -f *.ev *.evs *.ov *.ovs *.cv *.cvs *.ma *.mas
|
rm -f *.ev *.evs *.ov *.ovs *.cv *.cvs *.ma *.mas
|
||||||
@@ -312,6 +339,13 @@ TAGFILES=${srcdir}/*/*.cpp ${srcdir}/*/*.h ${srcdir}/*/[a-z]*.in \
|
|||||||
TAGS: $(TAGFILES)
|
TAGS: $(TAGFILES)
|
||||||
etags $(TAGFILES)
|
etags $(TAGFILES)
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
# Test targets
|
||||||
|
|
||||||
|
dist-file-list:
|
||||||
|
@echo "begin-dist-file-list:"; # Scripts look for this
|
||||||
|
@echo $(wildcard $(DISTFILES))
|
||||||
|
@echo "end-dist-file-list:"; # Scripts look for this
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
# Distributions
|
# Distributions
|
||||||
@@ -320,7 +354,7 @@ 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))
|
||||||
DISTDATEPRE := $(shell sed -e '/DTVERSION/!d' -e 's/.*\([0-3]\?[0-9].[0-3]\?[0-9].[1-2][0-9][0-9][0-9]\).*/\1/' -e q $(DISTCONFIG))
|
DISTDATEPRE := $(shell sed -e '/DTVERSION/!d' -e 's/.*\([1-2][0-9][0-9][0-9].[0-9]*[0-9].[0-9]*[0-9]\).*/\1/' -e q $(DISTCONFIG))
|
||||||
|
|
||||||
DISTTAGNAME := $(subst .,_,$(subst -,_,$(DISTNAME)))
|
DISTTAGNAME := $(subst .,_,$(subst -,_,$(DISTNAME)))
|
||||||
DISTDATE := $(subst /,-,$(DISTDATEPRE))
|
DISTDATE := $(subst /,-,$(DISTDATEPRE))
|
||||||
@@ -339,14 +373,14 @@ dist: $(DISTDEP) maintainer-copy
|
|||||||
chmod -R a+r $(DISTNAME)
|
chmod -R a+r $(DISTNAME)
|
||||||
tar chf $(DISTNAME).tar $(DISTNAME)
|
tar chf $(DISTNAME).tar $(DISTNAME)
|
||||||
gzip --force --best $(DISTNAME).tar
|
gzip --force --best $(DISTNAME).tar
|
||||||
|
mv $(DISTNAME).tar.gz $(DISTNAME).tgz
|
||||||
rm -fr $(DISTNAME)
|
rm -fr $(DISTNAME)
|
||||||
|
|
||||||
maintainer-diff:
|
maintainer-diff:
|
||||||
svnorcvs diff $(DISTTAGNAME)
|
svnorcvs diff $(DISTTAGNAME)
|
||||||
|
|
||||||
preexist:
|
preexist:
|
||||||
test ! -r ~/src/kits/$(DISTNAME).tar.gz
|
svnorcvs nexists $(DISTTAGNAME)
|
||||||
|
|
||||||
maintainer-dist: preexist dist tag
|
maintainer-dist: preexist dist tag
|
||||||
cp *.gz ~/backpack
|
svnorcvs release $(DISTNAME).tgz
|
||||||
cp *.gz ~/src/kits
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// $Id$
|
|
||||||
// DESCRIPTION: Verilator: List of To Do issues.
|
// DESCRIPTION: Verilator: List of To Do issues.
|
||||||
//
|
//
|
||||||
// Copyright 2004-2008 by Wilson Snyder. This program is free software; you can
|
// Copyright 2004-2008 by Wilson Snyder. This program is free software; you can
|
||||||
@@ -7,7 +6,7 @@
|
|||||||
|
|
||||||
|
|
||||||
Features:
|
Features:
|
||||||
Finish 3.400 new ordering fixes
|
Finish 3.400 new ordering fixes
|
||||||
Latch optimizations {Need here}
|
Latch optimizations {Need here}
|
||||||
Task I/Os connecting to non-simple variables.
|
Task I/Os connecting to non-simple variables.
|
||||||
Fix nested casez statements expanding into to huge C++. [JeanPaul Vanitegem]
|
Fix nested casez statements expanding into to huge C++. [JeanPaul Vanitegem]
|
||||||
@@ -50,7 +49,11 @@ Testing:
|
|||||||
|
|
||||||
Usability:
|
Usability:
|
||||||
Better reporting of unopt problems, including what lines of code
|
Better reporting of unopt problems, including what lines of code
|
||||||
Report more errors (all of them?) before exiting [Eugene Weber]
|
Report more errors (all of them?) before exiting [Eugene Weber]
|
||||||
|
|
||||||
|
Internal Code:
|
||||||
|
Eliminate the AstNUser* passed to all visitors; its only needed in V3Width,
|
||||||
|
and removing it will speed up and simplify all the other code.
|
||||||
|
|
||||||
Performance:
|
Performance:
|
||||||
Constant propagation
|
Constant propagation
|
||||||
@@ -65,7 +68,7 @@ Performance:
|
|||||||
Multithreaded execution
|
Multithreaded execution
|
||||||
Bit-multiply for faster bit swapping and a=b[1,3,2] random bit reorderings.
|
Bit-multiply for faster bit swapping and a=b[1,3,2] random bit reorderings.
|
||||||
Move _last sets and all other combo logic inside master
|
Move _last sets and all other combo logic inside master
|
||||||
if() that triggers on all possible sense items
|
if() that triggers on all possible sense items
|
||||||
Rewrite and combine V3Life, V3Subst
|
Rewrite and combine V3Life, V3Subst
|
||||||
If block temp only ever set in one place to constant, propagate it
|
If block temp only ever set in one place to constant, propagate it
|
||||||
Used in t_mem for array delayed assignments
|
Used in t_mem for array delayed assignments
|
||||||
@@ -135,15 +138,15 @@ Selectable SystemC types based on widths (see notes below)
|
|||||||
c) a conditional whose possible values are (a) or (b)
|
c) a conditional whose possible values are (a) or (b)
|
||||||
|
|
||||||
2) One can lose that fact that a node is a tristate node. This happens
|
2) One can lose that fact that a node is a tristate node. This happens
|
||||||
if a tristate node is assigned to a 'standard' node, or is used on
|
if a tristate node is assigned to a 'standard' node, or is used on
|
||||||
RHS of a conditional. The following infer tristate signals:
|
RHS of a conditional. The following infer tristate signals:
|
||||||
a) inout <SIGNAL>
|
a) inout <SIGNAL>
|
||||||
b) tri <SIGNAL>
|
b) tri <SIGNAL>
|
||||||
c) assigning to 'Z' (maybe through a conditional)
|
c) assigning to 'Z' (maybe through a conditional)
|
||||||
Note: tristate-ness of an output port determined only by
|
Note: tristate-ness of an output port determined only by
|
||||||
statements in the module (not the instances it calls)
|
statements in the module (not the instances it calls)
|
||||||
|
|
||||||
4) Tristate variables can't be multidimensional arrays
|
4) Tristate variables can't be multidimensional arrays
|
||||||
5) Only check tristate contention between modules (not within!)
|
5) Only check tristate contention between modules (not within!)
|
||||||
6) Only simple compares with 'Z' are allowed (===)
|
6) Only simple compares with 'Z' are allowed (===)
|
||||||
|
|
||||||
|
|||||||
+125
-81
@@ -1,7 +1,6 @@
|
|||||||
: # -*-Mode: perl;-*- use perl, wherever it is
|
: # -*-Mode: perl;-*- use perl, wherever it is
|
||||||
eval 'exec perl -wS $0 ${1+"$@"}'
|
eval 'exec perl -wS $0 ${1+"$@"}'
|
||||||
if 0;
|
if 0;
|
||||||
# $Id$
|
|
||||||
######################################################################
|
######################################################################
|
||||||
#
|
#
|
||||||
# Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
# Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
@@ -34,27 +33,7 @@ use Config;
|
|||||||
use Cwd qw(abs_path getcwd);
|
use Cwd qw(abs_path getcwd);
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use vars qw ($Debug %Vars $Opt $Opt_Make_Dir $Opt_Sp @Opt_Verilator_Sw
|
use vars qw ($Debug @Opt_Verilator_Sw);
|
||||||
$Opt_Trace
|
|
||||||
%Modules
|
|
||||||
);
|
|
||||||
|
|
||||||
#######################################################################
|
|
||||||
# Global constants -- Configuration info
|
|
||||||
|
|
||||||
# Where to find real executables
|
|
||||||
# We could find it by using $RealBin, but we require this path
|
|
||||||
# so that when the user runs make, they will have it and not get strange error.
|
|
||||||
$ENV{VERILATOR_ROOT} or die "%Error: verilator: VERILATOR_ROOT needs to be in environment\n";
|
|
||||||
print "export VERILATOR_ROOT=$ENV{VERILATOR_ROOT}\n" if $Debug;
|
|
||||||
|
|
||||||
# Read by verilator for populating makefile
|
|
||||||
if (!defined $ENV{SYSTEMC_ARCH}) {
|
|
||||||
$ENV{SYSTEMC_ARCH} ||= (($Config{osname} =~ /solaris/i && "gccsparcOS5")
|
|
||||||
|| ($Config{osname} =~ /cygwin/i && "cygwin")
|
|
||||||
|| "linux");
|
|
||||||
print "export SYSTEMC_ARCH=$ENV{SYSTEMC_ARCH}\n" if $Debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
#######################################################################
|
#######################################################################
|
||||||
@@ -65,7 +44,6 @@ autoflush STDERR 1;
|
|||||||
|
|
||||||
$Debug = 0;
|
$Debug = 0;
|
||||||
my $opt_gdb;
|
my $opt_gdb;
|
||||||
$Opt_Sp = undef;
|
|
||||||
|
|
||||||
# No arguments can't do anything useful. Give help
|
# No arguments can't do anything useful. Give help
|
||||||
if ($#ARGV < 0) {
|
if ($#ARGV < 0) {
|
||||||
@@ -84,33 +62,15 @@ if (! GetOptions (
|
|||||||
# Major operating modes
|
# Major operating modes
|
||||||
"help" => \&usage,
|
"help" => \&usage,
|
||||||
"debug:s" => \&debug,
|
"debug:s" => \&debug,
|
||||||
"version!" => \&version,
|
# "version!" => \&version, # Also passthru'ed
|
||||||
# Switches
|
# Switches
|
||||||
"gdb=s" => \$opt_gdb, # Undocumented debugging
|
"gdb=s" => \$opt_gdb, # Undocumented debugging
|
||||||
"trace!" => \$Opt_Trace,
|
|
||||||
"sp!" => sub {$Opt_Sp = 'sp';},
|
|
||||||
"sc!" => sub {$Opt_Sp = 'sc';},
|
|
||||||
"cc!" => sub {$Opt_Sp = 0;},
|
|
||||||
#"ignc!" => ..., # Undocumented debugging, disable $c but don't complain
|
|
||||||
# Additional parameters
|
# Additional parameters
|
||||||
"<>" => sub {}, # Ignored
|
"<>" => sub {}, # Ignored
|
||||||
)) {
|
)) {
|
||||||
pod2usage(-exitstatus=>2, -verbose=>0);
|
pod2usage(-exitstatus=>2, -verbose=>0);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check configuration
|
|
||||||
if ($Opt_Sp) {
|
|
||||||
(defined $ENV{SYSTEMC}) or die "%Error: verilator: Need \$SYSTEMC in environment\nProbably System-C isn't installed, see http://www.systemc.org\n";
|
|
||||||
}
|
|
||||||
if ($Opt_Sp eq 'sp' || $Opt_Trace) {
|
|
||||||
if (!defined $ENV{SYSTEMPERL}) {
|
|
||||||
my $try = "$ENV{W}/hw/utils/perltools/SystemC";
|
|
||||||
$ENV{SYSTEMPERL} = $try if -d $try;
|
|
||||||
}
|
|
||||||
(defined $ENV{SYSTEMPERL}) or die "%Error: verilator: Need \$SYSTEMPERL in environment for --sp or --trace\nProbably System-Perl isn't installed, see http://www.veripool.com/systemperl.html\n";
|
|
||||||
(-d "$ENV{SYSTEMPERL}/src") or die "%Error: verilator: \$SYSTEMPERL environment var doesn't seem to point to System-Perl kit\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
# Determine runtime flags
|
# Determine runtime flags
|
||||||
my $vcmd =(($opt_gdb?"$opt_gdb ":"")
|
my $vcmd =(($opt_gdb?"$opt_gdb ":"")
|
||||||
.verilator_bin()
|
.verilator_bin()
|
||||||
@@ -123,8 +83,6 @@ run ($vcmd);
|
|||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
sub usage {
|
sub usage {
|
||||||
bin_version();
|
|
||||||
print '$Revision$$Date$ ', "\n";
|
|
||||||
pod2usage(-exitstatus=>2, -verbose=>2);
|
pod2usage(-exitstatus=>2, -verbose=>2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,23 +92,16 @@ sub debug {
|
|||||||
$Debug = $level||3;
|
$Debug = $level||3;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub version {
|
|
||||||
bin_version();
|
|
||||||
exit (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
sub bin_version {
|
|
||||||
($ENV{VERILATOR_ROOT}) or print "%Warning: Unknown rev: VERILATOR_ROOT undefined\n";
|
|
||||||
run (verilator_bin()." --version");
|
|
||||||
}
|
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
#######################################################################
|
#######################################################################
|
||||||
# Builds
|
# Builds
|
||||||
|
|
||||||
sub verilator_bin {
|
sub verilator_bin {
|
||||||
my $bin = "$ENV{VERILATOR_ROOT}/".($ENV{VERILATOR_BIN}||"verilator_bin");
|
my $bin = "";
|
||||||
if ($Debug && -x "${bin}_dbg") { $bin = "${bin}_dbg"; }
|
# Use VERILATOR_ROOT if defined, else assume verilator_bin is in the search path
|
||||||
|
$bin .= $ENV{VERILATOR_ROOT}."/" if defined($ENV{VERILATOR_ROOT});
|
||||||
|
$bin .= ($ENV{VERILATOR_BIN}||"verilator_bin");
|
||||||
|
if ($Debug) { $bin = "${bin}_dbg"; }
|
||||||
return $bin;
|
return $bin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,8 +116,11 @@ sub run {
|
|||||||
system($command);
|
system($command);
|
||||||
my $status = $?;
|
my $status = $?;
|
||||||
if ($status) {
|
if ($status) {
|
||||||
|
if ($! =~ /no such file or directory/i) {
|
||||||
|
warn "%Error: verilator: Misinstalled, or VERILATOR_ROOT might need to be in environment\n";
|
||||||
|
}
|
||||||
if ($Debug) { # For easy rerunning
|
if ($Debug) { # For easy rerunning
|
||||||
warn "%Error: export VERILATOR_ROOT=$ENV{VERILATOR_ROOT}\n";
|
warn "%Error: export VERILATOR_ROOT=".($ENV{VERILATOR_ROOT}||"")."\n";
|
||||||
warn "%Error: $command\n";
|
warn "%Error: $command\n";
|
||||||
}
|
}
|
||||||
die "%Error: Command Failed $command\n";
|
die "%Error: Command Failed $command\n";
|
||||||
@@ -205,7 +159,7 @@ code, lints it, and optionally adds coverage and waveform tracing code.
|
|||||||
For C++ and SystemC formats, it outputs .cpp and .h files. For SystemPerl
|
For C++ and SystemC formats, it outputs .cpp and .h files. For SystemPerl
|
||||||
format, it outputs .sp files for the SystemPerl preprocessor, which greatly
|
format, it outputs .sp files for the SystemPerl preprocessor, which greatly
|
||||||
simplifies writing SystemC code and is available at
|
simplifies writing SystemC code and is available at
|
||||||
L<http://www.veripool.com>.
|
L<http://www.veripool.org>.
|
||||||
|
|
||||||
The files created by Verilator are then compiled with C++. The user writes
|
The files created by Verilator are then compiled with C++. The user writes
|
||||||
a little C++ wrapper file, which instantiates the top level module, and
|
a little C++ wrapper file, which instantiates the top level module, and
|
||||||
@@ -234,12 +188,14 @@ descriptions in the next sections for more information.
|
|||||||
--debug-check Enable debugging assertions
|
--debug-check Enable debugging assertions
|
||||||
--dump-tree Enable dumping .tree files
|
--dump-tree Enable dumping .tree files
|
||||||
-E Preprocess, but do not compile
|
-E Preprocess, but do not compile
|
||||||
|
--error-limit <value> Abort after this number of errors
|
||||||
--exe Link to create executable
|
--exe Link to create executable
|
||||||
-f <file> Parse options from a file
|
-f <file> Parse options from a file
|
||||||
--help Display this help.
|
--help Display this help.
|
||||||
-I<dir> Directory to search for includes
|
-I<dir> Directory to search for includes
|
||||||
--inhibit-sim Create function to turn off sim
|
--inhibit-sim Create function to turn off sim
|
||||||
--inline-mult <value> Tune module inlining
|
--inline-mult <value> Tune module inlining
|
||||||
|
--language <lang> Language standard to parse
|
||||||
--lint-only Lint, but do not make output
|
--lint-only Lint, but do not make output
|
||||||
--MMD Create .d dependency files
|
--MMD Create .d dependency files
|
||||||
--MP Create phony dependency targets
|
--MP Create phony dependency targets
|
||||||
@@ -260,6 +216,7 @@ descriptions in the next sections for more information.
|
|||||||
--sc Create SystemC output
|
--sc Create SystemC output
|
||||||
--sp Create SystemPerl output
|
--sp Create SystemPerl output
|
||||||
--stats Create statistics file
|
--stats Create statistics file
|
||||||
|
--top-module <topname> Name of top level input module
|
||||||
--trace Enable waveform creation
|
--trace Enable waveform creation
|
||||||
--trace-depth <levels> Depth of tracing
|
--trace-depth <levels> Depth of tracing
|
||||||
-U<var> Undefine preprocessor define
|
-U<var> Undefine preprocessor define
|
||||||
@@ -392,6 +349,11 @@ Preprocess the source code, but do not compile, as with 'gcc -E'. Output
|
|||||||
is written to standard out. Beware of enabling debugging messages, as they
|
is written to standard out. Beware of enabling debugging messages, as they
|
||||||
will also go to standard out.
|
will also go to standard out.
|
||||||
|
|
||||||
|
=item --error-limit <value>
|
||||||
|
|
||||||
|
After this number of errors or warnings are encountered, exit. Defaults to
|
||||||
|
50.
|
||||||
|
|
||||||
=item --exe
|
=item --exe
|
||||||
|
|
||||||
Generate a executable. You will also need to pass additional .cpp files on
|
Generate a executable. You will also need to pass additional .cpp files on
|
||||||
@@ -417,6 +379,14 @@ values, or a value <= 1 will inline everything, will lead to longer compile
|
|||||||
times, but potentially faster runtimes. This setting is ignored for very
|
times, but potentially faster runtimes. This setting is ignored for very
|
||||||
small modules; they will always be inlined, if allowed.
|
small modules; they will always be inlined, if allowed.
|
||||||
|
|
||||||
|
=item --language I<value>
|
||||||
|
|
||||||
|
Select the language to be used when first processing each Verilog file.
|
||||||
|
The language value must be "1364-1995", "1364-2001", "1364-2001",
|
||||||
|
"1364-2005", or "1800-2005". This should only be used for legacy code, as
|
||||||
|
the preferable option is to edit the code to repair new keywords, or add
|
||||||
|
appropriate `begin_keywords.
|
||||||
|
|
||||||
=item --lint-only
|
=item --lint-only
|
||||||
|
|
||||||
Check the files for lint violations only, do not create any other output.
|
Check the files for lint violations only, do not create any other output.
|
||||||
@@ -434,7 +404,7 @@ to gcc -MP option.
|
|||||||
=item --Mdir I<directory>
|
=item --Mdir I<directory>
|
||||||
|
|
||||||
Specifies the name of the Make object directory. All generated files will
|
Specifies the name of the Make object directory. All generated files will
|
||||||
be placed in this directory.
|
be placed in this directory. If not specified, "obj_dir" is used.
|
||||||
|
|
||||||
=item --mod-prefix I<topname>
|
=item --mod-prefix I<topname>
|
||||||
|
|
||||||
@@ -489,8 +459,9 @@ the backward-compatible default of sc_bv's.
|
|||||||
|
|
||||||
=item --prefix I<topname>
|
=item --prefix I<topname>
|
||||||
|
|
||||||
Specifies the name of the top level class. Defaults to the name of the top
|
Specifies the name of the top level class and makefile. Defaults to V
|
||||||
level Verilog module.
|
prepended to the name of the --top-module switch, or V prepended to the
|
||||||
|
first Verilog filename passed on the command line.
|
||||||
|
|
||||||
=item --profile-cfuncs
|
=item --profile-cfuncs
|
||||||
|
|
||||||
@@ -536,11 +507,22 @@ Specifies SystemPerl output mode; see also --cc and -sc.
|
|||||||
|
|
||||||
Creates a dump file with statistics on the design in {prefix}__stats.txt.
|
Creates a dump file with statistics on the design in {prefix}__stats.txt.
|
||||||
|
|
||||||
|
=item --top-module I<topname>
|
||||||
|
|
||||||
|
When the input Verilog contains more than one top level module, specifies
|
||||||
|
the name of the top level Verilog module to become the top, and sets the
|
||||||
|
default for if --prefix is not used. This is not needed with standard
|
||||||
|
designs with only one top.
|
||||||
|
|
||||||
=item --trace
|
=item --trace
|
||||||
|
|
||||||
Adds waveform tracing code to the model, this will create additional
|
Adds waveform tracing code to the model. Verilator will generate
|
||||||
{prefix}__Trace*.cpp files you will need to add to your Makefiles, if
|
additional {prefix}__Trace*.cpp files that will need to be compiled. In
|
||||||
you're not using the ones generated for you.
|
addition Sp.cpp (for SystemC traces) or SpTraceVcdC.c (for C++ only) from
|
||||||
|
the SystemPerl kit's src directory must be compiled and linked in. If
|
||||||
|
using the Verilator generated Makefiles, these will be added as source
|
||||||
|
targets for you. If you're not using the Verilator makefiles, you will
|
||||||
|
need to add these to your Makefile manually.
|
||||||
|
|
||||||
Having tracing compiled in may result in some small performance losses,
|
Having tracing compiled in may result in some small performance losses,
|
||||||
even when waveforms are not turned on during model execution.
|
even when waveforms are not turned on during model execution.
|
||||||
@@ -871,14 +853,16 @@ After running Make, the C++ compiler should produce the following:
|
|||||||
|
|
||||||
Required for SystemC output mode. If set, specifies the directory
|
Required for SystemC output mode. If set, specifies the directory
|
||||||
containing the SystemC distribution. This is used to find the SystemC
|
containing the SystemC distribution. This is used to find the SystemC
|
||||||
include files.
|
include files. If not specified, it will come from a default optionally
|
||||||
|
specified at configure time (before Verilator was compiled).
|
||||||
|
|
||||||
=item SYSTEMC_ARCH
|
=item SYSTEMC_ARCH
|
||||||
|
|
||||||
Specifies the architecture name used by the SystemC kit. This is the part
|
Specifies the architecture name used by the SystemC kit. This is the part
|
||||||
after the dash in the lib-{...} directory name created by a 'make' in the
|
after the dash in the lib-{...} directory name created by a 'make' in the
|
||||||
SystemC distribution. If not set, Verilator will try to intuit the proper
|
SystemC distribution. If not set, Verilator will try to intuit the proper
|
||||||
setting.
|
setting, or use the default optionally specified at configure time (before
|
||||||
|
Verilator was compiled). .
|
||||||
|
|
||||||
=item SYSTEMC_CXX_FLAGS
|
=item SYSTEMC_CXX_FLAGS
|
||||||
|
|
||||||
@@ -888,7 +872,9 @@ building the SystemC model.
|
|||||||
=item SYSTEMPERL
|
=item SYSTEMPERL
|
||||||
|
|
||||||
Specifies the directory containing the Verilog-Perl distribution kit. This
|
Specifies the directory containing the Verilog-Perl distribution kit. This
|
||||||
is used to find the Verilog-Perl library and include files.
|
is used to find the Verilog-Perl library and include files. If not
|
||||||
|
specified, it will come from a default optionally specified at configure
|
||||||
|
time (before Verilator was compiled).
|
||||||
|
|
||||||
=item VCS_HOME
|
=item VCS_HOME
|
||||||
|
|
||||||
@@ -904,7 +890,9 @@ for debugging and selecting between multiple operating system builds.
|
|||||||
=item VERILATOR_ROOT
|
=item VERILATOR_ROOT
|
||||||
|
|
||||||
Specifies the directory containing the distribution kit. This is used to
|
Specifies the directory containing the distribution kit. This is used to
|
||||||
find the executable, Perl library, and include files.
|
find the executable, Perl library, and include files. If not specified, it
|
||||||
|
will come from a default optionally specified at configure time (before
|
||||||
|
Verilator was compiled).
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
@@ -929,7 +917,7 @@ example:
|
|||||||
unsigned int main_time = 0; // Current simulation time
|
unsigned int main_time = 0; // Current simulation time
|
||||||
|
|
||||||
double sc_time_stamp () { // Called by $time in Verilog
|
double sc_time_stamp () { // Called by $time in Verilog
|
||||||
return main_time;
|
return main_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
@@ -1017,6 +1005,8 @@ declarations inside port lists.
|
|||||||
Verilator supports the `begin_keywords and `end_keywords compiler
|
Verilator supports the `begin_keywords and `end_keywords compiler
|
||||||
directives.
|
directives.
|
||||||
|
|
||||||
|
Verilator supports $clog2.
|
||||||
|
|
||||||
Verilator partially supports the uwire keyword.
|
Verilator partially supports the uwire keyword.
|
||||||
|
|
||||||
=head1 SYSTEMVERILOG (IEEE 1800-2005) SUPPORT
|
=head1 SYSTEMVERILOG (IEEE 1800-2005) SUPPORT
|
||||||
@@ -1560,6 +1550,10 @@ argument (as with C's printf), you cannot simply list variables standalone.
|
|||||||
The sized display functions are rarely used and so not supported. Replace
|
The sized display functions are rarely used and so not supported. Replace
|
||||||
them with a $write with the appropriate format specifier.
|
them with a $write with the appropriate format specifier.
|
||||||
|
|
||||||
|
=item $finish, $stop
|
||||||
|
|
||||||
|
The rarely used optional parameter to $finish and $stop is ignored.
|
||||||
|
|
||||||
=item $fopen, $fclose, $fdisplay, $fwrite
|
=item $fopen, $fclose, $fdisplay, $fwrite
|
||||||
|
|
||||||
File descriptors passed to the file PLI calls must be file descriptors, not
|
File descriptors passed to the file PLI calls must be file descriptors, not
|
||||||
@@ -1699,7 +1693,7 @@ output from a sub-module.) While legal in Verilog, implicit declarations
|
|||||||
only work for single bit wide signals (not buses), do not allow using a
|
only work for single bit wide signals (not buses), do not allow using a
|
||||||
signal before it is implicitly declared by a cell, and can lead to dangling
|
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.org/>
|
||||||
|
|
||||||
Ignoring this warning will only suppress the lint check, it will simulate
|
Ignoring this warning will only suppress the lint check, it will simulate
|
||||||
correctly.
|
correctly.
|
||||||
@@ -1733,6 +1727,23 @@ not really needed. The best solution is to insure that each module is in a
|
|||||||
unique file by the same name. Otherwise, make sure all library files are
|
unique file by the same name. Otherwise, make sure all library files are
|
||||||
read in as libraries with -v, instead of automatically with -y.
|
read in as libraries with -v, instead of automatically with -y.
|
||||||
|
|
||||||
|
=item REDEFMACRO
|
||||||
|
|
||||||
|
Warns that you have redefined the same macro with a different value, for
|
||||||
|
example:
|
||||||
|
|
||||||
|
`define MACRO def1
|
||||||
|
//...
|
||||||
|
`define MACRO otherdef
|
||||||
|
|
||||||
|
The best solution is to use a different name for the second macro. If this
|
||||||
|
is not possible, add a undef to indicate the code is overriding the value:
|
||||||
|
|
||||||
|
`define MACRO def1
|
||||||
|
//...
|
||||||
|
`undef MACRO
|
||||||
|
`define MACRO otherdef
|
||||||
|
|
||||||
=item STMTDLY
|
=item STMTDLY
|
||||||
|
|
||||||
Warns that you have a statement with a delayed time in front of it, for
|
Warns that you have a statement with a delayed time in front of it, for
|
||||||
@@ -1890,6 +1901,24 @@ The best fix, which clarifies intent and will also make all tools happy is:
|
|||||||
Ignoring this warning will only suppress the lint check, it will simulate
|
Ignoring this warning will only suppress the lint check, it will simulate
|
||||||
correctly.
|
correctly.
|
||||||
|
|
||||||
|
=item WIDTHCONCAT
|
||||||
|
|
||||||
|
Warns that based on width rules of Verilog, a concatenate or replication
|
||||||
|
has a undeterminate width. In most cases this violates the Verilog rule
|
||||||
|
that widths inside concatenates and replicates must be sized, and should be
|
||||||
|
fixed in the code.
|
||||||
|
|
||||||
|
wire [63:0] concat = {1,2};
|
||||||
|
|
||||||
|
An example where this is technically legal (though still bad form) is:
|
||||||
|
|
||||||
|
parameter PAR = 1;
|
||||||
|
wire [63:0] concat = {PAR,PAR};
|
||||||
|
|
||||||
|
The correct fix is to either size the 1 ("32'h1"), or add the width to the
|
||||||
|
parameter definition ("parameter [31:0]"), or add the width to the
|
||||||
|
parameter usage ("{PAR[31:0],PAR[31:0]}".
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
The following describes the less obvious errors:
|
The following describes the less obvious errors:
|
||||||
@@ -1943,11 +1972,14 @@ Visual C++ Version 7 or newer, but this is not tested by the author.
|
|||||||
|
|
||||||
=item Can you provide binaries?
|
=item Can you provide binaries?
|
||||||
|
|
||||||
At this time I'd prefer to get patches out quickly than have to generate
|
Verilator is available as a RPM for SuSE and perhaps other systems; this is
|
||||||
myriad binaries for many different OS flavors. People have generally
|
done by porters and may slightly lag the primary distribution. If there
|
||||||
requested binaries when they are having problems with their C++
|
isn't a binary build for your distribution, how about you set one up?
|
||||||
compiler. Alas, binaries won't help this, as in the end a fully working C++
|
Please contact the authors for assistance.
|
||||||
compiler is required to compile the output of Verilator.
|
|
||||||
|
Note people sometimes request binaries when they are having problems with
|
||||||
|
their C++ compiler. Alas, binaries won't help this, as in the end a fully
|
||||||
|
working C++ compiler is required to compile the output of Verilator.
|
||||||
|
|
||||||
=item How can it be faster than (name-the-simulator)?
|
=item How can it be faster than (name-the-simulator)?
|
||||||
|
|
||||||
@@ -2030,15 +2062,24 @@ the "verilator" define for you, so just wrap the code in a ifndef region:
|
|||||||
|
|
||||||
=item Why do I get "unexpected `do'" or "unexpected `bit'" errors?
|
=item Why do I get "unexpected `do'" or "unexpected `bit'" errors?
|
||||||
|
|
||||||
Do, bit, ref, and other words are now SystemVerilog keywords. You should
|
Do, bit, ref, return, and other words are now SystemVerilog keywords. You
|
||||||
change your code to not use them to insure it works with newer tools.
|
should change your code to not use them to insure it works with newer
|
||||||
Alternatively, surround them by the Verilog 2005/SystemVerilog
|
tools. Alternatively, surround them by the Verilog 2005/SystemVerilog
|
||||||
begin_keywords pragma to indicate Verilog 2001 code.
|
begin_keywords pragma to indicate Verilog 2001 code.
|
||||||
|
|
||||||
`begin_keywords "1364-2001"
|
`begin_keywords "1364-2001"
|
||||||
integer bit; initial bit = 1;
|
integer bit; initial bit = 1;
|
||||||
`end_keywords
|
`end_keywords
|
||||||
|
|
||||||
|
If you want the whole file to be parsed as Verilog 2001, just create a
|
||||||
|
file with
|
||||||
|
|
||||||
|
`begin_keywords "1364-2001"
|
||||||
|
|
||||||
|
and add it before other Verilog files on the command line. (Note this will
|
||||||
|
also change the default for --prefix, so if you're not using --prefix, you
|
||||||
|
will now need to.)
|
||||||
|
|
||||||
=item How do I prevent my assertions from firing during reset?
|
=item How do I prevent my assertions from firing during reset?
|
||||||
|
|
||||||
Call Verilated::assertOn(false) before you first call the model, then turn
|
Call Verilated::assertOn(false) before you first call the model, then turn
|
||||||
@@ -2078,7 +2119,7 @@ use GCC 2.95, or GCC 3.4 you'll have faster builds. Two ways to cheat are
|
|||||||
to compile on parallel machines and avoid compilations altogether. See the
|
to compile on parallel machines and avoid compilations altogether. See the
|
||||||
--output-split option, and the web for the ccache, distcc and icecream
|
--output-split option, and the web for the ccache, distcc and icecream
|
||||||
packages, and the Make::Cache package available from
|
packages, and the Make::Cache package available from
|
||||||
L<http://www.veripool.com/>. Make::Cache will skip GCC runs between
|
L<http://www.veripool.org/>. Make::Cache will skip GCC runs between
|
||||||
identical source builds, even across different users.
|
identical source builds, even across different users.
|
||||||
|
|
||||||
=item Why do so many files need to recompile when I add a signal?
|
=item Why do so many files need to recompile when I add a signal?
|
||||||
@@ -2163,7 +2204,10 @@ outputs. Now, the following should fail:
|
|||||||
cd test_regress
|
cd test_regress
|
||||||
t/t_BUG.pl
|
t/t_BUG.pl
|
||||||
|
|
||||||
Finally, Mail the bug report to C<[email protected]>.
|
Finally, report the bug using the bug tracker at
|
||||||
|
L<http://www.veripool.org/verilator>. The bug will become publicly
|
||||||
|
visible; if this is unacceptable, mail the bug report to
|
||||||
|
C<[email protected]>.
|
||||||
|
|
||||||
=head1 HISTORY
|
=head1 HISTORY
|
||||||
|
|
||||||
@@ -2216,7 +2260,7 @@ Eugene Weber, Leon Wildman, and Mat Zeno.
|
|||||||
|
|
||||||
=head1 DISTRIBUTION
|
=head1 DISTRIBUTION
|
||||||
|
|
||||||
The latest version is available from L<http://www.veripool.com/>.
|
The latest version is available from L<http://www.veripool.org/>.
|
||||||
|
|
||||||
Copyright 2003-2008 by Wilson Snyder. Verilator is free software; you can
|
Copyright 2003-2008 by Wilson Snyder. Verilator is free software; you can
|
||||||
redistribute it and/or modify it under the terms of either the GNU Lesser
|
redistribute it and/or modify it under the terms of either the GNU Lesser
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
: # -*-Mode: perl;-*- use perl, wherever it is
|
: # -*-Mode: perl;-*- use perl, wherever it is
|
||||||
eval 'exec perl -wS $0 ${1+"$@"}'
|
eval 'exec perl -wS $0 ${1+"$@"}'
|
||||||
if 0;
|
if 0;
|
||||||
# $Id$
|
|
||||||
######################################################################
|
######################################################################
|
||||||
#
|
#
|
||||||
# Copyright 2005-2008 by Wilson Snyder <[email protected]>. This
|
# Copyright 2005-2008 by Wilson Snyder <[email protected]>. This
|
||||||
@@ -115,7 +114,6 @@ sub filter {
|
|||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
sub usage {
|
sub usage {
|
||||||
print '$Id$ ', "\n";
|
|
||||||
pod2usage(-verbose=>2, -exitval => 2);
|
pod2usage(-verbose=>2, -exitval => 2);
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
@@ -130,7 +128,7 @@ sub parameter {
|
|||||||
$Opt_A = $param;
|
$Opt_A = $param;
|
||||||
} elsif (!defined $Opt_B) {
|
} elsif (!defined $Opt_B) {
|
||||||
$Opt_B = $param;
|
$Opt_B = $param;
|
||||||
} else {
|
} else {
|
||||||
die "%Error: Unknown parameter: $param\n";
|
die "%Error: Unknown parameter: $param\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -178,7 +176,7 @@ Displays this message and program version and exits.
|
|||||||
|
|
||||||
=head1 DISTRIBUTION
|
=head1 DISTRIBUTION
|
||||||
|
|
||||||
The latest version is available from L<http://www.veripool.com/>.
|
The latest version is available from L<http://www.veripool.org/verilator>.
|
||||||
|
|
||||||
Copyright 2005-2008 by Wilson Snyder. This package is free software; you
|
Copyright 2005-2008 by Wilson Snyder. This package is free software; you
|
||||||
can redistribute it and/or modify it under the terms of either the GNU
|
can redistribute it and/or modify it under the terms of either the GNU
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
: # -*-Mode: perl;-*- use perl, wherever it is
|
: # -*-Mode: perl;-*- use perl, wherever it is
|
||||||
eval 'exec perl -wS $0 ${1+"$@"}'
|
eval 'exec perl -wS $0 ${1+"$@"}'
|
||||||
if 0;
|
if 0;
|
||||||
# $Id$
|
|
||||||
# DESCRIPTION: Print include statements for each ARGV
|
# DESCRIPTION: Print include statements for each ARGV
|
||||||
#
|
#
|
||||||
# Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
# Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
: # -*-Mode: perl;-*- use perl, wherever it is
|
: # -*-Mode: perl;-*- use perl, wherever it is
|
||||||
eval 'exec perl -wS $0 ${1+"$@"}'
|
eval 'exec perl -wS $0 ${1+"$@"}'
|
||||||
if 0;
|
if 0;
|
||||||
# $Id$
|
|
||||||
######################################################################
|
######################################################################
|
||||||
#
|
#
|
||||||
# Copyright 2007-2008 by Wilson Snyder <[email protected]>. This
|
# Copyright 2007-2008 by Wilson Snyder <[email protected]>. This
|
||||||
@@ -50,7 +49,6 @@ profcfunc($Opt_File);
|
|||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
sub usage {
|
sub usage {
|
||||||
print '$Id$ ', "\n";
|
|
||||||
pod2usage(-verbose=>2, -exitval => 2);
|
pod2usage(-verbose=>2, -exitval => 2);
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
@@ -63,7 +61,7 @@ sub parameter {
|
|||||||
my $param = shift;
|
my $param = shift;
|
||||||
if (!defined $Opt_File) {
|
if (!defined $Opt_File) {
|
||||||
$Opt_File = $param;
|
$Opt_File = $param;
|
||||||
} else {
|
} else {
|
||||||
die "%Error: Unknown parameter: $param\n";
|
die "%Error: Unknown parameter: $param\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -189,7 +187,7 @@ Displays this message and program version and exits.
|
|||||||
|
|
||||||
=head1 DISTRIBUTION
|
=head1 DISTRIBUTION
|
||||||
|
|
||||||
The latest version is available from L<http://www.veripool.com/>.
|
The latest version is available from L<http://www.veripool.org/>.
|
||||||
|
|
||||||
Copyright 2007-2008 by Wilson Snyder. This package is free software; you
|
Copyright 2007-2008 by Wilson Snyder. This package is free software; you
|
||||||
can redistribute it and/or modify it under the terms of either the GNU
|
can redistribute it and/or modify it under the terms of either the GNU
|
||||||
|
|||||||
+19
-3
@@ -1,20 +1,36 @@
|
|||||||
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-2008 by Wilson Snyder. This program is free software; you can
|
dnl Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
dnl redistribute it and/or modify it under the terms of either the GNU
|
dnl redistribute it and/or modify it under the terms of either the GNU
|
||||||
dnl General Public License or the Perl Artistic License.
|
dnl General Public License or the Perl Artistic License.
|
||||||
|
|
||||||
AC_REVISION($Revision$)dnl
|
|
||||||
AC_INIT(src/Verilator.cpp)
|
AC_INIT(src/Verilator.cpp)
|
||||||
AC_CONFIG_HEADER(src/config_build.h)
|
AC_CONFIG_HEADER(src/config_build.h)
|
||||||
|
|
||||||
dnl Special Substitutions
|
dnl Special Substitutions
|
||||||
|
AC_ARG_ENABLE(defenv,
|
||||||
|
[AS_HELP_STRING([--disable-defenv], [disable hardcoded default environment variables])],
|
||||||
|
CFG_WITH_DEFENV=$enableval,
|
||||||
|
CFG_WITH_DEFENV=yes)
|
||||||
|
AC_SUBST(CFG_WITH_DEFENV)
|
||||||
|
|
||||||
|
dnl Compiler flags
|
||||||
|
CXX=g++
|
||||||
|
CFLAGS=-I${includedir}
|
||||||
|
CPPFLAGS=-I${includedir}
|
||||||
|
CXXFLAGS=-I${includedir}
|
||||||
|
LDFLAGS=-L${libdir}
|
||||||
|
|
||||||
dnl Checks for programs.
|
dnl Checks for programs.
|
||||||
CXX=g++
|
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
AC_PROG_CXX
|
AC_PROG_CXX
|
||||||
AC_PROG_INSTALL
|
AC_PROG_INSTALL
|
||||||
|
|
||||||
|
AC_LANG_PUSH(C++)
|
||||||
|
AC_MSG_CHECKING([that C++ compiler can compile simple program])
|
||||||
|
AC_TRY_RUN([int main() { return 0; }],
|
||||||
|
AC_MSG_RESULT(yes),
|
||||||
|
AC_MSG_RESULT(no);AC_MSG_ERROR([a working C++ compiler is required]))
|
||||||
|
|
||||||
AC_PATH_PROG(PERL,perl)
|
AC_PATH_PROG(PERL,perl)
|
||||||
if test "x$PERL" = "x" ; then
|
if test "x$PERL" = "x" ; then
|
||||||
AC_MSG_ERROR([Cannot find "perl" in your PATH, please install it])
|
AC_MSG_ERROR([Cannot find "perl" in your PATH, please install it])
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// $Id$ -*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
//=========================================================================
|
//=========================================================================
|
||||||
///
|
///
|
||||||
/// \file
|
/// \file
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
/// This file must be compiled and linked against all objects
|
/// This file must be compiled and linked against all objects
|
||||||
/// created from Verilator.
|
/// created from Verilator.
|
||||||
///
|
///
|
||||||
/// Code available from: http://www.veripool.com/verilator
|
/// Code available from: http://www.veripool.org/verilator
|
||||||
///
|
///
|
||||||
//=========================================================================
|
//=========================================================================
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ IData VL_RAND_RESET_I(int outBits) {
|
|||||||
if (Verilated::randReset()!=1) { // if 2, randomize
|
if (Verilated::randReset()!=1) { // if 2, randomize
|
||||||
data = VL_RAND32();
|
data = VL_RAND32();
|
||||||
}
|
}
|
||||||
if (outBits<32) data &= VL_MASK_I(outBits);
|
if (outBits<32) data &= VL_MASK_I(outBits);
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ QData VL_RAND_RESET_Q(int outBits) {
|
|||||||
if (Verilated::randReset()!=1) { // if 2, randomize
|
if (Verilated::randReset()!=1) { // if 2, randomize
|
||||||
data = ((QData)VL_RAND32()<<VL_ULL(32)) | (QData)VL_RAND32();
|
data = ((QData)VL_RAND32()<<VL_ULL(32)) | (QData)VL_RAND32();
|
||||||
}
|
}
|
||||||
if (outBits<64) data &= VL_MASK_Q(outBits);
|
if (outBits<64) data &= VL_MASK_Q(outBits);
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,7 +276,7 @@ void VL_READMEM_W(bool hex, int width, int depth, int array_lsb, int fnwords,
|
|||||||
else if (c=='\t' || c==' ' || c=='\r' || c=='\f') { 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
|
// Skip // comments and detect /* comments
|
||||||
else if (ignore_to_cmt && lastc=='*' && c=='/') {
|
else if (ignore_to_cmt && lastc=='*' && c=='/') {
|
||||||
ignore_to_cmt = false; if (innum) reading_addr=false; innum=false;
|
ignore_to_cmt = false; if (innum) reading_addr=false; innum=false;
|
||||||
} else if (!ignore_to_eol && !ignore_to_cmt) {
|
} else if (!ignore_to_eol && !ignore_to_cmt) {
|
||||||
if (lastc=='/' && c=='*') { ignore_to_cmt = true; }
|
if (lastc=='/' && c=='*') { ignore_to_cmt = true; }
|
||||||
else if (lastc=='/' && c=='/') { ignore_to_eol = true; }
|
else if (lastc=='/' && c=='/') { ignore_to_eol = true; }
|
||||||
@@ -355,7 +355,7 @@ const char* Verilated::catName(const char* n1, const char* n2) {
|
|||||||
// Used by symbol table creation to make module names
|
// Used by symbol table creation to make module names
|
||||||
static char* strp = NULL;
|
static char* strp = NULL;
|
||||||
static int len = -1;
|
static int len = -1;
|
||||||
int newlen = strlen(n1)+strlen(n2)+2;
|
int newlen = strlen(n1)+strlen(n2)+2;
|
||||||
if (newlen > len) {
|
if (newlen > len) {
|
||||||
if (strp) delete [] strp;
|
if (strp) delete [] strp;
|
||||||
strp = new char[newlen];
|
strp = new char[newlen];
|
||||||
|
|||||||
+81
-32
@@ -1,4 +1,4 @@
|
|||||||
// $Id$ -*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
///
|
///
|
||||||
/// \file
|
/// \file
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
/// all C++ files it generates. It contains standard macros and
|
/// all C++ files it generates. It contains standard macros and
|
||||||
/// classes required by the Verilated code.
|
/// classes required by the Verilated code.
|
||||||
///
|
///
|
||||||
/// Code available from: http://www.veripool.com/verilator
|
/// Code available from: http://www.veripool.org/verilator
|
||||||
///
|
///
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
@@ -129,7 +129,7 @@ struct Verilated {
|
|||||||
// Extern Vars
|
// Extern Vars
|
||||||
// Below two are used as bool, but having as uint32_t avoids conversion time
|
// Below two are used as bool, but having as uint32_t avoids conversion time
|
||||||
private:
|
private:
|
||||||
static int s_randReset; ///< Random reset: 0=all 0s, 1=all 1s, 2=random
|
static int s_randReset; ///< Random reset: 0=all 0s, 1=all 1s, 2=random
|
||||||
static int s_debug; ///< See accessors... only when VL_DEBUG set
|
static int s_debug; ///< See accessors... only when VL_DEBUG set
|
||||||
static bool s_calcUnusedSigs; ///< Waves file on, need all signals calculated
|
static bool s_calcUnusedSigs; ///< Waves file on, need all signals calculated
|
||||||
static bool s_gotFinish; ///< A $finish statement executed
|
static bool s_gotFinish; ///< A $finish statement executed
|
||||||
@@ -152,7 +152,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
/// Internal: Create a new module name by concatenating two strings
|
/// Internal: Create a new module name by concatenating two strings
|
||||||
static const char* catName(const char* n1, const char* n2); // Returns new'ed data
|
static const char* catName(const char* n1, const char* n2); // Returns new'ed data
|
||||||
/// Enable calculation of unused signals
|
/// Enable calculation of unused signals
|
||||||
static void calcUnusedSigs(bool flag) { s_calcUnusedSigs=flag; }
|
static void calcUnusedSigs(bool flag) { s_calcUnusedSigs=flag; }
|
||||||
static bool calcUnusedSigs() { return s_calcUnusedSigs; } ///< Return calcUnusedSigs value
|
static bool calcUnusedSigs() { return s_calcUnusedSigs; } ///< Return calcUnusedSigs value
|
||||||
/// Did the simulation $finish?
|
/// Did the simulation $finish?
|
||||||
@@ -165,7 +165,7 @@ public:
|
|||||||
/// Enable/disable assertions
|
/// Enable/disable assertions
|
||||||
static void assertOn(bool flag) { s_assertOn=flag; }
|
static void assertOn(bool flag) { s_assertOn=flag; }
|
||||||
static bool assertOn() { return s_assertOn; }
|
static bool assertOn() { return s_assertOn; }
|
||||||
};
|
};
|
||||||
|
|
||||||
//=========================================================================
|
//=========================================================================
|
||||||
// Extern functions -- User may override -- See verilated.cpp
|
// Extern functions -- User may override -- See verilated.cpp
|
||||||
@@ -236,7 +236,7 @@ static inline QData VL_EXTENDSIGN_Q(int lbits, QData lhs) { return (-((lhs)&(VL
|
|||||||
|
|
||||||
// Debugging prints
|
// Debugging prints
|
||||||
static inline void _VL_DEBUG_PRINT_W(int lbits, WDataInP iwp) {
|
static inline void _VL_DEBUG_PRINT_W(int lbits, WDataInP iwp) {
|
||||||
printf(" Data: w%d: ", lbits);
|
printf(" Data: w%d: ", lbits);
|
||||||
for (int i=VL_WORDS_I(lbits)-1; i>=0; i--) { printf("%08x ",iwp[i]); }
|
for (int i=VL_WORDS_I(lbits)-1; i>=0; i--) { printf("%08x ",iwp[i]); }
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
@@ -460,43 +460,92 @@ static inline IData VL_REDOR_W(int words, WDataInP lwp) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// EMIT_RULE: VL_REDXOR: oclean=dirty; obits=1;
|
// EMIT_RULE: VL_REDXOR: oclean=dirty; obits=1;
|
||||||
static inline IData VL_REDXOR_W(int words, WDataInP lwp) {
|
|
||||||
IData r = lwp[0];
|
|
||||||
for (int i=1; i < words; i++) r ^= lwp[i];
|
|
||||||
r=(r^(r>>1));
|
|
||||||
r=(r^(r>>2));
|
|
||||||
r=(r^(r>>4));
|
|
||||||
r=(r^(r>>8));
|
|
||||||
r=(r^(r>>16));
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
static inline IData VL_REDXOR_2(IData r) {
|
static inline IData VL_REDXOR_2(IData r) {
|
||||||
|
// Experiments show VL_REDXOR_2 is faster than __builtin_parityl
|
||||||
r=(r^(r>>1));
|
r=(r^(r>>1));
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
static inline IData VL_REDXOR_4(IData r) {
|
static inline IData VL_REDXOR_4(IData r) {
|
||||||
|
#if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(VL_NO_BUILTINS)
|
||||||
|
return __builtin_parityl(r);
|
||||||
|
#else
|
||||||
r=(r^(r>>1)); r=(r^(r>>2));
|
r=(r^(r>>1)); r=(r^(r>>2));
|
||||||
return r;
|
return r;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
static inline IData VL_REDXOR_8(IData r) {
|
static inline IData VL_REDXOR_8(IData r) {
|
||||||
|
#if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(VL_NO_BUILTINS)
|
||||||
|
return __builtin_parityl(r);
|
||||||
|
#else
|
||||||
r=(r^(r>>1)); r=(r^(r>>2)); r=(r^(r>>4));
|
r=(r^(r>>1)); r=(r^(r>>2)); r=(r^(r>>4));
|
||||||
return r;
|
return r;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
static inline IData VL_REDXOR_16(IData r) {
|
static inline IData VL_REDXOR_16(IData r) {
|
||||||
|
#if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(VL_NO_BUILTINS)
|
||||||
|
return __builtin_parityl(r);
|
||||||
|
#else
|
||||||
r=(r^(r>>1)); r=(r^(r>>2)); r=(r^(r>>4)); r=(r^(r>>8));
|
r=(r^(r>>1)); r=(r^(r>>2)); r=(r^(r>>4)); r=(r^(r>>8));
|
||||||
return r;
|
return r;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
static inline IData VL_REDXOR_32(IData r) {
|
static inline IData VL_REDXOR_32(IData r) {
|
||||||
|
#if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(VL_NO_BUILTINS)
|
||||||
|
return __builtin_parityl(r);
|
||||||
|
#else
|
||||||
r=(r^(r>>1)); r=(r^(r>>2)); r=(r^(r>>4)); r=(r^(r>>8)); r=(r^(r>>16));
|
r=(r^(r>>1)); r=(r^(r>>2)); r=(r^(r>>4)); r=(r^(r>>8)); r=(r^(r>>16));
|
||||||
return r;
|
return r;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
static inline IData VL_REDXOR_64(QData r) {
|
static inline IData VL_REDXOR_64(QData r) {
|
||||||
|
#if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(VL_NO_BUILTINS)
|
||||||
|
return __builtin_parityll(r);
|
||||||
|
#else
|
||||||
r=(r^(r>>1)); r=(r^(r>>2)); r=(r^(r>>4)); r=(r^(r>>8)); r=(r^(r>>16)); r=(r^(r>>32));
|
r=(r^(r>>1)); r=(r^(r>>2)); r=(r^(r>>4)); r=(r^(r>>8)); r=(r^(r>>16)); r=(r^(r>>32));
|
||||||
return r;
|
return r;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
static inline IData VL_REDXOR_W(int words, WDataInP lwp) {
|
||||||
|
IData r = lwp[0];
|
||||||
|
for (int i=1; i < words; i++) r ^= lwp[i];
|
||||||
|
return VL_REDXOR_32(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline IData VL_CLOG2_I(IData lhs) {
|
||||||
|
// Perhaps can do better using fls GCC4 builtins
|
||||||
|
int n=1;
|
||||||
|
IData chk;
|
||||||
|
if (!lhs) return 0;
|
||||||
|
chk = lhs >> VL_UL(16); if (chk) { n += 16; lhs = chk; }
|
||||||
|
chk = lhs >> VL_UL(8); if (chk) { n += 8; lhs = chk; }
|
||||||
|
chk = lhs >> VL_UL(4); if (chk) { n += 4; lhs = chk; }
|
||||||
|
chk = lhs >> VL_UL(2); if (chk) { n += 2; lhs = chk; }
|
||||||
|
chk = lhs >> VL_UL(1); if (chk) { n += 1; lhs = chk; }
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
static inline IData VL_CLOG2_Q(QData lhs) {
|
||||||
|
// Perhaps can do better using fls GCC4 builtins
|
||||||
|
int n=1;
|
||||||
|
QData chk;
|
||||||
|
if (!lhs) return 0;
|
||||||
|
chk = lhs >> VL_ULL(32); if (chk) { n += 32; lhs = chk; }
|
||||||
|
chk = lhs >> VL_ULL(16); if (chk) { n += 16; lhs = chk; }
|
||||||
|
chk = lhs >> VL_ULL(8); if (chk) { n += 8; lhs = chk; }
|
||||||
|
chk = lhs >> VL_ULL(4); if (chk) { n += 4; lhs = chk; }
|
||||||
|
chk = lhs >> VL_ULL(2); if (chk) { n += 2; lhs = chk; }
|
||||||
|
chk = lhs >> VL_ULL(1); if (chk) { n += 1; lhs = chk; }
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
static inline IData VL_CLOG2_W(int words, WDataInP lwp) {
|
||||||
|
for (int i=words-1; i>=0; i--) {
|
||||||
|
if (lwp[i]) return VL_CLOG2_I(lwp[i])+i*VL_WORDSIZE;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// EMIT_RULE: VL_COUNTONES_II: oclean = false; lhs clean
|
// EMIT_RULE: VL_COUNTONES_II: oclean = false; lhs clean
|
||||||
static inline IData VL_COUNTONES_I(IData lhs) {
|
static inline IData VL_COUNTONES_I(IData lhs) {
|
||||||
|
// This is faster than __builtin_popcountl
|
||||||
IData r = lhs - ((lhs >> 1) & 033333333333) - ((lhs >> 2) & 011111111111);
|
IData r = lhs - ((lhs >> 1) & 033333333333) - ((lhs >> 2) & 011111111111);
|
||||||
r = (r + (r>>3)) & 030707070707;
|
r = (r + (r>>3)) & 030707070707;
|
||||||
r = (r + (r>>6));
|
r = (r + (r>>6));
|
||||||
@@ -829,7 +878,7 @@ static inline IData VL_POW_III(int, int, int rbits, IData lhs, IData rhs) {
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define VL_POW_QQI(obits,lbits,rbits,lhs,rhs) VL_POW_QQQ(obits,lbits,rbits,lhs,rhs)
|
#define VL_POW_QQI(obits,lbits,rbits,lhs,rhs) VL_POW_QQQ(obits,lbits,rbits,lhs,rhs)
|
||||||
|
|
||||||
static inline QData VL_POW_QQQ(int, int, int rbits, QData lhs, QData rhs) {
|
static inline QData VL_POW_QQQ(int, int, int rbits, QData lhs, QData rhs) {
|
||||||
if (lhs==0) return 0;
|
if (lhs==0) return 0;
|
||||||
@@ -847,23 +896,23 @@ static inline QData VL_POW_QQQ(int, int, int rbits, QData lhs, QData rhs) {
|
|||||||
|
|
||||||
// INTERNAL: Stuff LHS bit 0++ into OUTPUT at specified offset
|
// INTERNAL: Stuff LHS bit 0++ into OUTPUT at specified offset
|
||||||
// ld may be "dirty", output is clean
|
// ld may be "dirty", output is clean
|
||||||
static inline void _VL_INSERT_II(int, CData& lhsr, IData ld, int hbit, int lbit) {
|
static inline void _VL_INSERT_II(int, CData& lhsr, IData ld, int hbit, int lbit) {
|
||||||
IData insmask = (VL_MASK_I(hbit-lbit+1))<<lbit;
|
IData insmask = (VL_MASK_I(hbit-lbit+1))<<lbit;
|
||||||
lhsr = (lhsr & ~insmask) | ((ld<<lbit) & insmask);
|
lhsr = (lhsr & ~insmask) | ((ld<<lbit) & insmask);
|
||||||
}
|
}
|
||||||
static inline void _VL_INSERT_II(int, SData& lhsr, IData ld, int hbit, int lbit) {
|
static inline void _VL_INSERT_II(int, SData& lhsr, IData ld, int hbit, int lbit) {
|
||||||
IData insmask = (VL_MASK_I(hbit-lbit+1))<<lbit;
|
IData insmask = (VL_MASK_I(hbit-lbit+1))<<lbit;
|
||||||
lhsr = (lhsr & ~insmask) | ((ld<<lbit) & insmask);
|
lhsr = (lhsr & ~insmask) | ((ld<<lbit) & insmask);
|
||||||
}
|
}
|
||||||
static inline void _VL_INSERT_II(int, IData& lhsr, IData ld, int hbit, int lbit) {
|
static inline void _VL_INSERT_II(int, IData& lhsr, IData ld, int hbit, int lbit) {
|
||||||
IData insmask = (VL_MASK_I(hbit-lbit+1))<<lbit;
|
IData insmask = (VL_MASK_I(hbit-lbit+1))<<lbit;
|
||||||
lhsr = (lhsr & ~insmask) | ((ld<<lbit) & insmask);
|
lhsr = (lhsr & ~insmask) | ((ld<<lbit) & insmask);
|
||||||
}
|
}
|
||||||
static inline void _VL_INSERT_QQ(int, QData& lhsr, QData ld, int hbit, int lbit) {
|
static inline void _VL_INSERT_QQ(int, QData& lhsr, QData ld, int hbit, int lbit) {
|
||||||
QData insmask = (VL_MASK_Q(hbit-lbit+1))<<lbit;
|
QData insmask = (VL_MASK_Q(hbit-lbit+1))<<lbit;
|
||||||
lhsr = (lhsr & ~insmask) | ((ld<<lbit) & insmask);
|
lhsr = (lhsr & ~insmask) | ((ld<<lbit) & insmask);
|
||||||
}
|
}
|
||||||
static inline void _VL_INSERT_WI(int, WDataOutP owp, IData ld, int hbit, int lbit) {
|
static inline void _VL_INSERT_WI(int, WDataOutP owp, IData ld, int hbit, int lbit) {
|
||||||
int hoffset = VL_BITBIT_I(hbit);
|
int hoffset = VL_BITBIT_I(hbit);
|
||||||
int loffset = VL_BITBIT_I(lbit);
|
int loffset = VL_BITBIT_I(lbit);
|
||||||
if (hoffset==VL_SIZEBITS_I && loffset==0) {
|
if (hoffset==VL_SIZEBITS_I && loffset==0) {
|
||||||
@@ -888,7 +937,7 @@ static inline void _VL_INSERT_WI(int, WDataOutP owp, IData ld, int hbit, int lbi
|
|||||||
|
|
||||||
// INTERNAL: Stuff large LHS bit 0++ into OUTPUT at specified offset
|
// INTERNAL: Stuff large LHS bit 0++ into OUTPUT at specified offset
|
||||||
// lwp may be "dirty"
|
// lwp may be "dirty"
|
||||||
static inline void _VL_INSERT_WW(int, WDataOutP owp, WDataInP lwp, int hbit, int lbit) {
|
static inline void _VL_INSERT_WW(int, WDataOutP owp, WDataInP lwp, int hbit, int lbit) {
|
||||||
int hoffset = hbit & VL_SIZEBITS_I;
|
int hoffset = hbit & VL_SIZEBITS_I;
|
||||||
int loffset = lbit & VL_SIZEBITS_I;
|
int loffset = lbit & VL_SIZEBITS_I;
|
||||||
int lword = VL_BITWORD_I(lbit);
|
int lword = VL_BITWORD_I(lbit);
|
||||||
@@ -934,7 +983,7 @@ static inline void _VL_INSERT_WW(int, WDataOutP owp, WDataInP lwp, int hbit, int
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void _VL_INSERT_WQ(int obits, WDataOutP owp, QData ld, int hbit, int lbit) {
|
static inline void _VL_INSERT_WQ(int obits, WDataOutP owp, QData ld, int hbit, int lbit) {
|
||||||
WData lwp[2]; VL_SET_WQ(lwp,ld);
|
WData lwp[2]; VL_SET_WQ(lwp,ld);
|
||||||
_VL_INSERT_WW(obits,owp,lwp,hbit,lbit);
|
_VL_INSERT_WW(obits,owp,lwp,hbit,lbit);
|
||||||
}
|
}
|
||||||
@@ -1214,7 +1263,7 @@ static inline QData VL_SEL_QWII(int, int lbits, int, int, WDataInP lwp, IData ls
|
|||||||
static inline WDataOutP VL_SEL_WWII(int obits,int lbits,int,int,WDataOutP owp,WDataInP lwp, IData lsb, IData width) {
|
static inline WDataOutP VL_SEL_WWII(int obits,int lbits,int,int,WDataOutP owp,WDataInP lwp, IData lsb, IData width) {
|
||||||
int msb = lsb+width-1;
|
int msb = lsb+width-1;
|
||||||
int word_shift = VL_BITWORD_I(lsb);
|
int word_shift = VL_BITWORD_I(lsb);
|
||||||
if (msb>lbits) { // Outside bounds,
|
if (msb>lbits) { // Outside bounds,
|
||||||
for (int i=0; i<VL_WORDS_I(obits)-1; i++) owp[i] = ~0;
|
for (int i=0; i<VL_WORDS_I(obits)-1; i++) owp[i] = ~0;
|
||||||
owp[VL_WORDS_I(obits)-1] = VL_MASK_I(obits);
|
owp[VL_WORDS_I(obits)-1] = VL_MASK_I(obits);
|
||||||
} else if (VL_BITBIT_I(lsb)==0) {
|
} else if (VL_BITBIT_I(lsb)==0) {
|
||||||
@@ -1311,32 +1360,32 @@ static inline WDataOutP VL_CONST_W_3X(int obits, WDataOutP o,
|
|||||||
o[0]=d0; o[1]=d1; o[2]=d2;
|
o[0]=d0; o[1]=d1; o[2]=d2;
|
||||||
_END(obits,3); }
|
_END(obits,3); }
|
||||||
#define VL_HAVE_CONST_W_4X
|
#define VL_HAVE_CONST_W_4X
|
||||||
static inline WDataOutP VL_CONST_W_4X(int obits, WDataOutP o,
|
static inline WDataOutP VL_CONST_W_4X(int obits, WDataOutP o,
|
||||||
I d3,I d2,I d1,I d0) {
|
I d3,I d2,I d1,I d0) {
|
||||||
o[0]=d0; o[1]=d1; o[2]=d2; o[3]=d3;
|
o[0]=d0; o[1]=d1; o[2]=d2; o[3]=d3;
|
||||||
_END(obits,4); }
|
_END(obits,4); }
|
||||||
#define VL_HAVE_CONST_W_5X
|
#define VL_HAVE_CONST_W_5X
|
||||||
static inline WDataOutP VL_CONST_W_5X(int obits, WDataOutP o,
|
static inline WDataOutP VL_CONST_W_5X(int obits, WDataOutP o,
|
||||||
I d4,I d3,I d2,I d1,I d0) {
|
I d4,I d3,I d2,I d1,I d0) {
|
||||||
o[0]=d0; o[1]=d1; o[2]=d2; o[3]=d3; o[4]=d4;
|
o[0]=d0; o[1]=d1; o[2]=d2; o[3]=d3; o[4]=d4;
|
||||||
_END(obits,5); }
|
_END(obits,5); }
|
||||||
#define VL_HAVE_CONST_W_6X
|
#define VL_HAVE_CONST_W_6X
|
||||||
static inline WDataOutP VL_CONST_W_6X(int obits, WDataOutP o,
|
static inline WDataOutP VL_CONST_W_6X(int obits, WDataOutP o,
|
||||||
I d5,I d4,I d3,I d2,I d1,I d0) {
|
I d5,I d4,I d3,I d2,I d1,I d0) {
|
||||||
o[0]=d0; o[1]=d1; o[2]=d2; o[3]=d3; o[4]=d4; o[5]=d5;
|
o[0]=d0; o[1]=d1; o[2]=d2; o[3]=d3; o[4]=d4; o[5]=d5;
|
||||||
_END(obits,6); }
|
_END(obits,6); }
|
||||||
#define VL_HAVE_CONST_W_7X
|
#define VL_HAVE_CONST_W_7X
|
||||||
static inline WDataOutP VL_CONST_W_7X(int obits, WDataOutP o,
|
static inline WDataOutP VL_CONST_W_7X(int obits, WDataOutP o,
|
||||||
I d6,I d5,I d4,I d3,I d2,I d1,I d0) {
|
I d6,I d5,I d4,I d3,I d2,I d1,I d0) {
|
||||||
o[0]=d0; o[1]=d1; o[2]=d2; o[3]=d3; o[4]=d4; o[5]=d5; o[6]=d6;
|
o[0]=d0; o[1]=d1; o[2]=d2; o[3]=d3; o[4]=d4; o[5]=d5; o[6]=d6;
|
||||||
_END(obits,7); }
|
_END(obits,7); }
|
||||||
#define VL_HAVE_CONST_W_8X
|
#define VL_HAVE_CONST_W_8X
|
||||||
static inline WDataOutP VL_CONST_W_8X(int obits, WDataOutP o,
|
static inline WDataOutP VL_CONST_W_8X(int obits, WDataOutP o,
|
||||||
I d7,I d6,I d5,I d4,I d3,I d2,I d1,I d0) {
|
I d7,I d6,I d5,I d4,I d3,I d2,I d1,I d0) {
|
||||||
o[0]=d0; o[1]=d1; o[2]=d2; o[3]=d3; o[4]=d4; o[5]=d5; o[6]=d6; o[7]=d7;
|
o[0]=d0; o[1]=d1; o[2]=d2; o[3]=d3; o[4]=d4; o[5]=d5; o[6]=d6; o[7]=d7;
|
||||||
_END(obits,8); }
|
_END(obits,8); }
|
||||||
#define VL_HAVE_CONST_W_9X
|
#define VL_HAVE_CONST_W_9X
|
||||||
static inline WDataOutP VL_CONST_W_9X(int obits, WDataOutP o,
|
static inline WDataOutP VL_CONST_W_9X(int obits, WDataOutP o,
|
||||||
I d8,
|
I d8,
|
||||||
I d7,I d6,I d5,I d4,I d3,I d2,I d1,I d0) {
|
I d7,I d6,I d5,I d4,I d3,I d2,I d1,I d0) {
|
||||||
o[0]=d0; o[1]=d1; o[2]=d2; o[3]=d3; o[4]=d4; o[5]=d5; o[6]=d6; o[7]=d7;
|
o[0]=d0; o[1]=d1; o[2]=d2; o[3]=d3; o[4]=d4; o[5]=d5; o[6]=d6; o[7]=d7;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# $Id$ -*- Makefile -*-
|
# -*- Makefile -*-
|
||||||
######################################################################
|
######################################################################
|
||||||
# DESCRIPTION: Makefile commands for all verilated target files
|
# DESCRIPTION: Makefile commands for all verilated target files
|
||||||
#
|
#
|
||||||
@@ -44,7 +44,7 @@ CPPFLAGS += -I. $(VK_CPPFLAGS_ALWAYS) $(VK_CPPFLAGS_WALL)
|
|||||||
VPATH += ..
|
VPATH += ..
|
||||||
VPATH += $(VERILATOR_ROOT)/include
|
VPATH += $(VERILATOR_ROOT)/include
|
||||||
|
|
||||||
#OPT = -ggdb -DPRINTINITSTR -DDETECTCHANGE
|
#OPT = -ggdb -DPRINTINITSTR -DDETECTCHANGE
|
||||||
#OPT = -ggdb -DPRINTINITSTR
|
#OPT = -ggdb -DPRINTINITSTR
|
||||||
CPPFLAGS += $(OPT)
|
CPPFLAGS += $(OPT)
|
||||||
|
|
||||||
@@ -59,11 +59,11 @@ LDFLAGS += $(USER_LDFLAGS)
|
|||||||
# 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.
|
||||||
#OPT_SLOW =
|
#OPT_SLOW =
|
||||||
# Fast path optimizations. Most time is spent in these classes.
|
# Fast path optimizations. Most time is spent in these classes.
|
||||||
#OPT_FAST = -O2 -fstrict-aliasing
|
#OPT_FAST = -O2 -fstrict-aliasing
|
||||||
#OPT_FAST = -O
|
#OPT_FAST = -O
|
||||||
#OPT_FAST =
|
#OPT_FAST =
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
##### Aggregates
|
##### Aggregates
|
||||||
|
|||||||
+4
-4
@@ -1,7 +1,7 @@
|
|||||||
// $Id$ -*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
//=========================================================================
|
//=========================================================================
|
||||||
//
|
//
|
||||||
// DESCRIPTION: Verilator: Include in verilog files to hide verilator defines
|
// DESCRIPTION: Verilator: Include in verilog files to hide verilator defines
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
`ifdef verilator `else
|
`ifdef verilator `else
|
||||||
`define coverage_block_off
|
`define coverage_block_off
|
||||||
`endif
|
`endif
|
||||||
|
|
||||||
// Hide file descriptor difference
|
// Hide file descriptor difference
|
||||||
`ifdef verilator
|
`ifdef verilator
|
||||||
`define verilator_file_descriptor reg [63:0]
|
`define verilator_file_descriptor reg [63:0]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// $Id$ -*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
///
|
///
|
||||||
/// \file
|
/// \file
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
/// config_build.h.in, code needed by Verilated code only 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).
|
/// 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.org/verilator
|
||||||
///
|
///
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ typedef unsigned char vluint8_t; ///< 8-bit unsigned type
|
|||||||
typedef unsigned short int vluint16_t; ///< 16-bit unsigned type
|
typedef unsigned short int vluint16_t; ///< 16-bit unsigned type
|
||||||
typedef long vlsint32_t; ///< 32-bit signed type
|
typedef long vlsint32_t; ///< 32-bit signed type
|
||||||
typedef unsigned long vluint32_t; ///< 32-bit unsigned type
|
typedef unsigned long vluint32_t; ///< 32-bit unsigned type
|
||||||
typedef long long vlsint64_t; ///< 64-bit signed type
|
typedef long long vlsint64_t; ///< 64-bit signed type
|
||||||
typedef unsigned long long vluint64_t; ///< 64-bit unsigned type
|
typedef unsigned long long vluint64_t; ///< 64-bit unsigned type
|
||||||
#elif defined(_WIN32) && !defined(__MINGW32__)
|
#elif defined(_WIN32) && !defined(__MINGW32__)
|
||||||
typedef unsigned char uint8_t; ///< 8-bit unsigned type (backward compatibility)
|
typedef unsigned char uint8_t; ///< 8-bit unsigned type (backward compatibility)
|
||||||
@@ -92,18 +92,18 @@ typedef unsigned short int uint16_t; ///< 16-bit unsigned type (backward co
|
|||||||
typedef unsigned long uint32_t; ///< 32-bit unsigned type (backward compatibility)
|
typedef unsigned long uint32_t; ///< 32-bit unsigned type (backward compatibility)
|
||||||
typedef unsigned char vluint8_t; ///< 8-bit unsigned type
|
typedef unsigned char vluint8_t; ///< 8-bit unsigned type
|
||||||
typedef unsigned short int vluint16_t; ///< 16-bit unsigned type
|
typedef unsigned short int vluint16_t; ///< 16-bit unsigned type
|
||||||
typedef int vlsint32_t; ///< 32-bit signed type
|
typedef int vlsint32_t; ///< 32-bit signed type
|
||||||
typedef unsigned int vluint32_t; ///< 32-bit unsigned type
|
typedef unsigned int vluint32_t; ///< 32-bit unsigned type
|
||||||
typedef __int64 vlsint64_t; ///< 64-bit signed type
|
typedef __int64 vlsint64_t; ///< 64-bit signed type
|
||||||
typedef unsigned __int64 vluint64_t; ///< 64-bit unsigned type
|
typedef unsigned __int64 vluint64_t; ///< 64-bit unsigned type
|
||||||
#else // Linux or compliant Unix flavors, -m64
|
#else // Linux or compliant Unix flavors, -m64
|
||||||
# include <stdint.h> // Linux and most flavors
|
# include <stdint.h> // Linux and most flavors
|
||||||
# include <inttypes.h> // Solaris
|
# include <inttypes.h> // Solaris
|
||||||
typedef uint8_t vluint8_t; ///< 32-bit unsigned type
|
typedef uint8_t vluint8_t; ///< 32-bit unsigned type
|
||||||
typedef uint16_t vluint16_t; ///< 32-bit unsigned type
|
typedef uint16_t vluint16_t; ///< 32-bit unsigned type
|
||||||
typedef int vlsint32_t; ///< 32-bit signed type
|
typedef int vlsint32_t; ///< 32-bit signed type
|
||||||
typedef uint32_t vluint32_t; ///< 32-bit signed type
|
typedef uint32_t vluint32_t; ///< 32-bit signed type
|
||||||
typedef long long vlsint64_t; ///< 64-bit signed type
|
typedef long long vlsint64_t; ///< 64-bit signed type
|
||||||
typedef unsigned long long vluint64_t; ///< 64-bit unsigned type
|
typedef unsigned long long vluint64_t; ///< 64-bit unsigned type
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -115,7 +115,7 @@ fi
|
|||||||
if [ x"$dir_arg" != x ]; then
|
if [ x"$dir_arg" != x ]; then
|
||||||
dst=$src
|
dst=$src
|
||||||
src=""
|
src=""
|
||||||
|
|
||||||
if [ -d $dst ]; then
|
if [ -d $dst ]; then
|
||||||
instcmd=:
|
instcmd=:
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
# Created: 1993-05-16
|
# Created: 1993-05-16
|
||||||
# Public domain
|
# Public domain
|
||||||
|
|
||||||
# $Id:$
|
|
||||||
|
|
||||||
errstatus=0
|
errstatus=0
|
||||||
|
|
||||||
for file
|
for file
|
||||||
|
|||||||
+3
-4
@@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/perl -w
|
#!/usr/bin/perl -w
|
||||||
#$Id$
|
|
||||||
######################################################################
|
######################################################################
|
||||||
#
|
#
|
||||||
# Copyright 2007-2008 by Wilson Snyder.
|
# Copyright 2007-2008 by Wilson Snyder.
|
||||||
@@ -7,16 +6,16 @@
|
|||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of either the GNU General Public License or the
|
# it under the terms of either the GNU General Public License or the
|
||||||
# Perl Artistic License.
|
# Perl Artistic License.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the Perl Artistic License
|
# You should have received a copy of the Perl Artistic License
|
||||||
# along with this module; see the file COPYING. If not, see
|
# along with this module; see the file COPYING. If not, see
|
||||||
# www.cpan.org
|
# www.cpan.org
|
||||||
#
|
#
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
# DESCRIPTION: Debugging of bison output
|
# DESCRIPTION: Debugging of bison output
|
||||||
|
|||||||
+1
-3
@@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/perl -w
|
#!/usr/bin/perl -w
|
||||||
# $Id$
|
|
||||||
######################################################################
|
######################################################################
|
||||||
#
|
#
|
||||||
# Copyright 2005-2008 by Wilson Snyder <[email protected]>. This
|
# Copyright 2005-2008 by Wilson Snyder <[email protected]>. This
|
||||||
@@ -50,7 +49,6 @@ cwrite ("graph_export.cpp");
|
|||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
sub usage {
|
sub usage {
|
||||||
print '$Id$ ', "\n";
|
|
||||||
pod2usage(-verbose=>2, -exitval => 2);
|
pod2usage(-verbose=>2, -exitval => 2);
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
@@ -120,7 +118,7 @@ sub cwrite {
|
|||||||
foreach my $edge (@Edges) {
|
foreach my $edge (@Edges) {
|
||||||
$fh->printf(" new V3GraphEdge(gp, %s, %s, %s, %s);\n",
|
$fh->printf(" new V3GraphEdge(gp, %s, %s, %s, %s);\n",
|
||||||
$edge->{from}, $edge->{to},
|
$edge->{from}, $edge->{to},
|
||||||
$edge->{weight}, $edge->{cutable}?"true":"false");
|
$edge->{weight}, $edge->{cutable}?"true":"false");
|
||||||
}
|
}
|
||||||
$fh->print("}\n");
|
$fh->print("}\n");
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-3
@@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/perl -w
|
#!/usr/bin/perl -w
|
||||||
# $Id$
|
|
||||||
######################################################################
|
######################################################################
|
||||||
#
|
#
|
||||||
# Copyright 2005-2008 by Wilson Snyder <[email protected]>. This
|
# Copyright 2005-2008 by Wilson Snyder <[email protected]>. This
|
||||||
@@ -55,7 +54,6 @@ dotwrite();
|
|||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
sub usage {
|
sub usage {
|
||||||
print '$Id$ ', "\n";
|
|
||||||
pod2usage(-verbose=>2, -exitval => 2);
|
pod2usage(-verbose=>2, -exitval => 2);
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
@@ -175,7 +173,7 @@ __END__
|
|||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
dot_pruner -
|
dot_pruner -
|
||||||
|
|
||||||
=head1 SYNOPSIS
|
=head1 SYNOPSIS
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/perl -w
|
#!/usr/bin/perl -w
|
||||||
# $Id$
|
|
||||||
######################################################################
|
######################################################################
|
||||||
#
|
#
|
||||||
# Copyright 2007-2008 by Wilson Snyder <[email protected]>. This
|
# Copyright 2007-2008 by Wilson Snyder <[email protected]>. This
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
export GLIBCPP_FORCE_NEW=1
|
||||||
|
compile with -DVL_LEAK_CHECKS
|
||||||
|
valgrind --tool=memcheck --leak-check=yes /home/wsnyder/src/verilator/v4/verilator/verilator_bin_dbg -MMD --bin /home/wsnyder/src/verilator/v4/verilator/verilator_bin_dbg --cc -f /home/wsnyder/src/verilator/v4/verilator/test_c/../test_v/input.vc top.v --no-skip-identical 2>&1 | tee ~/d/aa
|
||||||
|
valgrind --tool=memcheck --leak-check=yes /home/wsnyder/src/verilator/v4/verilator/verilator_bin_dbg -MMD --bin /home/wsnyder/src/verilator/v4/verilator/verilator_bin_dbg --cc /home/wsnyder/src/verilator/v4/verilator/test_regress/t/t_case_huge.v --no-skip-identical -I/home/wsnyder/src/verilator/v4/verilator/test_regress/t 2>&1 | tee ~/d/aa
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/perl -w
|
#!/usr/bin/perl -w
|
||||||
# $Id$
|
|
||||||
######################################################################
|
######################################################################
|
||||||
#
|
#
|
||||||
# Copyright 2005-2008 by Wilson Snyder <[email protected]>. This
|
# Copyright 2005-2008 by Wilson Snyder <[email protected]>. This
|
||||||
@@ -52,7 +51,6 @@ print '(query-replace-regexp "(\\([0-9a-z_]+\\))" "\\1" nil nil nil)',"\n";
|
|||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
sub usage {
|
sub usage {
|
||||||
print '$Id$ ', "\n";
|
|
||||||
pod2usage(-verbose=>2, -exitval => 2);
|
pod2usage(-verbose=>2, -exitval => 2);
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
@@ -292,7 +290,7 @@ sub p_var {
|
|||||||
}
|
}
|
||||||
p "\t";
|
p "\t";
|
||||||
{
|
{
|
||||||
local $Avoid_Hex=1;
|
local $Avoid_Hex=1;
|
||||||
t1;
|
t1;
|
||||||
}
|
}
|
||||||
p "\t";
|
p "\t";
|
||||||
@@ -322,7 +320,7 @@ __END__
|
|||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
vtree_importer -
|
vtree_importer -
|
||||||
|
|
||||||
=head1 SYNOPSIS
|
=head1 SYNOPSIS
|
||||||
|
|
||||||
|
|||||||
+17
-12
@@ -1,6 +1,5 @@
|
|||||||
\input texinfo @c -*-texinfo-*-
|
\input texinfo @c -*-texinfo-*-
|
||||||
@c %**start of header
|
@c %**start of header
|
||||||
$c $Id$
|
|
||||||
@setfilename readme.info
|
@setfilename readme.info
|
||||||
@settitle Verilator Installation
|
@settitle Verilator Installation
|
||||||
@c %**end of header
|
@c %**end of header
|
||||||
@@ -15,13 +14,13 @@ $c $Id$
|
|||||||
This is the Verilator Package.
|
This is the Verilator Package.
|
||||||
|
|
||||||
@menu
|
@menu
|
||||||
* Copyright::
|
* Copyright::
|
||||||
* Description::
|
* Description::
|
||||||
* Obtaining Distribution::
|
* Obtaining Distribution::
|
||||||
* Directory Structure::
|
* Directory Structure::
|
||||||
* Supported Systems::
|
* Supported Systems::
|
||||||
* Installation::
|
* Installation::
|
||||||
* Limitations::
|
* Limitations::
|
||||||
@end menu
|
@end menu
|
||||||
|
|
||||||
@node Copyright, Description, Top, Top
|
@node Copyright, Description, Top, Top
|
||||||
@@ -45,7 +44,7 @@ Verilator is invoked with parameters similar to GCC or Synopsys's VCS. It
|
|||||||
reads the specified Verilog code, lints it, and optionally adds coverage
|
reads the specified Verilog code, lints it, and optionally adds coverage
|
||||||
code. For C++ format, it outputs .cpp and .h files. For SystemC format,
|
code. For C++ format, it outputs .cpp and .h files. For SystemC format,
|
||||||
it outputs .sp files for the SystemPerl preprocessor available at
|
it outputs .sp files for the SystemPerl preprocessor available at
|
||||||
http://veripool.com.
|
http://www.veripool.org.
|
||||||
|
|
||||||
The resulting files are then compiled with C++. The user writes a little
|
The resulting files are then compiled with C++. The user writes a little
|
||||||
C++ wrapper file, which instantiates the top level module. This is
|
C++ wrapper file, which instantiates the top level module. This is
|
||||||
@@ -56,11 +55,11 @@ The resulting executable will perform the actual simulation.
|
|||||||
@node Obtaining Distribution, Directory Structure, Description, Top
|
@node Obtaining Distribution, Directory Structure, Description, Top
|
||||||
@section Obtaining Distribution
|
@section Obtaining Distribution
|
||||||
|
|
||||||
The latest version is available at
|
The latest version is available at
|
||||||
@uref{http://veripool.com/verilator.htm}
|
@uref{http://www.veripool.org/verilator}
|
||||||
|
|
||||||
Download the latest package from that site, and decompress.
|
Download the latest package from that site, and decompress.
|
||||||
@samp{gunzip verilator_version.tar.gz ; tar xvf verilator_version.tar}
|
@samp{tar xvzf verilator_version.tgz}
|
||||||
|
|
||||||
@node Directory Structure, Supported Systems, Obtaining Distribution, Top
|
@node Directory Structure, Supported Systems, Obtaining Distribution, Top
|
||||||
@section Directory Structure
|
@section Directory Structure
|
||||||
@@ -126,6 +125,12 @@ do a @code{make sc_patch}.
|
|||||||
@item
|
@item
|
||||||
Type @samp{./configure} to configure Verilator for your system.
|
Type @samp{./configure} to configure Verilator for your system.
|
||||||
|
|
||||||
|
If you are configuring Verilator to be part of a RPM or other
|
||||||
|
distribution package system, you may want to use the --enable-defenv
|
||||||
|
configure flag. This will take the current value of VERILATOR_ROOT,
|
||||||
|
SYSTEMC, SYSTEMC_ARCH, and SYSTEMPERL and build them as defaults into
|
||||||
|
the executable.
|
||||||
|
|
||||||
@item
|
@item
|
||||||
Type @samp{make} to compile Verilator.
|
Type @samp{make} to compile Verilator.
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -1,9 +1,9 @@
|
|||||||
# $Id$ */
|
# -*- Makefile -*-
|
||||||
#*****************************************************************************
|
#*****************************************************************************
|
||||||
#
|
#
|
||||||
# DESCRIPTION: Verilator: Makefile for verilog source
|
# DESCRIPTION: Verilator: Makefile for verilog source
|
||||||
#
|
#
|
||||||
# Code available from: http://www.veripool.com/verilator
|
# Code available from: http://www.veripool.org/verilator
|
||||||
#
|
#
|
||||||
#*****************************************************************************
|
#*****************************************************************************
|
||||||
#
|
#
|
||||||
@@ -40,7 +40,7 @@ export OBJCACHE_HOSTS := $(shell rschedule --no-allow-reserved --similar hostnam
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(OBJCACHE_HOSTS),)
|
ifeq ($(OBJCACHE_HOSTS),)
|
||||||
export OBJCACHE :=
|
export OBJCACHE :=
|
||||||
else
|
else
|
||||||
export OBJCACHE_JOBS := -j $(shell objcache --jobs "$(OBJCACHE_HOSTS)")
|
export OBJCACHE_JOBS := -j $(shell objcache --jobs "$(OBJCACHE_HOSTS)")
|
||||||
export OBJCACHE := @objcache --read --write
|
export OBJCACHE := @objcache --read --write
|
||||||
@@ -74,7 +74,7 @@ prefiles::
|
|||||||
ifeq ($(VERILATOR_AUTHOR_SITE),1) # Local... Else don't burden users
|
ifeq ($(VERILATOR_AUTHOR_SITE),1) # Local... Else don't burden users
|
||||||
prefiles:: config_rev.h
|
prefiles:: config_rev.h
|
||||||
# This output goes into srcdir, as we need to distribute it as part of the kit.
|
# This output goes into srcdir, as we need to distribute it as part of the kit.
|
||||||
config_rev.h: config_rev.pl .svn/entries
|
config_rev.h: config_rev.pl ../.git/index
|
||||||
$(PERL) config_rev.pl . >$@
|
$(PERL) config_rev.pl . >$@
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
+41
-11
@@ -1,9 +1,9 @@
|
|||||||
# $Id$ -*- Makefile -*-
|
# -*- Makefile -*-
|
||||||
#*****************************************************************************
|
#*****************************************************************************
|
||||||
#
|
#
|
||||||
# DESCRIPTION: Verilator: Makefile for verilog source
|
# DESCRIPTION: Verilator: Makefile for verilog source
|
||||||
#
|
#
|
||||||
# Code available from: http://www.veripool.com/verilator
|
# Code available from: http://www.veripool.org/verilator
|
||||||
#
|
#
|
||||||
#*****************************************************************************
|
#*****************************************************************************
|
||||||
#
|
#
|
||||||
@@ -23,11 +23,28 @@
|
|||||||
srcdir = ..
|
srcdir = ..
|
||||||
incdir = ../../include
|
incdir = ../../include
|
||||||
|
|
||||||
PERL = @PERL@
|
# Programs
|
||||||
CC = @CC@
|
CC = @CC@
|
||||||
CXX = @CXX@
|
CXX = @CXX@
|
||||||
LINK = @CXX@
|
LINK = @CXX@
|
||||||
|
LEX = @LEX@
|
||||||
|
LFLAGS = -d
|
||||||
|
PERL = @PERL@
|
||||||
|
YACC = @YACC@
|
||||||
|
YFLAGS = -y -d -v
|
||||||
|
|
||||||
|
prefix = @prefix@
|
||||||
|
|
||||||
|
# Directory in which to install data across multiple architectures
|
||||||
|
datarootdir = @datarootdir@
|
||||||
|
|
||||||
|
# Directory in which to install package specific files
|
||||||
|
# Generally ${prefix}/share/verilator
|
||||||
|
pkgdatadir = @pkgdatadir@
|
||||||
|
|
||||||
|
# Compile options
|
||||||
|
CFG_WITH_DEFENV = @CFG_WITH_DEFENV@
|
||||||
|
CPPFLAGSNOWALL += @CPPFLAGS@
|
||||||
LDFLAGS += @LDFLAGS@
|
LDFLAGS += @LDFLAGS@
|
||||||
|
|
||||||
#### End of system configuration section. ####
|
#### End of system configuration section. ####
|
||||||
@@ -48,17 +65,12 @@ COPT = -ggdb -DVL_DEBUG
|
|||||||
endif
|
endif
|
||||||
#################
|
#################
|
||||||
|
|
||||||
LEX = @LEX@
|
|
||||||
LFLAGS = -d
|
|
||||||
YACC = @YACC@
|
|
||||||
YFLAGS = -y -d -v
|
|
||||||
|
|
||||||
#LIBS += -ldl
|
#LIBS += -ldl
|
||||||
#CCMALLOC = /usr/local/lib/ccmalloc-gcc.o -lccmalloc -ldl
|
#CCMALLOC = /usr/local/lib/ccmalloc-gcc.o -lccmalloc -ldl
|
||||||
|
|
||||||
LIBS = -lm -lfl
|
LIBS = -lm -lfl
|
||||||
|
|
||||||
CPPFLAGSNOWALL = -MMD
|
CPPFLAGSNOWALL += -MMD
|
||||||
CPPFLAGSNOWALL += -I. -I$(srcdir) -I$(incdir)
|
CPPFLAGSNOWALL += -I. -I$(srcdir) -I$(incdir)
|
||||||
CPPFLAGSNOWALL += -DYYDEBUG # Required to get nice error messages
|
CPPFLAGSNOWALL += -DYYDEBUG # Required to get nice error messages
|
||||||
#CPPFLAGSNOWALL += -DVL_LEAK_CHECKS # If running valgrind or other hunting tool
|
#CPPFLAGSNOWALL += -DVL_LEAK_CHECKS # If running valgrind or other hunting tool
|
||||||
@@ -70,6 +82,19 @@ CPPFLAGS += -W -Wall -Wno-unused-parameter -Wno-char-subscripts -Werror
|
|||||||
#CPPFLAGS += -pedantic-errors
|
#CPPFLAGS += -pedantic-errors
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Allow RPM builds to specify hardcoded data directories
|
||||||
|
# To do this:
|
||||||
|
ifeq ($(CFG_WITH_DEFENV),yes)
|
||||||
|
CPPFLAGS += -DDEFENV_SYSTEMC=\"$(SYSTEMC)\"
|
||||||
|
CPPFLAGS += -DDEFENV_SYSTEMC_ARCH=\"$(SYSTEMC_ARCH)\"
|
||||||
|
CPPFLAGS += -DDEFENV_SYSTEMPERL=\"$(SYSTEMPERL)\"
|
||||||
|
ifeq ($(VERILATOR_ROOT),) # Use what we're given, or intuit
|
||||||
|
CPPFLAGS += -DDEFENV_VERILATOR_ROOT=\"$(pkgdatadir)\"
|
||||||
|
else
|
||||||
|
CPPFLAGS += -DDEFENV_VERILATOR_ROOT=\"$(VERILATOR_ROOT)\"
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
HEADERS = $(wildcard V*.h v*.h)
|
HEADERS = $(wildcard V*.h v*.h)
|
||||||
|
|
||||||
ASTGEN = $(srcdir)/astgen
|
ASTGEN = $(srcdir)/astgen
|
||||||
@@ -221,14 +246,19 @@ V3PreProc.o: V3PreProc.cpp V3PreLex.yy.cpp
|
|||||||
#### Generated files
|
#### Generated files
|
||||||
|
|
||||||
# Target rule called before parallel build to make generated files
|
# Target rule called before parallel build to make generated files
|
||||||
serial:: V3Ast__gen_classes.h
|
serial:: V3Ast__gen_classes.h y.tab.c
|
||||||
|
|
||||||
V3Ast__gen_classes.h : $(ASTGEN) V3Ast.h V3AstNodes.h
|
V3Ast__gen_classes.h : $(ASTGEN) V3Ast.h V3AstNodes.h
|
||||||
$(PERL) $(ASTGEN) -I$(srcdir) --classes
|
$(PERL) $(ASTGEN) -I$(srcdir) --classes
|
||||||
|
|
||||||
y.tab.c y.tab.h: verilog.y $(HEADERS)
|
y.tab.h: y.tab.c
|
||||||
|
|
||||||
|
# Have only one output file in this rule to prevent parallel make issues
|
||||||
|
y.tab.c: verilog.y $(HEADERS)
|
||||||
@echo "If you get errors from verilog.y below, try upgrading bison to version 1.875 or newer."
|
@echo "If you get errors from verilog.y below, try upgrading bison to version 1.875 or newer."
|
||||||
${YACC} ${YFLAGS} $<
|
${YACC} ${YFLAGS} $<
|
||||||
|
mv y.tab.c y_pregen.tab.c && $(PERL) $(srcdir)/bisonfix < y_pregen.tab.c > y.tab.c
|
||||||
|
mv y.tab.h y_pregen.tab.h && $(PERL) $(srcdir)/bisonfix < y_pregen.tab.h > y.tab.h
|
||||||
|
|
||||||
V3Lexer_pregen.yy.cpp: verilog.l y.tab.h $(HEADERS)
|
V3Lexer_pregen.yy.cpp: verilog.l y.tab.h $(HEADERS)
|
||||||
${LEX} ${LFLAGS} -o$@ $<
|
${LEX} ${LFLAGS} -o$@ $<
|
||||||
|
|||||||
+2
-3
@@ -1,8 +1,7 @@
|
|||||||
// $Id$
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Break always into sensitivity active domains
|
// DESCRIPTION: Verilator: Break always into sensitivity active domains
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
@@ -19,7 +18,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// V3Active's Transformations:
|
// V3Active's Transformations:
|
||||||
//
|
//
|
||||||
// Note this can be called multiple times.
|
// Note this can be called multiple times.
|
||||||
// Create a IACTIVE(initial), SACTIVE(combo)
|
// Create a IACTIVE(initial), SACTIVE(combo)
|
||||||
// ALWAYS: Remove any-edges from sense list
|
// ALWAYS: Remove any-edges from sense list
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
// $Id$ //-*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Break always into sensitivity block domains
|
// DESCRIPTION: Verilator: Break always into sensitivity block domains
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
|
|||||||
+2
-3
@@ -1,8 +1,7 @@
|
|||||||
// $Id$
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Break always into sensitivity active domains
|
// DESCRIPTION: Verilator: Break always into sensitivity active domains
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
@@ -19,7 +18,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// V3Active's Transformations:
|
// V3Active's Transformations:
|
||||||
//
|
//
|
||||||
// Note this can be called multiple times.
|
// Note this can be called multiple times.
|
||||||
// Across all ACTIVES
|
// Across all ACTIVES
|
||||||
// SenTrees are now under each ACTIVE statement, we want them global:
|
// SenTrees are now under each ACTIVE statement, we want them global:
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
// $Id$ //-*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Break always into sensitivity block domains
|
// DESCRIPTION: Verilator: Break always into sensitivity block domains
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
|
|||||||
+2
-3
@@ -1,8 +1,7 @@
|
|||||||
// $Id$
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Collect and print statistics
|
// DESCRIPTION: Verilator: Collect and print statistics
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
@@ -106,7 +105,7 @@ private:
|
|||||||
sentreep->unlinkFrBack();
|
sentreep->unlinkFrBack();
|
||||||
//
|
//
|
||||||
AstNode* bodysp = NULL;
|
AstNode* bodysp = NULL;
|
||||||
bool selfDestruct = false;
|
bool selfDestruct = false;
|
||||||
if (AstPslCover* snodep = nodep->castPslCover()) {
|
if (AstPslCover* snodep = nodep->castPslCover()) {
|
||||||
if (!v3Global.opt.coverageUser()) {
|
if (!v3Global.opt.coverageUser()) {
|
||||||
selfDestruct = true;
|
selfDestruct = true;
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
// $Id$ //-*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Assertion expansion
|
// DESCRIPTION: Verilator: Assertion expansion
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
|
|||||||
+1
-2
@@ -1,8 +1,7 @@
|
|||||||
// $Id$
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Collect and print statistics
|
// DESCRIPTION: Verilator: Collect and print statistics
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
// $Id$ //-*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Assertion pre-expansion
|
// DESCRIPTION: Verilator: Assertion pre-expansion
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
|
|||||||
+29
-13
@@ -1,8 +1,7 @@
|
|||||||
// $Id$
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Ast node structures
|
// DESCRIPTION: Verilator: Ast node structures
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
@@ -83,6 +82,20 @@ void AstNode::init() {
|
|||||||
m_user5Cnt = 0;
|
m_user5Cnt = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string AstNode::encodeName(const string& namein) {
|
||||||
|
string name2 = namein;
|
||||||
|
string out;
|
||||||
|
for (string::iterator pos = name2.begin(); pos != name2.end(); pos++) {
|
||||||
|
if (pos[0]=='_' && pos[1]=='_') {
|
||||||
|
out += "__ULUL_";
|
||||||
|
pos++;
|
||||||
|
} else {
|
||||||
|
out += pos[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
string AstNode::shortName() const {
|
string AstNode::shortName() const {
|
||||||
string pretty = name();
|
string pretty = name();
|
||||||
string::size_type pos;
|
string::size_type pos;
|
||||||
@@ -114,6 +127,9 @@ string AstNode::prettyName(const string& namein) {
|
|||||||
while ((pos=pretty.find("__PVT__")) != string::npos) {
|
while ((pos=pretty.find("__PVT__")) != string::npos) {
|
||||||
pretty.replace(pos, 7, "");
|
pretty.replace(pos, 7, "");
|
||||||
}
|
}
|
||||||
|
while ((pos=pretty.find("__ULUL_")) != string::npos) {
|
||||||
|
pretty.replace(pos, 7, "");
|
||||||
|
}
|
||||||
return AstNode::dedotName(pretty);
|
return AstNode::dedotName(pretty);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,8 +254,8 @@ void AstNode::addNextHere(AstNode* newp) {
|
|||||||
void AstNode::setOp1p(AstNode* newp) {
|
void AstNode::setOp1p(AstNode* newp) {
|
||||||
UASSERT(newp,"Null item passed to setOp1p\n");
|
UASSERT(newp,"Null item passed to setOp1p\n");
|
||||||
UDEBUGONLY(if (m_op1p) this->v3fatalSrc("Adding to non-empty, non-list op1"););
|
UDEBUGONLY(if (m_op1p) this->v3fatalSrc("Adding to non-empty, non-list op1"););
|
||||||
UDEBUGONLY(if (newp->m_backp) newp->v3fatalSrc("Adding already linked node"););
|
UDEBUGONLY(if (newp->m_backp) newp->v3fatalSrc("Adding already linked node"););
|
||||||
UDEBUGONLY(if (newp->m_nextp) newp->v3fatalSrc("Adding list to non-list op1"););
|
UDEBUGONLY(if (newp->m_nextp) newp->v3fatalSrc("Adding list to non-list op1"););
|
||||||
this->debugTreeChange("-setOp1pThs: ", __LINE__, false);
|
this->debugTreeChange("-setOp1pThs: ", __LINE__, false);
|
||||||
newp->debugTreeChange("-setOp1pNew: ", __LINE__, true);
|
newp->debugTreeChange("-setOp1pNew: ", __LINE__, true);
|
||||||
m_op1p = newp;
|
m_op1p = newp;
|
||||||
@@ -251,8 +267,8 @@ void AstNode::setOp1p(AstNode* newp) {
|
|||||||
void AstNode::setOp2p(AstNode* newp) {
|
void AstNode::setOp2p(AstNode* newp) {
|
||||||
UASSERT(newp,"Null item passed to setOp2p\n");
|
UASSERT(newp,"Null item passed to setOp2p\n");
|
||||||
UDEBUGONLY(if (m_op2p) this->v3fatalSrc("Adding to non-empty, non-list op2"););
|
UDEBUGONLY(if (m_op2p) this->v3fatalSrc("Adding to non-empty, non-list op2"););
|
||||||
UDEBUGONLY(if (newp->m_backp) newp->v3fatalSrc("Adding already linked node"););
|
UDEBUGONLY(if (newp->m_backp) newp->v3fatalSrc("Adding already linked node"););
|
||||||
UDEBUGONLY(if (newp->m_nextp) newp->v3fatalSrc("Adding list to non-list op2"););
|
UDEBUGONLY(if (newp->m_nextp) newp->v3fatalSrc("Adding list to non-list op2"););
|
||||||
this->debugTreeChange("-setOp2pThs: ", __LINE__, false);
|
this->debugTreeChange("-setOp2pThs: ", __LINE__, false);
|
||||||
newp->debugTreeChange("-setOp2pNew: ", __LINE__, true);
|
newp->debugTreeChange("-setOp2pNew: ", __LINE__, true);
|
||||||
m_op2p = newp;
|
m_op2p = newp;
|
||||||
@@ -264,8 +280,8 @@ void AstNode::setOp2p(AstNode* newp) {
|
|||||||
void AstNode::setOp3p(AstNode* newp) {
|
void AstNode::setOp3p(AstNode* newp) {
|
||||||
UASSERT(newp,"Null item passed to setOp3p\n");
|
UASSERT(newp,"Null item passed to setOp3p\n");
|
||||||
UDEBUGONLY(if (m_op3p) this->v3fatalSrc("Adding to non-empty, non-list op3"););
|
UDEBUGONLY(if (m_op3p) this->v3fatalSrc("Adding to non-empty, non-list op3"););
|
||||||
UDEBUGONLY(if (newp->m_backp) newp->v3fatalSrc("Adding already linked node"););
|
UDEBUGONLY(if (newp->m_backp) newp->v3fatalSrc("Adding already linked node"););
|
||||||
UDEBUGONLY(if (newp->m_nextp) newp->v3fatalSrc("Adding list to non-list op3"););
|
UDEBUGONLY(if (newp->m_nextp) newp->v3fatalSrc("Adding list to non-list op3"););
|
||||||
this->debugTreeChange("-setOp3pThs: ", __LINE__, false);
|
this->debugTreeChange("-setOp3pThs: ", __LINE__, false);
|
||||||
newp->debugTreeChange("-setOp3pNew: ", __LINE__, true);
|
newp->debugTreeChange("-setOp3pNew: ", __LINE__, true);
|
||||||
m_op3p = newp;
|
m_op3p = newp;
|
||||||
@@ -277,8 +293,8 @@ void AstNode::setOp3p(AstNode* newp) {
|
|||||||
void AstNode::setOp4p(AstNode* newp) {
|
void AstNode::setOp4p(AstNode* newp) {
|
||||||
UASSERT(newp,"Null item passed to setOp4p\n");
|
UASSERT(newp,"Null item passed to setOp4p\n");
|
||||||
UDEBUGONLY(if (m_op4p) this->v3fatalSrc("Adding to non-empty, non-list op4"););
|
UDEBUGONLY(if (m_op4p) this->v3fatalSrc("Adding to non-empty, non-list op4"););
|
||||||
UDEBUGONLY(if (newp->m_backp) newp->v3fatalSrc("Adding already linked node"););
|
UDEBUGONLY(if (newp->m_backp) newp->v3fatalSrc("Adding already linked node"););
|
||||||
UDEBUGONLY(if (newp->m_nextp) newp->v3fatalSrc("Adding list to non-list op4"););
|
UDEBUGONLY(if (newp->m_nextp) newp->v3fatalSrc("Adding list to non-list op4"););
|
||||||
this->debugTreeChange("-setOp4pThs: ", __LINE__, false);
|
this->debugTreeChange("-setOp4pThs: ", __LINE__, false);
|
||||||
newp->debugTreeChange("-setOp4pNew: ", __LINE__, true);
|
newp->debugTreeChange("-setOp4pNew: ", __LINE__, true);
|
||||||
m_op4p = newp;
|
m_op4p = newp;
|
||||||
@@ -627,7 +643,7 @@ void AstNode::iterateListBackwards(AstNVisitor& v, AstNUser* vup) {
|
|||||||
while (nodep->m_nextp) nodep=nodep->m_nextp;
|
while (nodep->m_nextp) nodep=nodep->m_nextp;
|
||||||
while (nodep) {
|
while (nodep) {
|
||||||
// Edits not supported: nodep->m_iterpp = &nodep;
|
// Edits not supported: nodep->m_iterpp = &nodep;
|
||||||
nodep->accept(v, vup);
|
nodep->accept(v, vup);
|
||||||
if (nodep->backp()->m_nextp == nodep) nodep=nodep->backp();
|
if (nodep->backp()->m_nextp == nodep) nodep=nodep->backp();
|
||||||
else nodep = NULL; // else: backp points up the tree.
|
else nodep = NULL; // else: backp points up the tree.
|
||||||
}
|
}
|
||||||
@@ -648,7 +664,7 @@ void AstNode::iterateAndNext(AstNVisitor& v, AstNUser* vup) {
|
|||||||
for (AstNode* nodep=this; nodep;) {
|
for (AstNode* nodep=this; nodep;) {
|
||||||
AstNode* niterp = nodep;
|
AstNode* niterp = nodep;
|
||||||
niterp->m_iterpp = &niterp;
|
niterp->m_iterpp = &niterp;
|
||||||
niterp->accept(v, vup);
|
niterp->accept(v, vup);
|
||||||
// accept may do a replaceNode and change niterp on us...
|
// accept may do a replaceNode and change niterp on us...
|
||||||
if (!niterp) return;
|
if (!niterp) return;
|
||||||
niterp->m_iterpp = NULL;
|
niterp->m_iterpp = NULL;
|
||||||
@@ -665,7 +681,7 @@ void AstNode::iterateAndNextIgnoreEdit(AstNVisitor& v, AstNUser* vup) {
|
|||||||
if (!this) return;
|
if (!this) return;
|
||||||
for (AstNode* nodep=this; nodep; ) {
|
for (AstNode* nodep=this; nodep; ) {
|
||||||
AstNode* nnextp = nodep->m_nextp;
|
AstNode* nnextp = nodep->m_nextp;
|
||||||
nodep->accept(v, vup);
|
nodep->accept(v, vup);
|
||||||
nodep = nnextp;
|
nodep = nnextp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-3
@@ -1,8 +1,8 @@
|
|||||||
// $Id$ //-*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Ast node structure
|
// DESCRIPTION: Verilator: Ast node structure
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
@@ -558,6 +558,7 @@ public:
|
|||||||
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 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
|
||||||
|
static string encodeName(const string& namein); // Encode user name into internal C representation
|
||||||
string prettyName() const { return prettyName(name()); }
|
string prettyName() const { return prettyName(name()); }
|
||||||
FileLine* fileline() const { return m_fileline; }
|
FileLine* fileline() const { return m_fileline; }
|
||||||
int width() const { return m_width; }
|
int width() const { return m_width; }
|
||||||
@@ -1008,7 +1009,7 @@ public:
|
|||||||
AstNodeFTaskRef(FileLine* fl, AstNode* namep, AstNode* pinsp)
|
AstNodeFTaskRef(FileLine* fl, AstNode* namep, AstNode* pinsp)
|
||||||
:AstNode(fl)
|
:AstNode(fl)
|
||||||
, m_taskp(NULL) {
|
, m_taskp(NULL) {
|
||||||
setOp1p(namep); addNOp2p(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(); }
|
||||||
|
|||||||
+5
-2
@@ -1,8 +1,7 @@
|
|||||||
// $Id$
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Ast node structures
|
// DESCRIPTION: Verilator: Ast node structures
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
@@ -304,6 +303,10 @@ void AstCellInline::dump(ostream& str) {
|
|||||||
this->AstNode::dump(str);
|
this->AstNode::dump(str);
|
||||||
str<<" -> "<<origModName();
|
str<<" -> "<<origModName();
|
||||||
}
|
}
|
||||||
|
void AstDisplay::dump(ostream& str) {
|
||||||
|
this->AstNode::dump(str);
|
||||||
|
//str<<" "<<displayType().ascii();
|
||||||
|
}
|
||||||
void AstPin::dump(ostream& str) {
|
void AstPin::dump(ostream& str) {
|
||||||
this->AstNode::dump(str);
|
this->AstNode::dump(str);
|
||||||
if (modVarp()) { str<<" -> "; modVarp()->dump(str); }
|
if (modVarp()) { str<<" -> "; modVarp()->dump(str); }
|
||||||
|
|||||||
+21
-6
@@ -1,8 +1,8 @@
|
|||||||
// $Id$ //-*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Ast node structure
|
// DESCRIPTION: Verilator: Ast node structure
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
@@ -254,7 +254,7 @@ private:
|
|||||||
m_sc=false; m_scClocked=false; m_scSensitive=false;
|
m_sc=false; m_scClocked=false; m_scSensitive=false;
|
||||||
m_usedClock=false; m_usedParam=false;
|
m_usedClock=false; m_usedParam=false;
|
||||||
m_sigPublic=false; m_sigModPublic=false;
|
m_sigPublic=false; m_sigModPublic=false;
|
||||||
m_funcLocal=false; m_funcReturn=false;
|
m_funcLocal=false; m_funcReturn=false;
|
||||||
m_attrClockEn=false; m_attrIsolateAssign=false;
|
m_attrClockEn=false; m_attrIsolateAssign=false;
|
||||||
m_fileDescr=false; m_isConst=false; m_isStatic=false;
|
m_fileDescr=false; m_isConst=false; m_isStatic=false;
|
||||||
m_trace=false;
|
m_trace=false;
|
||||||
@@ -554,7 +554,7 @@ public:
|
|||||||
virtual AstNode* clone() { return new AstVarXRef(*this);}
|
virtual AstNode* clone() { return new AstVarXRef(*this);}
|
||||||
virtual void accept(AstNVisitor& v, AstNUser* vup=NULL) { v.visit(this,vup); }
|
virtual void accept(AstNVisitor& v, AstNUser* vup=NULL) { v.visit(this,vup); }
|
||||||
virtual void dump(ostream& str);
|
virtual void dump(ostream& str);
|
||||||
string dotted() const { return m_dotted; }
|
string dotted() const { return m_dotted; }
|
||||||
string prettyDotted() const { return prettyName(dotted()); }
|
string prettyDotted() const { return prettyName(dotted()); }
|
||||||
string inlinedDots() const { return m_inlinedDots; }
|
string inlinedDots() const { return m_inlinedDots; }
|
||||||
void inlinedDots(const string& flag) { m_inlinedDots = flag; }
|
void inlinedDots(const string& flag) { m_inlinedDots = flag; }
|
||||||
@@ -755,7 +755,7 @@ public:
|
|||||||
AstNode* stmtsp() const { return op1p()->castNode(); } // op1 = List of statements
|
AstNode* stmtsp() const { return op1p()->castNode(); } // op1 = List of statements
|
||||||
void addStmtp(AstNode* nodep) { addOp1p(nodep); }
|
void addStmtp(AstNode* nodep) { addOp1p(nodep); }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct AstGenerate : public AstNode {
|
struct AstGenerate : public AstNode {
|
||||||
// A Generate/end block
|
// A Generate/end block
|
||||||
// Parents: MODULE
|
// Parents: MODULE
|
||||||
@@ -1117,7 +1117,7 @@ private:
|
|||||||
public:
|
public:
|
||||||
AstCoverDecl(FileLine* fl, int column, const string& type, const string& comment)
|
AstCoverDecl(FileLine* fl, int column, const string& type, const string& comment)
|
||||||
: AstNodeStmt(fl) {
|
: AstNodeStmt(fl) {
|
||||||
m_text = comment; m_typeText = type; m_column = column;
|
m_text = comment; m_typeText = type; m_column = column;
|
||||||
}
|
}
|
||||||
virtual ~AstCoverDecl() {}
|
virtual ~AstCoverDecl() {}
|
||||||
virtual AstType type() const { return AstType::COVERDECL;}
|
virtual AstType type() const { return AstType::COVERDECL;}
|
||||||
@@ -1254,6 +1254,7 @@ public:
|
|||||||
virtual AstType type() const { return AstType::DISPLAY;}
|
virtual AstType type() const { return AstType::DISPLAY;}
|
||||||
virtual AstNode* clone() { return new AstDisplay(*this); }
|
virtual AstNode* clone() { return new AstDisplay(*this); }
|
||||||
virtual void accept(AstNVisitor& v, AstNUser* vup=NULL) { v.visit(this,vup); }
|
virtual void accept(AstNVisitor& v, AstNUser* vup=NULL) { v.visit(this,vup); }
|
||||||
|
virtual void dump(ostream& str);
|
||||||
virtual string verilogKwd() const { return (filep() ? (string)"$f"+(string)displayType().ascii()
|
virtual string verilogKwd() const { return (filep() ? (string)"$f"+(string)displayType().ascii()
|
||||||
: (string)"$"+(string)displayType().ascii()); }
|
: (string)"$"+(string)displayType().ascii()); }
|
||||||
virtual bool isGateOptimizable() const { return false; }
|
virtual bool isGateOptimizable() const { return false; }
|
||||||
@@ -1970,6 +1971,20 @@ struct AstUnsigned : public AstNodeUniop {
|
|||||||
virtual bool sizeMattersLhs() {return true;} // Eliminated before matters
|
virtual bool sizeMattersLhs() {return true;} // Eliminated before matters
|
||||||
virtual int instrCount() const { return 0; }
|
virtual int instrCount() const { return 0; }
|
||||||
};
|
};
|
||||||
|
struct AstCLog2 : public AstNodeUniop {
|
||||||
|
AstCLog2(FileLine* fl, AstNode* lhsp) : AstNodeUniop(fl, lhsp) {}
|
||||||
|
virtual ~AstCLog2() {}
|
||||||
|
virtual AstType type() const { return AstType::CLOG2;}
|
||||||
|
virtual AstNode* clone() { return new AstCLog2(*this); }
|
||||||
|
virtual void accept(AstNVisitor& v, AstNUser* vup=NULL) { v.visit(this,vup); }
|
||||||
|
virtual void numberOperate(V3Number& out, const V3Number& lhs) { out.opCLog2(lhs); }
|
||||||
|
virtual string emitVerilog() { return "%k$clog2(%l)"; }
|
||||||
|
virtual bool emitWordForm() { return true; }
|
||||||
|
virtual string emitOperator() { return "VL_CLOG2"; }
|
||||||
|
virtual bool cleanOut() {return false;} virtual bool cleanLhs() {return true;}
|
||||||
|
virtual bool sizeMattersLhs() {return false;}
|
||||||
|
virtual int instrCount() const { return widthInstrs()*16; }
|
||||||
|
};
|
||||||
struct AstCountOnes : public AstNodeUniop {
|
struct AstCountOnes : public AstNodeUniop {
|
||||||
// Number of bits set in vector
|
// Number of bits set in vector
|
||||||
AstCountOnes(FileLine* fl, AstNode* lhsp) : AstNodeUniop(fl, lhsp) {}
|
AstCountOnes(FileLine* fl, AstNode* lhsp) : AstNodeUniop(fl, lhsp) {}
|
||||||
|
|||||||
+3
-3
@@ -1,8 +1,7 @@
|
|||||||
// $Id$
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Removal of named begin blocks
|
// DESCRIPTION: Verilator: Removal of named begin blocks
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
@@ -19,7 +18,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// V3Begin's Transformations:
|
// V3Begin's Transformations:
|
||||||
//
|
//
|
||||||
// Each module:
|
// Each module:
|
||||||
// Look for BEGINs
|
// Look for BEGINs
|
||||||
// BEGIN(VAR...) -> VAR ... {renamed}
|
// BEGIN(VAR...) -> VAR ... {renamed}
|
||||||
@@ -32,6 +31,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <cstring>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
// $Id$ //-*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Removal of named begin blocks
|
// DESCRIPTION: Verilator: Removal of named begin blocks
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
|
|||||||
+1
-2
@@ -1,8 +1,7 @@
|
|||||||
// $Id$
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Branch prediction
|
// DESCRIPTION: Verilator: Branch prediction
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
// $Id$ //-*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Branch prediction
|
// DESCRIPTION: Verilator: Branch prediction
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
|
|||||||
+2
-3
@@ -1,8 +1,7 @@
|
|||||||
// $Id$
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Find broken links in tree
|
// DESCRIPTION: Verilator: Find broken links in tree
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
@@ -19,7 +18,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// V3Broken's Transformations:
|
// V3Broken's Transformations:
|
||||||
//
|
//
|
||||||
// Entire netlist
|
// Entire netlist
|
||||||
// Mark all nodes
|
// Mark all nodes
|
||||||
// Check all links point to marked nodes
|
// Check all links point to marked nodes
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
// $Id$ //-*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Find broken links in tree
|
// DESCRIPTION: Verilator: Find broken links in tree
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
|
|||||||
+5
-6
@@ -1,8 +1,7 @@
|
|||||||
// $Id$
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Break case statements up and add Unknown assigns
|
// DESCRIPTION: Verilator: Break case statements up and add Unknown assigns
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
@@ -19,7 +18,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// V3Case's Transformations:
|
// V3Case's Transformations:
|
||||||
//
|
//
|
||||||
// Each module:
|
// Each module:
|
||||||
// TBD: Eliminate tristates by adding __in, __inen, __en wires in parallel
|
// TBD: Eliminate tristates by adding __in, __inen, __en wires in parallel
|
||||||
// Need __en in changed list if a signal is on the LHS of a assign
|
// Need __en in changed list if a signal is on the LHS of a assign
|
||||||
@@ -235,7 +234,7 @@ private:
|
|||||||
// new AstConst(cexprp->fileline(), nummask));
|
// new AstConst(cexprp->fileline(), nummask));
|
||||||
AstNode* and1p = new AstSel(cexprp->fileline(), cexprp->cloneTree(false),
|
AstNode* and1p = new AstSel(cexprp->fileline(), cexprp->cloneTree(false),
|
||||||
msb, 1);
|
msb, 1);
|
||||||
AstNode* eqp = new AstNeq(cexprp->fileline(),
|
AstNode* eqp = new AstNeq(cexprp->fileline(),
|
||||||
new AstConst(cexprp->fileline(), 0),
|
new AstConst(cexprp->fileline(), 0),
|
||||||
and1p);
|
and1p);
|
||||||
AstIf* ifp = new AstIf(cexprp->fileline(), eqp, tree1p, tree0p);
|
AstIf* ifp = new AstIf(cexprp->fileline(), eqp, tree1p, tree0p);
|
||||||
@@ -293,7 +292,7 @@ private:
|
|||||||
for (AstNode* icondp = itemp->condsp(); icondp!=NULL; icondp=icondNextp) {
|
for (AstNode* icondp = itemp->condsp(); icondp!=NULL; icondp=icondNextp) {
|
||||||
icondNextp = icondp->nextp();
|
icondNextp = icondp->nextp();
|
||||||
icondp->unlinkFrBack();
|
icondp->unlinkFrBack();
|
||||||
|
|
||||||
AstNode* and1p;
|
AstNode* and1p;
|
||||||
AstNode* and2p;
|
AstNode* and2p;
|
||||||
AstConst* iconstp = icondp->castConst();
|
AstConst* iconstp = icondp->castConst();
|
||||||
@@ -305,7 +304,7 @@ private:
|
|||||||
numval.opBitsOne(iconstp->num());
|
numval.opBitsOne(iconstp->num());
|
||||||
and1p = new AstAnd(itemp->fileline(), cexprp->cloneTree(false),
|
and1p = new AstAnd(itemp->fileline(), cexprp->cloneTree(false),
|
||||||
new AstConst(itemp->fileline(), nummask));
|
new AstConst(itemp->fileline(), nummask));
|
||||||
and2p = new AstAnd(itemp->fileline(),
|
and2p = new AstAnd(itemp->fileline(),
|
||||||
new AstConst(itemp->fileline(), numval),
|
new AstConst(itemp->fileline(), numval),
|
||||||
new AstConst(itemp->fileline(), nummask));
|
new AstConst(itemp->fileline(), nummask));
|
||||||
icondp->deleteTree(); icondp=NULL; iconstp=NULL;
|
icondp->deleteTree(); icondp=NULL; iconstp=NULL;
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
// $Id$ //-*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Break case statements up and add Unknown assigns
|
// DESCRIPTION: Verilator: Break case statements up and add Unknown assigns
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
|
|||||||
+3
-4
@@ -1,8 +1,7 @@
|
|||||||
// $Id$
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Add C++ casts across expression size changes
|
// DESCRIPTION: Verilator: Add C++ casts across expression size changes
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
@@ -19,7 +18,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// V3Cast's Transformations:
|
// V3Cast's Transformations:
|
||||||
//
|
//
|
||||||
// Each module:
|
// Each module:
|
||||||
// For each math operator, if above operator requires 32 bits,
|
// For each math operator, if above operator requires 32 bits,
|
||||||
// and this isn't, cast to 32 bits.
|
// and this isn't, cast to 32 bits.
|
||||||
@@ -148,7 +147,7 @@ private:
|
|||||||
&& nodep->backp()->width()
|
&& nodep->backp()->width()
|
||||||
&& castSize(nodep) != castSize(nodep->varp())) {
|
&& castSize(nodep) != castSize(nodep->varp())) {
|
||||||
// Cast vars to IData first, else below has upper bits wrongly set
|
// Cast vars to IData first, else below has upper bits wrongly set
|
||||||
// CData x=3; out = (QData)(x<<30);
|
// CData x=3; out = (QData)(x<<30);
|
||||||
insertCast (nodep, castSize(nodep));
|
insertCast (nodep, castSize(nodep));
|
||||||
}
|
}
|
||||||
nodep->user(1);
|
nodep->user(1);
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
// $Id$ //-*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Add C++ casts across expression size changes
|
// DESCRIPTION: Verilator: Add C++ casts across expression size changes
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
|
|||||||
+2
-3
@@ -1,8 +1,7 @@
|
|||||||
// $Id$
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Add temporaries, such as for changed nodes
|
// DESCRIPTION: Verilator: Add temporaries, such as for changed nodes
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
@@ -19,7 +18,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// V3Changed's Transformations:
|
// V3Changed's Transformations:
|
||||||
//
|
//
|
||||||
// Each module:
|
// Each module:
|
||||||
// Each combo block
|
// Each combo block
|
||||||
// For each variable that comes from combo block and is generated AFTER a usage
|
// For each variable that comes from combo block and is generated AFTER a usage
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
// $Id$ //-*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Pre C-Emit stage changes
|
// DESCRIPTION: Verilator: Pre C-Emit stage changes
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
|
|||||||
+3
-4
@@ -1,8 +1,7 @@
|
|||||||
// $Id$
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Add temporaries, such as for clean nodes
|
// DESCRIPTION: Verilator: Add temporaries, such as for clean nodes
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
@@ -19,7 +18,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// V3Clean's Transformations:
|
// V3Clean's Transformations:
|
||||||
//
|
//
|
||||||
// Each module:
|
// Each module:
|
||||||
// For each math operator, if it requires a clean operand,
|
// For each math operator, if it requires a clean operand,
|
||||||
// and the operand is dirty, insert a CLEAN node.
|
// and the operand is dirty, insert a CLEAN node.
|
||||||
@@ -55,7 +54,7 @@ private:
|
|||||||
|
|
||||||
// ENUMS
|
// ENUMS
|
||||||
enum CleanState { UNKNOWN, CLEAN, DIRTY };
|
enum CleanState { UNKNOWN, CLEAN, DIRTY };
|
||||||
|
|
||||||
// METHODS
|
// METHODS
|
||||||
// Width resetting
|
// Width resetting
|
||||||
int cppWidth(AstNode* nodep) {
|
int cppWidth(AstNode* nodep) {
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
// $Id$ //-*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Pre C-Emit stage changes
|
// DESCRIPTION: Verilator: Pre C-Emit stage changes
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
|
|||||||
+5
-6
@@ -1,8 +1,7 @@
|
|||||||
// $Id$
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Clocking POS/NEGEDGE insertion
|
// DESCRIPTION: Verilator: Clocking POS/NEGEDGE insertion
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
@@ -19,7 +18,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// V3Clock's Transformations:
|
// V3Clock's Transformations:
|
||||||
//
|
//
|
||||||
// Top Scope:
|
// Top Scope:
|
||||||
// Check created ACTIVEs
|
// Check created ACTIVEs
|
||||||
// Compress adjacent ACTIVEs with same sensitivity list
|
// Compress adjacent ACTIVEs with same sensitivity list
|
||||||
@@ -245,12 +244,12 @@ private:
|
|||||||
//UINFO(4," MOD "<<nodep<<endl);
|
//UINFO(4," MOD "<<nodep<<endl);
|
||||||
m_modp = nodep;
|
m_modp = nodep;
|
||||||
m_stableNum = 0;
|
m_stableNum = 0;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstScope* nodep, AstNUser*) {
|
virtual void visit(AstScope* nodep, AstNUser*) {
|
||||||
//UINFO(4," SCOPE "<<nodep<<endl);
|
//UINFO(4," SCOPE "<<nodep<<endl);
|
||||||
m_scopep = nodep;
|
m_scopep = nodep;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (AstNode* movep = nodep->finalClksp()) {
|
if (AstNode* movep = nodep->finalClksp()) {
|
||||||
if (!m_topScopep) nodep->v3fatalSrc("Final clocks under non-top scope");
|
if (!m_topScopep) nodep->v3fatalSrc("Final clocks under non-top scope");
|
||||||
movep->unlinkFrBackWithNext();
|
movep->unlinkFrBackWithNext();
|
||||||
@@ -416,7 +415,7 @@ private:
|
|||||||
new AstConst(fl, 1)));
|
new AstConst(fl, 1)));
|
||||||
preUntilp->addNext(new AstAssign(fl, new AstVarRef(fl, countVarp, true),
|
preUntilp->addNext(new AstAssign(fl, new AstVarRef(fl, countVarp, true),
|
||||||
new AstConst(fl, 0)));
|
new AstConst(fl, 0)));
|
||||||
|
|
||||||
// Add stable variables & preinits
|
// Add stable variables & preinits
|
||||||
AstNode* setChglastp = NULL;
|
AstNode* setChglastp = NULL;
|
||||||
for (AstVarRef* varrefp = nodep->stablesp(); varrefp; varrefp=varrefp->nextp()->castVarRef()) {
|
for (AstVarRef* varrefp = nodep->stablesp(); varrefp; varrefp=varrefp->nextp()->castVarRef()) {
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
// $Id$ //-*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Clocking POS/NEGEDGE insertion
|
// DESCRIPTION: Verilator: Clocking POS/NEGEDGE insertion
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
|
|||||||
+4
-5
@@ -1,8 +1,7 @@
|
|||||||
// $Id$
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Combine common code into functions
|
// DESCRIPTION: Verilator: Combine common code into functions
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
@@ -19,7 +18,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// V3Combine's Transformations:
|
// V3Combine's Transformations:
|
||||||
//
|
//
|
||||||
// For every function that we spit out
|
// For every function that we spit out
|
||||||
// Examine code to find largest common blocks
|
// Examine code to find largest common blocks
|
||||||
// Hash each node depth first
|
// Hash each node depth first
|
||||||
@@ -32,7 +31,7 @@
|
|||||||
// Make new function
|
// Make new function
|
||||||
// Move common block to function
|
// Move common block to function
|
||||||
// Replace each common block ref with funccall
|
// Replace each common block ref with funccall
|
||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config_build.h"
|
#include "config_build.h"
|
||||||
@@ -392,7 +391,7 @@ private:
|
|||||||
m_hashed.clear();
|
m_hashed.clear();
|
||||||
// Compute hash of all statement trees in the function
|
// Compute hash of all statement trees in the function
|
||||||
m_state = STATE_HASH;
|
m_state = STATE_HASH;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_state = STATE_IDLE;
|
m_state = STATE_IDLE;
|
||||||
// Walk the hashes removing empty functions
|
// Walk the hashes removing empty functions
|
||||||
if (emptyFunctionDeletion()) {
|
if (emptyFunctionDeletion()) {
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
// $Id$ //-*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Combine common code into functions
|
// DESCRIPTION: Verilator: Combine common code into functions
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
|
|||||||
+121
-18
@@ -1,8 +1,7 @@
|
|||||||
// $Id$
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Constant folding
|
// DESCRIPTION: Verilator: Constant folding
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
@@ -39,18 +38,70 @@
|
|||||||
#include "V3Width.h"
|
#include "V3Width.h"
|
||||||
#include "V3Signed.h"
|
#include "V3Signed.h"
|
||||||
|
|
||||||
|
//######################################################################
|
||||||
|
// Utilities
|
||||||
|
|
||||||
|
class ConstVarMarkVisitor : public AstNVisitor {
|
||||||
|
// NODE STATE
|
||||||
|
// AstVar::userp -> bool, Var marked, 0=not set yet
|
||||||
|
private:
|
||||||
|
// VISITORS
|
||||||
|
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
||||||
|
if (nodep->varp()) nodep->varp()->user(1);
|
||||||
|
}
|
||||||
|
virtual void visit(AstNode* nodep, AstNUser*) {
|
||||||
|
nodep->iterateChildren(*this);
|
||||||
|
}
|
||||||
|
public:
|
||||||
|
// CONSTUCTORS
|
||||||
|
ConstVarMarkVisitor(AstNode* nodep) {
|
||||||
|
AstNode::userClearTree();
|
||||||
|
nodep->iterateAndNext(*this, NULL);
|
||||||
|
}
|
||||||
|
virtual ~ConstVarMarkVisitor() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
class ConstVarFindVisitor : public AstNVisitor {
|
||||||
|
// NODE STATE
|
||||||
|
// AstVar::userp -> bool, input from ConstVarMarkVisitor
|
||||||
|
// MEMBERS
|
||||||
|
bool m_found;
|
||||||
|
private:
|
||||||
|
// VISITORS
|
||||||
|
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
||||||
|
if (nodep->varp() && nodep->varp()->user()) m_found = true;
|
||||||
|
}
|
||||||
|
virtual void visit(AstNode* nodep, AstNUser*) {
|
||||||
|
nodep->iterateChildren(*this);
|
||||||
|
}
|
||||||
|
public:
|
||||||
|
// CONSTUCTORS
|
||||||
|
ConstVarFindVisitor(AstNode* nodep) {
|
||||||
|
m_found = false;
|
||||||
|
nodep->iterateAndNext(*this, NULL);
|
||||||
|
}
|
||||||
|
virtual ~ConstVarFindVisitor() {}
|
||||||
|
// METHODS
|
||||||
|
bool found() const { return m_found; }
|
||||||
|
};
|
||||||
|
|
||||||
//######################################################################
|
//######################################################################
|
||||||
// Const state, as a visitor of each AstNode
|
// Const state, as a visitor of each AstNode
|
||||||
|
|
||||||
class ConstVisitor : public AstNVisitor {
|
class ConstVisitor : public AstNVisitor {
|
||||||
private:
|
private:
|
||||||
|
// NODE STATE
|
||||||
|
// ** only when m_warn is set. If state is needed other times,
|
||||||
|
// ** must track down everywhere V3Const is called and make sure no overlaps.
|
||||||
|
// AstVar::userp -> Used by ConstVarMarkVisitor/ConstVarFindVisitor
|
||||||
|
|
||||||
// STATE
|
// STATE
|
||||||
bool m_params; // If true, propogate parameterized and true numbers only
|
bool m_params; // If true, propogate parameterized and true numbers only
|
||||||
bool m_required; // If true, must become a constant
|
bool m_required; // If true, must become a constant
|
||||||
bool m_wremove; // Inside scope, no assignw removal
|
bool m_wremove; // Inside scope, no assignw removal
|
||||||
bool m_warn; // Output warnings
|
bool m_warn; // Output warnings
|
||||||
bool m_cpp; // C++ conversions only
|
bool m_cpp; // C++ conversions only
|
||||||
AstModule* m_modp; // Current module
|
AstModule* m_modp; // Current module
|
||||||
AstNode* m_scopep; // Current scope
|
AstNode* m_scopep; // Current scope
|
||||||
//int debug() { return 9; }
|
//int debug() { return 9; }
|
||||||
|
|
||||||
@@ -91,7 +142,7 @@ private:
|
|||||||
}
|
}
|
||||||
bool operandIsTwo(AstNode* nodep) {
|
bool operandIsTwo(AstNode* nodep) {
|
||||||
return (nodep->castConst()
|
return (nodep->castConst()
|
||||||
&& nodep->width() <= VL_QUADSIZE
|
&& nodep->width() <= VL_QUADSIZE
|
||||||
&& nodep->castConst()->asQuad()==2);
|
&& nodep->castConst()->asQuad()==2);
|
||||||
}
|
}
|
||||||
bool operandIsTwostate(AstNode* nodep) {
|
bool operandIsTwostate(AstNode* nodep) {
|
||||||
@@ -494,10 +545,26 @@ private:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!m_cpp && nodep->lhsp()->castConcat()) {
|
else if (!m_cpp && nodep->lhsp()->castConcat()) {
|
||||||
UINFO(4," ASSI "<<nodep<<endl);
|
bool need_temp = false;
|
||||||
|
if (m_warn && !nodep->castAssignDly()) { // Is same var on LHS and RHS?
|
||||||
|
ConstVarMarkVisitor mark(nodep->lhsp());
|
||||||
|
ConstVarFindVisitor find(nodep->rhsp());
|
||||||
|
if (find.found()) need_temp = true;
|
||||||
|
}
|
||||||
|
if (need_temp) {
|
||||||
|
// The first time we constify, there may be the same variable on the LHS
|
||||||
|
// and RHS. In that case, we must use temporaries, or {a,b}={b,a} will break.
|
||||||
|
UINFO(4," ASSITEMP "<<nodep<<endl);
|
||||||
|
// ASSIGN(CONCAT(lc1,lc2),rhs) -> ASSIGN(temp1,SEL(rhs,{size})),
|
||||||
|
// ASSIGN(temp2,SEL(newrhs,{size}))
|
||||||
|
// ASSIGN(lc1,temp1),
|
||||||
|
// ASSIGN(lc2,temp2)
|
||||||
|
} else {
|
||||||
|
UINFO(4," ASSI "<<nodep<<endl);
|
||||||
|
// ASSIGN(CONCAT(lc1,lc2),rhs) -> ASSIGN(lc1,SEL(rhs,{size})),
|
||||||
|
// ASSIGN(lc2,SEL(newrhs,{size}))
|
||||||
|
}
|
||||||
if (debug()>=9) nodep->dumpTree(cout," Ass_old: ");
|
if (debug()>=9) nodep->dumpTree(cout," Ass_old: ");
|
||||||
// ASSIGN(CONCAT(lc1,lc2),rhs) -> ASSIGN(lc1,SEL(rhs,{size})),
|
|
||||||
// ASSIGN(lc2,SEL(newrhs,{size}))
|
|
||||||
// Unlink the stuff
|
// Unlink the stuff
|
||||||
AstNode* lc1p = nodep->lhsp()->castConcat()->lhsp()->unlinkFrBack();
|
AstNode* lc1p = nodep->lhsp()->castConcat()->lhsp()->unlinkFrBack();
|
||||||
AstNode* lc2p = nodep->lhsp()->castConcat()->rhsp()->unlinkFrBack();
|
AstNode* lc2p = nodep->lhsp()->castConcat()->rhsp()->unlinkFrBack();
|
||||||
@@ -517,14 +584,50 @@ private:
|
|||||||
sel2p->width(msb2-lsb2+1,msb2-lsb2+1);
|
sel2p->width(msb2-lsb2+1,msb2-lsb2+1);
|
||||||
// Make new assigns of same flavor as old one
|
// Make new assigns of same flavor as old one
|
||||||
//*** Not cloneTree; just one node.
|
//*** Not cloneTree; just one node.
|
||||||
AstNodeAssign* asn1p=nodep->cloneType(lc1p, sel1p)->castNodeAssign();
|
AstNode* newp = NULL;
|
||||||
AstNodeAssign* asn2p=nodep->cloneType(lc2p, sel2p)->castNodeAssign();
|
if (!need_temp) {
|
||||||
asn1p->width(msb1-lsb1+1,msb1-lsb1+1);
|
AstNodeAssign* asn1ap=nodep->cloneType(lc1p, sel1p)->castNodeAssign();
|
||||||
asn2p->width(msb2-lsb2+1,msb2-lsb2+1);
|
AstNodeAssign* asn2ap=nodep->cloneType(lc2p, sel2p)->castNodeAssign();
|
||||||
nodep->addNextHere(asn1p);
|
asn1ap->width(msb1-lsb1+1,msb1-lsb1+1);
|
||||||
nodep->addNextHere(asn2p);
|
asn2ap->width(msb2-lsb2+1,msb2-lsb2+1);
|
||||||
if (debug()>=9) asn1p->dumpTree(cout," _new: ");
|
newp = newp->addNext(asn1ap);
|
||||||
if (debug()>=9) asn2p->dumpTree(cout," _new: ");
|
newp = newp->addNext(asn2ap);
|
||||||
|
} else {
|
||||||
|
if (!m_modp) nodep->v3fatalSrc("Not under module");
|
||||||
|
// We could create just one temp variable, but we'll get better optimization
|
||||||
|
// if we make one per term.
|
||||||
|
string name1 = ((string)"__Vconcswap__"+cvtToStr(m_modp->varNumGetInc()));
|
||||||
|
string name2 = ((string)"__Vconcswap__"+cvtToStr(m_modp->varNumGetInc()));
|
||||||
|
AstVar* temp1p = new AstVar(sel1p->fileline(), AstVarType::BLOCKTEMP, name1,
|
||||||
|
new AstRange(sel1p->fileline(), msb1-lsb1, 0));
|
||||||
|
AstVar* temp2p = new AstVar(sel2p->fileline(), AstVarType::BLOCKTEMP, name2,
|
||||||
|
new AstRange(sel2p->fileline(), msb2-lsb2, 0));
|
||||||
|
m_modp->addStmtp(temp1p);
|
||||||
|
m_modp->addStmtp(temp2p);
|
||||||
|
AstNodeAssign* asn1ap=nodep->cloneType
|
||||||
|
(new AstVarRef(sel1p->fileline(), temp1p, true),
|
||||||
|
sel1p)->castNodeAssign();
|
||||||
|
AstNodeAssign* asn2ap=nodep->cloneType
|
||||||
|
(new AstVarRef(sel2p->fileline(), temp2p, true),
|
||||||
|
sel2p)->castNodeAssign();
|
||||||
|
AstNodeAssign* asn1bp=nodep->cloneType
|
||||||
|
(lc1p, new AstVarRef(sel1p->fileline(), temp1p, false))
|
||||||
|
->castNodeAssign();
|
||||||
|
AstNodeAssign* asn2bp=nodep->cloneType
|
||||||
|
(lc2p, new AstVarRef(sel2p->fileline(), temp2p, false))
|
||||||
|
->castNodeAssign();
|
||||||
|
asn1ap->width(msb1-lsb1+1,msb1-lsb1+1);
|
||||||
|
asn1bp->width(msb1-lsb1+1,msb1-lsb1+1);
|
||||||
|
asn2ap->width(msb2-lsb2+1,msb2-lsb2+1);
|
||||||
|
asn2bp->width(msb2-lsb2+1,msb2-lsb2+1);
|
||||||
|
// This order matters
|
||||||
|
newp = newp->addNext(asn1ap);
|
||||||
|
newp = newp->addNext(asn2ap);
|
||||||
|
newp = newp->addNext(asn1bp);
|
||||||
|
newp = newp->addNext(asn2bp);
|
||||||
|
}
|
||||||
|
if (debug()>=9) newp->dumpTreeAndNext(cout," _new: ");
|
||||||
|
nodep->addNextHere(newp);
|
||||||
// Cleanup
|
// Cleanup
|
||||||
nodep->unlinkFrBack()->deleteTree(); nodep=NULL;
|
nodep->unlinkFrBack()->deleteTree(); nodep=NULL;
|
||||||
conp->deleteTree(); conp=NULL;
|
conp->deleteTree(); conp=NULL;
|
||||||
@@ -641,7 +744,7 @@ private:
|
|||||||
// Recurse rather then calling node->iterate to prevent 2^n recursion!
|
// Recurse rather then calling node->iterate to prevent 2^n recursion!
|
||||||
if (operandConcatMove(abConcp)) moveConcat(abConcp);
|
if (operandConcatMove(abConcp)) moveConcat(abConcp);
|
||||||
bcConcp->deleteTree(); bcConcp=NULL;
|
bcConcp->deleteTree(); bcConcp=NULL;
|
||||||
} else {
|
} else {
|
||||||
AstConcat* abConcp = nodep->lhsp()->castConcat(); abConcp->unlinkFrBack();
|
AstConcat* abConcp = nodep->lhsp()->castConcat(); abConcp->unlinkFrBack();
|
||||||
AstNode* ap = abConcp->lhsp()->unlinkFrBack();
|
AstNode* ap = abConcp->lhsp()->unlinkFrBack();
|
||||||
AstNode* bp = abConcp->rhsp()->unlinkFrBack();
|
AstNode* bp = abConcp->rhsp()->unlinkFrBack();
|
||||||
@@ -913,7 +1016,7 @@ private:
|
|||||||
&& nodep->ifsp() && nodep->elsesp()) {
|
&& nodep->ifsp() && nodep->elsesp()) {
|
||||||
UINFO(4,"IF(NOT {x}) => IF(x) swapped if/else"<<nodep<<endl);
|
UINFO(4,"IF(NOT {x}) => IF(x) swapped if/else"<<nodep<<endl);
|
||||||
AstNode* condp = nodep->condp()->castNot()->lhsp()->unlinkFrBackWithNext();
|
AstNode* condp = nodep->condp()->castNot()->lhsp()->unlinkFrBackWithNext();
|
||||||
AstNode* ifsp = nodep->ifsp()->unlinkFrBackWithNext();
|
AstNode* ifsp = nodep->ifsp()->unlinkFrBackWithNext();
|
||||||
AstNode* elsesp = nodep->elsesp()->unlinkFrBackWithNext();
|
AstNode* elsesp = nodep->elsesp()->unlinkFrBackWithNext();
|
||||||
AstIf* ifp = new AstIf(nodep->fileline(), condp, elsesp, ifsp);
|
AstIf* ifp = new AstIf(nodep->fileline(), condp, elsesp, ifsp);
|
||||||
ifp->branchPred(nodep->branchPred().invert());
|
ifp->branchPred(nodep->branchPred().invert());
|
||||||
@@ -934,7 +1037,7 @@ private:
|
|||||||
nodep->deleteTree(); nodep=NULL;
|
nodep->deleteTree(); nodep=NULL;
|
||||||
}
|
}
|
||||||
else if (0 // Disabled, as vpm assertions are faster without due to short-circuiting
|
else if (0 // Disabled, as vpm assertions are faster without due to short-circuiting
|
||||||
&& operandIfIf(nodep)) {
|
&& operandIfIf(nodep)) {
|
||||||
UINFO(0,"IF({a}) IF({b}) => IF({a} && {b})"<<endl);
|
UINFO(0,"IF({a}) IF({b}) => IF({a} && {b})"<<endl);
|
||||||
AstNodeIf* lowerIfp = nodep->ifsp()->castNodeIf();
|
AstNodeIf* lowerIfp = nodep->ifsp()->castNodeIf();
|
||||||
AstNode* condp = nodep->condp()->unlinkFrBack();
|
AstNode* condp = nodep->condp()->unlinkFrBack();
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
// $Id$ //-*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Propagate constants across AST
|
// DESCRIPTION: Verilator: Propagate constants across AST
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
|
|||||||
+3
-4
@@ -1,8 +1,7 @@
|
|||||||
// $Id$
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Netlist (top level) functions
|
// DESCRIPTION: Verilator: Netlist (top level) functions
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
@@ -53,7 +52,7 @@ private:
|
|||||||
bool m_checkBlock; // Should this block get covered?
|
bool m_checkBlock; // Should this block get covered?
|
||||||
AstModule* m_modp; // Current module to add statement to
|
AstModule* m_modp; // Current module to add statement to
|
||||||
FileMap m_fileps; // Column counts for each fileline
|
FileMap m_fileps; // Column counts for each fileline
|
||||||
|
|
||||||
//int debug() { return 9; }
|
//int debug() { return 9; }
|
||||||
|
|
||||||
// METHODS
|
// METHODS
|
||||||
@@ -66,7 +65,7 @@ private:
|
|||||||
column = (it->second)++;
|
column = (it->second)++;
|
||||||
}
|
}
|
||||||
|
|
||||||
AstCoverDecl* declp = new AstCoverDecl(fl, column, type, comment);
|
AstCoverDecl* declp = new AstCoverDecl(fl, column, type, comment);
|
||||||
m_modp->addStmtp(declp);
|
m_modp->addStmtp(declp);
|
||||||
|
|
||||||
return new AstCoverInc(fl, declp);
|
return new AstCoverInc(fl, declp);
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
// $Id$ //-*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Coverage modules/signals together
|
// DESCRIPTION: Verilator: Coverage modules/signals together
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
|
|||||||
+2
-3
@@ -1,8 +1,7 @@
|
|||||||
// $Id$
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Dead code elimination
|
// DESCRIPTION: Verilator: Dead code elimination
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
@@ -21,7 +20,7 @@
|
|||||||
// DEAD TRANSFORMATIONS:
|
// DEAD TRANSFORMATIONS:
|
||||||
// Remove any unreferenced modules
|
// Remove any unreferenced modules
|
||||||
// Remove any unreferenced variables
|
// Remove any unreferenced variables
|
||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config_build.h"
|
#include "config_build.h"
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
// $Id$ //-*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Dead branch elimination
|
// DESCRIPTION: Verilator: Dead branch elimination
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
|
|||||||
+7
-8
@@ -1,8 +1,7 @@
|
|||||||
// $Id$
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Add temporaries, such as for delayed nodes
|
// DESCRIPTION: Verilator: Add temporaries, such as for delayed nodes
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
@@ -19,9 +18,9 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// V3Delayed's Transformations:
|
// V3Delayed's Transformations:
|
||||||
//
|
//
|
||||||
// Each module:
|
// Each module:
|
||||||
// Replace ASSIGNDLY var, exp
|
// Replace ASSIGNDLY var, exp
|
||||||
// With ASSIGNDLY newvar, exp
|
// With ASSIGNDLY newvar, exp
|
||||||
// At top of block: VAR newvar
|
// At top of block: VAR newvar
|
||||||
// At bottom of block: ASSIGNW var newvar
|
// At bottom of block: ASSIGNW var newvar
|
||||||
@@ -269,7 +268,7 @@ private:
|
|||||||
AstAlwaysPost* finalp = varrefp->varScopep()->user4p()->castNode()->castAlwaysPost();
|
AstAlwaysPost* finalp = varrefp->varScopep()->user4p()->castNode()->castAlwaysPost();
|
||||||
if (!finalp) {
|
if (!finalp) {
|
||||||
finalp = new AstAlwaysPost(nodep->fileline(), NULL/*sens*/, NULL/*body*/);
|
finalp = new AstAlwaysPost(nodep->fileline(), NULL/*sens*/, NULL/*body*/);
|
||||||
UINFO(9," Created "<<finalp<<endl);
|
UINFO(9," Created "<<finalp<<endl);
|
||||||
m_activep->addStmtsp(finalp);
|
m_activep->addStmtsp(finalp);
|
||||||
varrefp->varScopep()->user4p(finalp);
|
varrefp->varScopep()->user4p(finalp);
|
||||||
}
|
}
|
||||||
@@ -284,7 +283,7 @@ private:
|
|||||||
new AstVarRef(nodep->fileline(), setvscp, false),
|
new AstVarRef(nodep->fileline(), setvscp, false),
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
UINFO(9," Created "<<postLogicp<<endl);
|
UINFO(9," Created "<<postLogicp<<endl);
|
||||||
finalp->addBodysp(postLogicp);
|
finalp->addBodysp(postLogicp);
|
||||||
finalp->user5p(setvscp); // Remember IF's vset variable
|
finalp->user5p(setvscp); // Remember IF's vset variable
|
||||||
finalp->user4p(postLogicp); // and the associated IF, as we may be able to reuse it
|
finalp->user4p(postLogicp); // and the associated IF, as we may be able to reuse it
|
||||||
@@ -347,7 +346,7 @@ private:
|
|||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
||||||
if (!nodep->user2()) { // Not done yet
|
if (!nodep->user2()) { // Not done yet
|
||||||
nodep->user2(true);
|
nodep->user2(true);
|
||||||
|
|
||||||
if (m_inDly && nodep->lvalue()) {
|
if (m_inDly && nodep->lvalue()) {
|
||||||
UINFO(4,"AssignDlyVar: "<<nodep<<endl);
|
UINFO(4,"AssignDlyVar: "<<nodep<<endl);
|
||||||
markVarUsage(nodep->varp(), VU_DLY);
|
markVarUsage(nodep->varp(), VU_DLY);
|
||||||
@@ -401,7 +400,7 @@ private:
|
|||||||
m_activep->sensesp());
|
m_activep->sensesp());
|
||||||
newactp->addStmtsp(prep); // Add to FRONT of statements
|
newactp->addStmtsp(prep); // Add to FRONT of statements
|
||||||
newactp->addStmtsp(postp);
|
newactp->addStmtsp(postp);
|
||||||
m_activep->addNext(newactp);
|
m_activep->addNext(newactp);
|
||||||
dlyvscp->user2p(newactp);
|
dlyvscp->user2p(newactp);
|
||||||
}
|
}
|
||||||
AstVarRef* newrefp = new AstVarRef(nodep->fileline(), dlyvscp, true);
|
AstVarRef* newrefp = new AstVarRef(nodep->fileline(), dlyvscp, true);
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
// $Id$ //-*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Pre C-Emit stage changes
|
// DESCRIPTION: Verilator: Pre C-Emit stage changes
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
|
|||||||
+3
-4
@@ -1,8 +1,7 @@
|
|||||||
// $Id$
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Prevent very deep expressions
|
// DESCRIPTION: Verilator: Prevent very deep expressions
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
@@ -19,7 +18,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// V3Depth's Transformations:
|
// V3Depth's Transformations:
|
||||||
//
|
//
|
||||||
// Each module:
|
// Each module:
|
||||||
// For each wide OP, assign a temporary variable.
|
// For each wide OP, assign a temporary variable.
|
||||||
// For each deep expression, assign expression to temporary.
|
// For each deep expression, assign expression to temporary.
|
||||||
@@ -111,7 +110,7 @@ private:
|
|||||||
// We have some operator defines that use 2 parens, so += 2.
|
// We have some operator defines that use 2 parens, so += 2.
|
||||||
m_depth += 2;
|
m_depth += 2;
|
||||||
if (m_depth>m_maxdepth) m_maxdepth=m_depth;
|
if (m_depth>m_maxdepth) m_maxdepth=m_depth;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_depth -= 2;
|
m_depth -= 2;
|
||||||
|
|
||||||
if (m_stmtp
|
if (m_stmtp
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
// $Id$ //-*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Prevent very deep expressions
|
// DESCRIPTION: Verilator: Prevent very deep expressions
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
// $Id$
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Prevent very deep expressions
|
// DESCRIPTION: Verilator: Prevent very deep expressions
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
@@ -19,7 +18,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// V3DepthBlock's Transformations:
|
// V3DepthBlock's Transformations:
|
||||||
//
|
//
|
||||||
// Each module:
|
// Each module:
|
||||||
// For each deep block, create cfunc including that block.
|
// For each deep block, create cfunc including that block.
|
||||||
//
|
//
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
// $Id$ //-*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Prevent very deep expressions
|
// DESCRIPTION: Verilator: Prevent very deep expressions
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
|
|||||||
+2
-3
@@ -1,8 +1,7 @@
|
|||||||
// $Id$
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Rename scope references to module-local references
|
// DESCRIPTION: Verilator: Rename scope references to module-local references
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
@@ -24,7 +23,7 @@
|
|||||||
// Change varref name() to be relative to current module
|
// Change varref name() to be relative to current module
|
||||||
// Remove varScopep()
|
// Remove varScopep()
|
||||||
// This allows for better V3Combine'ing.
|
// This allows for better V3Combine'ing.
|
||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config_build.h"
|
#include "config_build.h"
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
// $Id$ //-*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Rename scope references to module-local references
|
// DESCRIPTION: Verilator: Rename scope references to module-local references
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
|
|||||||
+9
-12
@@ -1,8 +1,7 @@
|
|||||||
// $Id$
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Emit C++ for tree
|
// DESCRIPTION: Verilator: Emit C++ for tree
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
@@ -80,9 +79,9 @@ public:
|
|||||||
|
|
||||||
// METHODS
|
// METHODS
|
||||||
void displayEmit(AstDisplay* nodep);
|
void displayEmit(AstDisplay* nodep);
|
||||||
string displayFormat(AstNode* widthNode, string in,
|
string displayFormat(AstNode* widthNode, string in,
|
||||||
char fmtLetter, bool padZero, bool reallyString);
|
char fmtLetter, bool padZero, bool reallyString);
|
||||||
void displayArg(AstDisplay* dispp, AstNode** elistp, string fmt, char fmtLetter);
|
void displayArg(AstDisplay* dispp, AstNode** elistp, string fmt, char fmtLetter);
|
||||||
|
|
||||||
void emitVarDecl(AstVar* nodep, const string& prefixIfImp);
|
void emitVarDecl(AstVar* nodep, const string& prefixIfImp);
|
||||||
typedef enum {EVL_IO, EVL_SIG, EVL_TEMP, EVL_STATIC, EVL_ALL} EisWhich;
|
typedef enum {EVL_IO, EVL_SIG, EVL_TEMP, EVL_STATIC, EVL_ALL} EisWhich;
|
||||||
@@ -212,7 +211,7 @@ public:
|
|||||||
}
|
}
|
||||||
virtual void visit(AstCoverDecl* nodep, AstNUser*) {
|
virtual void visit(AstCoverDecl* nodep, AstNUser*) {
|
||||||
puts("__vlCoverInsert("); // As Declared in emitCoverageDecl
|
puts("__vlCoverInsert("); // As Declared in emitCoverageDecl
|
||||||
puts("&__Vcoverage[");
|
puts("&__Vcoverage[");
|
||||||
puts(cvtToStr(m_coverIds.remap(nodep))); puts("]");
|
puts(cvtToStr(m_coverIds.remap(nodep))); puts("]");
|
||||||
puts(", \""); puts(nodep->fileline()->filebasename()); puts("\"");
|
puts(", \""); puts(nodep->fileline()->filebasename()); puts("\"");
|
||||||
puts(", "); puts(cvtToStr(nodep->fileline()->lineno()));
|
puts(", "); puts(cvtToStr(nodep->fileline()->lineno()));
|
||||||
@@ -458,7 +457,7 @@ public:
|
|||||||
// Terminals
|
// Terminals
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
||||||
puts(nodep->hiername());
|
puts(nodep->hiername());
|
||||||
puts(nodep->varp()->name());
|
puts(nodep->varp()->name());
|
||||||
}
|
}
|
||||||
void emitConstant(AstConst* nodep, AstVarRef* assigntop, const string& assignString) {
|
void emitConstant(AstConst* nodep, AstVarRef* assigntop, const string& assignString) {
|
||||||
// Put out constant set to the specified variable, or given variable in a string
|
// Put out constant set to the specified variable, or given variable in a string
|
||||||
@@ -639,7 +638,7 @@ class EmitCImp : EmitCStmts {
|
|||||||
puts(modClassName(m_modp)+"::"+nodep->name()
|
puts(modClassName(m_modp)+"::"+nodep->name()
|
||||||
+"("+cFuncArgs(nodep)+") {\n");
|
+"("+cFuncArgs(nodep)+") {\n");
|
||||||
|
|
||||||
puts("VL_DEBUG_IF(cout<<\" ");
|
puts("VL_DEBUG_IF(cout<<\" ");
|
||||||
for (int i=0;i<m_modp->level();i++) { puts(" "); }
|
for (int i=0;i<m_modp->level();i++) { puts(" "); }
|
||||||
puts(modClassName(m_modp)+"::"+nodep->name()
|
puts(modClassName(m_modp)+"::"+nodep->name()
|
||||||
+"\"<<endl; );\n");
|
+"\"<<endl; );\n");
|
||||||
@@ -1027,10 +1026,8 @@ void EmitCStmts::visit(AstDisplay* nodep, AstNUser*) {
|
|||||||
emitDispState.clear();
|
emitDispState.clear();
|
||||||
string fmt = "";
|
string fmt = "";
|
||||||
string::iterator pos = vformat.begin();
|
string::iterator pos = vformat.begin();
|
||||||
if (*pos == '"') pos++;
|
|
||||||
bool inPct = false;
|
bool inPct = false;
|
||||||
for (; pos != vformat.end(); ++pos) {
|
for (; pos != vformat.end(); ++pos) {
|
||||||
if (pos[0]=='"' && (pos+1)==vformat.end()) break;
|
|
||||||
if (inPct && pos[0]=='%') {
|
if (inPct && pos[0]=='%') {
|
||||||
emitDispState.pushFormat("%%"); // We're printf'ing it, so need to quote the %
|
emitDispState.pushFormat("%%"); // We're printf'ing it, so need to quote the %
|
||||||
inPct = false;
|
inPct = false;
|
||||||
@@ -1680,7 +1677,7 @@ void EmitCImp::main(AstModule* modp, bool slow, bool fast) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
emitImp (modp);
|
emitImp (modp);
|
||||||
|
|
||||||
for (AstNode* nodep=modp->stmtsp(); nodep; nodep = nodep->nextp()) {
|
for (AstNode* nodep=modp->stmtsp(); nodep; nodep = nodep->nextp()) {
|
||||||
if (AstCFunc* funcp = nodep->castCFunc()) {
|
if (AstCFunc* funcp = nodep->castCFunc()) {
|
||||||
if (v3Global.opt.outputSplit() > 1 && splitSize()
|
if (v3Global.opt.outputSplit() > 1 && splitSize()
|
||||||
@@ -1741,7 +1738,7 @@ class EmitCTrace : EmitCStmts {
|
|||||||
puts("if (!Verilated::calcUnusedSigs()) vl_fatal(__FILE__,__LINE__,__FILE__,\"Turning on wave traces requires Verilated::traceEverOn(true) call before time 0.\");\n");
|
puts("if (!Verilated::calcUnusedSigs()) vl_fatal(__FILE__,__LINE__,__FILE__,\"Turning on wave traces requires Verilated::traceEverOn(true) call before time 0.\");\n");
|
||||||
puts("t->traceInitThis (vlSymsp, vcdp, code);\n");
|
puts("t->traceInitThis (vlSymsp, vcdp, code);\n");
|
||||||
puts("}\n");
|
puts("}\n");
|
||||||
|
|
||||||
puts("void "+topClassName()+"::traceFull(SpTraceVcd* vcdp, void* userthis, uint32_t code) {\n");
|
puts("void "+topClassName()+"::traceFull(SpTraceVcd* vcdp, void* userthis, uint32_t code) {\n");
|
||||||
puts("// Callback from vcd->dump()\n");
|
puts("// Callback from vcd->dump()\n");
|
||||||
puts(topClassName()+"* t=("+topClassName()+"*)userthis;\n");
|
puts(topClassName()+"* t=("+topClassName()+"*)userthis;\n");
|
||||||
@@ -1911,7 +1908,7 @@ class EmitCTrace : EmitCStmts {
|
|||||||
}
|
}
|
||||||
virtual void visit(AstCoverInc* nodep, AstNUser*) {
|
virtual void visit(AstCoverInc* nodep, AstNUser*) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
EmitCTrace(bool slow) {
|
EmitCTrace(bool slow) {
|
||||||
m_funcp = NULL;
|
m_funcp = NULL;
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
// $Id$ //-*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Emit C++ code for module tree
|
// DESCRIPTION: Verilator: Emit C++ code for module tree
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
// $Id$ -*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Emit C++ for tree
|
// DESCRIPTION: Verilator: Emit C++ for tree
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
// $Id$
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Emit C++ for tree
|
// DESCRIPTION: Verilator: Emit C++ for tree
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
|
|||||||
+2
-3
@@ -1,8 +1,7 @@
|
|||||||
// $Id$
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Emit C++ for tree
|
// DESCRIPTION: Verilator: Emit C++ for tree
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
@@ -68,7 +67,7 @@ class EmitCSyms : EmitCBaseVisitor {
|
|||||||
virtual void visit(AstNetlist* nodep, AstNUser*) {
|
virtual void visit(AstNetlist* nodep, AstNUser*) {
|
||||||
// Collect list of scopes
|
// Collect list of scopes
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
|
|
||||||
// Sort m_scopes by scope name
|
// Sort m_scopes by scope name
|
||||||
sort(m_scopes.begin(), m_scopes.end(), CmpName());
|
sort(m_scopes.begin(), m_scopes.end(), CmpName());
|
||||||
// Output
|
// Output
|
||||||
|
|||||||
+5
-6
@@ -1,8 +1,7 @@
|
|||||||
// $Id$
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Emit Makefile
|
// DESCRIPTION: Verilator: Emit Makefile
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
@@ -79,16 +78,16 @@ public:
|
|||||||
of.puts("default: "+v3Global.opt.prefix()+"__ALL.a\n");
|
of.puts("default: "+v3Global.opt.prefix()+"__ALL.a\n");
|
||||||
}
|
}
|
||||||
of.puts("\n# Constants...\n");
|
of.puts("\n# Constants...\n");
|
||||||
of.puts("PERL = "+V3Options::getenvStr("PERL","perl")+"\n");
|
of.puts("PERL = "+V3Options::getenvPERL()+"\n");
|
||||||
of.puts("VERILATOR_ROOT = "+V3Options::getenvStr("VERILATOR_ROOT","")+"\n");
|
of.puts("VERILATOR_ROOT = "+V3Options::getenvVERILATOR_ROOT()+"\n");
|
||||||
of.puts("SYSTEMPERL = "+V3Options::getenvStr("SYSTEMPERL","")+"\n");
|
of.puts("SYSTEMPERL = "+V3Options::getenvSYSTEMPERL()+"\n");
|
||||||
|
|
||||||
of.puts("\n# Switches...\n");
|
of.puts("\n# Switches...\n");
|
||||||
of.puts(string("VM_SP = ")+(v3Global.opt.systemPerl()?"1":"0")+"\n");
|
of.puts(string("VM_SP = ")+(v3Global.opt.systemPerl()?"1":"0")+"\n");
|
||||||
of.puts(string("VM_SC = ")+((v3Global.opt.systemC()&&!v3Global.opt.systemPerl())?"1":"0")+"\n");
|
of.puts(string("VM_SC = ")+((v3Global.opt.systemC()&&!v3Global.opt.systemPerl())?"1":"0")+"\n");
|
||||||
of.puts(string("VM_SP_OR_SC = ")+(v3Global.opt.systemC()?"1":"0")+"\n");
|
of.puts(string("VM_SP_OR_SC = ")+(v3Global.opt.systemC()?"1":"0")+"\n");
|
||||||
of.puts(string("VM_PCLI = ")+(v3Global.opt.systemC()?"0":"1")+"\n");
|
of.puts(string("VM_PCLI = ")+(v3Global.opt.systemC()?"0":"1")+"\n");
|
||||||
of.puts(string("VM_SC_TARGET_ARCH = ")+V3Options::getenvStr("SYSTEMC_ARCH","")+"\n");
|
of.puts(string("VM_SC_TARGET_ARCH = ")+V3Options::getenvSYSTEMC_ARCH()+"\n");
|
||||||
|
|
||||||
of.puts("\n# Vars...\n");
|
of.puts("\n# Vars...\n");
|
||||||
of.puts(string("VM_PREFIX = ")+v3Global.opt.prefix()+"\n");
|
of.puts(string("VM_PREFIX = ")+v3Global.opt.prefix()+"\n");
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
// $Id$ //-*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Emit Makefile
|
// DESCRIPTION: Verilator: Emit Makefile
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
|
|||||||
+3
-4
@@ -1,8 +1,7 @@
|
|||||||
// $Id$
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Emit Verilog from tree
|
// DESCRIPTION: Verilator: Emit Verilog from tree
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
@@ -368,12 +367,12 @@ public:
|
|||||||
// Terminals
|
// Terminals
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
||||||
puts(nodep->hiername());
|
puts(nodep->hiername());
|
||||||
puts(nodep->varp()->name());
|
puts(nodep->varp()->name());
|
||||||
}
|
}
|
||||||
virtual void visit(AstVarXRef* nodep, AstNUser*) {
|
virtual void visit(AstVarXRef* nodep, AstNUser*) {
|
||||||
puts(nodep->dotted());
|
puts(nodep->dotted());
|
||||||
puts(".");
|
puts(".");
|
||||||
puts(nodep->varp()->name());
|
puts(nodep->varp()->name());
|
||||||
}
|
}
|
||||||
virtual void visit(AstConst* nodep, AstNUser*) {
|
virtual void visit(AstConst* nodep, AstNUser*) {
|
||||||
puts(nodep->num().ascii(true,true));
|
puts(nodep->num().ascii(true,true));
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
// $Id$ //-*- C++ -*-
|
//-*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Emit Verilog code for module tree
|
// DESCRIPTION: Verilator: Emit Verilog code for module tree
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
|
|||||||
+6
-7
@@ -1,8 +1,7 @@
|
|||||||
// $Id$
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Error handling
|
// DESCRIPTION: Verilator: Error handling
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
@@ -21,7 +20,7 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <cstring>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include "V3Error.h"
|
#include "V3Error.h"
|
||||||
#ifndef _V3ERROR_NO_GLOBAL_
|
#ifndef _V3ERROR_NO_GLOBAL_
|
||||||
@@ -47,7 +46,7 @@ bool V3Error::s_pretendError[V3ErrorCode::MAX];
|
|||||||
struct v3errorIniter {
|
struct v3errorIniter {
|
||||||
v3errorIniter() { V3Error::init(); };
|
v3errorIniter() { V3Error::init(); };
|
||||||
};
|
};
|
||||||
v3errorIniter v3errorInit;
|
v3errorIniter v3errorInit;
|
||||||
|
|
||||||
//######################################################################
|
//######################################################################
|
||||||
// ErrorCode class functions
|
// ErrorCode class functions
|
||||||
@@ -203,7 +202,7 @@ void FileLine::deleteAllRemaining() {
|
|||||||
while (1) {
|
while (1) {
|
||||||
FileLineCheckSet::iterator it=fileLineLeakChecks.begin();
|
FileLineCheckSet::iterator it=fileLineLeakChecks.begin();
|
||||||
if (it==fileLineLeakChecks.end()) break;
|
if (it==fileLineLeakChecks.end()) break;
|
||||||
delete *it;
|
delete *it;
|
||||||
// Operator delete will remove the iterated object from the list.
|
// Operator delete will remove the iterated object from the list.
|
||||||
// Eventually the list will be empty and terminate the loop.
|
// Eventually the list will be empty and terminate the loop.
|
||||||
}
|
}
|
||||||
@@ -243,8 +242,8 @@ void V3Error::incWarnings() {
|
|||||||
|
|
||||||
void V3Error::incErrors() {
|
void V3Error::incErrors() {
|
||||||
s_errCount++;
|
s_errCount++;
|
||||||
if (errorCount() == MAX_ERRORS) { // Not >= as would otherwise recurse
|
if (errorCount() == v3Global.opt.errorLimit()) { // Not >= as would otherwise recurse
|
||||||
v3fatal ("Exiting due to too many errors encountered\n");
|
v3fatal ("Exiting due to too many errors encountered; --error-limit="<<errorCount()<<endl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-4
@@ -1,8 +1,8 @@
|
|||||||
// $Id$ //-*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Error handling
|
// DESCRIPTION: Verilator: Error handling
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
@@ -53,6 +53,7 @@ public:
|
|||||||
IMPLICIT, // Implicit wire
|
IMPLICIT, // Implicit wire
|
||||||
IMPURE, // Impure function not being inlined
|
IMPURE, // Impure function not being inlined
|
||||||
MULTIDRIVEN, // Driven from multiple blocks
|
MULTIDRIVEN, // Driven from multiple blocks
|
||||||
|
REDEFMACRO, // Redefining existing define macro
|
||||||
UNDRIVEN, // No drivers
|
UNDRIVEN, // No drivers
|
||||||
UNOPT, // Unoptimizable block
|
UNOPT, // Unoptimizable block
|
||||||
UNOPTFLAT, // Unoptimizable block after flattening
|
UNOPTFLAT, // Unoptimizable block after flattening
|
||||||
@@ -60,6 +61,7 @@ public:
|
|||||||
UNUSED, // No receivers
|
UNUSED, // No receivers
|
||||||
VARHIDDEN, // Hiding variable
|
VARHIDDEN, // Hiding variable
|
||||||
WIDTH, // Width mismatch
|
WIDTH, // Width mismatch
|
||||||
|
WIDTHCONCAT, // Unsized numbers/parameters in concatenations
|
||||||
MAX
|
MAX
|
||||||
// ***Add new elements below also***
|
// ***Add new elements below also***
|
||||||
};
|
};
|
||||||
@@ -78,9 +80,9 @@ public:
|
|||||||
"BLKANDNBLK",
|
"BLKANDNBLK",
|
||||||
"CASEINCOMPLETE", "CASEOVERLAP", "CASEX", "CMPCONST",
|
"CASEINCOMPLETE", "CASEOVERLAP", "CASEX", "CMPCONST",
|
||||||
"COMBDLY", "STMTDLY", "GENCLK", "IMPLICIT", "IMPURE",
|
"COMBDLY", "STMTDLY", "GENCLK", "IMPLICIT", "IMPURE",
|
||||||
"MULTIDRIVEN",
|
"MULTIDRIVEN", "REDEFMACRO",
|
||||||
"UNDRIVEN", "UNOPT", "UNOPTFLAT", "UNSIGNED", "UNUSED",
|
"UNDRIVEN", "UNOPT", "UNOPTFLAT", "UNSIGNED", "UNUSED",
|
||||||
"VARHIDDEN", "WIDTH",
|
"VARHIDDEN", "WIDTH", "WIDTHCONCAT",
|
||||||
" MAX"
|
" MAX"
|
||||||
};
|
};
|
||||||
return names[m_e];
|
return names[m_e];
|
||||||
|
|||||||
+17
-18
@@ -1,8 +1,7 @@
|
|||||||
// $Id$
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Add temporaries, such as for expand nodes
|
// DESCRIPTION: Verilator: Add temporaries, such as for expand nodes
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
@@ -19,7 +18,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// V3Expand's Transformations:
|
// V3Expand's Transformations:
|
||||||
//
|
//
|
||||||
// Each module:
|
// Each module:
|
||||||
// Expand verilated.h macros into internal micro optimizations (RTL)
|
// Expand verilated.h macros into internal micro optimizations (RTL)
|
||||||
// this will enable later optimizations.
|
// this will enable later optimizations.
|
||||||
@@ -168,7 +167,7 @@ private:
|
|||||||
}
|
}
|
||||||
return newp;
|
return newp;
|
||||||
}
|
}
|
||||||
|
|
||||||
AstNode* newSelBitWord(AstNode* lsbp, int wordAdder) {
|
AstNode* newSelBitWord(AstNode* lsbp, int wordAdder) {
|
||||||
// Return equation to get the VL_BITWORD of a constant or non-constant
|
// Return equation to get the VL_BITWORD of a constant or non-constant
|
||||||
if (lsbp->castConst()) {
|
if (lsbp->castConst()) {
|
||||||
@@ -355,7 +354,7 @@ private:
|
|||||||
AstNode* lowwordp = new AstWordSel (nodep->fromp()->fileline(),
|
AstNode* lowwordp = new AstWordSel (nodep->fromp()->fileline(),
|
||||||
nodep->fromp()->cloneTree(true),
|
nodep->fromp()->cloneTree(true),
|
||||||
newSelBitWord(nodep->lsbp(), 0));
|
newSelBitWord(nodep->lsbp(), 0));
|
||||||
if (nodep->isQuad() && !lowwordp->isQuad()) lowwordp = new AstCast(nodep->fileline(), lowwordp, nodep);
|
if (nodep->isQuad() && !lowwordp->isQuad()) lowwordp = new AstCast(nodep->fileline(), lowwordp, nodep);
|
||||||
AstNode* lowp = new AstShiftR (nodep->fileline(),
|
AstNode* lowp = new AstShiftR (nodep->fileline(),
|
||||||
lowwordp,
|
lowwordp,
|
||||||
newSelBitBit(nodep->lsbp()),
|
newSelBitBit(nodep->lsbp()),
|
||||||
@@ -368,7 +367,7 @@ private:
|
|||||||
new AstWordSel (nodep->fromp()->fileline(),
|
new AstWordSel (nodep->fromp()->fileline(),
|
||||||
nodep->fromp()->cloneTree(true),
|
nodep->fromp()->cloneTree(true),
|
||||||
newSelBitWord(nodep->lsbp(), 1));
|
newSelBitWord(nodep->lsbp(), 1));
|
||||||
if (nodep->isQuad() && !midwordp->isQuad()) midwordp = new AstCast(nodep->fileline(), midwordp, nodep);
|
if (nodep->isQuad() && !midwordp->isQuad()) midwordp = new AstCast(nodep->fileline(), midwordp, nodep);
|
||||||
// If we're selecting bit zero, then all 32 bits in word 1 get shifted << by 32 bits
|
// If we're selecting bit zero, then all 32 bits in word 1 get shifted << by 32 bits
|
||||||
// else we need to form the lower word, so we << by 31 or less
|
// else we need to form the lower word, so we << by 31 or less
|
||||||
// nbitsfromlow <= (lsb==0) ? 64-bitbit(lsb) : 32-bitbit(lsb)
|
// nbitsfromlow <= (lsb==0) ? 64-bitbit(lsb) : 32-bitbit(lsb)
|
||||||
@@ -406,7 +405,7 @@ private:
|
|||||||
new AstWordSel (nodep->fromp()->fileline(),
|
new AstWordSel (nodep->fromp()->fileline(),
|
||||||
nodep->fromp()->cloneTree(true),
|
nodep->fromp()->cloneTree(true),
|
||||||
newSelBitWord(nodep->lsbp(), 2));
|
newSelBitWord(nodep->lsbp(), 2));
|
||||||
if (nodep->isQuad() && !hiwordp->isQuad()) hiwordp = new AstCast(nodep->fileline(), hiwordp, nodep);
|
if (nodep->isQuad() && !hiwordp->isQuad()) hiwordp = new AstCast(nodep->fileline(), hiwordp, nodep);
|
||||||
AstNode* himayp =
|
AstNode* himayp =
|
||||||
new AstShiftL (nodep->fileline(),
|
new AstShiftL (nodep->fileline(),
|
||||||
hiwordp,
|
hiwordp,
|
||||||
@@ -434,7 +433,7 @@ private:
|
|||||||
UINFO(8," SEL->SHIFT "<<nodep<<endl);
|
UINFO(8," SEL->SHIFT "<<nodep<<endl);
|
||||||
AstNode* fromp = nodep->fromp()->unlinkFrBack();
|
AstNode* fromp = nodep->fromp()->unlinkFrBack();
|
||||||
AstNode* lsbp = nodep->lsbp()->unlinkFrBack();
|
AstNode* lsbp = nodep->lsbp()->unlinkFrBack();
|
||||||
if (nodep->isQuad() && !fromp->isQuad()) fromp = new AstCast(nodep->fileline(), fromp, nodep);
|
if (nodep->isQuad() && !fromp->isQuad()) fromp = new AstCast(nodep->fileline(), fromp, nodep);
|
||||||
AstNode* newp = new AstShiftR (nodep->fileline(),
|
AstNode* newp = new AstShiftR (nodep->fileline(),
|
||||||
fromp,
|
fromp,
|
||||||
dropCondBound(lsbp),
|
dropCondBound(lsbp),
|
||||||
@@ -504,7 +503,7 @@ private:
|
|||||||
bool destwide = lhsp->fromp()->isWide();
|
bool destwide = lhsp->fromp()->isWide();
|
||||||
bool ones = nodep->rhsp()->isAllOnesV();
|
bool ones = nodep->rhsp()->isAllOnesV();
|
||||||
if (lhsp->lsbp()->castConst()) {
|
if (lhsp->lsbp()->castConst()) {
|
||||||
// The code should work without this constant test, but it won't
|
// The code should work without this constant test, but it won't
|
||||||
// constify as nicely as we'd like.
|
// constify as nicely as we'd like.
|
||||||
AstNode* rhsp = nodep->rhsp()->unlinkFrBack();
|
AstNode* rhsp = nodep->rhsp()->unlinkFrBack();
|
||||||
AstNode* destp = lhsp->fromp()->unlinkFrBack();
|
AstNode* destp = lhsp->fromp()->unlinkFrBack();
|
||||||
@@ -592,7 +591,7 @@ private:
|
|||||||
// For wide destp, we can either form a equation for every destination word,
|
// For wide destp, we can either form a equation for every destination word,
|
||||||
// with the appropriate long equation of if it's being written or not.
|
// with the appropriate long equation of if it's being written or not.
|
||||||
// Or, we can use a LHS variable arraysel with non-constant index to set the vector.
|
// Or, we can use a LHS variable arraysel with non-constant index to set the vector.
|
||||||
// Doing the variable arraysel is better for globals and large arrays,
|
// Doing the variable arraysel is better for globals and large arrays,
|
||||||
// doing every word is better for temporaries and if we're setting most words
|
// doing every word is better for temporaries and if we're setting most words
|
||||||
// since it may result in better substitution optimizations later.
|
// since it may result in better substitution optimizations later.
|
||||||
// This results in so much code, we're better off leaving a function call.
|
// This results in so much code, we're better off leaving a function call.
|
||||||
@@ -630,7 +629,7 @@ private:
|
|||||||
//newp->dumpTree(cout,"- new: ");
|
//newp->dumpTree(cout,"- new: ");
|
||||||
insertBefore(nodep,newp);
|
insertBefore(nodep,newp);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -641,10 +640,10 @@ private:
|
|||||||
} else {
|
} else {
|
||||||
UINFO(8," CONCAT "<<nodep<<endl);
|
UINFO(8," CONCAT "<<nodep<<endl);
|
||||||
AstNode* lhsp = nodep->lhsp()->unlinkFrBack();
|
AstNode* lhsp = nodep->lhsp()->unlinkFrBack();
|
||||||
AstNode* rhsp = nodep->rhsp()->unlinkFrBack();
|
AstNode* rhsp = nodep->rhsp()->unlinkFrBack();
|
||||||
int rhsshift = rhsp->widthMin();
|
int rhsshift = rhsp->widthMin();
|
||||||
if (nodep->isQuad() && !lhsp->isQuad()) lhsp = new AstCast(nodep->fileline(), lhsp, nodep);
|
if (nodep->isQuad() && !lhsp->isQuad()) lhsp = new AstCast(nodep->fileline(), lhsp, nodep);
|
||||||
if (nodep->isQuad() && !rhsp->isQuad()) rhsp = new AstCast(nodep->fileline(), rhsp, nodep);
|
if (nodep->isQuad() && !rhsp->isQuad()) rhsp = new AstCast(nodep->fileline(), rhsp, nodep);
|
||||||
AstNode* newp = new AstOr (nodep->fileline(),
|
AstNode* newp = new AstOr (nodep->fileline(),
|
||||||
new AstShiftL (nodep->fileline(),
|
new AstShiftL (nodep->fileline(),
|
||||||
lhsp,
|
lhsp,
|
||||||
@@ -657,7 +656,7 @@ private:
|
|||||||
}
|
}
|
||||||
bool expandWide (AstNodeAssign* nodep, AstConcat* rhsp) {
|
bool expandWide (AstNodeAssign* nodep, AstConcat* rhsp) {
|
||||||
UINFO(8," Wordize ASSIGN(CONCAT) "<<nodep<<endl);
|
UINFO(8," Wordize ASSIGN(CONCAT) "<<nodep<<endl);
|
||||||
// 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.
|
// Sometimes doing the words backwards is preferrable.
|
||||||
@@ -670,7 +669,7 @@ private:
|
|||||||
rhsp->lhsp(), rhsshift),
|
rhsp->lhsp(), rhsshift),
|
||||||
newAstWordSelClone (rhsp->rhsp(), w)));
|
newAstWordSelClone (rhsp->rhsp(), w)));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstReplicate* nodep, AstNUser*) {
|
virtual void visit(AstReplicate* nodep, AstNUser*) {
|
||||||
@@ -690,7 +689,7 @@ private:
|
|||||||
AstConst* constp = nodep->rhsp()->castConst();
|
AstConst* constp = nodep->rhsp()->castConst();
|
||||||
if (!constp) nodep->v3fatalSrc("Replication value isn't a constant. Checked earlier!");
|
if (!constp) nodep->v3fatalSrc("Replication value isn't a constant. Checked earlier!");
|
||||||
uint32_t times = constp->asInt();
|
uint32_t times = constp->asInt();
|
||||||
if (nodep->isQuad() && !lhsp->isQuad()) lhsp = new AstCast(nodep->fileline(), lhsp, nodep);
|
if (nodep->isQuad() && !lhsp->isQuad()) lhsp = new AstCast(nodep->fileline(), lhsp, nodep);
|
||||||
newp = lhsp->cloneTree(true);
|
newp = lhsp->cloneTree(true);
|
||||||
for (unsigned repnum=1; repnum<times; repnum++) {
|
for (unsigned repnum=1; repnum<times; repnum++) {
|
||||||
int rhsshift = repnum*lhswidth;
|
int rhsshift = repnum*lhswidth;
|
||||||
@@ -731,7 +730,7 @@ private:
|
|||||||
}
|
}
|
||||||
addWordAssign(nodep, w, newp);
|
addWordAssign(nodep, w, newp);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstChangeXor* nodep, AstNUser*) {
|
virtual void visit(AstChangeXor* nodep, AstNUser*) {
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
// $Id$ //-*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Expansion of wide operator macros to C operators
|
// DESCRIPTION: Verilator: Expansion of wide operator macros to C operators
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
|
|||||||
+10
-2
@@ -1,8 +1,7 @@
|
|||||||
// $Id$
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: File stream wrapper that understands indentation
|
// DESCRIPTION: Verilator: File stream wrapper that understands indentation
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
@@ -23,6 +22,7 @@
|
|||||||
#include "verilatedos.h"
|
#include "verilatedos.h"
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@@ -232,6 +232,14 @@ bool V3File::checkTimes(const string& filename, const string& cmdline) {
|
|||||||
return dependImp.checkTimes(filename, cmdline);
|
return dependImp.checkTimes(filename, cmdline);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void V3File::createMakeDir() {
|
||||||
|
static bool created = false;
|
||||||
|
if (!created) {
|
||||||
|
created = true;
|
||||||
|
mkdir(v3Global.opt.makeDir().c_str(), 0777);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//######################################################################
|
//######################################################################
|
||||||
// V3OutFile: A class for printing to a file, with automatic indentation of C++ code.
|
// V3OutFile: A class for printing to a file, with automatic indentation of C++ code.
|
||||||
|
|
||||||
|
|||||||
+8
-2
@@ -1,8 +1,8 @@
|
|||||||
// $Id$ //-*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: File stream wrapper that understands indentation
|
// DESCRIPTION: Verilator: File stream wrapper that understands indentation
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
@@ -46,6 +46,7 @@ public:
|
|||||||
return new_ofstream_nodepend (filename, append);
|
return new_ofstream_nodepend (filename, append);
|
||||||
}
|
}
|
||||||
static ofstream* new_ofstream_nodepend(const string& filename, bool append=false) {
|
static ofstream* new_ofstream_nodepend(const string& filename, bool append=false) {
|
||||||
|
if (filename != "/dev/null") createMakeDir();
|
||||||
if (append) {
|
if (append) {
|
||||||
return new ofstream(filename.c_str(), ios::app);
|
return new ofstream(filename.c_str(), ios::app);
|
||||||
} else {
|
} else {
|
||||||
@@ -53,15 +54,20 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
static FILE* new_fopen_w(const string& filename) {
|
static FILE* new_fopen_w(const string& filename) {
|
||||||
|
if (filename != "/dev/null") createMakeDir();
|
||||||
addTgtDepend(filename);
|
addTgtDepend(filename);
|
||||||
return fopen(filename.c_str(),"w");
|
return fopen(filename.c_str(),"w");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dependencies
|
// Dependencies
|
||||||
static void addSrcDepend(const string& filename);
|
static void addSrcDepend(const string& filename);
|
||||||
static void addTgtDepend(const string& filename);
|
static void addTgtDepend(const string& filename);
|
||||||
static void writeDepend(const string& filename);
|
static void writeDepend(const string& filename);
|
||||||
static void writeTimes(const string& filename, const string& cmdline);
|
static void writeTimes(const string& filename, const string& cmdline);
|
||||||
static bool checkTimes(const string& filename, const string& cmdline);
|
static bool checkTimes(const string& filename, const string& cmdline);
|
||||||
|
|
||||||
|
// Directory utilities
|
||||||
|
static void createMakeDir();
|
||||||
};
|
};
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|||||||
+5
-6
@@ -1,8 +1,7 @@
|
|||||||
// $Id$
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Gate optimizations, such as wire elimination
|
// DESCRIPTION: Verilator: Gate optimizations, such as wire elimination
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
@@ -19,7 +18,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// V3Gate's Transformations:
|
// V3Gate's Transformations:
|
||||||
//
|
//
|
||||||
// Extract a graph of the *entire* netlist with cells expanded
|
// Extract a graph of the *entire* netlist with cells expanded
|
||||||
// Perform constant optimization across the graph
|
// Perform constant optimization across the graph
|
||||||
// Create VARSCOPEs for any variables we can rip out
|
// Create VARSCOPEs for any variables we can rip out
|
||||||
@@ -170,7 +169,7 @@ private:
|
|||||||
// V3Const cleans up any NOTs by flipping the edges for us
|
// V3Const cleans up any NOTs by flipping the edges for us
|
||||||
if (m_buffersOnly
|
if (m_buffersOnly
|
||||||
&& !(nodep->rhsp()->castVarRef()
|
&& !(nodep->rhsp()->castVarRef()
|
||||||
// Until NEW_ORDERING, avoid making non-clocked logic into clocked,
|
// Until NEW_ORDERING, avoid making non-clocked logic into clocked,
|
||||||
// as it slows down the verilator_sim_benchmark
|
// as it slows down the verilator_sim_benchmark
|
||||||
|| (nodep->rhsp()->castNot()
|
|| (nodep->rhsp()->castNot()
|
||||||
&& nodep->rhsp()->castNot()->lhsp()->castVarRef()
|
&& nodep->rhsp()->castNot()->lhsp()->castVarRef()
|
||||||
@@ -343,7 +342,7 @@ private:
|
|||||||
UINFO(5," VARREF to "<<varscp<<endl);
|
UINFO(5," VARREF to "<<varscp<<endl);
|
||||||
// We use weight of one; if we ref the var more than once, when we simplify,
|
// We use weight of one; if we ref the var more than once, when we simplify,
|
||||||
// the weight will increase
|
// the weight will increase
|
||||||
if (nodep->lvalue()) {
|
if (nodep->lvalue()) {
|
||||||
new V3GraphEdge(&m_graph, m_logicVertexp, varvertexp, 1);
|
new V3GraphEdge(&m_graph, m_logicVertexp, varvertexp, 1);
|
||||||
} else {
|
} else {
|
||||||
new V3GraphEdge(&m_graph, varvertexp, m_logicVertexp, 1);
|
new V3GraphEdge(&m_graph, varvertexp, m_logicVertexp, 1);
|
||||||
@@ -490,7 +489,7 @@ void GateVisitor::optimizeSignals(bool allowMultiIn) {
|
|||||||
if (debug()>=5) substp->dumpTree(cout,"\t subst: ");
|
if (debug()>=5) substp->dumpTree(cout,"\t subst: ");
|
||||||
m_statSigs++;
|
m_statSigs++;
|
||||||
while (V3GraphEdge* edgep = vvertexp->outBeginp()) {
|
while (V3GraphEdge* edgep = vvertexp->outBeginp()) {
|
||||||
GateLogicVertex* consumeVertexp = dynamic_cast<GateLogicVertex*>(edgep->top());
|
GateLogicVertex* consumeVertexp = dynamic_cast<GateLogicVertex*>(edgep->top());
|
||||||
AstNode* consumerp = consumeVertexp->nodep();
|
AstNode* consumerp = consumeVertexp->nodep();
|
||||||
optimizeElimVar(vvertexp->varScp(), substp, consumerp);
|
optimizeElimVar(vvertexp->varScp(), substp, consumerp);
|
||||||
// If the new replacement referred to a signal,
|
// If the new replacement referred to a signal,
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
// $Id$ //-*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Break always into sensitivity block domains
|
// DESCRIPTION: Verilator: Break always into sensitivity block domains
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
|
|||||||
+4
-5
@@ -1,8 +1,7 @@
|
|||||||
// $Id$
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Generated Clock repairs
|
// DESCRIPTION: Verilator: Generated Clock repairs
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
@@ -21,7 +20,7 @@
|
|||||||
// GENCLK TRANSFORMATIONS:
|
// GENCLK TRANSFORMATIONS:
|
||||||
// Follow control-flow graph with assignments and var usages
|
// Follow control-flow graph with assignments and var usages
|
||||||
// ASSIGNDLY to variable later used as clock requires change detect
|
// ASSIGNDLY to variable later used as clock requires change detect
|
||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
#include "config_build.h"
|
#include "config_build.h"
|
||||||
@@ -93,7 +92,7 @@ private:
|
|||||||
}
|
}
|
||||||
//----
|
//----
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
||||||
// Consumption/generation of a variable,
|
// Consumption/generation of a variable,
|
||||||
AstVarScope* vscp = nodep->varScopep();
|
AstVarScope* vscp = nodep->varScopep();
|
||||||
if (!vscp) nodep->v3fatalSrc("Scope not assigned");
|
if (!vscp) nodep->v3fatalSrc("Scope not assigned");
|
||||||
if (m_activep && !nodep->user3()) {
|
if (m_activep && !nodep->user3()) {
|
||||||
@@ -172,7 +171,7 @@ private:
|
|||||||
//----
|
//----
|
||||||
|
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
||||||
// Consumption/generation of a variable,
|
// Consumption/generation of a variable,
|
||||||
AstVarScope* vscp = nodep->varScopep();
|
AstVarScope* vscp = nodep->varScopep();
|
||||||
if (!vscp) nodep->v3fatalSrc("Scope not assigned");
|
if (!vscp) nodep->v3fatalSrc("Scope not assigned");
|
||||||
if (m_activep) {
|
if (m_activep) {
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
// $Id$ //-*- C++ -*-
|
//-*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Generated Clock Repairs
|
// DESCRIPTION: Verilator: Generated Clock Repairs
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
// $Id$ //-*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Common headers
|
// DESCRIPTION: Verilator: Common headers
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
|
|||||||
+3
-3
@@ -1,8 +1,8 @@
|
|||||||
// $Id$
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Graph optimizations
|
// DESCRIPTION: Verilator: Graph optimizations
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
@@ -106,7 +106,7 @@ ostream& operator<<(ostream& os, V3GraphVertex* vertexp) {
|
|||||||
//######################################################################
|
//######################################################################
|
||||||
// Edges
|
// Edges
|
||||||
|
|
||||||
V3GraphEdge::V3GraphEdge(V3Graph* graphp,
|
V3GraphEdge::V3GraphEdge(V3Graph* graphp,
|
||||||
V3GraphVertex* fromp, V3GraphVertex* top, int weight,
|
V3GraphVertex* fromp, V3GraphVertex* top, int weight,
|
||||||
bool cutable) {
|
bool cutable) {
|
||||||
UASSERT(fromp, "Null from pointer\n");
|
UASSERT(fromp, "Null from pointer\n");
|
||||||
|
|||||||
+3
-3
@@ -1,8 +1,8 @@
|
|||||||
// $Id$ //-*- C++ -*-
|
//-*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Graph optimizations
|
// DESCRIPTION: Verilator: Graph optimizations
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
@@ -67,7 +67,7 @@ public:
|
|||||||
virtual ~V3Graph();
|
virtual ~V3Graph();
|
||||||
static void debug(int level) { s_debug = level; }
|
static void debug(int level) { s_debug = level; }
|
||||||
virtual string dotRankDir() { return "TB"; } // rankdir for dot plotting
|
virtual string dotRankDir() { return "TB"; } // rankdir for dot plotting
|
||||||
|
|
||||||
// METHODS
|
// METHODS
|
||||||
void clear(); // Empty it of all vertices/edges, as if making a new object
|
void clear(); // Empty it of all vertices/edges, as if making a new object
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -1,8 +1,7 @@
|
|||||||
// $Id$
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Graph acyclic algorithm
|
// DESCRIPTION: Verilator: Graph acyclic algorithm
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
|
|||||||
+2
-3
@@ -1,8 +1,7 @@
|
|||||||
// $Id$
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Graph optimizations
|
// DESCRIPTION: Verilator: Graph optimizations
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
@@ -345,7 +344,7 @@ private:
|
|||||||
if (m_done) return;
|
if (m_done) return;
|
||||||
|
|
||||||
m_callTrace.reserve(currentRank+10); // Leave slop for speed
|
m_callTrace.reserve(currentRank+10); // Leave slop for speed
|
||||||
m_callTrace[currentRank++] = vertexp;
|
m_callTrace[currentRank++] = vertexp;
|
||||||
|
|
||||||
if (vertexp->user() == 1) {
|
if (vertexp->user() == 1) {
|
||||||
for (unsigned i=0; i<currentRank; i++) {
|
for (unsigned i=0; i<currentRank; i++) {
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
// $Id$ //-*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Graph algorithm base class
|
// DESCRIPTION: Verilator: Graph algorithm base class
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
|
|||||||
+102
-9
@@ -1,8 +1,7 @@
|
|||||||
// $Id$
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Graph optimizations
|
// DESCRIPTION: Verilator: Graph optimizations
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
@@ -224,7 +223,7 @@ private:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
UINFO(5,"Dfa to Nfa conversion...\n");
|
UINFO(5,"Dfa to Nfa conversion...\n");
|
||||||
// Vertex::color() begin: 1 indicates vertex on DFA graph, 0=NFA graph
|
// Vertex::color() begin: 1 indicates vertex on DFA graph, 0=NFA graph
|
||||||
@@ -236,7 +235,7 @@ private:
|
|||||||
|
|
||||||
// Find NFA start
|
// Find NFA start
|
||||||
DfaVertex* nfaStartp = graphp()->findStart();
|
DfaVertex* nfaStartp = graphp()->findStart();
|
||||||
|
|
||||||
// Create new DFA State (start state) from the NFA states
|
// Create new DFA State (start state) from the NFA states
|
||||||
DfaVertex* dfaStartp = newDfaVertex(nfaStartp);
|
DfaVertex* dfaStartp = newDfaVertex(nfaStartp);
|
||||||
|
|
||||||
@@ -267,7 +266,7 @@ private:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (debug()>=6) m_graphp->dumpDotFilePrefixed("dfa_start");
|
if (debug()>=6) m_graphp->dumpDotFilePrefixed("dfa_start");
|
||||||
insertDfaOrigins(dfaStartp);
|
insertDfaOrigins(dfaStartp);
|
||||||
|
|
||||||
int i=0;
|
int i=0;
|
||||||
UINFO(5,"Main state conversion...\n");
|
UINFO(5,"Main state conversion...\n");
|
||||||
@@ -293,7 +292,7 @@ private:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Foreach input state (NFA inputs of this DFA state)
|
// Foreach input state (NFA inputs of this DFA state)
|
||||||
for (set<DfaInput>::const_iterator inIt=inputs.begin(); inIt!=inputs.end(); ++inIt) {
|
for (set<DfaInput>::const_iterator inIt=inputs.begin(); inIt!=inputs.end(); ++inIt) {
|
||||||
DfaInput input = *inIt;
|
DfaInput input = *inIt;
|
||||||
@@ -303,7 +302,7 @@ private:
|
|||||||
// Find all states reachable for given input
|
// Find all states reachable for given input
|
||||||
DfaStates nfasWithInput;
|
DfaStates nfasWithInput;
|
||||||
findNfasWithInput(dfaStatep, input, nfasWithInput/*ref*/);
|
findNfasWithInput(dfaStatep, input, nfasWithInput/*ref*/);
|
||||||
|
|
||||||
// nfasWithInput now maps to the DFA we want a transition to.
|
// nfasWithInput now maps to the DFA we want a transition to.
|
||||||
// Does a DFA already exist with this, and only this subset of NFA's?
|
// Does a DFA already exist with this, and only this subset of NFA's?
|
||||||
DfaVertex* toDfaStatep = findDfaOrigins(nfasWithInput);
|
DfaVertex* toDfaStatep = findDfaOrigins(nfasWithInput);
|
||||||
@@ -317,7 +316,7 @@ private:
|
|||||||
new DfaEdge (graphp(), toDfaStatep, *nfaIt, DfaEdge::NA());
|
new DfaEdge (graphp(), toDfaStatep, *nfaIt, DfaEdge::NA());
|
||||||
if ((*nfaIt)->accepting()) toDfaStatep->accepting(true);
|
if ((*nfaIt)->accepting()) toDfaStatep->accepting(true);
|
||||||
}
|
}
|
||||||
insertDfaOrigins(toDfaStatep);
|
insertDfaOrigins(toDfaStatep);
|
||||||
}
|
}
|
||||||
// Add input transition
|
// Add input transition
|
||||||
new DfaEdge (graphp(), dfaStatep, toDfaStatep, input);
|
new DfaEdge (graphp(), dfaStatep, toDfaStatep, input);
|
||||||
@@ -375,7 +374,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void optimize_accepting_out() {
|
void optimize_accepting_out() {
|
||||||
// Delete outbound edges from accepting states
|
// Delete outbound edges from accepting states
|
||||||
// (As once we've accepted, we no longer care about anything else.)
|
// (As once we've accepted, we no longer care about anything else.)
|
||||||
for (V3GraphVertex* vertexp = m_graphp->verticesBeginp(); vertexp; vertexp=vertexp->verticesNextp()) {
|
for (V3GraphVertex* vertexp = m_graphp->verticesBeginp(); vertexp; vertexp=vertexp->verticesNextp()) {
|
||||||
if (DfaVertex* vvertexp = dynamic_cast<DfaVertex*>(vertexp)) {
|
if (DfaVertex* vvertexp = dynamic_cast<DfaVertex*>(vertexp)) {
|
||||||
@@ -480,3 +479,97 @@ public:
|
|||||||
void DfaGraph::dfaReduce() {
|
void DfaGraph::dfaReduce() {
|
||||||
DfaGraphReduce (this, &V3GraphEdge::followAlwaysTrue);
|
DfaGraphReduce (this, &V3GraphEdge::followAlwaysTrue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//######################################################################
|
||||||
|
//######################################################################
|
||||||
|
// Algorithms - complement a DFA
|
||||||
|
//
|
||||||
|
// The traditional algorithm is to make a rejecting state, add edges to
|
||||||
|
// reject from all missing values, then swap accept and reject. Rather
|
||||||
|
// than swap at the end, it's faster if we swap up front, then do the edge
|
||||||
|
// changes.
|
||||||
|
//
|
||||||
|
// 1. Since we didn't log rejecting states, make a temp state (this will be
|
||||||
|
// the old accept, and new reject).
|
||||||
|
//
|
||||||
|
// 2. All vertexes except start/accept get edges to NEW accept for any
|
||||||
|
// non-existing case. Weedely we don't have a nice way of representing
|
||||||
|
// this so we just create a edge for each case and mark it "complemented."
|
||||||
|
//
|
||||||
|
// 3. Delete temp vertex (old accept/new reject) and related edges.
|
||||||
|
// The user's old accept is now the new accept. This is imporant as
|
||||||
|
// we want the virtual type of it to be intact.
|
||||||
|
|
||||||
|
class DfaGraphComplement : GraphAlg {
|
||||||
|
private:
|
||||||
|
// MEMBERS
|
||||||
|
DfaVertex* m_tempNewerReject;
|
||||||
|
|
||||||
|
// METHODS
|
||||||
|
int debug() { return 9; }
|
||||||
|
DfaGraph* graphp() { return static_cast<DfaGraph*>(m_graphp); }
|
||||||
|
|
||||||
|
void add_complement_edges() {
|
||||||
|
// Find accepting vertex
|
||||||
|
DfaVertex* acceptp = NULL;
|
||||||
|
for (V3GraphVertex* vertexp = m_graphp->verticesBeginp(); vertexp; vertexp=vertexp->verticesNextp()) {
|
||||||
|
if (DfaVertex* vvertexp = dynamic_cast<DfaVertex*>(vertexp)) {
|
||||||
|
if (vvertexp->accepting()) {
|
||||||
|
acceptp = vvertexp;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!acceptp) v3fatalSrc("No accepting vertex in DFA\n");
|
||||||
|
|
||||||
|
// Remap edges
|
||||||
|
for (V3GraphVertex* vertexp = m_graphp->verticesBeginp(); vertexp; vertexp=vertexp->verticesNextp()) {
|
||||||
|
if (DfaVertex* vvertexp = dynamic_cast<DfaVertex*>(vertexp)) {
|
||||||
|
//UINFO(9, " on vertex "<<vvertexp->name()<<endl);
|
||||||
|
if (!vvertexp->accepting() && vvertexp != m_tempNewerReject) {
|
||||||
|
for (V3GraphEdge* nextp, *edgep = vertexp->outBeginp(); edgep; edgep=nextp) {
|
||||||
|
nextp = edgep->outNextp();
|
||||||
|
if (!edgep->user()) { // Not processed
|
||||||
|
// Old edges to accept now go to new reject
|
||||||
|
DfaEdge* vedgep = static_cast<DfaEdge*>(edgep);
|
||||||
|
DfaVertex* tovertexp = static_cast<DfaVertex*>(edgep->top());
|
||||||
|
if (tovertexp->accepting()) {
|
||||||
|
new DfaEdge(graphp(), vvertexp, m_tempNewerReject, vedgep);
|
||||||
|
edgep->unlinkDelete(); edgep=NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOT of all values goes to accept
|
||||||
|
// We make a edge for each value to OR, IE
|
||||||
|
// edge(complemented,a) edge(complemented,b) means !(a | b)
|
||||||
|
if (!tovertexp->accepting()) { // Note we must include edges moved above to reject
|
||||||
|
DfaEdge* newp = new DfaEdge (graphp(), vvertexp, acceptp, vedgep);
|
||||||
|
newp->complement(!newp->complement());
|
||||||
|
newp->user(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public:
|
||||||
|
DfaGraphComplement(V3Graph* dfagraphp, V3EdgeFuncP edgeFuncp)
|
||||||
|
: GraphAlg(dfagraphp, edgeFuncp) {
|
||||||
|
if (debug()>=6) m_graphp->dumpDotFilePrefixed("comp_in");
|
||||||
|
|
||||||
|
// Vertex::m_user begin: 1 indicates new edge, no more processing
|
||||||
|
m_graphp->userClearEdges();
|
||||||
|
|
||||||
|
m_tempNewerReject = new DfaVertex(graphp());
|
||||||
|
add_complement_edges();
|
||||||
|
if (debug()>=6) m_graphp->dumpDotFilePrefixed("comp_preswap");
|
||||||
|
|
||||||
|
m_tempNewerReject->unlinkDelete(graphp()); m_tempNewerReject=NULL;
|
||||||
|
if (debug()>=6) m_graphp->dumpDotFilePrefixed("comp_out");
|
||||||
|
}
|
||||||
|
~DfaGraphComplement() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
void DfaGraph::dfaComplement() {
|
||||||
|
DfaGraphComplement (this, &V3GraphEdge::followAlwaysTrue);
|
||||||
|
}
|
||||||
|
|||||||
+29
-11
@@ -1,8 +1,8 @@
|
|||||||
// $Id$ //-*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Graph automata base class
|
// DESCRIPTION: Verilator: Graph automata base class
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
@@ -43,16 +43,18 @@ class DfaEdge;
|
|||||||
/// or epsilon, represented as a empty list of inputs.
|
/// or epsilon, represented as a empty list of inputs.
|
||||||
///
|
///
|
||||||
/// We're only looking for matches, so the only accepting states are
|
/// We're only looking for matches, so the only accepting states are
|
||||||
/// at the end of the transformations.
|
/// at the end of the transformations. (If we want the complement, we
|
||||||
///
|
/// call complement and the algorithm makes a REJECT state, then flips
|
||||||
|
/// accept and reject for you.)
|
||||||
|
///
|
||||||
/// Common transforms:
|
/// Common transforms:
|
||||||
///
|
///
|
||||||
/// "*": DfaVertex(START) --> [epsilon] -->DfaVertex(ACCEPT)
|
/// "*": DfaVertex(START) --> [epsilon] -->DfaVertex(ACCEPT)
|
||||||
///
|
///
|
||||||
/// "L": ...->[ON_L]-->DfaVtx-->[epsilon]-->DfaVtx(ACCEPT)
|
/// "L": ...->[ON_L]-->DfaVtx-->[epsilon]-->DfaVtx(ACCEPT)
|
||||||
///
|
///
|
||||||
/// "LR": ...->[ON_L]-->DfaVtx-->[epsilon]-->DfaVtx()
|
/// "LR": ...->[ON_L]-->DfaVtx-->[epsilon]-->DfaVtx(ACCEPT)
|
||||||
/// ->[ON_R]-->DfaVtx-->[epsilon]-->DfaVtx(ACCEPT)
|
/// ->[ON_R]-->DfaVtx-->[epsilon]-/
|
||||||
///
|
///
|
||||||
/// "L|R": ...->DfaVtx-->[epsilon]-->DfaVtx-->[ON_L]-->DfaVtx()->[epsilon]-->DfaVtx(ACCEPT)
|
/// "L|R": ...->DfaVtx-->[epsilon]-->DfaVtx-->[ON_L]-->DfaVtx()->[epsilon]-->DfaVtx(ACCEPT)
|
||||||
/// \->[epsilon]-->DfaVtx-->[ON_R]-->DfaVtx()->[epsilon]-/
|
/// \->[epsilon]-->DfaVtx-->[ON_R]-->DfaVtx()->[epsilon]-/
|
||||||
@@ -76,13 +78,16 @@ public:
|
|||||||
|
|
||||||
/// Simplify a DFA automata
|
/// Simplify a DFA automata
|
||||||
void dfaReduce();
|
void dfaReduce();
|
||||||
|
|
||||||
|
/// Complement result (must already be dfa)
|
||||||
|
void dfaComplement();
|
||||||
};
|
};
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
// Vertex
|
// Vertex
|
||||||
|
|
||||||
class DfaVertex : public V3GraphVertex {
|
class DfaVertex : public V3GraphVertex {
|
||||||
// Each DFA state is captured in this vertex.
|
// Each DFA state is captured in this vertex.
|
||||||
// Start and accepting are members, rather than the more intuitive
|
// Start and accepting are members, rather than the more intuitive
|
||||||
// subclasses, as subclassing them would make it harder to inherit from here.
|
// subclasses, as subclassing them would make it harder to inherit from here.
|
||||||
bool m_start; // Start state
|
bool m_start; // Start state
|
||||||
@@ -93,7 +98,7 @@ public:
|
|||||||
: V3GraphVertex(graphp)
|
: V3GraphVertex(graphp)
|
||||||
, m_start(start), m_accepting(accepting) {}
|
, m_start(start), m_accepting(accepting) {}
|
||||||
virtual DfaVertex* clone(DfaGraph* graphp) {
|
virtual DfaVertex* clone(DfaGraph* graphp) {
|
||||||
return new DfaVertex(graphp, start(), accepting()); }
|
return new DfaVertex(graphp, start(), accepting()); }
|
||||||
virtual ~DfaVertex() {}
|
virtual ~DfaVertex() {}
|
||||||
// ACCESSORS
|
// ACCESSORS
|
||||||
virtual string dotShape() const { return (accepting()?"doublecircle":""); }
|
virtual string dotShape() const { return (accepting()?"doublecircle":""); }
|
||||||
@@ -113,20 +118,33 @@ typedef AstNUser* DfaInput;
|
|||||||
|
|
||||||
class DfaEdge : public V3GraphEdge {
|
class DfaEdge : public V3GraphEdge {
|
||||||
DfaInput m_input;
|
DfaInput m_input;
|
||||||
|
bool m_complement; // Invert value when doing compare
|
||||||
public:
|
public:
|
||||||
static DfaInput EPSILON() { return NULL; }
|
static DfaInput EPSILON() { return NULL; }
|
||||||
static DfaInput NA() { return AstNUser::fromInt(1); } // as in not-applicable
|
static DfaInput NA() { return AstNUser::fromInt(1); } // as in not-applicable
|
||||||
// CONSTRUCTORS
|
// CONSTRUCTORS
|
||||||
DfaEdge(DfaGraph* graphp, DfaVertex* fromp, DfaVertex* top, DfaInput input)
|
DfaEdge(DfaGraph* graphp, DfaVertex* fromp, DfaVertex* top, DfaInput input)
|
||||||
: V3GraphEdge(graphp, fromp, top, 1)
|
: V3GraphEdge(graphp, fromp, top, 1)
|
||||||
, m_input(input) {}
|
, m_input(input), m_complement(false) {}
|
||||||
|
DfaEdge(DfaGraph* graphp, DfaVertex* fromp, DfaVertex* top, const DfaEdge* copyfrom)
|
||||||
|
: V3GraphEdge(graphp, fromp, top, copyfrom->weight())
|
||||||
|
, m_input(copyfrom->input()), m_complement(copyfrom->complement()) {}
|
||||||
virtual ~DfaEdge() {}
|
virtual ~DfaEdge() {}
|
||||||
// METHODS
|
// METHODS
|
||||||
virtual string dotColor() const { return na()?"yellow":epsilon()?"green":"black"; }
|
virtual string dotColor() const {
|
||||||
virtual string dotLabel() const { return na()?"":epsilon()?"e":cvtToStr((void*)(input())); }
|
return (na() ? "yellow"
|
||||||
|
: epsilon() ? "green"
|
||||||
|
: "black"); }
|
||||||
|
virtual string dotLabel() const {
|
||||||
|
return (na() ? ""
|
||||||
|
: epsilon() ? "e"
|
||||||
|
: complement() ? ("not "+cvtToStr((void*)(input())))
|
||||||
|
: cvtToStr((void*)(input()))); }
|
||||||
virtual string dotStyle() const { return (na()||cutable())?"dashed":""; }
|
virtual string dotStyle() const { return (na()||cutable())?"dashed":""; }
|
||||||
bool epsilon() const { return input()==EPSILON(); }
|
bool epsilon() const { return input()==EPSILON(); }
|
||||||
bool na() const { return input()==NA(); }
|
bool na() const { return input()==NA(); }
|
||||||
|
bool complement() const { return m_complement; }
|
||||||
|
void complement(bool value) { m_complement=value; }
|
||||||
DfaInput input() const { return m_input; }
|
DfaInput input() const { return m_input; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+25
-20
@@ -1,8 +1,7 @@
|
|||||||
// $Id$
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// DESCRIPTION: Verilator: Graph tests
|
// DESCRIPTION: Verilator: Graph tests
|
||||||
//
|
//
|
||||||
// Code available from: http://www.veripool.com/verilator
|
// Code available from: http://www.veripool.org/verilator
|
||||||
//
|
//
|
||||||
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
||||||
//
|
//
|
||||||
@@ -112,7 +111,7 @@ public:
|
|||||||
new V3GraphEdge(gp, g1, q, 2, true);
|
new V3GraphEdge(gp, g1, q, 2, true);
|
||||||
new V3GraphEdge(gp, g2, q, 2, true);
|
new V3GraphEdge(gp, g2, q, 2, true);
|
||||||
new V3GraphEdge(gp, g3, q, 2, true);
|
new V3GraphEdge(gp, g3, q, 2, true);
|
||||||
|
|
||||||
gp->stronglyConnected(&V3GraphEdge::followAlwaysTrue);
|
gp->stronglyConnected(&V3GraphEdge::followAlwaysTrue);
|
||||||
dump();
|
dump();
|
||||||
|
|
||||||
@@ -143,7 +142,7 @@ public:
|
|||||||
new V3GraphEdge(gp, g1, a, 2, true);
|
new V3GraphEdge(gp, g1, a, 2, true);
|
||||||
new V3GraphEdge(gp, g2, a, 2, true);
|
new V3GraphEdge(gp, g2, a, 2, true);
|
||||||
new V3GraphEdge(gp, g3, a, 2, true);
|
new V3GraphEdge(gp, g3, a, 2, true);
|
||||||
|
|
||||||
gp->acyclic(&V3GraphEdge::followAlwaysTrue);
|
gp->acyclic(&V3GraphEdge::followAlwaysTrue);
|
||||||
gp->order();
|
gp->order();
|
||||||
dump();
|
dump();
|
||||||
@@ -157,7 +156,7 @@ public:
|
|||||||
V3Graph* gp = &m_graph;
|
V3Graph* gp = &m_graph;
|
||||||
|
|
||||||
V3GraphTestVertex* clk = new V3GraphTestVarVertex(gp,"$clk");
|
V3GraphTestVertex* clk = new V3GraphTestVarVertex(gp,"$clk");
|
||||||
|
|
||||||
V3GraphTestVertex* a = new V3GraphTestVarVertex(gp,"$a");
|
V3GraphTestVertex* a = new V3GraphTestVarVertex(gp,"$a");
|
||||||
V3GraphTestVertex* a_dly = new V3GraphTestVarVertex(gp,"$a_dly");
|
V3GraphTestVertex* a_dly = new V3GraphTestVarVertex(gp,"$a_dly");
|
||||||
V3GraphTestVertex* a_dlyblk= new V3GraphTestVarVertex(gp,"$a_dlyblk");
|
V3GraphTestVertex* a_dlyblk= new V3GraphTestVarVertex(gp,"$a_dlyblk");
|
||||||
@@ -166,13 +165,13 @@ public:
|
|||||||
V3GraphTestVertex* b_dlyblk= new V3GraphTestVarVertex(gp,"$b_dlyblk");
|
V3GraphTestVertex* b_dlyblk= new V3GraphTestVarVertex(gp,"$b_dlyblk");
|
||||||
V3GraphTestVertex* c = new V3GraphTestVarVertex(gp,"$c");
|
V3GraphTestVertex* c = new V3GraphTestVarVertex(gp,"$c");
|
||||||
V3GraphTestVertex* i = new V3GraphTestVarVertex(gp,"$i");
|
V3GraphTestVertex* i = new V3GraphTestVarVertex(gp,"$i");
|
||||||
|
|
||||||
V3GraphTestVertex* ap = new V3GraphTestVarVertex(gp,"$a_pre");
|
V3GraphTestVertex* ap = new V3GraphTestVarVertex(gp,"$a_pre");
|
||||||
V3GraphTestVertex* bp = new V3GraphTestVarVertex(gp,"$b_pre");
|
V3GraphTestVertex* bp = new V3GraphTestVarVertex(gp,"$b_pre");
|
||||||
V3GraphTestVertex* cp = new V3GraphTestVarVertex(gp,"$c_pre");
|
V3GraphTestVertex* cp = new V3GraphTestVarVertex(gp,"$c_pre");
|
||||||
|
|
||||||
V3GraphTestVertex* n;
|
V3GraphTestVertex* n;
|
||||||
|
|
||||||
// Logical order between clk, and posedge blocks
|
// Logical order between clk, and posedge blocks
|
||||||
// implemented by special CLK prod/cons?
|
// implemented by special CLK prod/cons?
|
||||||
// Required order between first x_DLY<=x_pre and final x<=x_DLY
|
// Required order between first x_DLY<=x_pre and final x<=x_DLY
|
||||||
@@ -183,23 +182,23 @@ public:
|
|||||||
// implemented by producer/consumer on a_dly signals
|
// implemented by producer/consumer on a_dly signals
|
||||||
// Desired order between different _DLY blocks so we can elim temporaries
|
// Desired order between different _DLY blocks so we can elim temporaries
|
||||||
// implemented by cutable "pre" signal dependencies
|
// implemented by cutable "pre" signal dependencies
|
||||||
|
|
||||||
|
|
||||||
n = new V3GraphTestVertex(gp,"*INPUTS*"); {
|
n = new V3GraphTestVertex(gp,"*INPUTS*"); {
|
||||||
new V3GraphEdge(gp, n, clk, 2);
|
new V3GraphEdge(gp, n, clk, 2);
|
||||||
new V3GraphEdge(gp, n, i, 2);
|
new V3GraphEdge(gp, n, i, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
V3GraphTestVertex* posedge = n = new V3GraphTestVertex(gp,"*posedge clk*"); {
|
V3GraphTestVertex* posedge = n = new V3GraphTestVertex(gp,"*posedge clk*"); {
|
||||||
new V3GraphEdge(gp, clk, n, 2);
|
new V3GraphEdge(gp, clk, n, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// AssignPre's VarRefs on LHS: generate special BLK
|
// AssignPre's VarRefs on LHS: generate special BLK
|
||||||
// normal: VarRefs on LHS: generate normal
|
// normal: VarRefs on LHS: generate normal
|
||||||
// underSBlock: VarRefs on RHS: consume 'pre' (required to save cutable tests)
|
// underSBlock: VarRefs on RHS: consume 'pre' (required to save cutable tests)
|
||||||
n = new V3GraphTestVertex(gp,"a_dly<PRE=a"); {
|
n = new V3GraphTestVertex(gp,"a_dly<PRE=a"); {
|
||||||
new V3GraphEdge(gp, n, a_dlyblk, 2); // Block ordering
|
new V3GraphEdge(gp, n, a_dlyblk, 2); // Block ordering
|
||||||
new V3GraphEdge(gp, n, a_dly, 2);
|
new V3GraphEdge(gp, n, a_dly, 2);
|
||||||
new V3GraphEdge(gp, ap, n, 2, true); // DESIRED delayed ordering (inp is required)
|
new V3GraphEdge(gp, ap, n, 2, true); // DESIRED delayed ordering (inp is required)
|
||||||
new V3GraphEdge(gp, posedge, n, 2);
|
new V3GraphEdge(gp, posedge, n, 2);
|
||||||
}
|
}
|
||||||
@@ -209,7 +208,7 @@ public:
|
|||||||
new V3GraphEdge(gp, bp, n, 2, true); // DESIRED delayed ordering
|
new V3GraphEdge(gp, bp, n, 2, true); // DESIRED delayed ordering
|
||||||
new V3GraphEdge(gp, posedge, n, 2);
|
new V3GraphEdge(gp, posedge, n, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// AssignDly's VarRefs on LHS: consume special BLK
|
// AssignDly's VarRefs on LHS: consume special BLK
|
||||||
// normal: VarRefs on LHS: generate normal
|
// normal: VarRefs on LHS: generate normal
|
||||||
// underSBlock: VarRefs on RHS: generate 'pre' signals (cutable)
|
// underSBlock: VarRefs on RHS: generate 'pre' signals (cutable)
|
||||||
@@ -228,7 +227,7 @@ public:
|
|||||||
new V3GraphEdge(gp, n, ap, 2); // DESIRED delayed usage
|
new V3GraphEdge(gp, n, ap, 2); // DESIRED delayed usage
|
||||||
new V3GraphEdge(gp, posedge, n, 2);
|
new V3GraphEdge(gp, posedge, n, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// AssignPost's
|
// AssignPost's
|
||||||
// normal: VarRefs on LHS: generate normal
|
// normal: VarRefs on LHS: generate normal
|
||||||
// underSBlock: VarRefs on RHS: consume normal
|
// underSBlock: VarRefs on RHS: consume normal
|
||||||
@@ -242,11 +241,11 @@ public:
|
|||||||
new V3GraphEdge(gp, b_dly, n, 3);
|
new V3GraphEdge(gp, b_dly, n, 3);
|
||||||
new V3GraphEdge(gp, posedge, n, 2);
|
new V3GraphEdge(gp, posedge, n, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// COMBO
|
// COMBO
|
||||||
// Inbound edges are always uncutable, because we must put combo logic after sequential
|
// Inbound edges are always uncutable, because we must put combo logic after sequential
|
||||||
// Outbound are cutable, as we may need to evaluate multiple times
|
// Outbound are cutable, as we may need to evaluate multiple times
|
||||||
|
|
||||||
{
|
{
|
||||||
V3GraphTestVertex* n = new V3GraphTestVertex(gp,"c=a|b|i");
|
V3GraphTestVertex* n = new V3GraphTestVertex(gp,"c=a|b|i");
|
||||||
new V3GraphEdge(gp, n, c, 1, true);
|
new V3GraphEdge(gp, n, c, 1, true);
|
||||||
@@ -254,7 +253,7 @@ public:
|
|||||||
new V3GraphEdge(gp, b, n, 1, false);
|
new V3GraphEdge(gp, b, n, 1, false);
|
||||||
new V3GraphEdge(gp, i, n, 1, false);
|
new V3GraphEdge(gp, i, n, 1, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
gp->acyclic(&V3GraphEdge::followAlwaysTrue);
|
gp->acyclic(&V3GraphEdge::followAlwaysTrue);
|
||||||
gp->order();
|
gp->order();
|
||||||
|
|
||||||
@@ -288,7 +287,7 @@ public:
|
|||||||
DfaTestVertex* sr = new DfaTestVertex(gp,"sR");
|
DfaTestVertex* sr = new DfaTestVertex(gp,"sR");
|
||||||
DfaTestVertex* sz = new DfaTestVertex(gp,"sZ");
|
DfaTestVertex* sz = new DfaTestVertex(gp,"sZ");
|
||||||
DfaTestVertex* sac = new DfaTestVertex(gp,"*ACCEPT*"); sac->accepting(true);
|
DfaTestVertex* sac = new DfaTestVertex(gp,"*ACCEPT*"); sac->accepting(true);
|
||||||
|
|
||||||
AstNUser* L = AstNUser::fromInt(0xaa);
|
AstNUser* L = AstNUser::fromInt(0xaa);
|
||||||
AstNUser* R = AstNUser::fromInt(0xbb);
|
AstNUser* R = AstNUser::fromInt(0xbb);
|
||||||
AstNUser* Z = AstNUser::fromInt(0xcc);
|
AstNUser* Z = AstNUser::fromInt(0xcc);
|
||||||
@@ -309,6 +308,12 @@ public:
|
|||||||
gp->nfaToDfa();
|
gp->nfaToDfa();
|
||||||
dump();
|
dump();
|
||||||
gp->dfaReduce();
|
gp->dfaReduce();
|
||||||
|
dump();
|
||||||
|
|
||||||
|
gp->dfaComplement();
|
||||||
|
dump();
|
||||||
|
gp->dfaReduce();
|
||||||
|
dump();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -334,7 +339,7 @@ public:
|
|||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
# include "graph_export.cpp"
|
# include "graph_export.cpp"
|
||||||
#else
|
#else
|
||||||
void V3GraphTestImport::dotImport() {
|
void V3GraphTestImport::dotImport() {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user