mirror of
https://github.com/verilator/verilator.git
synced 2026-10-06 01:54:01 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a1d1d6d3d4 | ||
|
|
d17f812827 | ||
|
|
3916758529 | ||
|
|
2396181bc5 | ||
|
|
6e8640bf1b | ||
|
|
c2c7c7bd9a | ||
|
|
071a1c4adb | ||
|
|
d5b2dda2e8 | ||
|
|
2ac281eb3e | ||
|
|
5e81543448 | ||
|
|
b32f925468 | ||
|
|
fdeb6bcae0 | ||
|
|
76232cd9e7 | ||
|
|
4da9b5e491 | ||
|
|
c4504a9221 | ||
|
|
65de8359e7 | ||
|
|
f6fab74436 | ||
|
|
350ba264e8 | ||
|
|
29e24818a1 | ||
|
|
71cd6f7b90 | ||
|
|
84ba253791 | ||
|
|
fce158b8ad | ||
|
|
da13ba6c67 | ||
|
|
7618133298 | ||
|
|
0d1698f81d | ||
|
|
362d642c87 | ||
|
|
e4c96d5be5 | ||
|
|
f488701adc | ||
|
|
8ff2bf51c5 | ||
|
|
a2490a55a9 | ||
|
|
20189f5191 | ||
|
|
06b796c6bd | ||
|
|
ad4edf6c68 | ||
|
|
4100f20a69 | ||
|
|
bedf946fb2 | ||
|
|
b9e67157c6 | ||
|
|
b30b2a183b | ||
|
|
9ab3bcdde3 | ||
|
|
5df3bbe188 | ||
|
|
8cf12416c0 | ||
|
|
b7c2c83c88 | ||
|
|
3b6da93331 | ||
|
|
b4642d3fd4 | ||
|
|
88a2b0b911 | ||
|
|
954e127f1d | ||
|
|
7654add5e5 | ||
|
|
85a37ea53f | ||
|
|
b337acebcc | ||
|
|
fb9ca54c95 | ||
|
|
1a15d41523 | ||
|
|
e378cc5791 | ||
|
|
748c189c79 | ||
|
|
b89be6c4b9 | ||
|
|
df207807b6 | ||
|
|
1f2b40cff1 | ||
|
|
734400fd37 | ||
|
|
f19979d928 | ||
|
|
19be7a53da | ||
|
|
e56af34fb0 | ||
|
|
7737aa20e8 | ||
|
|
ead046201c | ||
|
|
0aa7c3f659 | ||
|
|
4aa7222022 | ||
|
|
86e3c78776 | ||
|
|
40076287ea | ||
|
|
ca81db8edf | ||
|
|
ae68a80e98 | ||
|
|
beb7c58375 | ||
|
|
e080b9d565 | ||
|
|
ca2db37039 | ||
|
|
194825f78e | ||
|
|
55bd765ea0 | ||
|
|
b03d61e2cf | ||
|
|
6fc0e5167b | ||
|
|
0065be011f | ||
|
|
3f7cbce58c | ||
|
|
246b62e322 | ||
|
|
7c2fdd1ee9 | ||
|
|
f77aa2623c | ||
|
|
20847a3ff5 | ||
|
|
eb6d42acf9 | ||
|
|
094d676a8b | ||
|
|
71306ceb1d | ||
|
|
8bbfc7fc22 | ||
|
|
19baba12b1 | ||
|
|
15b8819136 | ||
|
|
3fae8ade05 | ||
|
|
f9bbf31d65 | ||
|
|
df1da3dda9 | ||
|
|
c83f2a4abd | ||
|
|
ad53833040 | ||
|
|
bc8c85668a | ||
|
|
d12a3dde45 | ||
|
|
301c878c0f | ||
|
|
bd55bfa071 | ||
|
|
6d2f09b579 | ||
|
|
4bfea7f54d | ||
|
|
55906486d8 | ||
|
|
d5478e6e08 | ||
|
|
d88d85c172 | ||
|
|
59c3c536c7 | ||
|
|
a007458cb8 | ||
|
|
d051912f21 | ||
|
|
a547158a50 | ||
|
|
95f2351aa0 | ||
|
|
698aaffb0b | ||
|
|
73eccecbf8 | ||
|
|
ae4a261463 | ||
|
|
c9f0d0cec2 | ||
|
|
4fa1e45d45 | ||
|
|
1b3d252bfe | ||
|
|
a9ba4a9fcd | ||
|
|
7f49619875 | ||
|
|
696660639a | ||
|
|
da4323062d | ||
|
|
a901e171b2 | ||
|
|
6e41d532fe | ||
|
|
4fc78ffb58 | ||
|
|
8137f41fc3 | ||
|
|
2e9471797d | ||
|
|
3fd2108b10 | ||
|
|
96e2a407f4 | ||
|
|
ca83fd6dc1 |
@@ -24,6 +24,8 @@ src/Makefile_obj$
|
|||||||
include/verilated.mk$
|
include/verilated.mk$
|
||||||
config.cache$
|
config.cache$
|
||||||
config.status$
|
config.status$
|
||||||
|
verilator.log
|
||||||
|
verilator.tex
|
||||||
verilator_bin.*
|
verilator_bin.*
|
||||||
.vcsmx_rebuild$
|
.vcsmx_rebuild$
|
||||||
autom4te\.cache/
|
autom4te\.cache/
|
||||||
|
|||||||
+39
-22
@@ -9,7 +9,7 @@
|
|||||||
#
|
#
|
||||||
#*****************************************************************************
|
#*****************************************************************************
|
||||||
#
|
#
|
||||||
# Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
# Copyright 2003-2012 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
|
||||||
# Lesser General Public License Version 3 or the Perl Artistic License
|
# Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
# Version 2.0.
|
# Version 2.0.
|
||||||
@@ -88,7 +88,10 @@ pkgdatadir = @pkgdatadir@
|
|||||||
datarootdir = @datarootdir@
|
datarootdir = @datarootdir@
|
||||||
|
|
||||||
# Compile options
|
# Compile options
|
||||||
|
CFG_WITH_CCWARN = @CFG_WITH_CCWARN@
|
||||||
CFG_WITH_DEFENV = @CFG_WITH_DEFENV@
|
CFG_WITH_DEFENV = @CFG_WITH_DEFENV@
|
||||||
|
CFG_WITH_LONGTESTS = @CFG_WITH_LONGTESTS@
|
||||||
|
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||||
|
|
||||||
#### End of system configuration section. ####
|
#### End of system configuration section. ####
|
||||||
######################################################################
|
######################################################################
|
||||||
@@ -101,8 +104,6 @@ INFOS = README internals.txt verilator.txt verilator.html verilator.1 verilator.
|
|||||||
|
|
||||||
# Files that can be generated, but should be up to date for a distribution.
|
# Files that can be generated, but should be up to date for a distribution.
|
||||||
DISTDEP = info Makefile
|
DISTDEP = info Makefile
|
||||||
# Files to distribute.
|
|
||||||
DISTBIN = $(wildcard bin/verilator-*)
|
|
||||||
|
|
||||||
DISTFILES_INC = $(INFOS) .gitignore Artistic COPYING COPYING.LESSER \
|
DISTFILES_INC = $(INFOS) .gitignore Artistic COPYING COPYING.LESSER \
|
||||||
*.in *.ac \
|
*.in *.ac \
|
||||||
@@ -129,7 +130,6 @@ DISTFILES_INC = $(INFOS) .gitignore Artistic COPYING COPYING.LESSER \
|
|||||||
test_regress/t/*.pl \
|
test_regress/t/*.pl \
|
||||||
test_regress/t/*.pf \
|
test_regress/t/*.pf \
|
||||||
test_regress/t/*.v* \
|
test_regress/t/*.v* \
|
||||||
verilator.* \
|
|
||||||
|
|
||||||
INST_PROJ_FILES = \
|
INST_PROJ_FILES = \
|
||||||
bin/verilator \
|
bin/verilator \
|
||||||
@@ -171,7 +171,7 @@ msg_test:
|
|||||||
@echo
|
@echo
|
||||||
|
|
||||||
.PHONY:test
|
.PHONY:test
|
||||||
ifeq ($(VERILATOR_AUTHOR_SITE),1) # Local... Else don't burden users
|
ifeq ($(CFG_WITH_LONGTESTS),yes) # 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
|
||||||
test: test_c test_sc test_sp
|
test: test_c test_sc test_sp
|
||||||
@@ -203,17 +203,18 @@ test_regress: all_nomsg
|
|||||||
info: $(INFOS)
|
info: $(INFOS)
|
||||||
|
|
||||||
# Use --no-split to avoid creating filenames > 14 chars.
|
# Use --no-split to avoid creating filenames > 14 chars.
|
||||||
verilator.1: bin/verilator
|
verilator.1: ${srcdir}/bin/verilator
|
||||||
pod2man $< $@
|
pod2man $< $@
|
||||||
|
|
||||||
verilator.txt: bin/verilator
|
verilator.txt: ${srcdir}/bin/verilator
|
||||||
$(POD2TEXT) $< $@
|
$(POD2TEXT) $< $@
|
||||||
|
|
||||||
verilator.html: bin/verilator
|
verilator.html: ${srcdir}/bin/verilator
|
||||||
pod2html $< >$@
|
pod2html $< >$@
|
||||||
|
|
||||||
verilator.pdf: bin/verilator $(DISTCONFIG)
|
# PDF needs DIST variables; but having configure.ac as dependency isn't detected
|
||||||
pod2latex --full --out verilator.tex bin/verilator
|
verilator.pdf: ${srcdir}/bin/verilator Makefile
|
||||||
|
pod2latex --full --out verilator.tex ${srcdir}/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[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[pdftex,bookmarks=true,bookmarksnumbered=true,hypertexnames=false,breaklinks=true,linkbordercolor={0 0 1}]{hyperref}\n\\begin{document}/' \
|
||||||
@@ -257,7 +258,7 @@ VL_INST_DATA_SRCDIR_FILES = \
|
|||||||
test_v/*.[chv]* \
|
test_v/*.[chv]* \
|
||||||
test_c/*.[chv]* test_c/Makefile test_c/Makefile_obj \
|
test_c/*.[chv]* test_c/Makefile test_c/Makefile_obj \
|
||||||
test_sc/*.[chv]* test_sc/Makefile test_sc/Makefile_obj \
|
test_sc/*.[chv]* test_sc/Makefile test_sc/Makefile_obj \
|
||||||
test_sp/*.[chv]* test_sp/Makefile test_sp/Makefile_obj \
|
test_sp/Makefile test_sp/Makefile_obj \
|
||||||
|
|
||||||
installbin:
|
installbin:
|
||||||
$(SHELL) ${srcdir}/mkinstalldirs $(DESTDIR)$(bindir)
|
$(SHELL) ${srcdir}/mkinstalldirs $(DESTDIR)$(bindir)
|
||||||
@@ -268,9 +269,11 @@ installbin:
|
|||||||
$(SHELL) ${srcdir}/mkinstalldirs $(DESTDIR)$(pkgdatadir)/bin
|
$(SHELL) ${srcdir}/mkinstalldirs $(DESTDIR)$(pkgdatadir)/bin
|
||||||
( cd ${srcdir}/bin ; $(INSTALL_PROGRAM) verilator_includer $(DESTDIR)$(pkgdatadir)/bin/verilator_includer )
|
( cd ${srcdir}/bin ; $(INSTALL_PROGRAM) verilator_includer $(DESTDIR)$(pkgdatadir)/bin/verilator_includer )
|
||||||
|
|
||||||
|
# Man files can either be part of the original kit, or built in current directory
|
||||||
|
# So important we use $< so VPATH is searched
|
||||||
installman: $(VL_INST_MAN_FILES)
|
installman: $(VL_INST_MAN_FILES)
|
||||||
$(SHELL) ${srcdir}/mkinstalldirs $(DESTDIR)$(mandir)/man1
|
$(SHELL) ${srcdir}/mkinstalldirs $(DESTDIR)$(mandir)/man1
|
||||||
for p in $(VL_INST_MAN_FILES) ; do \
|
for p in $< ; do \
|
||||||
$(INSTALL_DATA) $$p $(DESTDIR)$(mandir)/man1/$$p; \
|
$(INSTALL_DATA) $$p $(DESTDIR)$(mandir)/man1/$$p; \
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -310,11 +313,14 @@ uninstall:
|
|||||||
-rmdir $(DESTDIR)$(pkgdatadir)/examples
|
-rmdir $(DESTDIR)$(pkgdatadir)/examples
|
||||||
-rmdir $(DESTDIR)$(pkgdatadir)
|
-rmdir $(DESTDIR)$(pkgdatadir)
|
||||||
|
|
||||||
install: all_nomsg installbin installman installdata install-msg
|
install: all_nomsg install-all
|
||||||
|
install-all: installbin installman installdata install-msg
|
||||||
|
|
||||||
install-here: installman ftp
|
install-here: installman ftp
|
||||||
|
|
||||||
ifeq ($(VERILATOR_AUTHOR_SITE),1) # Local... Else don't burden users
|
ifeq ($(VERILATOR_AUTHOR_SITE),1) # Local... Else don't burden users
|
||||||
|
DISTNAMEREV = $(shell sed -e '/DTVERSION/!d' -e 's/.*verilator_\([^"]*\).*/\1/' -e q ${srcdir}/src/config_rev.h)
|
||||||
|
|
||||||
DIRPROJECT := $(shell project_dir --project)
|
DIRPROJECT := $(shell project_dir --project)
|
||||||
VERILATOR_CAD_DIR = $(CAD_DIR)/verilator/$(DISTNAMEREV)/$(DIRPROJECT_ARCH)
|
VERILATOR_CAD_DIR = $(CAD_DIR)/verilator/$(DISTNAMEREV)/$(DIRPROJECT_ARCH)
|
||||||
INST_PROJ_CVS = cp_if_cvs_diff
|
INST_PROJ_CVS = cp_if_cvs_diff
|
||||||
@@ -323,7 +329,7 @@ install-project: dist
|
|||||||
@echo "Install-project to $(DIRPROJECT)"
|
@echo "Install-project to $(DIRPROJECT)"
|
||||||
strip verilator_bin*
|
strip verilator_bin*
|
||||||
$(MAKE) install-project-quick
|
$(MAKE) install-project-quick
|
||||||
for p in verilator.1 ; do \
|
for p in $(VL_INST_MAN_FILES) ; do \
|
||||||
$(INSTALL_DATA) $$p $(DIRPROJECT_PREFIX)/man/man1/$$p; \
|
$(INSTALL_DATA) $$p $(DIRPROJECT_PREFIX)/man/man1/$$p; \
|
||||||
done
|
done
|
||||||
$(INST_PROJ_CVS) $(DISTNAME).tgz $(DIRPROJECT)/hw/utils/verilator/verilator.tgz
|
$(INST_PROJ_CVS) $(DISTNAME).tgz $(DIRPROJECT)/hw/utils/verilator/verilator.tgz
|
||||||
@@ -347,7 +353,7 @@ install-cadtools: dist
|
|||||||
strip verilator_bin*
|
strip verilator_bin*
|
||||||
$(MAKE) install-cadtools-quick
|
$(MAKE) install-cadtools-quick
|
||||||
$(SHELL) ${srcdir}/mkinstalldirs $(VERILATOR_CAD_DIR)/man/man1
|
$(SHELL) ${srcdir}/mkinstalldirs $(VERILATOR_CAD_DIR)/man/man1
|
||||||
for p in verilator.1 ; do \
|
for p in $(VL_INST_MAN_FILES) ; do \
|
||||||
$(INSTALL_DATA) $$p $(VERILATOR_CAD_DIR)/man/man1/$$p; \
|
$(INSTALL_DATA) $$p $(VERILATOR_CAD_DIR)/man/man1/$$p; \
|
||||||
done
|
done
|
||||||
$(INST_PROJ_CVS) $(DISTNAME).tgz $(VERILATOR_CAD_DIR)/verilator.tgz
|
$(INST_PROJ_CVS) $(DISTNAME).tgz $(VERILATOR_CAD_DIR)/verilator.tgz
|
||||||
@@ -371,6 +377,15 @@ endif
|
|||||||
# VERILATOR_AUTHOR_SITE
|
# VERILATOR_AUTHOR_SITE
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
CPPCHECK = cppcheck
|
||||||
|
CPPCHECK_FLAGS = --enable=all --inline-suppr --suppress=unusedScopedObject
|
||||||
|
CPPCHECK_CPP = $(wildcard $(srcdir)/include/*.cpp $(srcdir)/src/*.cpp)
|
||||||
|
CPPCHECK_DEP = $(subst .cpp,.cppcheck,$(CPPCHECK_CPP))
|
||||||
|
|
||||||
|
cppcheck: $(CPPCHECK_DEP)
|
||||||
|
%.cppcheck: %.cpp
|
||||||
|
$(CPPCHECK) $(CPPCHECK_FLAGS) -DVL_DEBUG=1 -I$(srcdir)/include -I$(srcdir)/src $<
|
||||||
|
|
||||||
ftp: info
|
ftp: info
|
||||||
|
|
||||||
install-msg:
|
install-msg:
|
||||||
@@ -391,8 +406,13 @@ Makefile: Makefile.in config.status $(IN_WILD)
|
|||||||
src/Makefile: src/Makefile.in Makefile
|
src/Makefile: src/Makefile.in Makefile
|
||||||
config.status: configure
|
config.status: configure
|
||||||
./config.status --recheck
|
./config.status --recheck
|
||||||
|
|
||||||
configure: configure.ac
|
configure: configure.ac
|
||||||
|
ifeq ($(CFG_WITH_CCWARN),yes) # Local... Else don't burden users
|
||||||
|
autoconf --warnings=all
|
||||||
|
else
|
||||||
autoconf
|
autoconf
|
||||||
|
endif
|
||||||
|
|
||||||
maintainer-clean::
|
maintainer-clean::
|
||||||
@echo "This command is intended for maintainers to use;"
|
@echo "This command is intended for maintainers to use;"
|
||||||
@@ -433,15 +453,12 @@ dist-file-list:
|
|||||||
######################################################################
|
######################################################################
|
||||||
# Distributions
|
# Distributions
|
||||||
|
|
||||||
DISTCONFIG = ${srcdir}/src/config_build.h.in
|
DISTTITLE := Verilator $(word 1,$(PACKAGE_VERSION))
|
||||||
|
DISTNAME := verilator-$(word 1,$(PACKAGE_VERSION))
|
||||||
DISTTITLE := $(shell sed -e '/DTVERSION/!d' -e 's/[^0-9]*\([0-9.a-z]*\).*/verilator-\1/' -e 's/v/V/' -e q $(DISTCONFIG))
|
DISTDATEPRE := $(word 2,$(PACKAGE_VERSION))
|
||||||
DISTNAME := $(shell sed -e '/DTVERSION/!d' -e 's/[^0-9]*\([0-9.a-z]*\).*/verilator-\1/' -e q $(DISTCONFIG))
|
DISTDATE := $(subst /,-,$(DISTDATEPRE))
|
||||||
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))
|
|
||||||
DISTNAMEREV := $(shell sed -e '/DTVERSION/!d' -e 's/.*verilator_\([^"]*\).*/\1/' -e q src/config_rev.h)
|
|
||||||
|
|
||||||
DISTTAGNAME := $(subst .,_,$(subst -,_,$(DISTNAME)))
|
DISTTAGNAME := $(subst .,_,$(subst -,_,$(DISTNAME)))
|
||||||
DISTDATE := $(subst /,-,$(DISTDATEPRE))
|
|
||||||
|
|
||||||
tag:
|
tag:
|
||||||
svnorcvs tag $(DISTTAGNAME)
|
svnorcvs tag $(DISTTAGNAME)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// DESCRIPTION: Verilator: List of To Do issues.
|
// DESCRIPTION: Verilator: List of To Do issues.
|
||||||
//
|
//
|
||||||
// Copyright 2004-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2004-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
@@ -62,7 +62,7 @@ Usability:
|
|||||||
* Print version/etc message at runtime. (4.000?)
|
* Print version/etc message at runtime. (4.000?)
|
||||||
Include number of lines of code, percent comments, code complexity measurement
|
Include number of lines of code, percent comments, code complexity measurement
|
||||||
<-80chars------------------------------------------------------------------->
|
<-80chars------------------------------------------------------------------->
|
||||||
Verilator 3.600 - fast, free, open-sourced. Copyright 2001-2011.
|
Verilator 3.600 - fast, free, open-sourced. Copyright 2001-2012.
|
||||||
Verilated #### modules, #### instances, ##### sigs,
|
Verilated #### modules, #### instances, ##### sigs,
|
||||||
#### non-comment lines, ##### ops, ### KB model size
|
#### non-comment lines, ##### ops, ### KB model size
|
||||||
* Default the --l2name to remove extra "v" level of hierarchy (flag to make "top")
|
* Default the --l2name to remove extra "v" level of hierarchy (flag to make "top")
|
||||||
|
|||||||
+167
-91
@@ -3,7 +3,7 @@ eval 'exec perl -wS $0 ${1+"$@"}'
|
|||||||
if 0;
|
if 0;
|
||||||
######################################################################
|
######################################################################
|
||||||
#
|
#
|
||||||
# Copyright 2003-2011 by Wilson Snyder. This program is free software; you
|
# Copyright 2003-2012 by Wilson Snyder. This program is free software; you
|
||||||
# can redistribute it and/or modify it under the terms of either the GNU
|
# can redistribute it and/or modify it under the terms of either the GNU
|
||||||
# Lesser General Public License Version 3 or the Perl Artistic License
|
# Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
# Version 2.0.
|
# Version 2.0.
|
||||||
@@ -70,7 +70,7 @@ if (! GetOptions (
|
|||||||
# "version!" => \&version, # Also passthru'ed
|
# "version!" => \&version, # Also passthru'ed
|
||||||
# Switches
|
# Switches
|
||||||
"gdb=s" => \$opt_gdb, # Undocumented debugging
|
"gdb=s" => \$opt_gdb, # Undocumented debugging
|
||||||
"gdbbt!" => \$opt_gdbbt, # Undocumented debugging
|
"gdbbt!" => \$opt_gdbbt,
|
||||||
# Additional parameters
|
# Additional parameters
|
||||||
"<>" => sub {}, # Ignored
|
"<>" => sub {}, # Ignored
|
||||||
)) {
|
)) {
|
||||||
@@ -99,7 +99,7 @@ if ($opt_gdbbt && !$opt_gdb && $Debug) {
|
|||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
sub usage {
|
sub usage {
|
||||||
pod2usage(-exitstatus=>2, -verbose=>2);
|
pod2usage(-verbose=>2, -exitval=>2, -output=>\*STDOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub debug {
|
sub debug {
|
||||||
@@ -125,7 +125,14 @@ sub verilator_bin {
|
|||||||
$bin = "$dir/$basename"; # From pointing to kit directory
|
$bin = "$dir/$basename"; # From pointing to kit directory
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$bin = $basename;
|
if (-x "$RealBin/$basename") {
|
||||||
|
$bin = "$RealBin/$basename"; # From path/to/verilator with verilator_bin installed
|
||||||
|
} else {
|
||||||
|
$bin = $basename; # Find in PATH
|
||||||
|
}
|
||||||
|
# Note we don't look under bin/$basename which would be right if running
|
||||||
|
# in the kit dir. Running that would likely break, since
|
||||||
|
# VERILATOR_ROOT wouldn't be set and Verilator won't find internal files.
|
||||||
}
|
}
|
||||||
return $bin;
|
return $bin;
|
||||||
}
|
}
|
||||||
@@ -196,8 +203,9 @@ Verilator - Convert Verilog code to C++/SystemC
|
|||||||
=head1 DESCRIPTION
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
Verilator converts synthesizable (not behavioral) Verilog code, plus some
|
Verilator converts synthesizable (not behavioral) Verilog code, plus some
|
||||||
Synthesis, SystemVerilog and Sugar/PSL assertions, into C++, SystemC or
|
Synthesis, SystemVerilog and a small subset of Verilog AMS and Sugar/PSL
|
||||||
SystemPerl code. It is not a complete simulator, just a compiler.
|
assertions, into C++, SystemC or SystemPerl code. It is not a complete
|
||||||
|
simulator, just a compiler.
|
||||||
|
|
||||||
Verilator is invoked with parameters similar to GCC, Cadence
|
Verilator is invoked with parameters similar to GCC, Cadence
|
||||||
Verilog-XL/NC-Verilog, or Synopsys's VCS. It reads the specified Verilog
|
Verilog-XL/NC-Verilog, or Synopsys's VCS. It reads the specified Verilog
|
||||||
@@ -268,7 +276,7 @@ descriptions in the next sections for more information.
|
|||||||
--MP Create phony dependency targets
|
--MP Create phony dependency targets
|
||||||
--Mdir <directory> Name of output object directory
|
--Mdir <directory> Name of output object directory
|
||||||
--mod-prefix <topname> Name to prepend to lower classes
|
--mod-prefix <topname> Name to prepend to lower classes
|
||||||
--no-pins64 Don't use uint64_t's for 33-64 bit sigs
|
--no-pins64 Don't use vluint64_t's for 33-64 bit sigs
|
||||||
--no-skip-identical Disable skipping identical output
|
--no-skip-identical Disable skipping identical output
|
||||||
+notimingchecks Ignored
|
+notimingchecks Ignored
|
||||||
-O0 Disable optimizations
|
-O0 Disable optimizations
|
||||||
@@ -292,8 +300,8 @@ descriptions in the next sections for more information.
|
|||||||
--top-module <topname> Name of top level input module
|
--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
|
||||||
--trace-max-array <bits> Maximum bit width for tracing
|
--trace-max-array <depth> Maximum bit width for tracing
|
||||||
--trace-max-width <depth> Maximum array depth for tracing
|
--trace-max-width <width> Maximum array depth for tracing
|
||||||
--trace-underscore Enable tracing of _signals
|
--trace-underscore Enable tracing of _signals
|
||||||
-U<var> Undefine preprocessor define
|
-U<var> Undefine preprocessor define
|
||||||
--unroll-count <loops> Tune maximum loop iterations
|
--unroll-count <loops> Tune maximum loop iterations
|
||||||
@@ -530,7 +538,7 @@ After this number of errors or warnings are encountered, exit. Defaults to
|
|||||||
|
|
||||||
=item --exe
|
=item --exe
|
||||||
|
|
||||||
Generate a executable. You will also need to pass additional .cpp files on
|
Generate an executable. You will also need to pass additional .cpp files on
|
||||||
the command line that implement the main loop for your simulation.
|
the command line that implement the main loop for your simulation.
|
||||||
|
|
||||||
=item -F I<file>
|
=item -F I<file>
|
||||||
@@ -562,10 +570,7 @@ Displays this message and program version and exits.
|
|||||||
|
|
||||||
=item -II<dir>
|
=item -II<dir>
|
||||||
|
|
||||||
Add the directory to the list of directories that should be searched for
|
See -y.
|
||||||
include directories or libraries. Same as +incdir and -y; +incdir and -y
|
|
||||||
are fairly standard across Verilog tools while -I is an alias for GCC
|
|
||||||
compatibility.
|
|
||||||
|
|
||||||
=item --if-depth I<value>
|
=item --if-depth I<value>
|
||||||
|
|
||||||
@@ -574,15 +579,12 @@ defaults to 0 which disables this warning.
|
|||||||
|
|
||||||
=item +incdir+I<dir>
|
=item +incdir+I<dir>
|
||||||
|
|
||||||
Add the directory to the list of directories that should be searched for
|
See -y.
|
||||||
include directories or libraries. Same as -I and -y; +incdir and -y
|
|
||||||
are fairly standard across Verilog tools while -I is an alias for GCC
|
|
||||||
compatibility.
|
|
||||||
|
|
||||||
=item --inhibit-sim
|
=item --inhibit-sim
|
||||||
|
|
||||||
Rarely needed. Create a "inhibitSim(bool)" function to enable and disable
|
Rarely needed. Create a "inhibitSim(bool)" function to enable and disable
|
||||||
evaluation. This allows a upper level testbench to disable modules that
|
evaluation. This allows an upper level testbench to disable modules that
|
||||||
are not important in a given simulation, without needing to recompile or
|
are not important in a given simulation, without needing to recompile or
|
||||||
change the SystemC modules instantiated.
|
change the SystemC modules instantiated.
|
||||||
|
|
||||||
@@ -609,9 +611,13 @@ in the Make variable LDLIBS, not LDFLAGS.)
|
|||||||
|
|
||||||
Select the language to be used when first processing each Verilog file.
|
Select the language to be used when first processing each Verilog file.
|
||||||
The language value must be "1364-1995", "1364-2001", "1364-2001",
|
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
|
"1364-2005", "1800-2005", "VAMS-2.3". Verilator also allows the
|
||||||
the preferable option is to edit the code to repair new keywords, or add
|
non-standard "1800+VAMS" to allow both the full SystemVerilog and
|
||||||
appropriate `begin_keywords.
|
Verilog-AMS keywords.
|
||||||
|
|
||||||
|
The --language flag is only recommended for legacy code, as the preferable
|
||||||
|
option is to edit the code to repair new keywords, or add appropriate
|
||||||
|
`begin_keywords.
|
||||||
|
|
||||||
=item +libext+I<ext>+I<ext>...
|
=item +libext+I<ext>+I<ext>...
|
||||||
|
|
||||||
@@ -713,9 +719,10 @@ Backward compatible alias for "--pins-bv 65". Note that's a 65, not a 64.
|
|||||||
=item --pins-bv I<width>
|
=item --pins-bv I<width>
|
||||||
|
|
||||||
Specifies SystemC inputs/outputs of greater than or equal to I<width> bits
|
Specifies SystemC inputs/outputs of greater than or equal to I<width> bits
|
||||||
wide should use sc_bv's instead of uint32/uint64_t's. The default is
|
wide should use sc_bv's instead of uint32/vluint64_t's. The default is
|
||||||
"--pins-bv 65". Versions before Verilator 3.671 defaulted to "--pins-bv
|
"--pins-bv 65". Versions before Verilator 3.671 defaulted to "--pins-bv
|
||||||
33". The more sc_bv is used, the worse for performance.
|
33". The more sc_bv is used, the worse for performance. Use the
|
||||||
|
"/*verilator sc_bv*/" attribute to select specific ports to be sc_bv.
|
||||||
|
|
||||||
=item --pins-uint8
|
=item --pins-uint8
|
||||||
|
|
||||||
@@ -823,13 +830,13 @@ Specify the number of levels deep to enable tracing, for example
|
|||||||
entire model. Using a small number will decrease visibility, but greatly
|
entire model. Using a small number will decrease visibility, but greatly
|
||||||
improve runtime and trace file size.
|
improve runtime and trace file size.
|
||||||
|
|
||||||
=item --trace-max-array I<bits>
|
=item --trace-max-array I<depth>
|
||||||
|
|
||||||
Rarely needed. Specify the maximum array depth of a signal that may be
|
Rarely needed. Specify the maximum array depth of a signal that may be
|
||||||
traced. Defaults to 32, as tracing large arrays may greatly slow traced
|
traced. Defaults to 32, as tracing large arrays may greatly slow traced
|
||||||
simulations.
|
simulations.
|
||||||
|
|
||||||
=item --trace-max-width I<depth>
|
=item --trace-max-width I<width>
|
||||||
|
|
||||||
Rarely needed. Specify the maximum bit width of a signal that may be
|
Rarely needed. Specify the maximum bit width of a signal that may be
|
||||||
traced. Defaults to 256, as tracing large vectors may greatly slow traced
|
traced. Defaults to 256, as tracing large vectors may greatly slow traced
|
||||||
@@ -878,7 +885,7 @@ disabled by default.
|
|||||||
|
|
||||||
=item -Werror-I<message>
|
=item -Werror-I<message>
|
||||||
|
|
||||||
Convert the specified warning message into a error message. This is
|
Convert the specified warning message into an error message. This is
|
||||||
generally to discourage users from violating important site-wide rules, for
|
generally to discourage users from violating important site-wide rules, for
|
||||||
example C<-Werror-NOUNOPTFLAT>.
|
example C<-Werror-NOUNOPTFLAT>.
|
||||||
|
|
||||||
@@ -930,14 +937,14 @@ Enables the specified warning message.
|
|||||||
Enable all lint related warning messages (note by default they are already
|
Enable all lint related warning messages (note by default they are already
|
||||||
enabled), but do not affect style messages. This is equivalent to
|
enabled), but do not affect style messages. This is equivalent to
|
||||||
"-Wwarn-CASEINCOMPLETE -Wwarn-CASEOVERLAP -Wwarn-CASEX -Wwarn-CASEWITHX
|
"-Wwarn-CASEINCOMPLETE -Wwarn-CASEOVERLAP -Wwarn-CASEX -Wwarn-CASEWITHX
|
||||||
-Wwarn-CMPCONST -Wwarn-IMPLICIT -Wwarn-LITENDIAN -Wwarn-UNSIGNED
|
-Wwarn-CMPCONST -Wwarn-IMPLICIT -Wwarn-LITENDIAN -Wwarn-REALCVT
|
||||||
-Wwarn-WIDTH".
|
-Wwarn-UNSIGNED -Wwarn-WIDTH".
|
||||||
|
|
||||||
=item -Wwarn-style
|
=item -Wwarn-style
|
||||||
|
|
||||||
Enable all code style related warning messages. This is equivalent to
|
Enable all code style related warning messages. This is equivalent to
|
||||||
"-Wwarn-DECLFILENAME -Wwarn-DEFPARAM -Wwarn-INCABSPATH -Wwarn-SYNCASYNCNET
|
"-Wwarn ASSIGNDLY -Wwarn-DECLFILENAME -Wwarn-DEFPARAM -Wwarn-INCABSPATH
|
||||||
-Wwarn-UNDRIVEN -Wwarn-UNUSED -Wwarn-VARHIDDEN".
|
-Wwarn-SYNCASYNCNET -Wwarn-UNDRIVEN -Wwarn-UNUSED -Wwarn-VARHIDDEN".
|
||||||
|
|
||||||
=item -x-assign 0
|
=item -x-assign 0
|
||||||
|
|
||||||
@@ -965,9 +972,14 @@ enable rerunning with that same seed so you can reproduce bugs.
|
|||||||
=item -y I<dir>
|
=item -y I<dir>
|
||||||
|
|
||||||
Add the directory to the list of directories that should be searched for
|
Add the directory to the list of directories that should be searched for
|
||||||
include directories or libraries. Same as +incdir and -I; +incdir and +y
|
include files or libraries. The three flags -y, +incdir and -I have
|
||||||
are fairly standard across Verilog tools while -I is an alias for GCC
|
similar effect; +incdir and +y are fairly standard across Verilog tools while -I
|
||||||
compatibility.
|
is an alias for GCC compatibility.
|
||||||
|
|
||||||
|
Verilator defaults to the current directory ("-y .") and any specified
|
||||||
|
--Mdir, though these default paths are used after any user specified
|
||||||
|
directories. This allows '-y "$(pwd)"' to be used if absolute filenames
|
||||||
|
are desired for error messages instead of relative filenames.
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
@@ -1091,8 +1103,8 @@ We then can compile it
|
|||||||
And link with SystemC. Note your path to the libraries may vary,
|
And link with SystemC. Note your path to the libraries may vary,
|
||||||
depending on the operating system.
|
depending on the operating system.
|
||||||
|
|
||||||
export SYSTEMC=/path/to/where/systemc/was/built/or/installed
|
export SYSTEMC_LIBDIR=/path/to/where/libsystemc.a/exists
|
||||||
g++ -L$SYSTEMC/lib-linux ../sc_main.o Vour__ALL*.o verilated.o \
|
g++ -L$SYSTEMC_LIBDIR ../sc_main.o Vour__ALL*.o verilated.o \
|
||||||
-o Vour -lsystemc
|
-o Vour -lsystemc
|
||||||
|
|
||||||
And now we run it
|
And now we run it
|
||||||
@@ -1226,31 +1238,41 @@ all runs of the C++ Compiler. For example, "objcache --read --write", or
|
|||||||
"ccache". If using distcc, it would generally be run under either objcache
|
"ccache". If using distcc, it would generally be run under either objcache
|
||||||
or ccache; see the documentation for those programs.
|
or ccache; see the documentation for those programs.
|
||||||
|
|
||||||
=item OBJCACHE_JOBS
|
|
||||||
|
|
||||||
Optionally lists Make flags that specifies parallel make jobs. For example
|
|
||||||
a 4 CPU system may use "-j 6" to request 6 parallel compiles when making.
|
|
||||||
|
|
||||||
=item SYSTEMC
|
=item SYSTEMC
|
||||||
|
|
||||||
Required for SystemC output mode. If set, specifies the directory
|
Deprecated. Used only if SYSTEMC_INCLUDE or SYSTEMC_LIBDIR is not set. If
|
||||||
containing the SystemC distribution. This is used to find the SystemC
|
set, specifies the directory containing the SystemC distribution. If not
|
||||||
include files. If not specified, it will come from a default optionally
|
specified, it will come from a default optionally specified at configure
|
||||||
specified at configure time (before Verilator was compiled).
|
time (before Verilator was compiled).
|
||||||
|
|
||||||
=item SYSTEMC_ARCH
|
=item SYSTEMC_ARCH
|
||||||
|
|
||||||
Specifies the architecture name used by the SystemC kit. This is the part
|
Deprecated. Used only if SYSTEMC_LIBDIR is not set. Specifies the
|
||||||
after the dash in the lib-{...} directory name created by a 'make' in the
|
architecture name used by the SystemC kit. This is the part after the dash
|
||||||
SystemC distribution. If not set, Verilator will try to intuit the proper
|
in the lib-{...} directory name created by a 'make' in the SystemC
|
||||||
setting, or use the default optionally specified at configure time (before
|
distribution. If not set, Verilator will try to intuit the proper setting,
|
||||||
Verilator was compiled). .
|
or use the default optionally specified at configure time (before Verilator
|
||||||
|
was compiled).
|
||||||
|
|
||||||
=item SYSTEMC_CXX_FLAGS
|
=item SYSTEMC_CXX_FLAGS
|
||||||
|
|
||||||
Specifies additional flags that are required to be passed to GCC when
|
Specifies additional flags that are required to be passed to GCC when
|
||||||
building the SystemC model.
|
building the SystemC model.
|
||||||
|
|
||||||
|
=item SYSTEMC_INCLUDE
|
||||||
|
|
||||||
|
If set, specifies the directory containing the systemc.h header file. If
|
||||||
|
not specified, it will come from a default optionally specified at
|
||||||
|
configure time (before Verilator was compiled), or computed from
|
||||||
|
SYSTEMC/include.
|
||||||
|
|
||||||
|
=item SYSTEMC_LIBDIR
|
||||||
|
|
||||||
|
If set, specifies the directory containing the libsystemc.a library. If not
|
||||||
|
specified, it will come from a default optionally specified at configure
|
||||||
|
time (before Verilator was compiled), or compted from
|
||||||
|
SYSTEMC/lib-SYSTEMC_ARCH.
|
||||||
|
|
||||||
=item SYSTEMPERL
|
=item SYSTEMPERL
|
||||||
|
|
||||||
Specifies the directory containing the SystemPerl distribution kit. This
|
Specifies the directory containing the SystemPerl distribution kit. This
|
||||||
@@ -1306,10 +1328,13 @@ example:
|
|||||||
|
|
||||||
Vtop *top; // Instantiation of module
|
Vtop *top; // Instantiation of module
|
||||||
|
|
||||||
unsigned int main_time = 0; // Current simulation time
|
vluint64_t main_time = 0; // Current simulation time
|
||||||
|
// This is a 64-bit integer to reduce wrap over issues and
|
||||||
|
// allow modulus. You can also use a double, if you wish.
|
||||||
|
|
||||||
double sc_time_stamp () { // Called by $time in Verilog
|
double sc_time_stamp () { // Called by $time in Verilog
|
||||||
return main_time;
|
return main_time; // converts to double, to match
|
||||||
|
// what SystemC does
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
@@ -1352,7 +1377,7 @@ will plug directly into a SystemC netlist.
|
|||||||
The SC_MODULE gets the same pinout as the Verilog module, with the
|
The SC_MODULE gets the same pinout as the Verilog module, with the
|
||||||
following type conversions: Pins of a single bit become bool. Pins 2-32
|
following type conversions: Pins of a single bit become bool. Pins 2-32
|
||||||
bits wide become uint32_t's. Pins 33-64 bits wide become sc_bv's or
|
bits wide become uint32_t's. Pins 33-64 bits wide become sc_bv's or
|
||||||
uint64_t's depending on the --no-pins64 switch. Wider pins become sc_bv's.
|
vluint64_t's depending on the --no-pins64 switch. Wider pins become sc_bv's.
|
||||||
(Uints simulate the fastest so are used where possible.)
|
(Uints simulate the fastest so are used where possible.)
|
||||||
|
|
||||||
Lower modules are not pure SystemC code. This is a feature, as using the
|
Lower modules are not pure SystemC code. This is a feature, as using the
|
||||||
@@ -1661,7 +1686,7 @@ please file a bug if a feature you need is missing.
|
|||||||
Verilator supports ==? and !=? operators, ++ and -- in some contexts,
|
Verilator supports ==? and !=? operators, ++ and -- in some contexts,
|
||||||
$bits, $countones, $error, $fatal, $info, $isunknown, $onehot, $onehot0,
|
$bits, $countones, $error, $fatal, $info, $isunknown, $onehot, $onehot0,
|
||||||
$unit, $warning, always_comb, always_ff, always_latch, bit, byte, chandle,
|
$unit, $warning, always_comb, always_ff, always_latch, bit, byte, chandle,
|
||||||
do-while, enum, export, final, import, int, logic, longint, package,
|
const, do-while, enum, export, final, import, int, logic, longint, package,
|
||||||
program, shortint, time, typedef, var, void, priority case/if, and unique
|
program, shortint, time, typedef, var, void, priority case/if, and unique
|
||||||
case/if.
|
case/if.
|
||||||
|
|
||||||
@@ -1680,6 +1705,18 @@ Verilator currently has some support for SystemVerilog 2009 synthesis
|
|||||||
constructs. As SystemVerilog features enter common usage they are added;
|
constructs. As SystemVerilog features enter common usage they are added;
|
||||||
please file a bug if a feature you need is missing.
|
please file a bug if a feature you need is missing.
|
||||||
|
|
||||||
|
=head2 Verilog AMS Support
|
||||||
|
|
||||||
|
Verilator implements a very small subset of Verilog AMS (Verilog Analog and
|
||||||
|
Mixed-Signal Extensions) with the subset corresponding to those VMS
|
||||||
|
keywords with near equivelents in the Verilog 2005 or SystemVerilog 2009
|
||||||
|
languages.
|
||||||
|
|
||||||
|
AMS parsing is enabled with "--language VAMS" or "--language 1800+VAMS".
|
||||||
|
|
||||||
|
At present Verilator implements ceil, exp, floor, ln, log, pow, sqrt,
|
||||||
|
string, and wreal.
|
||||||
|
|
||||||
=head2 Sugar/PSL Support
|
=head2 Sugar/PSL Support
|
||||||
|
|
||||||
Most future work is being directed towards improving SystemVerilog
|
Most future work is being directed towards improving SystemVerilog
|
||||||
@@ -1711,8 +1748,8 @@ assertion clocks.
|
|||||||
=head2 Synthesis Directive Assertion Support
|
=head2 Synthesis Directive Assertion Support
|
||||||
|
|
||||||
With the --assert switch, Verilator reads any "//synopsys full_case" or "//
|
With the --assert switch, Verilator reads any "//synopsys full_case" or "//
|
||||||
synopsys parallel_case" directives. The same applies to any "//cadence" or
|
synopsys parallel_case" directives. The same applies to any "// ambit
|
||||||
"// ambit synthesis" directives of the same form.
|
synthesis", "//cadence" or "//pragma" directives of the same form.
|
||||||
|
|
||||||
When these synthesis directives are discovered, Verilator will either
|
When these synthesis directives are discovered, Verilator will either
|
||||||
formally prove the directive to be true, or failing that, will insert the
|
formally prove the directive to be true, or failing that, will insert the
|
||||||
@@ -1775,7 +1812,7 @@ other optimizations.
|
|||||||
If you will be reading or writing any Verilog variables inside the C++
|
If you will be reading or writing any Verilog variables inside the C++
|
||||||
functions, the Verilog signals must be declared with /*verilator public*/.
|
functions, the Verilog signals must be declared with /*verilator public*/.
|
||||||
|
|
||||||
You may also append a arbitrary number to $c, generally the width of the
|
You may also append an arbitrary number to $c, generally the width of the
|
||||||
output. [signal_32_bits = $c32("...");] This allows for compatibility with
|
output. [signal_32_bits = $c32("...");] This allows for compatibility with
|
||||||
other simulators which require a differently named PLI function name for
|
other simulators which require a differently named PLI function name for
|
||||||
each different output width.
|
each different output width.
|
||||||
@@ -1831,7 +1868,7 @@ Despite the name of this macro, this also works in pure C++ code.
|
|||||||
|
|
||||||
If you will be reading or writing any Verilog variables in the C++
|
If you will be reading or writing any Verilog variables in the C++
|
||||||
functions, the Verilog signals must be declared with /*verilator public*/.
|
functions, the Verilog signals must be declared with /*verilator public*/.
|
||||||
See also the public task feature; writing a accessor may result in cleaner
|
See also the public task feature; writing an accessor may result in cleaner
|
||||||
code.
|
code.
|
||||||
|
|
||||||
=item `VERILATOR
|
=item `VERILATOR
|
||||||
@@ -1962,7 +1999,7 @@ be pure; they cannot reference any variables outside the task itself.
|
|||||||
|
|
||||||
=item /*verilator public*/ (variable)
|
=item /*verilator public*/ (variable)
|
||||||
|
|
||||||
Used after a input, output, register, or wire declaration to indicate the
|
Used after an input, output, register, or wire declaration to indicate the
|
||||||
signal should be declared so that C code may read or write the value of the
|
signal should be declared so that C code may read or write the value of the
|
||||||
signal. This will also declare this module public, otherwise use
|
signal. This will also declare this module public, otherwise use
|
||||||
/*verilator public_flat*/.
|
/*verilator public_flat*/.
|
||||||
@@ -1984,7 +2021,7 @@ stack.
|
|||||||
|
|
||||||
Wide variables over 64 bits cannot be function returns, to avoid exposing
|
Wide variables over 64 bits cannot be function returns, to avoid exposing
|
||||||
complexities. However, wide variables can be input/outputs; they will be
|
complexities. However, wide variables can be input/outputs; they will be
|
||||||
passed as references to an array of 32 bit numbers.
|
passed as references to an array of 32-bit numbers.
|
||||||
|
|
||||||
Generally, only the values of stored state (flops) should be written, as
|
Generally, only the values of stored state (flops) should be written, as
|
||||||
the model will NOT notice changes made to variables in these functions.
|
the model will NOT notice changes made to variables in these functions.
|
||||||
@@ -1995,7 +2032,7 @@ simulators.
|
|||||||
|
|
||||||
=item /*verilator public_flat*/ (variable)
|
=item /*verilator public_flat*/ (variable)
|
||||||
|
|
||||||
Used after a input, output, register, or wire declaration to indicate the
|
Used after an input, output, register, or wire declaration to indicate the
|
||||||
signal should be declared so that C code may read or write the value of the
|
signal should be declared so that C code may read or write the value of the
|
||||||
signal. This will not declare this module public, which means the name of
|
signal. This will not declare this module public, which means the name of
|
||||||
the signal or path to it may change based upon the module inlining which
|
the signal or path to it may change based upon the module inlining which
|
||||||
@@ -2003,12 +2040,12 @@ takes place.
|
|||||||
|
|
||||||
=item /*verilator public_flat_rd*/ (variable)
|
=item /*verilator public_flat_rd*/ (variable)
|
||||||
|
|
||||||
Used after a input, output, register, or wire declaration to indicate the
|
Used after an input, output, register, or wire declaration to indicate the
|
||||||
signal should be declared public_flat (see above), but read-only.
|
signal should be declared public_flat (see above), but read-only.
|
||||||
|
|
||||||
=item /*verilator public_flat_rw @(<edge_list>) */ (variable)
|
=item /*verilator public_flat_rw @(<edge_list>) */ (variable)
|
||||||
|
|
||||||
Used after a input, output, register, or wire declaration to indicate the
|
Used after an input, output, register, or wire declaration to indicate the
|
||||||
signal should be declared public_flat_rd (see above), and also writable,
|
signal should be declared public_flat_rd (see above), and also writable,
|
||||||
where writes should be considered to have the timing specified by the given
|
where writes should be considered to have the timing specified by the given
|
||||||
sensitivity edge list.
|
sensitivity edge list.
|
||||||
@@ -2023,11 +2060,20 @@ using the --public switch.
|
|||||||
|
|
||||||
=item /*verilator sc_clock*/
|
=item /*verilator sc_clock*/
|
||||||
|
|
||||||
Rarely needed. Used after a input declaration to indicate the signal
|
Rarely needed. Used after an input declaration to indicate the signal
|
||||||
should be declared in SystemC as a sc_clock instead of a bool. This was
|
should be declared in SystemC as a sc_clock instead of a bool. This was
|
||||||
needed in SystemC 1.1 and 1.2 only; versions 2.0 and later do not require
|
needed in SystemC 1.1 and 1.2 only; versions 2.0 and later do not require
|
||||||
clock pins to be sc_clocks and this is no longer needed.
|
clock pins to be sc_clocks and this is no longer needed.
|
||||||
|
|
||||||
|
=item /*verilator sc_bv*/
|
||||||
|
|
||||||
|
Used after a port declaration. It sets the port to be of sc_bv<I<width>>
|
||||||
|
type, instead of bool, vluint32_t or vluint64_t. This may be useful if
|
||||||
|
the port width is parametrized and different of such modules interface
|
||||||
|
a templated module (such as a transactor) or for other reasons. In general
|
||||||
|
you should avoid using this attribute when not necessary as with increasing
|
||||||
|
usage of sc_bv the performance increases significantly.
|
||||||
|
|
||||||
=item /*verilator sformat*/
|
=item /*verilator sformat*/
|
||||||
|
|
||||||
Attached to the final input of a function or task "input string" to
|
Attached to the final input of a function or task "input string" to
|
||||||
@@ -2096,7 +2142,7 @@ that Verilator will print a list of known scopes to help your debugging.
|
|||||||
|
|
||||||
=head2 Floating Point
|
=head2 Floating Point
|
||||||
|
|
||||||
Floating Point numbers are not synthesizable, and so not supported.
|
Floating Point (real) numbers are supported.
|
||||||
|
|
||||||
=head2 Latches
|
=head2 Latches
|
||||||
|
|
||||||
@@ -2150,7 +2196,7 @@ Pullup, pulldown, bufif0, bufif1, notif0, notif1 are also supported.
|
|||||||
External logic will be needed to combine these signals with any external
|
External logic will be needed to combine these signals with any external
|
||||||
drivers.
|
drivers.
|
||||||
|
|
||||||
Tristate drivers are not supported inside functions and tasks; a inout
|
Tristate drivers are not supported inside functions and tasks; an inout
|
||||||
there will be considered a two state variable that is read and written
|
there will be considered a two state variable that is read and written
|
||||||
instead of a four state variable.
|
instead of a four state variable.
|
||||||
|
|
||||||
@@ -2258,6 +2304,13 @@ not arrays nor structs.
|
|||||||
Treated as a "longint"; does not yet warn about operations that are
|
Treated as a "longint"; does not yet warn about operations that are
|
||||||
specified as illegal on chandles.
|
specified as illegal on chandles.
|
||||||
|
|
||||||
|
=item disable
|
||||||
|
|
||||||
|
Disable statements may be used only if the block being disabled is a block
|
||||||
|
the disable statement itself is inside. This was commonly used to provide
|
||||||
|
loop break and continue functionality before SystemVerilog added the break
|
||||||
|
and continue keywords.
|
||||||
|
|
||||||
=item priority if, unique if
|
=item priority if, unique if
|
||||||
|
|
||||||
Priority and unique if's are treated as normal ifs and not asserted to be
|
Priority and unique if's are treated as normal ifs and not asserted to be
|
||||||
@@ -2306,11 +2359,6 @@ The rarely used optional parameter to $finish and $stop is ignored.
|
|||||||
|
|
||||||
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
|
||||||
MCDs, which includes the mode parameter to $fopen being mandatory.
|
MCDs, which includes the mode parameter to $fopen being mandatory.
|
||||||
Verilator will convert the integer used to hold the file descriptor into a
|
|
||||||
internal FILE*. To prevent core dumps due to mis-use, and because integers
|
|
||||||
are 32 bits while FILE*s may be 64 bits, the descriptor must be stored in a
|
|
||||||
reg [63:0] rather than an integer. The define `verilator_file_descriptor in
|
|
||||||
verilated.v can be used to hide this difference.
|
|
||||||
|
|
||||||
=item $fscanf, $sscanf
|
=item $fscanf, $sscanf
|
||||||
|
|
||||||
@@ -2334,10 +2382,6 @@ Read memory commands should work properly. Note Verilator and the Verilog
|
|||||||
specification does not include support for readmem to multi-dimensional
|
specification does not include support for readmem to multi-dimensional
|
||||||
arrays.
|
arrays.
|
||||||
|
|
||||||
=item $realtime
|
|
||||||
|
|
||||||
Treated as $time.
|
|
||||||
|
|
||||||
=item $test$plusargs, $value$plusargs
|
=item $test$plusargs, $value$plusargs
|
||||||
|
|
||||||
Supported, but the instantiating C++/SystemC testbench must call
|
Supported, but the instantiating C++/SystemC testbench must call
|
||||||
@@ -2377,6 +2421,29 @@ List of all warnings:
|
|||||||
|
|
||||||
=over 4
|
=over 4
|
||||||
|
|
||||||
|
=item ASSIGNIN
|
||||||
|
|
||||||
|
Error that an assignment is being made to an input signal. This is almost
|
||||||
|
certainly a mistake, though technically legal.
|
||||||
|
|
||||||
|
input a;
|
||||||
|
assign a = 1'b1;
|
||||||
|
|
||||||
|
Ignoring this warning will only suppress the lint check, it will simulate
|
||||||
|
correctly.
|
||||||
|
|
||||||
|
=item ASSIGNDLY
|
||||||
|
|
||||||
|
Warns that you have an assignment statement with a delayed time in front of
|
||||||
|
it, for example:
|
||||||
|
|
||||||
|
a <= #100 b;
|
||||||
|
assign #100 a = b;
|
||||||
|
|
||||||
|
Ignoring this warning may make Verilator simulations differ from other
|
||||||
|
simulators, however at one point this was a common style so disabled by
|
||||||
|
default as a code style warning.
|
||||||
|
|
||||||
=item BLKANDNBLK
|
=item BLKANDNBLK
|
||||||
|
|
||||||
BLKANDNBLK is an error that a variable comes from a mix of blocked and
|
BLKANDNBLK is an error that a variable comes from a mix of blocked and
|
||||||
@@ -2617,6 +2684,11 @@ 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 REALCVT
|
||||||
|
|
||||||
|
Warns that a real number is being implicitly rounded to an integer, with
|
||||||
|
possible loss of precision.
|
||||||
|
|
||||||
=item REDEFMACRO
|
=item REDEFMACRO
|
||||||
|
|
||||||
Warns that you have redefined the same macro with a different value, for
|
Warns that you have redefined the same macro with a different value, for
|
||||||
@@ -2655,7 +2727,7 @@ Verilator to avoid the conflict.
|
|||||||
|
|
||||||
Warns that the specified net is used in at least two different always
|
Warns that the specified net is used in at least two different always
|
||||||
statements with posedge/negedges (i.e. a flop). One usage has the signal
|
statements with posedge/negedges (i.e. a flop). One usage has the signal
|
||||||
in the sensitivity list and body, probably as a async reset, and the other
|
in the sensitivity list and body, probably as an async reset, and the other
|
||||||
usage has the signal only in the body, probably as a sync reset. Mixing
|
usage has the signal only in the body, probably as a sync reset. Mixing
|
||||||
sync and async resets is usually a mistake. The warning may be disabled
|
sync and async resets is usually a mistake. The warning may be disabled
|
||||||
with a lint_off pragma around the net, or either flopped block.
|
with a lint_off pragma around the net, or either flopped block.
|
||||||
@@ -2834,7 +2906,7 @@ correctly.
|
|||||||
=item WIDTHCONCAT
|
=item WIDTHCONCAT
|
||||||
|
|
||||||
Warns that based on width rules of Verilog, a concatenate or replication
|
Warns that based on width rules of Verilog, a concatenate or replication
|
||||||
has a indeterminate width. In most cases this violates the Verilog rule
|
has an indeterminate width. In most cases this violates the Verilog rule
|
||||||
that widths inside concatenates and replicates must be sized, and should be
|
that widths inside concatenates and replicates must be sized, and should be
|
||||||
fixed in the code.
|
fixed in the code.
|
||||||
|
|
||||||
@@ -2945,6 +3017,11 @@ One limit is that you cannot under either license release a commercial
|
|||||||
Verilog simulation product incorporating Verilator without making the
|
Verilog simulation product incorporating Verilator without making the
|
||||||
source code available.
|
source code available.
|
||||||
|
|
||||||
|
As is standard with Open Source, contributions back to Verilator will be
|
||||||
|
placed under the Verilator copyright and LGPL/Artistic license. Small test
|
||||||
|
cases will be released into the public domain so they can be used anywhere,
|
||||||
|
large tests under the LGPL/Artistic, unless requested otherwise.
|
||||||
|
|
||||||
=item Why is Verilation so slow?
|
=item Why is Verilation so slow?
|
||||||
|
|
||||||
Verilator needs more memory than the resulting simulator will require, as
|
Verilator needs more memory than the resulting simulator will require, as
|
||||||
@@ -2952,7 +3029,7 @@ Verilator creates internally all of the state of the resulting simulator in
|
|||||||
order to optimize it. If it takes more than a minute or so (and you're not
|
order to optimize it. If it takes more than a minute or so (and you're not
|
||||||
using --debug since debug is disk bound), see if your machine is paging;
|
using --debug since debug is disk bound), see if your machine is paging;
|
||||||
most likely you need to run it on a machine with more memory. Verilator is
|
most likely you need to run it on a machine with more memory. Verilator is
|
||||||
a full 64 bit application and may use more than 4GB, but about 1GB is the
|
a full 64-bit application and may use more than 4GB, but about 1GB is the
|
||||||
maximum typically needed.
|
maximum typically needed.
|
||||||
|
|
||||||
=item How do I generate waveforms (traces) in C++?
|
=item How do I generate waveforms (traces) in C++?
|
||||||
@@ -3051,8 +3128,8 @@ network disk. Network disks are generally far slower.
|
|||||||
=item How do I do coverage analysis?
|
=item How do I do coverage analysis?
|
||||||
|
|
||||||
Verilator supports both block (line) coverage and user inserted functional
|
Verilator supports both block (line) coverage and user inserted functional
|
||||||
coverage. Both currently require SystemPerl output mode and the SystemPerl
|
coverage. Both require the SystemPerl package to be installed but do not
|
||||||
package.
|
require use of the SystemPerl output mode.
|
||||||
|
|
||||||
First, run verilator with the --coverage option. If you're using your own
|
First, run verilator with the --coverage option. If you're using your own
|
||||||
makefile, compile the model with the GCC flag -DSP_COVERAGE_ENABLE (if
|
makefile, compile the model with the GCC flag -DSP_COVERAGE_ENABLE (if
|
||||||
@@ -3074,7 +3151,7 @@ with '%' to see what lines Verilator believes need more coverage.
|
|||||||
Translate on/off pragmas are generally a bad idea, as it's easy to have
|
Translate on/off pragmas are generally a bad idea, as it's easy to have
|
||||||
mismatched pairs, and you can't see what another tool sees by just
|
mismatched pairs, and you can't see what another tool sees by just
|
||||||
preprocessing the code. Instead, use the preprocessor; Verilator defines
|
preprocessing the code. Instead, use the preprocessor; Verilator defines
|
||||||
the "VERILATOR" define for you, so just wrap the code in a ifndef region:
|
the "VERILATOR" define for you, so just wrap the code in an ifndef region:
|
||||||
|
|
||||||
`ifndef VERILATOR
|
`ifndef VERILATOR
|
||||||
Something_Verilator_Dislikes;
|
Something_Verilator_Dislikes;
|
||||||
@@ -3142,10 +3219,9 @@ Between GCC 3.0 to 3.3, each compiled progressively slower, thus if you can
|
|||||||
use GCC 2.95, or GCC 3.4 you'll have faster builds. Two ways to cheat are
|
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. ccache will skip GCC runs between identical source builds, even
|
||||||
L<http://www.veripool.org/>. Make::Cache will skip GCC runs between
|
across different users. You can use the OBJCACHE environment variable to
|
||||||
identical source builds, even across different users. You can use the
|
use these CC wrappers.
|
||||||
OBJCACHE environment variable to use these CC wrappers.
|
|
||||||
|
|
||||||
=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?
|
||||||
|
|
||||||
@@ -3173,14 +3249,14 @@ be accessing with a /*verilator public*/ comment before the closing
|
|||||||
semicolon. Then scope into the C++ class to read the value of the signal,
|
semicolon. Then scope into the C++ class to read the value of the signal,
|
||||||
as you would any other member variable.
|
as you would any other member variable.
|
||||||
|
|
||||||
Signals are the smallest of 8 bit chars, 16 bit shorts, 32 bit longs, or 64
|
Signals are the smallest of 8-bit chars, 16-bit shorts, 32-bit longs, or
|
||||||
bit long longs that fits the width of the signal. Generally, you can use
|
64-bit long longs that fits the width of the signal. Generally, you can
|
||||||
just uint32_t's for 1 to 32 bits, or uint64_t for 1 to 64 bits, and the
|
use just uint32_t's for 1 to 32 bits, or vluint64_t for 1 to 64 bits, and
|
||||||
compiler will properly up-convert smaller entities.
|
the compiler will properly up-convert smaller entities.
|
||||||
|
|
||||||
Signals wider than 64 bits are stored as an array of 32-bit uint32_t's.
|
Signals wider than 64 bits are stored as an array of 32-bit uint32_t's.
|
||||||
Thus to read bits 31:0, access signal[0], and for bits 63:32, access
|
Thus to read bits 31:0, access signal[0], and for bits 63:32, access
|
||||||
signal[1]. Unused bits (for example bit numbers 65-96 of a 65 bit vector)
|
signal[1]. Unused bits (for example bit numbers 65-96 of a 65-bit vector)
|
||||||
will always be zero. if you change the value you must make sure to pack
|
will always be zero. if you change the value you must make sure to pack
|
||||||
zeros in the unused bits or core-dumps may result. (Because Verilator
|
zeros in the unused bits or core-dumps may result. (Because Verilator
|
||||||
strips array bound checks where it believes them to be unnecessary.)
|
strips array bound checks where it believes them to be unnecessary.)
|
||||||
@@ -3328,7 +3404,7 @@ Thanks all.
|
|||||||
|
|
||||||
The latest version is available from L<http://www.veripool.org/>.
|
The latest version is available from L<http://www.veripool.org/>.
|
||||||
|
|
||||||
Copyright 2003-2011 by Wilson Snyder. Verilator is free software; you can
|
Copyright 2003-2012 by Wilson Snyder. Verilator is free software; you can
|
||||||
redistribute it and/or modify the Verilator internals under the terms of
|
redistribute it and/or modify the Verilator internals under the terms of
|
||||||
either the GNU Lesser General Public License Version 3 or the Perl Artistic
|
either the GNU Lesser General Public License Version 3 or the Perl Artistic
|
||||||
License Version 2.0.
|
License Version 2.0.
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ sub filter {
|
|||||||
next if $line =~ / This=/;
|
next if $line =~ / This=/;
|
||||||
$line =~ s/0x[a-f0-9]+/0x/g;
|
$line =~ s/0x[a-f0-9]+/0x/g;
|
||||||
$line =~ s/<e[0-9]+\#?>/<e>/g;
|
$line =~ s/<e[0-9]+\#?>/<e>/g;
|
||||||
$line =~ s/{\d+}/{}/g if !$Opt_Lineno;
|
$line =~ s/{[a-z]*\d+}/{}/g if !$Opt_Lineno;
|
||||||
print $f2 $line;
|
print $f2 $line;
|
||||||
}
|
}
|
||||||
$f1->close;
|
$f1->close;
|
||||||
@@ -109,7 +109,7 @@ sub filter {
|
|||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
sub usage {
|
sub usage {
|
||||||
pod2usage(-verbose=>2, -exitval => 2);
|
pod2usage(-verbose=>2, -exitval=>2, -output=>\*STDOUT);
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,7 +177,7 @@ Do not show differences in line numbering.
|
|||||||
|
|
||||||
The latest version is available from L<http://www.veripool.org/verilator>.
|
The latest version is available from L<http://www.veripool.org/verilator>.
|
||||||
|
|
||||||
Copyright 2005-2011 by Wilson Snyder. This package is free software; you can
|
Copyright 2005-2012 by Wilson Snyder. This package is free software; you can
|
||||||
redistribute it and/or modify it under the terms of either the GNU Lesser
|
redistribute it and/or modify it under the terms of either the GNU Lesser
|
||||||
General Public License Version 3 or the Perl Artistic License Version 2.0.
|
General Public License Version 3 or the Perl Artistic License Version 2.0.
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ eval 'exec perl -wS $0 ${1+"$@"}'
|
|||||||
if 0;
|
if 0;
|
||||||
# DESCRIPTION: Print include statements for each ARGV
|
# DESCRIPTION: Print include statements for each ARGV
|
||||||
#
|
#
|
||||||
# Copyright 2003-2011 by Wilson Snyder. This package is free software; you can
|
# Copyright 2003-2012 by Wilson Snyder. This package is free software; you can
|
||||||
# redistribute it and/or modify it under the terms of either the GNU Lesser
|
# redistribute it and/or modify it under the terms of either the GNU Lesser
|
||||||
# General Public License Version 3 or the Perl Artistic License Version 2.0.
|
# General Public License Version 3 or the Perl Artistic License Version 2.0.
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ profcfunc($Opt_File);
|
|||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
sub usage {
|
sub usage {
|
||||||
pod2usage(-verbose=>2, -exitval => 2);
|
pod2usage(-verbose=>2, -exitval=>2, -output=>\*STDOUT);
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,7 +208,7 @@ Displays this message and program version and exits.
|
|||||||
|
|
||||||
The latest version is available from L<http://www.veripool.org/>.
|
The latest version is available from L<http://www.veripool.org/>.
|
||||||
|
|
||||||
Copyright 2007-2011 by Wilson Snyder. Verilator is free software; you can
|
Copyright 2007-2012 by Wilson Snyder. Verilator is free software; you can
|
||||||
redistribute it and/or modify it under the terms of either the GNU Lesser
|
redistribute it and/or modify it under the terms of either the GNU Lesser
|
||||||
General Public License Version 3 or the Perl Artistic License Version 2.0.
|
General Public License Version 3 or the Perl Artistic License Version 2.0.
|
||||||
|
|
||||||
|
|||||||
+100
-31
@@ -1,35 +1,83 @@
|
|||||||
dnl DESCRIPTION: Process this file with autoconf to produce a configure script.
|
# DESCRIPTION: Process this file with autoconf to produce a configure script.
|
||||||
dnl
|
#
|
||||||
dnl Copyright 2003-2011 by Wilson Snyder. Verilator is free software; you can
|
# Copyright 2003-2012 by Wilson Snyder. Verilator is free software; you can
|
||||||
dnl 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
|
||||||
dnl General Public License Version 3 or the Perl Artistic License Version 2.0.
|
# General Public License Version 3 or the Perl Artistic License Version 2.0.
|
||||||
|
|
||||||
AC_INIT(src/Verilator.cpp)
|
AC_INIT([Verilator],[3.831 2012-01-20])
|
||||||
AC_CONFIG_HEADER(src/config_build.h)
|
AC_CONFIG_HEADER(src/config_build.h)
|
||||||
|
AC_CONFIG_FILES(Makefile src/Makefile src/Makefile_obj include/verilated.mk)
|
||||||
|
|
||||||
dnl Special Substitutions
|
AC_MSG_RESULT([configuring for $PACKAGE_STRING])
|
||||||
AC_ARG_ENABLE(defenv,
|
|
||||||
[AS_HELP_STRING([--disable-defenv], [disable hardcoded default environment variables])],
|
# Special Substitutions - CFG_WITH_DEFENV
|
||||||
CFG_WITH_DEFENV=$enableval,
|
AC_MSG_CHECKING(whether to disable hardcoded paths)
|
||||||
CFG_WITH_DEFENV=yes)
|
AC_ARG_ENABLE([defenv],
|
||||||
|
[AS_HELP_STRING([--disable-defenv],
|
||||||
|
[disable using some hardcoded data paths extracted from some default environment variables (the default is to use hardcoded paths)])],
|
||||||
|
[case "${enableval}" in
|
||||||
|
yes) CFG_WITH_DEFENV=yes ;;
|
||||||
|
no) CFG_WITH_DEFENV=no ;;
|
||||||
|
*) AC_MSG_ERROR([bad value ${enableval} for --disable-defenv]) ;;
|
||||||
|
esac],
|
||||||
|
CFG_WITH_DEFENV=yes)
|
||||||
AC_SUBST(CFG_WITH_DEFENV)
|
AC_SUBST(CFG_WITH_DEFENV)
|
||||||
|
AC_MSG_RESULT($CFG_WITH_DEFENV)
|
||||||
|
|
||||||
dnl Compiler flags
|
# Special Substitutions - CFG_WITH_CCWARN
|
||||||
|
AC_MSG_CHECKING(whether to show and stop on compilation warnings)
|
||||||
|
AC_ARG_ENABLE([ccwarn],
|
||||||
|
[AS_HELP_STRING([--enable-ccwarn],
|
||||||
|
[enable showing and stopping on compilation warnings])],
|
||||||
|
[case "${enableval}" in
|
||||||
|
yes) CFG_WITH_CCWARN=yes ;;
|
||||||
|
no) CFG_WITH_CCWARN=no ;;
|
||||||
|
*) AC_MSG_ERROR([bad value ${enableval} for --enable-ccwarn]) ;;
|
||||||
|
esac],
|
||||||
|
[case "x${VERILATOR_AUTHOR_SITE}" in
|
||||||
|
x) CFG_WITH_CCWARN=no ;;
|
||||||
|
*) CFG_WITH_CCWARN=yes ;;
|
||||||
|
esac]
|
||||||
|
)
|
||||||
|
AC_SUBST(CFG_WITH_CCWARN)
|
||||||
|
AC_MSG_RESULT($CFG_WITH_CCWARN)
|
||||||
|
|
||||||
|
# Special Substitutions - CFG_WITH_LONGTESTS
|
||||||
|
AC_MSG_CHECKING(whether to run long tests)
|
||||||
|
AC_ARG_ENABLE([longtests],
|
||||||
|
[AS_HELP_STRING([--enable-longtests],
|
||||||
|
[enable running long developer tests])],
|
||||||
|
[case "${enableval}" in
|
||||||
|
yes) CFG_WITH_LONGTESTS=yes ;;
|
||||||
|
no) CFG_WITH_LONGTESTS=no ;;
|
||||||
|
*) AC_MSG_ERROR([bad value ${enableval} for --enable-longtests]) ;;
|
||||||
|
esac],
|
||||||
|
[case "x${VERILATOR_AUTHOR_SITE}" in
|
||||||
|
x) CFG_WITH_LONGTESTS=no ;;
|
||||||
|
*) CFG_WITH_LONGTESTS=yes ;;
|
||||||
|
esac]
|
||||||
|
)
|
||||||
|
AC_SUBST(CFG_WITH_LONGTESTS)
|
||||||
|
AC_MSG_RESULT($CFG_WITH_LONGTESTS)
|
||||||
|
|
||||||
|
# Compiler flags
|
||||||
CFLAGS=-I${includedir}
|
CFLAGS=-I${includedir}
|
||||||
CPPFLAGS=-I${includedir}
|
CPPFLAGS=-I${includedir}
|
||||||
CXXFLAGS=-I${includedir}
|
CXXFLAGS=-I${includedir}
|
||||||
LDFLAGS=-L${libdir}
|
LDFLAGS=-L${libdir}
|
||||||
|
|
||||||
dnl Checks for programs.
|
# Checks for programs.
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
AC_PROG_CXX
|
AC_PROG_CXX
|
||||||
AC_PROG_INSTALL
|
AC_PROG_INSTALL
|
||||||
|
|
||||||
AC_LANG_PUSH(C++)
|
AC_LANG_PUSH(C++)
|
||||||
AC_MSG_CHECKING([that C++ compiler can compile simple program])
|
AC_MSG_CHECKING([that C++ compiler can compile simple program])
|
||||||
AC_TRY_RUN([int main() { return 0; }],
|
AC_RUN_IFELSE(
|
||||||
|
[AC_LANG_SOURCE([int main() { return 0; }])],
|
||||||
AC_MSG_RESULT(yes),
|
AC_MSG_RESULT(yes),
|
||||||
AC_MSG_RESULT(no);AC_MSG_ERROR([a working C++ compiler is required]))
|
AC_MSG_RESULT(no);AC_MSG_ERROR([a working C++ compiler is required]),
|
||||||
|
AC_MSG_RESULT(yes))
|
||||||
|
|
||||||
AC_PATH_PROG(PERL,perl)
|
AC_PATH_PROG(PERL,perl)
|
||||||
if test "x$PERL" = "x" ; then
|
if test "x$PERL" = "x" ; then
|
||||||
@@ -44,33 +92,54 @@ if test "x$YACC" = "x" ; then
|
|||||||
AC_MSG_ERROR([Cannot find "bison" in your PATH, please install it])
|
AC_MSG_ERROR([Cannot find "bison" in your PATH, please install it])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl Checks for libraries.
|
# Checks for libraries.
|
||||||
|
|
||||||
dnl Checks for header files.
|
# Checks for typedefs, structures
|
||||||
AC_HEADER_STDC
|
|
||||||
AC_HEADER_SYS_WAIT
|
|
||||||
AC_CHECK_HEADERS(fcntl.h unistd.h inttypes.h sys/file.h sys/time.h sys/un.h math.h stdint.h mingw/stdint.h)
|
|
||||||
|
|
||||||
dnl Checks for typedefs, structures
|
|
||||||
AC_CHECK_TYPE(size_t,unsigned int)
|
AC_CHECK_TYPE(size_t,unsigned int)
|
||||||
AC_CHECK_TYPE(uint_t,unsigned int)
|
|
||||||
AC_CHECK_TYPE(ulong_t,unsigned long)
|
|
||||||
AC_TYPE_SIZE_T
|
AC_TYPE_SIZE_T
|
||||||
AC_STRUCT_TM
|
|
||||||
|
|
||||||
dnl Checks for compiler characteristics.
|
# Checks for compiler characteristics.
|
||||||
AC_C_INLINE
|
AC_C_INLINE
|
||||||
|
|
||||||
dnl Checks for library functions.
|
AC_DEFUN([_MY_CXX_CHECK_OPT],
|
||||||
|
[# _MY_CXX_CHECK_OPT(flag) -- Check if compiler supports specific options
|
||||||
|
ACO_SAVE_CXXFLAGS="$CXXFLAGS"
|
||||||
|
# -Werror needed otherwise unknown -Wno-div-by-zero won't report problems
|
||||||
|
CXXFLAGS="$CXXFLAGS $1 -Werror"
|
||||||
|
AC_MSG_CHECKING([whether $CXX accepts $1])
|
||||||
|
AC_COMPILE_IFELSE(
|
||||||
|
[AC_LANG_PROGRAM([],[])],
|
||||||
|
[_my_result=yes],
|
||||||
|
[_my_result=no])
|
||||||
|
AC_MSG_RESULT($_my_result)
|
||||||
|
if test "$_my_result" = "yes" ; then
|
||||||
|
CFG_CXXFLAGS_NO_UNUSED="$CFG_CXXFLAGS_NO_UNUSED $1"
|
||||||
|
fi
|
||||||
|
CXXFLAGS="$ACO_SAVE_CXXFLAGS"
|
||||||
|
])# _MY_CXX_CHECK_OPT
|
||||||
|
|
||||||
dnl Checks for system services
|
# For example, -Wno-div-by-zero isn't in 4.1.2
|
||||||
|
_MY_CXX_CHECK_OPT(-Wno-char-subscripts)
|
||||||
|
# Random code often does / 0. Unfortunately VL_DIV_I(0,0) will warn
|
||||||
|
# without this flag, even though there's a conditional to prevent the divide.
|
||||||
|
# We still don't add no-div-by-zero as it throws message to stdout, though doesn't die.
|
||||||
|
#_MY_CXX_CHECK_OPT(-Wno-div-by-zero)
|
||||||
|
_MY_CXX_CHECK_OPT(-Wno-sign-compare)
|
||||||
|
_MY_CXX_CHECK_OPT(-Wno-uninitialized)
|
||||||
|
_MY_CXX_CHECK_OPT(-Wno-unused-parameter)
|
||||||
|
_MY_CXX_CHECK_OPT(-Wno-unused-variable)
|
||||||
|
AC_SUBST(CFG_CXXFLAGS_NO_UNUSED)
|
||||||
|
|
||||||
dnl Other install directories
|
# Checks for library functions.
|
||||||
|
|
||||||
|
# Checks for system services
|
||||||
|
|
||||||
|
# Other install directories
|
||||||
pkgdatadir=${datadir}/verilator
|
pkgdatadir=${datadir}/verilator
|
||||||
AC_SUBST(pkgdatadir)
|
AC_SUBST(pkgdatadir)
|
||||||
|
|
||||||
AC_OUTPUT(Makefile src/Makefile src/Makefile_obj include/verilated.mk)
|
AC_OUTPUT
|
||||||
|
|
||||||
AC_MSG_RESULT([])
|
AC_MSG_RESULT([])
|
||||||
AC_MSG_RESULT([Now type 'gmake'])
|
AC_MSG_RESULT([Now type 'make' (or sometimes 'gmake') to build Verilator.])
|
||||||
AC_MSG_RESULT([])
|
AC_MSG_RESULT([])
|
||||||
|
|||||||
+79
-13
@@ -1,7 +1,7 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License.
|
// Lesser General Public License Version 3 or the Perl Artistic License.
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
@@ -26,7 +26,6 @@
|
|||||||
#define _VERILATED_CPP_
|
#define _VERILATED_CPP_
|
||||||
#include "verilated_imp.h"
|
#include "verilated_imp.h"
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#define VL_VALUE_STRING_MAX_WIDTH 1024 ///< Max static char array for VL_VALUE_STRING
|
#define VL_VALUE_STRING_MAX_WIDTH 1024 ///< Max static char array for VL_VALUE_STRING
|
||||||
|
|
||||||
@@ -285,12 +284,15 @@ void _vl_vsformat(string& output, const char* formatp, va_list ap) {
|
|||||||
// Note also assumes variables < 64 are not wide, this assumption is
|
// Note also assumes variables < 64 are not wide, this assumption is
|
||||||
// sometimes not true in low-level routines written here in verilated.cpp
|
// sometimes not true in low-level routines written here in verilated.cpp
|
||||||
static VL_THREAD char tmp[VL_VALUE_STRING_MAX_WIDTH];
|
static VL_THREAD char tmp[VL_VALUE_STRING_MAX_WIDTH];
|
||||||
|
static VL_THREAD char tmpf[VL_VALUE_STRING_MAX_WIDTH];
|
||||||
|
const char* pctp = NULL; // Most recent %##.##g format
|
||||||
bool inPct = false;
|
bool inPct = false;
|
||||||
bool widthSet = false;
|
bool widthSet = false;
|
||||||
int width = 0;
|
int width = 0;
|
||||||
const char* pos = formatp;
|
const char* pos = formatp;
|
||||||
for (; *pos; ++pos) {
|
for (; *pos; ++pos) {
|
||||||
if (!inPct && pos[0]=='%') {
|
if (!inPct && pos[0]=='%') {
|
||||||
|
pctp = pos;
|
||||||
inPct = true;
|
inPct = true;
|
||||||
widthSet = false;
|
widthSet = false;
|
||||||
width = 0;
|
width = 0;
|
||||||
@@ -312,6 +314,9 @@ void _vl_vsformat(string& output, const char* formatp, va_list ap) {
|
|||||||
widthSet = true;
|
widthSet = true;
|
||||||
width = width*10 + (fmt - '0');
|
width = width*10 + (fmt - '0');
|
||||||
break;
|
break;
|
||||||
|
case '.':
|
||||||
|
inPct = true; // Get more digits
|
||||||
|
break;
|
||||||
case '%':
|
case '%':
|
||||||
output += '%';
|
output += '%';
|
||||||
break;
|
break;
|
||||||
@@ -325,6 +330,18 @@ void _vl_vsformat(string& output, const char* formatp, va_list ap) {
|
|||||||
output += cstrp;
|
output += cstrp;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case 'e':
|
||||||
|
case 'f':
|
||||||
|
case 'g': {
|
||||||
|
const int lbits = va_arg(ap, int);
|
||||||
|
double d = va_arg(ap, double);
|
||||||
|
if (lbits) {} // UNUSED - always 64
|
||||||
|
strncpy(tmpf, pctp, pos-pctp+1);
|
||||||
|
tmpf[pos-pctp+1] = '\0';
|
||||||
|
sprintf(tmp, tmpf, d);
|
||||||
|
output += tmp;
|
||||||
|
break;
|
||||||
|
}
|
||||||
default: {
|
default: {
|
||||||
// Deal with all read-and-print somethings
|
// Deal with all read-and-print somethings
|
||||||
const int lbits = va_arg(ap, int);
|
const int lbits = va_arg(ap, int);
|
||||||
@@ -358,14 +375,26 @@ void _vl_vsformat(string& output, const char* formatp, va_list ap) {
|
|||||||
case 'd': { // Signed decimal
|
case 'd': { // Signed decimal
|
||||||
int digits=sprintf(tmp,"%" VL_PRI64 "d",(vlsint64_t)(VL_EXTENDS_QQ(lbits,lbits,ld)));
|
int digits=sprintf(tmp,"%" VL_PRI64 "d",(vlsint64_t)(VL_EXTENDS_QQ(lbits,lbits,ld)));
|
||||||
int needmore = width-digits;
|
int needmore = width-digits;
|
||||||
if (needmore>0) output.append(needmore,' '); // Pre-pad spaces
|
if (needmore>0) {
|
||||||
|
if (pctp && pctp[0] && pctp[1]=='0') { //%0
|
||||||
|
output.append(needmore,'0'); // Pre-pad zero
|
||||||
|
} else {
|
||||||
|
output.append(needmore,' '); // Pre-pad spaces
|
||||||
|
}
|
||||||
|
}
|
||||||
output += tmp;
|
output += tmp;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'u': { // Unsigned decimal
|
case 'u': { // Unsigned decimal
|
||||||
int digits=sprintf(tmp,"%" VL_PRI64 "u",ld);
|
int digits=sprintf(tmp,"%" VL_PRI64 "u",ld);
|
||||||
int needmore = width-digits;
|
int needmore = width-digits;
|
||||||
if (needmore>0) output.append(needmore,' '); // Pre-pad spaces
|
if (needmore>0) {
|
||||||
|
if (pctp && pctp[0] && pctp[1]=='0') { //%0
|
||||||
|
output.append(needmore,'0'); // Pre-pad zero
|
||||||
|
} else {
|
||||||
|
output.append(needmore,' '); // Pre-pad spaces
|
||||||
|
}
|
||||||
|
}
|
||||||
output += tmp;
|
output += tmp;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -569,6 +598,17 @@ IData _vl_vsscanf(FILE* fp, // If a fscanf
|
|||||||
VL_SET_WQ(owp,ld);
|
VL_SET_WQ(owp,ld);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case 'f':
|
||||||
|
case 'e':
|
||||||
|
case 'g': { // Real number
|
||||||
|
_vl_vsss_skipspace(fp,floc,fromp);
|
||||||
|
_vl_vsss_read(fp,floc,fromp, tmp, "+-.0123456789eE");
|
||||||
|
if (!tmp[0]) goto done;
|
||||||
|
union { double r; vlsint64_t ld; } u;
|
||||||
|
u.r = strtod(tmp, NULL);
|
||||||
|
VL_SET_WQ(owp,u.ld);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case 't': // FALLTHRU // Time
|
case 't': // FALLTHRU // Time
|
||||||
case 'u': { // Unsigned decimal
|
case 'u': { // Unsigned decimal
|
||||||
_vl_vsss_skipspace(fp,floc,fromp);
|
_vl_vsss_skipspace(fp,floc,fromp);
|
||||||
@@ -628,6 +668,10 @@ IData _vl_vsscanf(FILE* fp, // If a fscanf
|
|||||||
//===========================================================================
|
//===========================================================================
|
||||||
// File I/O
|
// File I/O
|
||||||
|
|
||||||
|
FILE* VL_CVT_I_FP(IData lhs) {
|
||||||
|
return VerilatedImp::fdToFp(lhs);
|
||||||
|
}
|
||||||
|
|
||||||
void _VL_VINT_TO_STRING(int obits, char* destoutp, WDataInP sourcep) {
|
void _VL_VINT_TO_STRING(int obits, char* destoutp, WDataInP sourcep) {
|
||||||
// See also VL_DATA_TO_STRING_NW
|
// See also VL_DATA_TO_STRING_NW
|
||||||
int lsb=obits-1;
|
int lsb=obits-1;
|
||||||
@@ -655,8 +699,8 @@ void _VL_STRING_TO_VINT(int obits, void* destp, int srclen, const char* srcp) {
|
|||||||
for (; i<bytes; i++) { *op++ = 0; }
|
for (; i<bytes; i++) { *op++ = 0; }
|
||||||
}
|
}
|
||||||
|
|
||||||
IData VL_FGETS_IXQ(int obits, void* destp, QData fpq) {
|
IData VL_FGETS_IXI(int obits, void* destp, IData fpi) {
|
||||||
FILE* fp = VL_CVT_Q_FP(fpq);
|
FILE* fp = VL_CVT_I_FP(fpi);
|
||||||
if (VL_UNLIKELY(!fp)) return 0;
|
if (VL_UNLIKELY(!fp)) return 0;
|
||||||
|
|
||||||
// The string needs to be padded with 0's in unused spaces in front of
|
// The string needs to be padded with 0's in unused spaces in front of
|
||||||
@@ -683,16 +727,26 @@ IData VL_FGETS_IXQ(int obits, void* destp, QData fpq) {
|
|||||||
return got;
|
return got;
|
||||||
}
|
}
|
||||||
|
|
||||||
QData VL_FOPEN_QI(QData filename, IData mode) {
|
IData VL_FOPEN_QI(QData filename, IData mode) {
|
||||||
IData fnw[2]; VL_SET_WQ(fnw, filename);
|
IData fnw[2]; VL_SET_WQ(fnw, filename);
|
||||||
return VL_FOPEN_WI(2, fnw, mode);
|
return VL_FOPEN_WI(2, fnw, mode);
|
||||||
}
|
}
|
||||||
QData VL_FOPEN_WI(int fnwords, WDataInP filenamep, IData mode) {
|
IData VL_FOPEN_WI(int fnwords, WDataInP filenamep, IData mode) {
|
||||||
char filenamez[VL_TO_STRING_MAX_WORDS*VL_WORDSIZE+1];
|
char filenamez[VL_TO_STRING_MAX_WORDS*VL_WORDSIZE+1];
|
||||||
_VL_VINT_TO_STRING(fnwords*VL_WORDSIZE, filenamez, filenamep);
|
_VL_VINT_TO_STRING(fnwords*VL_WORDSIZE, filenamez, filenamep);
|
||||||
char modez[5];
|
char modez[5];
|
||||||
_VL_VINT_TO_STRING(VL_WORDSIZE, modez, &mode);
|
_VL_VINT_TO_STRING(VL_WORDSIZE, modez, &mode);
|
||||||
return VL_CVT_FP_Q(fopen(filenamez,modez));
|
return VL_FOPEN_S(filenamez,modez);
|
||||||
|
}
|
||||||
|
IData VL_FOPEN_S(const char* filenamep, const char* modep) {
|
||||||
|
return VerilatedImp::fdNew(fopen(filenamep,modep));
|
||||||
|
}
|
||||||
|
|
||||||
|
void VL_FCLOSE_I(IData fdi) {
|
||||||
|
FILE* fp = VL_CVT_I_FP(fdi);
|
||||||
|
if (VL_UNLIKELY(!fp)) return;
|
||||||
|
fclose(fp);
|
||||||
|
VerilatedImp::fdDelete(fdi);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VL_SFORMAT_X(int obits, void* destp, const char* formatp, ...) {
|
void VL_SFORMAT_X(int obits, void* destp, const char* formatp, ...) {
|
||||||
@@ -726,8 +780,8 @@ void VL_WRITEF(const char* formatp, ...) {
|
|||||||
VL_PRINTF("%s", output.c_str());
|
VL_PRINTF("%s", output.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void VL_FWRITEF(QData fpq, const char* formatp, ...) {
|
void VL_FWRITEF(IData fpi, const char* formatp, ...) {
|
||||||
FILE* fp = VL_CVT_Q_FP(fpq);
|
FILE* fp = VL_CVT_I_FP(fpi);
|
||||||
if (VL_UNLIKELY(!fp)) return;
|
if (VL_UNLIKELY(!fp)) return;
|
||||||
|
|
||||||
va_list ap;
|
va_list ap;
|
||||||
@@ -739,8 +793,8 @@ void VL_FWRITEF(QData fpq, const char* formatp, ...) {
|
|||||||
fputs(output.c_str(), fp);
|
fputs(output.c_str(), fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
IData VL_FSCANF_IX(QData fpq, const char* formatp, ...) {
|
IData VL_FSCANF_IX(IData fpi, const char* formatp, ...) {
|
||||||
FILE* fp = VL_CVT_Q_FP(fpq);
|
FILE* fp = VL_CVT_I_FP(fpi);
|
||||||
if (VL_UNLIKELY(!fp)) return 0;
|
if (VL_UNLIKELY(!fp)) return 0;
|
||||||
|
|
||||||
va_list ap;
|
va_list ap;
|
||||||
@@ -883,6 +937,17 @@ void VL_READMEM_W(bool hex, int width, int depth, int array_lsb, int fnwords,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IData VL_SYSTEM_IQ(QData lhs) {
|
||||||
|
IData lhsw[2]; VL_SET_WQ(lhsw, lhs);
|
||||||
|
return VL_SYSTEM_IW(2, lhsw);
|
||||||
|
}
|
||||||
|
IData VL_SYSTEM_IW(int lhswords, WDataInP filenamep) {
|
||||||
|
char filenamez[VL_TO_STRING_MAX_WORDS*VL_WORDSIZE+1];
|
||||||
|
_VL_VINT_TO_STRING(lhswords*VL_WORDSIZE, filenamez, filenamep);
|
||||||
|
int code = system(filenamez);
|
||||||
|
return code >> 8; // Want exit status
|
||||||
|
}
|
||||||
|
|
||||||
IData VL_TESTPLUSARGS_I(const char* formatp) {
|
IData VL_TESTPLUSARGS_I(const char* formatp) {
|
||||||
string match = VerilatedImp::argPlusMatch(formatp);
|
string match = VerilatedImp::argPlusMatch(formatp);
|
||||||
if (match == "") return 0;
|
if (match == "") return 0;
|
||||||
@@ -1038,6 +1103,7 @@ VerilatedScope::VerilatedScope() {
|
|||||||
m_callbacksp = NULL;
|
m_callbacksp = NULL;
|
||||||
m_namep = NULL;
|
m_namep = NULL;
|
||||||
m_funcnumMax = 0;
|
m_funcnumMax = 0;
|
||||||
|
m_symsp = NULL;
|
||||||
m_varsp = NULL;
|
m_varsp = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+43
-24
@@ -1,7 +1,7 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License.
|
// Lesser General Public License Version 3 or the Perl Artistic License.
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
@@ -35,6 +35,7 @@
|
|||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <cmath>
|
||||||
// <iostream> avoided to reduce compile time
|
// <iostream> avoided to reduce compile time
|
||||||
// <string> avoided and instead in verilated_heavy.h to reduce compile time
|
// <string> avoided and instead in verilated_heavy.h to reduce compile time
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@@ -321,11 +322,14 @@ extern WDataOutP VL_ZERO_RESET_W(int obits, WDataOutP outwp); ///< Zero reset a
|
|||||||
extern WDataOutP _vl_moddiv_w(int lbits, WDataOutP owp, WDataInP lwp, WDataInP rwp, bool is_modulus);
|
extern WDataOutP _vl_moddiv_w(int lbits, WDataOutP owp, WDataInP lwp, WDataInP rwp, bool is_modulus);
|
||||||
|
|
||||||
/// File I/O
|
/// File I/O
|
||||||
extern IData VL_FGETS_IXQ(int obits, void* destp, QData fpq);
|
extern IData VL_FGETS_IXI(int obits, void* destp, IData fpi);
|
||||||
|
|
||||||
extern QData VL_FOPEN_WI(int fnwords, WDataInP ofilename, IData mode);
|
extern IData VL_FOPEN_S(const char* filenamep, const char* mode);
|
||||||
extern QData VL_FOPEN_QI(QData ofilename, IData mode);
|
extern IData VL_FOPEN_WI(int fnwords, WDataInP ofilename, IData mode);
|
||||||
inline QData VL_FOPEN_II(IData ofilename, IData mode) { return VL_FOPEN_QI(ofilename,mode); }
|
extern IData VL_FOPEN_QI(QData ofilename, IData mode);
|
||||||
|
inline IData VL_FOPEN_II(IData ofilename, IData mode) { return VL_FOPEN_QI(ofilename,mode); }
|
||||||
|
|
||||||
|
extern void VL_FCLOSE_I(IData fdi);
|
||||||
|
|
||||||
extern void VL_READMEM_W(bool hex, int width, int depth, int array_lsb, int fnwords,
|
extern void VL_READMEM_W(bool hex, int width, int depth, int array_lsb, int fnwords,
|
||||||
WDataInP ofilename, void* memp, IData start, IData end);
|
WDataInP ofilename, void* memp, IData start, IData end);
|
||||||
@@ -336,15 +340,19 @@ inline void VL_READMEM_I(bool hex, int width, int depth, int array_lsb, int fnwo
|
|||||||
VL_READMEM_Q(hex, width,depth,array_lsb,fnwords, ofilename,memp,start,end); }
|
VL_READMEM_Q(hex, width,depth,array_lsb,fnwords, ofilename,memp,start,end); }
|
||||||
|
|
||||||
extern void VL_WRITEF(const char* formatp, ...);
|
extern void VL_WRITEF(const char* formatp, ...);
|
||||||
extern void VL_FWRITEF(QData fpq, const char* formatp, ...);
|
extern void VL_FWRITEF(IData fpi, const char* formatp, ...);
|
||||||
|
|
||||||
extern IData VL_FSCANF_IX(QData fpq, const char* formatp, ...);
|
extern IData VL_FSCANF_IX(IData fpi, const char* formatp, ...);
|
||||||
extern IData VL_SSCANF_IIX(int lbits, IData ld, const char* formatp, ...);
|
extern IData VL_SSCANF_IIX(int lbits, IData ld, const char* formatp, ...);
|
||||||
extern IData VL_SSCANF_IQX(int lbits, QData ld, const char* formatp, ...);
|
extern IData VL_SSCANF_IQX(int lbits, QData ld, const char* formatp, ...);
|
||||||
extern IData VL_SSCANF_IWX(int lbits, WDataInP lwp, const char* formatp, ...);
|
extern IData VL_SSCANF_IWX(int lbits, WDataInP lwp, const char* formatp, ...);
|
||||||
|
|
||||||
extern void VL_SFORMAT_X(int obits, void* destp, const char* formatp, ...);
|
extern void VL_SFORMAT_X(int obits, void* destp, const char* formatp, ...);
|
||||||
|
|
||||||
|
extern IData VL_SYSTEM_IW(int lhsnwords, WDataInP lhs);
|
||||||
|
extern IData VL_SYSTEM_IQ(QData lhs);
|
||||||
|
inline IData VL_SYSTEM_II(IData lhs) { return VL_SYSTEM_IQ(lhs); }
|
||||||
|
|
||||||
extern IData VL_TESTPLUSARGS_I(const char* formatp);
|
extern IData VL_TESTPLUSARGS_I(const char* formatp);
|
||||||
extern IData VL_VALUEPLUSARGS_IW(int rbits, const char* prefixp, char fmt, WDataOutP rwp);
|
extern IData VL_VALUEPLUSARGS_IW(int rbits, const char* prefixp, char fmt, WDataOutP rwp);
|
||||||
extern const char* vl_mc_scan_plusargs(const char* prefixp); // PLIish
|
extern const char* vl_mc_scan_plusargs(const char* prefixp); // PLIish
|
||||||
@@ -364,15 +372,24 @@ extern const char* vl_mc_scan_plusargs(const char* prefixp); // PLIish
|
|||||||
#define VL_SET_QW(lwp) ( ((QData)(lwp[0])) | ((QData)(lwp[1])<<((QData)(VL_WORDSIZE)) ))
|
#define VL_SET_QW(lwp) ( ((QData)(lwp[0])) | ((QData)(lwp[1])<<((QData)(VL_WORDSIZE)) ))
|
||||||
#define _VL_SET_QII(ld,rd) ( ((QData)(ld)<<VL_ULL(32)) | (QData)(rd) )
|
#define _VL_SET_QII(ld,rd) ( ((QData)(ld)<<VL_ULL(32)) | (QData)(rd) )
|
||||||
|
|
||||||
|
/// Return FILE* from IData
|
||||||
|
extern FILE* VL_CVT_I_FP(IData lhs);
|
||||||
|
|
||||||
// Use a union to avoid cast-to-different-size warnings
|
// Use a union to avoid cast-to-different-size warnings
|
||||||
/// Return FILE* from QData
|
|
||||||
static inline FILE* VL_CVT_Q_FP(QData lhs) { union { FILE* fp; QData q; } u; u.q=lhs; return u.fp; }
|
|
||||||
/// Return void* from QData
|
/// Return void* from QData
|
||||||
static inline void* VL_CVT_Q_VP(QData lhs) { union { void* fp; QData q; } u; u.q=lhs; return u.fp; }
|
static inline void* VL_CVT_Q_VP(QData lhs) { union { void* fp; QData q; } u; u.q=lhs; return u.fp; }
|
||||||
/// Return QData from FILE*
|
|
||||||
static inline QData VL_CVT_FP_Q(FILE* fp) { union { FILE* fp; QData q; } u; u.q=0; u.fp=fp; return u.q; }
|
|
||||||
/// Return QData from void*
|
/// Return QData from void*
|
||||||
static inline QData VL_CVT_VP_Q(void* fp) { union { void* fp; QData q; } u; u.q=0; u.fp=fp; return u.q; }
|
static inline QData VL_CVT_VP_Q(void* fp) { union { void* fp; QData q; } u; u.q=0; u.fp=fp; return u.q; }
|
||||||
|
/// Return double from QData (bits, not numerically)
|
||||||
|
static inline double VL_CVT_D_Q(QData lhs) { union { double d; QData q; } u; u.q=lhs; return u.d; }
|
||||||
|
/// Return QData from double (bits, not numerically)
|
||||||
|
static inline QData VL_CVT_Q_D(double lhs) { union { double d; QData q; } u; u.d=lhs; return u.q; }
|
||||||
|
/// Return double from QData (numeric)
|
||||||
|
static inline double VL_ITOR_D_I(IData lhs) { return ((double)((vlsint32_t)(lhs))); }
|
||||||
|
/// Return QData from double (numeric)
|
||||||
|
static inline IData VL_RTOI_I_D(double lhs) { return ((vlsint32_t)(VL_TRUNC(lhs))); }
|
||||||
|
/// Return QData from double (numeric)
|
||||||
|
static inline IData VL_RTOIROUND_I_D(double lhs) { return ((vlsint32_t)(VL_ROUND(lhs))); }
|
||||||
|
|
||||||
// Sign extend such that if MSB set, we get ffff_ffff, else 0s
|
// Sign extend such that if MSB set, we get ffff_ffff, else 0s
|
||||||
// (Requires clean input)
|
// (Requires clean input)
|
||||||
@@ -402,9 +419,11 @@ void _VL_DEBUG_PRINT_W(int lbits, WDataInP iwp);
|
|||||||
#if defined(SYSTEMC_VERSION) && (SYSTEMC_VERSION>20011000)
|
#if defined(SYSTEMC_VERSION) && (SYSTEMC_VERSION>20011000)
|
||||||
# define VL_TIME_I() ((IData)(sc_time_stamp().to_default_time_units()*VL_TIME_MULTIPLIER))
|
# define VL_TIME_I() ((IData)(sc_time_stamp().to_default_time_units()*VL_TIME_MULTIPLIER))
|
||||||
# define VL_TIME_Q() ((QData)(sc_time_stamp().to_default_time_units()*VL_TIME_MULTIPLIER))
|
# define VL_TIME_Q() ((QData)(sc_time_stamp().to_default_time_units()*VL_TIME_MULTIPLIER))
|
||||||
|
# define VL_TIME_D() ((double)(sc_time_stamp().to_default_time_units()*VL_TIME_MULTIPLIER))
|
||||||
#else
|
#else
|
||||||
# define VL_TIME_I() ((IData)(sc_time_stamp()*VL_TIME_MULTIPLIER))
|
# define VL_TIME_I() ((IData)(sc_time_stamp()*VL_TIME_MULTIPLIER))
|
||||||
# define VL_TIME_Q() ((QData)(sc_time_stamp()*VL_TIME_MULTIPLIER))
|
# define VL_TIME_Q() ((QData)(sc_time_stamp()*VL_TIME_MULTIPLIER))
|
||||||
|
# define VL_TIME_D() ((double)(sc_time_stamp()*VL_TIME_MULTIPLIER))
|
||||||
extern double sc_time_stamp();
|
extern double sc_time_stamp();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -947,11 +966,11 @@ static inline WDataOutP VL_SUB_W(int words, WDataOutP owp,WDataInP lwp,WDataInP
|
|||||||
|
|
||||||
// Optimization bug in GCC 2.96 and presumably all-pre GCC 3 versions need this workaround,
|
// Optimization bug in GCC 2.96 and presumably all-pre GCC 3 versions need this workaround,
|
||||||
// we can't just
|
// we can't just
|
||||||
//# define VL_UNARYMIN_I(data) (-(data))
|
//# define VL_NEGATE_I(data) (-(data))
|
||||||
static inline IData VL_UNARYMIN_I(IData data) { return -data; }
|
static inline IData VL_NEGATE_I(IData data) { return -data; }
|
||||||
static inline QData VL_UNARYMIN_Q(QData data) { return -data; }
|
static inline QData VL_NEGATE_Q(QData data) { return -data; }
|
||||||
|
|
||||||
static inline WDataOutP VL_UNARYMIN_W(int words, WDataOutP owp,WDataInP lwp){
|
static inline WDataOutP VL_NEGATE_W(int words, WDataOutP owp,WDataInP lwp){
|
||||||
QData carry = 0;
|
QData carry = 0;
|
||||||
for (int i=0; i<words; i++) {
|
for (int i=0; i<words; i++) {
|
||||||
carry = carry + (QData)(IData)(~lwp[i]);
|
carry = carry + (QData)(IData)(~lwp[i]);
|
||||||
@@ -998,18 +1017,18 @@ static inline WDataOutP VL_MULS_WWW(int,int lbits,int, WDataOutP owp,WDataInP lw
|
|||||||
IData lneg = VL_SIGN_I(lbits,lwp[words-1]);
|
IData lneg = VL_SIGN_I(lbits,lwp[words-1]);
|
||||||
if (lneg) { // Negate lhs
|
if (lneg) { // Negate lhs
|
||||||
lwusp = lwstore;
|
lwusp = lwstore;
|
||||||
VL_UNARYMIN_W(words, lwstore, lwp);
|
VL_NEGATE_W(words, lwstore, lwp);
|
||||||
lwstore[words-1] &= VL_MASK_I(lbits); // Clean it
|
lwstore[words-1] &= VL_MASK_I(lbits); // Clean it
|
||||||
}
|
}
|
||||||
IData rneg = VL_SIGN_I(lbits,rwp[words-1]);
|
IData rneg = VL_SIGN_I(lbits,rwp[words-1]);
|
||||||
if (rneg) { // Negate rhs
|
if (rneg) { // Negate rhs
|
||||||
rwusp = rwstore;
|
rwusp = rwstore;
|
||||||
VL_UNARYMIN_W(words, rwstore, rwp);
|
VL_NEGATE_W(words, rwstore, rwp);
|
||||||
rwstore[words-1] &= VL_MASK_I(lbits); // Clean it
|
rwstore[words-1] &= VL_MASK_I(lbits); // Clean it
|
||||||
}
|
}
|
||||||
VL_MUL_W(words,owp,lwusp,rwusp);
|
VL_MUL_W(words,owp,lwusp,rwusp);
|
||||||
owp[words-1] &= VL_MASK_I(lbits); // Clean. Note it's ok for the multiply to overflow into the sign bit
|
owp[words-1] &= VL_MASK_I(lbits); // Clean. Note it's ok for the multiply to overflow into the sign bit
|
||||||
if ((lneg ^ rneg) & 1) { // Negate output (not using UNARYMIN, as owp==lwp)
|
if ((lneg ^ rneg) & 1) { // Negate output (not using NEGATE, as owp==lwp)
|
||||||
QData carry = 0;
|
QData carry = 0;
|
||||||
for (int i=0; i<words; i++) {
|
for (int i=0; i<words; i++) {
|
||||||
carry = carry + (QData)(IData)(~owp[i]);
|
carry = carry + (QData)(IData)(~owp[i]);
|
||||||
@@ -1056,12 +1075,12 @@ static inline WDataOutP VL_DIVS_WWW(int lbits, WDataOutP owp,WDataInP lwp,WDataI
|
|||||||
IData rwstore[VL_MULS_MAX_WORDS];
|
IData rwstore[VL_MULS_MAX_WORDS];
|
||||||
WDataInP ltup = lwp;
|
WDataInP ltup = lwp;
|
||||||
WDataInP rtup = rwp;
|
WDataInP rtup = rwp;
|
||||||
if (lsign) { ltup = _VL_CLEAN_INPLACE_W(lbits, VL_UNARYMIN_W(VL_WORDS_I(lbits), lwstore, lwp)); }
|
if (lsign) { ltup = _VL_CLEAN_INPLACE_W(lbits, VL_NEGATE_W(VL_WORDS_I(lbits), lwstore, lwp)); }
|
||||||
if (rsign) { rtup = _VL_CLEAN_INPLACE_W(lbits, VL_UNARYMIN_W(VL_WORDS_I(lbits), rwstore, rwp)); }
|
if (rsign) { rtup = _VL_CLEAN_INPLACE_W(lbits, VL_NEGATE_W(VL_WORDS_I(lbits), rwstore, rwp)); }
|
||||||
if ((lsign && !rsign) || (!lsign && rsign)) {
|
if ((lsign && !rsign) || (!lsign && rsign)) {
|
||||||
IData qNoSign[VL_MULS_MAX_WORDS];
|
IData qNoSign[VL_MULS_MAX_WORDS];
|
||||||
VL_DIV_WWW(lbits,qNoSign,ltup,rtup);
|
VL_DIV_WWW(lbits,qNoSign,ltup,rtup);
|
||||||
_VL_CLEAN_INPLACE_W(lbits, VL_UNARYMIN_W(VL_WORDS_I(lbits), owp, qNoSign));
|
_VL_CLEAN_INPLACE_W(lbits, VL_NEGATE_W(VL_WORDS_I(lbits), owp, qNoSign));
|
||||||
return owp;
|
return owp;
|
||||||
} else {
|
} else {
|
||||||
return VL_DIV_WWW(lbits,owp,ltup,rtup);
|
return VL_DIV_WWW(lbits,owp,ltup,rtup);
|
||||||
@@ -1075,12 +1094,12 @@ static inline WDataOutP VL_MODDIVS_WWW(int lbits, WDataOutP owp,WDataInP lwp,WDa
|
|||||||
IData rwstore[VL_MULS_MAX_WORDS];
|
IData rwstore[VL_MULS_MAX_WORDS];
|
||||||
WDataInP ltup = lwp;
|
WDataInP ltup = lwp;
|
||||||
WDataInP rtup = rwp;
|
WDataInP rtup = rwp;
|
||||||
if (lsign) { ltup = _VL_CLEAN_INPLACE_W(lbits, VL_UNARYMIN_W(VL_WORDS_I(lbits), lwstore, lwp)); }
|
if (lsign) { ltup = _VL_CLEAN_INPLACE_W(lbits, VL_NEGATE_W(VL_WORDS_I(lbits), lwstore, lwp)); }
|
||||||
if (rsign) { rtup = _VL_CLEAN_INPLACE_W(lbits, VL_UNARYMIN_W(VL_WORDS_I(lbits), rwstore, rwp)); }
|
if (rsign) { rtup = _VL_CLEAN_INPLACE_W(lbits, VL_NEGATE_W(VL_WORDS_I(lbits), rwstore, rwp)); }
|
||||||
if (lsign) { // Only dividend sign matters for modulus
|
if (lsign) { // Only dividend sign matters for modulus
|
||||||
IData qNoSign[VL_MULS_MAX_WORDS];
|
IData qNoSign[VL_MULS_MAX_WORDS];
|
||||||
VL_MODDIV_WWW(lbits,qNoSign,ltup,rtup);
|
VL_MODDIV_WWW(lbits,qNoSign,ltup,rtup);
|
||||||
_VL_CLEAN_INPLACE_W(lbits, VL_UNARYMIN_W(VL_WORDS_I(lbits), owp, qNoSign));
|
_VL_CLEAN_INPLACE_W(lbits, VL_NEGATE_W(VL_WORDS_I(lbits), owp, qNoSign));
|
||||||
return owp;
|
return owp;
|
||||||
} else {
|
} else {
|
||||||
return VL_MODDIV_WWW(lbits,owp,ltup,rtup);
|
return VL_MODDIV_WWW(lbits,owp,ltup,rtup);
|
||||||
|
|||||||
+16
-10
@@ -2,7 +2,7 @@
|
|||||||
######################################################################
|
######################################################################
|
||||||
# DESCRIPTION: Makefile commands for all verilated target files
|
# DESCRIPTION: Makefile commands for all verilated target files
|
||||||
#
|
#
|
||||||
# Copyright 2003-2011 by Wilson Snyder. Verilator is free software; you can
|
# Copyright 2003-2012 by Wilson Snyder. Verilator is free software; you can
|
||||||
# redistribute it and/or modify it under the terms of either the GNU Lesser
|
# redistribute it and/or modify it under the terms of either the GNU Lesser
|
||||||
# General Public License Version 3 or the Perl Artistic License Version 2.0.
|
# General Public License Version 3 or the Perl Artistic License Version 2.0.
|
||||||
######################################################################
|
######################################################################
|
||||||
@@ -13,6 +13,12 @@ LINK = @CXX@
|
|||||||
AR = ar
|
AR = ar
|
||||||
RANLIB = ranlib
|
RANLIB = ranlib
|
||||||
|
|
||||||
|
CFG_WITH_CCWARN = @CFG_WITH_CCWARN@
|
||||||
|
CFG_WITH_LONGTESTS = @CFG_WITH_LONGTESTS@
|
||||||
|
|
||||||
|
# Compiler flags to use to turn off unused and generated code warnings, such as -Wno-div-by-zero
|
||||||
|
CFG_CXXFLAGS_NO_UNUSED = @CFG_CXXFLAGS_NO_UNUSED@
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
# Programs
|
# Programs
|
||||||
|
|
||||||
@@ -38,13 +44,9 @@ VK_CPPFLAGS_ALWAYS += \
|
|||||||
-DVM_TRACE=$(VM_TRACE) \
|
-DVM_TRACE=$(VM_TRACE) \
|
||||||
-DVM_COVERAGE=$(VM_COVERAGE) \
|
-DVM_COVERAGE=$(VM_COVERAGE) \
|
||||||
|
|
||||||
ifeq ($(VERILATOR_AUTHOR_SITE),1) # Local... Else don't burden users
|
ifeq ($(CFG_WITH_CCWARN),yes) # Local... Else don't burden users
|
||||||
VK_CPPFLAGS_WALL += -Wall \
|
VK_CPPFLAGS_WALL += -Wall \
|
||||||
-Wno-char-subscripts \
|
$(CFG_CXXFLAGS_NO_UNUSED) \
|
||||||
-Wno-sign-compare \
|
|
||||||
-Wno-unused-parameter \
|
|
||||||
-Wno-unused-variable \
|
|
||||||
-Wno-uninitialized \
|
|
||||||
-Werror
|
-Werror
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -91,10 +93,10 @@ VM_SUPPORT += $(VM_SUPPORT_FAST) $(VM_SUPPORT_SLOW)
|
|||||||
##### SystemC or SystemPerl builds
|
##### SystemC or SystemPerl builds
|
||||||
|
|
||||||
ifeq ($(VM_SP_OR_SC),1)
|
ifeq ($(VM_SP_OR_SC),1)
|
||||||
CPPFLAGS += $(SYSTEMC_CXX_FLAGS) -I$(SYSTEMC)/include
|
CPPFLAGS += $(SYSTEMC_CXX_FLAGS) -I$(SYSTEMC_INCLUDE)
|
||||||
LDFLAGS += $(SYSTEMC_CXX_FLAGS) -L$(SYSTEMC)/lib-$(VM_SC_TARGET_ARCH)
|
LDFLAGS += $(SYSTEMC_CXX_FLAGS) -L$(SYSTEMC_LIBDIR)
|
||||||
SC_LIBS = -lsystemc
|
SC_LIBS = -lsystemc
|
||||||
ifneq ($(wildcard $(SYSTEMC)/lib-$(VM_SC_TARGET_ARCH)/*numeric_bit*),)
|
ifneq ($(wildcard $(SYSTEMC_LIBDIR)/*numeric_bit*),)
|
||||||
# Systemc 1.2.1beta
|
# Systemc 1.2.1beta
|
||||||
SC_LIBS += -lnumeric_bit -lqt
|
SC_LIBS += -lnumeric_bit -lqt
|
||||||
endif
|
endif
|
||||||
@@ -116,6 +118,10 @@ ifeq ($(VM_SP),1)
|
|||||||
$(SP_PREPROC) -M sp_preproc.d --tree $(VM_PREFIX).sp_tree \
|
$(SP_PREPROC) -M sp_preproc.d --tree $(VM_PREFIX).sp_tree \
|
||||||
--preproc $(VK_CLASSES_SP)
|
--preproc $(VK_CLASSES_SP)
|
||||||
else
|
else
|
||||||
|
ifeq ($(VM_COVERAGE),1)
|
||||||
|
CPPFLAGS += -I$(SYSTEMPERL_INCLUDE)
|
||||||
|
VPATH += $(SYSTEMPERL_INCLUDE)
|
||||||
|
endif
|
||||||
preproc:
|
preproc:
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
+3
-7
@@ -5,7 +5,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License.
|
// Lesser General Public License Version 3 or the Perl Artistic License.
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
@@ -27,11 +27,7 @@
|
|||||||
`define coverage_block_off
|
`define coverage_block_off
|
||||||
`endif
|
`endif
|
||||||
|
|
||||||
// Hide file descriptor difference
|
// Hide file descriptor difference - deprecated - for older versions
|
||||||
`ifdef verilator
|
`define verilator_file_descriptor integer
|
||||||
`define verilator_file_descriptor reg [63:0]
|
|
||||||
`else
|
|
||||||
`define verilator_file_descriptor integer
|
|
||||||
`endif
|
|
||||||
|
|
||||||
`endif // guard
|
`endif // guard
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2009-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2009-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License.
|
// Lesser General Public License Version 3 or the Perl Artistic License.
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License.
|
// Lesser General Public License Version 3 or the Perl Artistic License.
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2010-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2010-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License.
|
// Lesser General Public License Version 3 or the Perl Artistic License.
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
|
|||||||
+40
-2
@@ -1,7 +1,7 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2009-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2009-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License.
|
// Lesser General Public License Version 3 or the Perl Artistic License.
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
@@ -35,6 +35,7 @@
|
|||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <deque>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
class VerilatedScope;
|
class VerilatedScope;
|
||||||
@@ -62,9 +63,18 @@ class VerilatedImp {
|
|||||||
ExportNameMap m_exportMap; ///< Map of <export_func_proto, func number>
|
ExportNameMap m_exportMap; ///< Map of <export_func_proto, func number>
|
||||||
int m_exportNext; ///< Next export funcnum
|
int m_exportNext; ///< Next export funcnum
|
||||||
|
|
||||||
|
// File I/O
|
||||||
|
vector<FILE*> m_fdps; ///< File descriptors
|
||||||
|
deque<IData> m_fdFree; ///< List of free descriptors (SLOW - FOPEN/CLOSE only)
|
||||||
|
|
||||||
public: // But only for verilated*.cpp
|
public: // But only for verilated*.cpp
|
||||||
// CONSTRUCTORS
|
// CONSTRUCTORS
|
||||||
VerilatedImp() : m_argVecLoaded(false), m_exportNext(0) {}
|
VerilatedImp() : m_argVecLoaded(false), m_exportNext(0) {
|
||||||
|
m_fdps.resize(3);
|
||||||
|
m_fdps[0] = stdin;
|
||||||
|
m_fdps[1] = stdout;
|
||||||
|
m_fdps[2] = stderr;
|
||||||
|
}
|
||||||
~VerilatedImp() {}
|
~VerilatedImp() {}
|
||||||
|
|
||||||
// METHODS - arguments
|
// METHODS - arguments
|
||||||
@@ -184,6 +194,34 @@ public: // But only for verilated*.cpp
|
|||||||
}
|
}
|
||||||
// We don't free up m_exportMap until the end, because we can't be sure
|
// We don't free up m_exportMap until the end, because we can't be sure
|
||||||
// what other models are using the assigned funcnum's.
|
// what other models are using the assigned funcnum's.
|
||||||
|
|
||||||
|
public: // But only for verilated*.cpp
|
||||||
|
// METHODS - file IO
|
||||||
|
static IData fdNew(FILE* fp) {
|
||||||
|
if (VL_UNLIKELY(!fp)) return 0;
|
||||||
|
// Bit 31 indicates it's a descriptor not a MCD
|
||||||
|
if (s_s.m_fdFree.empty()) {
|
||||||
|
// Need to create more space in m_fdps and m_fdFree
|
||||||
|
size_t start = s_s.m_fdps.size();
|
||||||
|
s_s.m_fdps.resize(start*2);
|
||||||
|
for (size_t i=start; i<start*2; i++) s_s.m_fdFree.push_back((IData)i);
|
||||||
|
}
|
||||||
|
IData idx = s_s.m_fdFree.back(); s_s.m_fdFree.pop_back();
|
||||||
|
s_s.m_fdps[idx] = fp;
|
||||||
|
return (idx | (1UL<<31)); // bit 31 indicates not MCD
|
||||||
|
}
|
||||||
|
static void fdDelete(IData fdi) {
|
||||||
|
IData idx = VL_MASK_I(31) & fdi;
|
||||||
|
if (VL_UNLIKELY(!(fdi & (1ULL<<31)) || idx >= s_s.m_fdps.size())) return;
|
||||||
|
if (VL_UNLIKELY(!s_s.m_fdps[idx])) return; // Already free
|
||||||
|
s_s.m_fdps[idx] = NULL;
|
||||||
|
s_s.m_fdFree.push_back(idx);
|
||||||
|
}
|
||||||
|
static inline FILE* fdToFp(IData fdi) {
|
||||||
|
IData idx = VL_MASK_I(31) & fdi;
|
||||||
|
if (VL_UNLIKELY(!(fdi & (1ULL<<31)) || idx >= s_s.m_fdps.size())) return NULL;
|
||||||
|
return s_s.m_fdps[idx];
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // Guard
|
#endif // Guard
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2009-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2009-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License.
|
// Lesser General Public License Version 3 or the Perl Artistic License.
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License.
|
// Lesser General Public License Version 3 or the Perl Artistic License.
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
//
|
//
|
||||||
// THIS MODULE IS PUBLICLY LICENSED
|
// THIS MODULE IS PUBLICLY LICENSED
|
||||||
//
|
//
|
||||||
// Copyright 2001-2011 by Wilson Snyder. This program is free software;
|
// Copyright 2001-2012 by Wilson Snyder. This program is free software;
|
||||||
// you can redistribute it and/or modify it under the terms of either the GNU
|
// you can redistribute it and/or modify it under the terms of either the GNU
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License Version 2.0.
|
// Lesser General Public License Version 3 or the Perl Artistic License Version 2.0.
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
//
|
//
|
||||||
// THIS MODULE IS PUBLICLY LICENSED
|
// THIS MODULE IS PUBLICLY LICENSED
|
||||||
//
|
//
|
||||||
// Copyright 2001-2011 by Wilson Snyder. This program is free software;
|
// Copyright 2001-2012 by Wilson Snyder. This program is free software;
|
||||||
// you can redistribute it and/or modify it under the terms of either the GNU
|
// you can redistribute it and/or modify it under the terms of either the GNU
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License Version 2.0.
|
// Lesser General Public License Version 3 or the Perl Artistic License Version 2.0.
|
||||||
//
|
//
|
||||||
@@ -86,8 +86,8 @@ private:
|
|||||||
NameMap* m_namemapp; ///< List of names for the header
|
NameMap* m_namemapp; ///< List of names for the header
|
||||||
static vector<VerilatedVcd*> s_vcdVecp; ///< List of all created traces
|
static vector<VerilatedVcd*> s_vcdVecp; ///< List of all created traces
|
||||||
|
|
||||||
inline size_t bufferSize() { return 256*1024; } // See below for slack calculation
|
inline static size_t bufferSize() { return 256*1024; } // See below for slack calculation
|
||||||
inline size_t bufferInsertSize() { return 16*1024; }
|
inline static size_t bufferInsertSize() { return 16*1024; }
|
||||||
void bufferFlush();
|
void bufferFlush();
|
||||||
void bufferCheck() {
|
void bufferCheck() {
|
||||||
// Flush the write buffer if there's not enough space left for new information
|
// Flush the write buffer if there's not enough space left for new information
|
||||||
@@ -110,6 +110,7 @@ private:
|
|||||||
void dumpHeader();
|
void dumpHeader();
|
||||||
void dumpPrep (vluint64_t timeui);
|
void dumpPrep (vluint64_t timeui);
|
||||||
void dumpFull (vluint64_t timeui);
|
void dumpFull (vluint64_t timeui);
|
||||||
|
// cppcheck-suppress functionConst
|
||||||
void dumpDone ();
|
void dumpDone ();
|
||||||
inline void printCode (vluint32_t code) {
|
inline void printCode (vluint32_t code) {
|
||||||
if (code>=(94*94*94)) *m_writep++ = ((char)((code/94/94/94)%94+33));
|
if (code>=(94*94*94)) *m_writep++ = ((char)((code/94/94/94)%94+33));
|
||||||
@@ -117,7 +118,7 @@ private:
|
|||||||
if (code>=(94)) *m_writep++ = ((char)((code/94)%94+33));
|
if (code>=(94)) *m_writep++ = ((char)((code/94)%94+33));
|
||||||
*m_writep++ = ((char)((code)%94+33));
|
*m_writep++ = ((char)((code)%94+33));
|
||||||
}
|
}
|
||||||
string stringCode (vluint32_t code) {
|
static string stringCode (vluint32_t code) {
|
||||||
string out;
|
string out;
|
||||||
if (code>=(94*94*94)) out += ((char)((code/94/94/94)%94+33));
|
if (code>=(94*94*94)) out += ((char)((code/94/94/94)%94+33));
|
||||||
if (code>=(94*94)) out += ((char)((code/94/94)%94+33));
|
if (code>=(94*94)) out += ((char)((code/94/94)%94+33));
|
||||||
@@ -141,6 +142,8 @@ public:
|
|||||||
m_evcd = false;
|
m_evcd = false;
|
||||||
m_scopeEscape = '.'; // Backward compatibility
|
m_scopeEscape = '.'; // Backward compatibility
|
||||||
m_wroteBytes = 0;
|
m_wroteBytes = 0;
|
||||||
|
m_fd = 0;
|
||||||
|
m_fullDump = true;
|
||||||
}
|
}
|
||||||
~VerilatedVcd();
|
~VerilatedVcd();
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
//
|
//
|
||||||
// THIS MODULE IS PUBLICLY LICENSED
|
// THIS MODULE IS PUBLICLY LICENSED
|
||||||
//
|
//
|
||||||
// Copyright 2001-2011 by Wilson Snyder. This program is free software;
|
// Copyright 2001-2012 by Wilson Snyder. This program is free software;
|
||||||
// you can redistribute it and/or modify it under the terms of either the GNU
|
// you can redistribute it and/or modify it under the terms of either the GNU
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License Version 2.0.
|
// Lesser General Public License Version 3 or the Perl Artistic License Version 2.0.
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
//
|
//
|
||||||
// THIS MODULE IS PUBLICLY LICENSED
|
// THIS MODULE IS PUBLICLY LICENSED
|
||||||
//
|
//
|
||||||
// Copyright 2001-2011 by Wilson Snyder. This program is free software;
|
// Copyright 2001-2012 by Wilson Snyder. This program is free software;
|
||||||
// you can redistribute it and/or modify it under the terms of either the GNU
|
// you can redistribute it and/or modify it under the terms of either the GNU
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License Version 2.0.
|
// Lesser General Public License Version 3 or the Perl Artistic License Version 2.0.
|
||||||
//
|
//
|
||||||
@@ -76,6 +76,8 @@ private:
|
|||||||
#ifdef NC_SYSTEMC
|
#ifdef NC_SYSTEMC
|
||||||
// Cadence Incisive has these as abstract functions so we must create them
|
// Cadence Incisive has these as abstract functions so we must create them
|
||||||
virtual void set_time_unit( int exponent10_seconds ) {} // deprecated
|
virtual void set_time_unit( int exponent10_seconds ) {} // deprecated
|
||||||
|
#endif
|
||||||
|
#if defined(NC_SYSTEMC) || (SYSTEMC_VERSION>=20111100)
|
||||||
virtual void set_time_unit( double v, sc_time_unit tu ) {}
|
virtual void set_time_unit( double v, sc_time_unit tu ) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2009-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2009-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License.
|
// Lesser General Public License Version 3 or the Perl Artistic License.
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
|
|||||||
+43
-21
@@ -1,7 +1,7 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2009-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2009-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License.
|
// Lesser General Public License Version 3 or the Perl Artistic License.
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
@@ -95,9 +95,14 @@ typedef PLI_INT32 (*VerilatedPliCb)(struct t_cb_data *);
|
|||||||
|
|
||||||
class VerilatedVpioCb : public VerilatedVpio {
|
class VerilatedVpioCb : public VerilatedVpio {
|
||||||
t_cb_data m_cbData;
|
t_cb_data m_cbData;
|
||||||
|
s_vpi_value m_value;
|
||||||
QData m_time;
|
QData m_time;
|
||||||
public:
|
public:
|
||||||
VerilatedVpioCb(const t_cb_data* cbDatap, QData time) : m_cbData(*cbDatap), m_time(time) {}
|
// cppcheck-suppress uninitVar // m_value
|
||||||
|
VerilatedVpioCb(const t_cb_data* cbDatap, QData time)
|
||||||
|
: m_cbData(*cbDatap), m_time(time) {
|
||||||
|
m_cbData.value = &m_value;
|
||||||
|
}
|
||||||
virtual ~VerilatedVpioCb() {}
|
virtual ~VerilatedVpioCb() {}
|
||||||
static inline VerilatedVpioCb* castp(vpiHandle h) { return dynamic_cast<VerilatedVpioCb*>((VerilatedVpio*)h); }
|
static inline VerilatedVpioCb* castp(vpiHandle h) { return dynamic_cast<VerilatedVpioCb*>((VerilatedVpio*)h); }
|
||||||
vluint32_t reason() const { return m_cbData.reason; }
|
vluint32_t reason() const { return m_cbData.reason; }
|
||||||
@@ -326,6 +331,7 @@ public:
|
|||||||
VL_DEBUG_IF_PLI(VL_PRINTF("-vltVpi: value_callback %p %s v[0]=%d\n",
|
VL_DEBUG_IF_PLI(VL_PRINTF("-vltVpi: value_callback %p %s v[0]=%d\n",
|
||||||
vop,varop->fullname(), *((CData*)newDatap)););
|
vop,varop->fullname(), *((CData*)newDatap)););
|
||||||
memcpy(prevDatap, newDatap, varop->entSize());
|
memcpy(prevDatap, newDatap, varop->entSize());
|
||||||
|
vpi_get_value(vop->cb_datap()->obj, vop->cb_datap()->value);
|
||||||
(vop->cb_rtnp()) (vop->cb_datap());
|
(vop->cb_rtnp()) (vop->cb_datap());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -735,19 +741,26 @@ vpiHandle vpi_put_value(vpiHandle object, p_vpi_value value_p,
|
|||||||
|
|
||||||
// I/O routines
|
// I/O routines
|
||||||
|
|
||||||
//-PLI_UINT32 vpi_mcd_open(PLI_BYTE8 *fileName) {
|
PLI_UINT32 vpi_mcd_open(PLI_BYTE8 *filenamep) {
|
||||||
//- _VL_VPI_UNIMP(); return 0;
|
return VL_FOPEN_S(filenamep,"wb");
|
||||||
//-}
|
}
|
||||||
//-PLI_UINT32 vpi_mcd_close(PLI_UINT32 mcd) {
|
|
||||||
//- _VL_VPI_UNIMP(); return 0;
|
PLI_UINT32 vpi_mcd_close(PLI_UINT32 mcd) {
|
||||||
//-}
|
VL_FCLOSE_I(mcd); return 0;
|
||||||
//-PLI_BYTE8 *vpi_mcd_name(PLI_UINT32 cd) {
|
}
|
||||||
//- _VL_VPI_UNIMP(); return 0;
|
|
||||||
//-}
|
//-PLI_BYTE8 *vpi_mcd_name(PLI_UINT32 mcd) {
|
||||||
//-PLI_INT32 vpi_mcd_printf(PLI_UINT32 mcd, PLI_BYTE8 *format, ...) {
|
|
||||||
//- _VL_VPI_UNIMP(); return 0;
|
//- _VL_VPI_UNIMP(); return 0;
|
||||||
//-}
|
//-}
|
||||||
|
|
||||||
|
PLI_INT32 vpi_mcd_printf(PLI_UINT32 mcd, PLI_BYTE8 *formatp, ...) {
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap,formatp);
|
||||||
|
int chars = vpi_mcd_vprintf(mcd, formatp, ap);
|
||||||
|
va_end(ap);
|
||||||
|
return chars;
|
||||||
|
}
|
||||||
|
|
||||||
PLI_INT32 vpi_printf(PLI_BYTE8 *formatp, ...) {
|
PLI_INT32 vpi_printf(PLI_BYTE8 *formatp, ...) {
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap,formatp);
|
va_start(ap,formatp);
|
||||||
@@ -760,15 +773,24 @@ PLI_INT32 vpi_vprintf(PLI_BYTE8* formatp, va_list ap) {
|
|||||||
return VL_VPRINTF(formatp, ap);
|
return VL_VPRINTF(formatp, ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-PLI_INT32 vpi_mcd_vprintf(PLI_UINT32 mcd, PLI_BYTE8 *format, va_list ap) {
|
PLI_INT32 vpi_mcd_vprintf(PLI_UINT32 mcd, PLI_BYTE8 *format, va_list ap) {
|
||||||
//- _VL_VPI_UNIMP(); return 0;
|
FILE* fp = VL_CVT_I_FP(mcd);
|
||||||
//-}
|
if (VL_UNLIKELY(!fp)) return 0;
|
||||||
//-PLI_INT32 vpi_flush(void) {
|
int chars = vfprintf(fp, format, ap);
|
||||||
//- _VL_VPI_UNIMP(); return 0;
|
return chars;
|
||||||
//-}
|
}
|
||||||
//-PLI_INT32 vpi_mcd_flush(PLI_UINT32 mcd) {
|
|
||||||
//- _VL_VPI_UNIMP(); return 0;
|
PLI_INT32 vpi_flush(void) {
|
||||||
//-}
|
Verilated::flushCall();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PLI_INT32 vpi_mcd_flush(PLI_UINT32 mcd) {
|
||||||
|
FILE* fp = VL_CVT_I_FP(mcd);
|
||||||
|
if (VL_UNLIKELY(!fp)) return 1;
|
||||||
|
fflush(fp);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// utility routines
|
// utility routines
|
||||||
|
|
||||||
|
|||||||
+13
-1
@@ -1,7 +1,7 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License.
|
// Lesser General Public License Version 3 or the Perl Artistic License.
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
@@ -221,6 +221,18 @@ typedef unsigned long long vluint64_t; ///< 64-bit unsigned type
|
|||||||
#define VL_BITBIT_I(bit) ((bit)&VL_SIZEBITS_I) ///< Bit number for a bit in a long
|
#define VL_BITBIT_I(bit) ((bit)&VL_SIZEBITS_I) ///< Bit number for a bit in a long
|
||||||
#define VL_BITBIT_Q(bit) ((bit)&VL_SIZEBITS_Q) ///< Bit number for a bit in a quad
|
#define VL_BITBIT_Q(bit) ((bit)&VL_SIZEBITS_Q) ///< Bit number for a bit in a quad
|
||||||
|
|
||||||
|
//=========================================================================
|
||||||
|
// Floating point
|
||||||
|
// #defines, to avoid requiring math.h on all compile runs
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
# define VL_TRUNC(n) (((n)<0) ? ceil((n)) : floor((n)))
|
||||||
|
# define VL_ROUND(n) (((n)<0) ? ceil((n)-0.5) : floor((n)+0.5))
|
||||||
|
#else
|
||||||
|
# define VL_TRUNC(n) trunc(n)
|
||||||
|
# define VL_ROUND(n) round(n)
|
||||||
|
#endif
|
||||||
|
|
||||||
//=========================================================================
|
//=========================================================================
|
||||||
|
|
||||||
#endif /*guard*/
|
#endif /*guard*/
|
||||||
|
|||||||
+7
-6
@@ -207,10 +207,10 @@ viewers let us know; ZGRViewer isn't great for large graphs.
|
|||||||
Tree files are dumps of the AST Tree and are produced between every major
|
Tree files are dumps of the AST Tree and are produced between every major
|
||||||
algorithmic stage. An example:
|
algorithmic stage. An example:
|
||||||
|
|
||||||
NETLIST 0x90fb00 <e1> {0} w0
|
NETLIST 0x90fb00 <e1> {a0} w0
|
||||||
1: MODULE 0x912b20 <e8822> {8} w0 top L2 [P]
|
1: MODULE 0x912b20 <e8822> {a8} w0 top L2 [P]
|
||||||
*1:2: VAR 0x91a780 <e74#> {22} w70 out_wide [O] WIRE
|
*1:2: VAR 0x91a780 <e74#> {a22} w70 out_wide [O] WIRE
|
||||||
1:2:1: BASICDTYPE 0x91a3c0 <e73> {22} w70 [logic]
|
1:2:1: BASICDTYPE 0x91a3c0 <e73> {a22} w70 [logic]
|
||||||
|
|
||||||
=over 4
|
=over 4
|
||||||
|
|
||||||
@@ -224,7 +224,8 @@ algorithmic stage. An example:
|
|||||||
this node. A trailing # indicates this node changed since the last tree
|
this node. A trailing # indicates this node changed since the last tree
|
||||||
dump was made. You can gdb break on this edit; see below.
|
dump was made. You can gdb break on this edit; see below.
|
||||||
|
|
||||||
"{22}" indicates this node is related to line 22 in the source.
|
"{a22}" indicates this node is related to line 22 in the source filename
|
||||||
|
"a", where "a" is the first file read, "z" the 36th, and "aa" the 37th.
|
||||||
|
|
||||||
"w70" indicates the width is 70 bits. sw70 would be signed 70 bits.
|
"w70" indicates the width is 70 bits. sw70 would be signed 70 bits.
|
||||||
|
|
||||||
@@ -250,7 +251,7 @@ what made a <e####> line in the tree dumps):
|
|||||||
|
|
||||||
The latest version is available from L<http://www.veripool.org/>.
|
The latest version is available from L<http://www.veripool.org/>.
|
||||||
|
|
||||||
Copyright 2008-2011 by Wilson Snyder. Verilator is free software; you can
|
Copyright 2008-2012 by Wilson Snyder. Verilator is free software; you can
|
||||||
redistribute it and/or modify it under the terms of either the GNU Lesser
|
redistribute it and/or modify it under the terms of either the GNU Lesser
|
||||||
General Public License Version 3 or the Perl Artistic License Version 2.0.
|
General Public License Version 3 or the Perl Artistic License Version 2.0.
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/perl -w
|
#!/usr/bin/perl -w
|
||||||
######################################################################
|
######################################################################
|
||||||
#
|
#
|
||||||
# Copyright 2007-2011 by Wilson Snyder. This package is free software; you
|
# Copyright 2007-2012 by Wilson Snyder. This package is free software; you
|
||||||
# can redistribute it and/or modify it under the terms of either the GNU
|
# can redistribute it and/or modify it under the terms of either the GNU
|
||||||
# Lesser General Public License Version 3 or the Perl Artistic License
|
# Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
# Version 2.0.
|
# Version 2.0.
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/perl -w
|
#!/usr/bin/perl -w
|
||||||
######################################################################
|
######################################################################
|
||||||
#
|
#
|
||||||
# Copyright 2007-2011 by Wilson Snyder. This package is free software; you
|
# Copyright 2007-2012 by Wilson Snyder. This package is free software; you
|
||||||
# can redistribute it and/or modify it under the terms of either the GNU
|
# can redistribute it and/or modify it under the terms of either the GNU
|
||||||
# Lesser General Public License Version 3 or the Perl Artistic License
|
# Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
# Version 2.0.
|
# Version 2.0.
|
||||||
|
|||||||
+2
-2
@@ -38,7 +38,7 @@ cwrite ("graph_export.cpp");
|
|||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
sub usage {
|
sub usage {
|
||||||
pod2usage(-verbose=>2, -exitval => 2);
|
pod2usage(-verbose=>2, -exitval=>2, -output=>\*STDOUT);
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,7 +143,7 @@ Displays this message and program version and exits.
|
|||||||
|
|
||||||
=head1 DISTRIBUTION
|
=head1 DISTRIBUTION
|
||||||
|
|
||||||
Copyright 2005-2011 by Wilson Snyder. Verilator is free software; you can
|
Copyright 2005-2012 by Wilson Snyder. Verilator is free software; you can
|
||||||
redistribute it and/or modify it under the terms of either the GNU Lesser
|
redistribute it and/or modify it under the terms of either the GNU Lesser
|
||||||
General Public License Version 3 or the Perl Artistic License Version 2.0.
|
General Public License Version 3 or the Perl Artistic License Version 2.0.
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -43,7 +43,7 @@ dotwrite();
|
|||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
sub usage {
|
sub usage {
|
||||||
pod2usage(-verbose=>2, -exitval => 2);
|
pod2usage(-verbose=>2, -exitval=>2, -output=>\*STDOUT);
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,7 +184,7 @@ Displays this message and program version and exits.
|
|||||||
|
|
||||||
=head1 DISTRIBUTION
|
=head1 DISTRIBUTION
|
||||||
|
|
||||||
Copyright 2005-2011 by Wilson Snyder. Verilator is free software; you can
|
Copyright 2005-2012 by Wilson Snyder. Verilator is free software; you can
|
||||||
redistribute it and/or modify it under the terms of either the GNU Lesser
|
redistribute it and/or modify it under the terms of either the GNU Lesser
|
||||||
General Public License Version 3 or the Perl Artistic License Version 2.0.
|
General Public License Version 3 or the Perl Artistic License Version 2.0.
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/perl -w
|
#!/usr/bin/perl -w
|
||||||
######################################################################
|
######################################################################
|
||||||
#
|
#
|
||||||
# Copyright 2007-2011 by Wilson Snyder. This package is free software; you
|
# Copyright 2007-2012 by Wilson Snyder. This package is free software; you
|
||||||
# can redistribute it and/or modify it under the terms of either the GNU
|
# can redistribute it and/or modify it under the terms of either the GNU
|
||||||
# Lesser General Public License Version 3 or the Perl Artistic License
|
# Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
# Version 2.0.
|
# Version 2.0.
|
||||||
|
|||||||
+56
-12
@@ -12,12 +12,15 @@ use vars qw ($Debug);
|
|||||||
#======================================================================
|
#======================================================================
|
||||||
# main
|
# main
|
||||||
|
|
||||||
|
our $Opt_Stage = 0;
|
||||||
|
|
||||||
autoflush STDOUT 1;
|
autoflush STDOUT 1;
|
||||||
autoflush STDERR 1;
|
autoflush STDERR 1;
|
||||||
Getopt::Long::config ("no_auto_abbrev");
|
Getopt::Long::config ("no_auto_abbrev");
|
||||||
if (! GetOptions (
|
if (! GetOptions (
|
||||||
"debug" => sub { $Debug = 1; },
|
"debug" => sub { $Debug = 1; },
|
||||||
"<>" => sub { die "%Error: Unknown parameter: $_[0]\n"; },
|
"<>" => sub { die "%Error: Unknown parameter: $_[0]\n"; },
|
||||||
|
"stage=i" => \$Opt_Stage,
|
||||||
)) {
|
)) {
|
||||||
die "%Error: Bad usage, try 'install_test --help'\n";
|
die "%Error: Bad usage, try 'install_test --help'\n";
|
||||||
}
|
}
|
||||||
@@ -37,8 +40,10 @@ sub test {
|
|||||||
my $srcdir = getcwd();
|
my $srcdir = getcwd();
|
||||||
my $blddir = $srcdir."/test_regress/obj_dir/install_test_bld";
|
my $blddir = $srcdir."/test_regress/obj_dir/install_test_bld";
|
||||||
my $prefix = $srcdir."/test_regress/obj_dir/install_test_prefix";
|
my $prefix = $srcdir."/test_regress/obj_dir/install_test_prefix";
|
||||||
my $testdir = $srcdir."/test_regress/obj_dir/install_test_test";
|
my $testdirp= $srcdir."/test_regress/obj_dir/install_test_testp";
|
||||||
if (1) {
|
my $testdirn= $srcdir."/test_regress/obj_dir/install_test_testn";
|
||||||
|
|
||||||
|
if ($Opt_Stage <= 0) {
|
||||||
run("/bin/rm -rf $blddir");
|
run("/bin/rm -rf $blddir");
|
||||||
run("/bin/mkdir -p $blddir");
|
run("/bin/mkdir -p $blddir");
|
||||||
run("cd $blddir && $srcdir/configure --prefix $prefix");
|
run("cd $blddir && $srcdir/configure --prefix $prefix");
|
||||||
@@ -46,24 +51,63 @@ sub test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Install it under the prefix
|
# Install it under the prefix
|
||||||
if (1) {
|
if ($Opt_Stage <= 1) {
|
||||||
run("/bin/rm -rf $prefix");
|
run("/bin/rm -rf $prefix");
|
||||||
run("/bin/mkdir -p $prefix");
|
run("/bin/mkdir -p $prefix");
|
||||||
run("cd $blddir && make install");
|
run("cd $blddir && make install");
|
||||||
|
run("test -e $prefix/share/man/man1/verilator.1");
|
||||||
|
run("test -e $prefix/share/verilator/examples/test_c/Makefile");
|
||||||
|
run("test -e $prefix/share/verilator/include/verilated.h");
|
||||||
|
run("test -e $prefix/bin/verilator");
|
||||||
|
run("test -e $prefix/bin/verilator_bin");
|
||||||
|
run("test -e $prefix/bin/verilator_bin_dbg");
|
||||||
|
run("test -e $prefix/bin/verilator_profcfunc");
|
||||||
}
|
}
|
||||||
|
|
||||||
# Run a test using just the path
|
# Run a test using just the path
|
||||||
if (1) {
|
if ($Opt_Stage <= 2) {
|
||||||
run("/bin/rm -rf $testdir");
|
my $dir = $testdirp;
|
||||||
run("/bin/mkdir -p $testdir");
|
run("/bin/rm -rf $dir");
|
||||||
|
run("/bin/mkdir -p $dir");
|
||||||
my $bin1 = $prefix."/bin";
|
my $bin1 = $prefix."/bin";
|
||||||
my $bin2 = $prefix."/share/bin";
|
my $bin2 = $prefix."/share/bin";
|
||||||
IO::File->new(">$testdir/foo.v")->print('module t; initial begin $display("HELLO WORLD"); end endmodule'."\n");
|
write_verilog($dir);
|
||||||
run("cd $testdir && PATH=$bin1:$bin2:\$PATH verilator --cc foo.v");
|
run("cd $dir && PATH=$bin1:$bin2:\$PATH verilator --cc foo.v --exe foo.cpp");
|
||||||
run("cd $testdir/obj_dir && PATH=$bin1:$bin2:\$PATH make -f Vfoo.mk");
|
run("cd $dir/obj_dir && PATH=$bin1:$bin2:\$PATH make -f Vfoo.mk");
|
||||||
#Need .c file, and --exe for this to work
|
run("cd $dir && PATH=$bin1:$bin2:\$PATH obj_dir/Vfoo");
|
||||||
#run("cd $testdir && PATH=$bin1:$bin2:\$PATH obj_dir/Vfoo");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Run a test using exact path to binary
|
||||||
|
if ($Opt_Stage <= 3) {
|
||||||
|
my $dir = $testdirn;
|
||||||
|
run("/bin/rm -rf $dir");
|
||||||
|
run("/bin/mkdir -p $dir");
|
||||||
|
write_verilog($dir);
|
||||||
|
my $bin1 = $prefix."/bin";
|
||||||
|
my $bin2 = $prefix."/share/bin";
|
||||||
|
run("cd $dir && $bin1/verilator --cc foo.v --exe foo.cpp");
|
||||||
|
run("cd $dir/obj_dir && make -f Vfoo.mk");
|
||||||
|
run("cd $dir/obj_dir && ./Vfoo");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub write_verilog {
|
||||||
|
my $dir = shift;
|
||||||
|
IO::File->new(">$dir/foo.v")->print('module t; initial begin $display("HELLO WORLD"); $finish; end endmodule'."\n");
|
||||||
|
my $fh = IO::File->new(">$dir/foo.cpp");
|
||||||
|
$fh->print('#include "Vfoo.h"' ,"\n");
|
||||||
|
$fh->print('unsigned int main_time = 0;' ,"\n");
|
||||||
|
$fh->print('double sc_time_stamp () {' ,"\n");
|
||||||
|
$fh->print(' return main_time;' ,"\n");
|
||||||
|
$fh->print('}' ,"\n");
|
||||||
|
$fh->print('int main() {' ,"\n");
|
||||||
|
$fh->print(' Vfoo *top = new Vfoo;' ,"\n");
|
||||||
|
$fh->print(' while (!Verilated::gotFinish()) {',"\n");
|
||||||
|
$fh->print(' top->eval();' ,"\n");
|
||||||
|
$fh->print(' main_time++;' ,"\n");
|
||||||
|
$fh->print(' }' ,"\n");
|
||||||
|
$fh->print(' top->final();' ,"\n");
|
||||||
|
$fh->print('}' ,"\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
sub cleanenv {
|
sub cleanenv {
|
||||||
@@ -117,7 +161,7 @@ Displays this message and program version and exits.
|
|||||||
|
|
||||||
=head1 DISTRIBUTION
|
=head1 DISTRIBUTION
|
||||||
|
|
||||||
Copyright 2009-2011 by Wilson Snyder. This package is free software; you
|
Copyright 2009-2012 by Wilson Snyder. This package is free software; you
|
||||||
can redistribute it and/or modify it under the terms of either the GNU
|
can redistribute it and/or modify it under the terms of either the GNU
|
||||||
Lesser General Public License Version 3 or the Perl Artistic License
|
Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
Version 2.0.
|
Version 2.0.
|
||||||
|
|||||||
+1
-1
@@ -28,7 +28,7 @@ invoke_atsim - Invoke tool under "modules" command
|
|||||||
|
|
||||||
=head1 DISTRIBUTION
|
=head1 DISTRIBUTION
|
||||||
|
|
||||||
Copyright 2005-2011 by Wilson Snyder. This package is free software; you
|
Copyright 2005-2012 by Wilson Snyder. This package is free software; you
|
||||||
can redistribute it and/or modify it under the terms of either the GNU
|
can redistribute it and/or modify it under the terms of either the GNU
|
||||||
Lesser General Public License Version 3 or the Perl Artistic License
|
Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
Version 2.0.
|
Version 2.0.
|
||||||
|
|||||||
+1
-1
@@ -28,7 +28,7 @@ invoke_iccr - Invoke tool under "modules" command
|
|||||||
|
|
||||||
=head1 DISTRIBUTION
|
=head1 DISTRIBUTION
|
||||||
|
|
||||||
Copyright 2007-2011 by Wilson Snyder. This package is free software; you
|
Copyright 2007-2012 by Wilson Snyder. This package is free software; you
|
||||||
can redistribute it and/or modify it under the terms of either the GNU
|
can redistribute it and/or modify it under the terms of either the GNU
|
||||||
Lesser General Public License Version 3 or the Perl Artistic License
|
Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
Version 2.0.
|
Version 2.0.
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ invoke_ncverilog - Invoke tool under "modules" command
|
|||||||
|
|
||||||
=head1 DISTRIBUTION
|
=head1 DISTRIBUTION
|
||||||
|
|
||||||
Copyright 2005-2011 by Wilson Snyder. This package is free software; you
|
Copyright 2005-2012 by Wilson Snyder. This package is free software; you
|
||||||
can redistribute it and/or modify it under the terms of either the GNU
|
can redistribute it and/or modify it under the terms of either the GNU
|
||||||
Lesser General Public License Version 3 or the Perl Artistic License
|
Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
Version 2.0.
|
Version 2.0.
|
||||||
|
|||||||
+1
-1
@@ -28,7 +28,7 @@ invoke_vcs - Invoke tool under "modules" command
|
|||||||
|
|
||||||
=head1 DISTRIBUTION
|
=head1 DISTRIBUTION
|
||||||
|
|
||||||
Copyright 2005-2011 by Wilson Snyder. This package is free software; you
|
Copyright 2005-2012 by Wilson Snyder. This package is free software; you
|
||||||
can redistribute it and/or modify it under the terms of either the GNU
|
can redistribute it and/or modify it under the terms of either the GNU
|
||||||
Lesser General Public License Version 3 or the Perl Artistic License
|
Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
Version 2.0.
|
Version 2.0.
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/perl -w
|
#!/usr/bin/perl -w
|
||||||
######################################################################
|
######################################################################
|
||||||
#
|
#
|
||||||
# Copyright 2010-2011 by Wilson Snyder. This package is free software; you
|
# Copyright 2010-2012 by Wilson Snyder. This package is free software; you
|
||||||
# can redistribute it and/or modify it under the terms of either the GNU
|
# can redistribute it and/or modify it under the terms of either the GNU
|
||||||
# Lesser General Public License Version 3 or the Perl Artistic License
|
# Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
# Version 2.0.
|
# Version 2.0.
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ print '(query-replace-regexp "(\\([0-9a-z_]+\\))" "\\1" nil nil nil)',"\n";
|
|||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
sub usage {
|
sub usage {
|
||||||
pod2usage(-verbose=>2, -exitval => 2);
|
pod2usage(-verbose=>2, -exitval=>2, -output=>\*STDOUT);
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,7 +256,7 @@ sub gentree {
|
|||||||
'TRACE' => sub { p "TRACE what{";p1;p ",";p2;p ",";p3;p ",";p4;p ",";p5;p "}";nl; },
|
'TRACE' => sub { p "TRACE what{";p1;p ",";p2;p ",";p3;p ",";p4;p ",";p5;p "}";nl; },
|
||||||
'UCFUNC' => sub { p '$c(';p1;p ",";p2;p ",";p3;p ",";p4;p ",";p5;p ")"; },
|
'UCFUNC' => sub { p '$c(';p1;p ",";p2;p ",";p3;p ",";p4;p ",";p5;p ")"; },
|
||||||
'UCSTMT' => sub { p '$c(';p1;p ",";p2;p ",";p3;p ",";p4;p ",";p5;p ");";nl; },
|
'UCSTMT' => sub { p '$c(';p1;p ",";p2;p ",";p3;p ",";p4;p ",";p5;p ");";nl; },
|
||||||
'UNARYMIN' => sub { p " -";p1; },
|
'NEGATE' => sub { p " -";p1; },
|
||||||
'VAR' => sub { p_var(); },
|
'VAR' => sub { p_var(); },
|
||||||
'VARPIN' => sub { p "VARPIN what{";p1;p ",";p2;p ",";p3;p ",";p4;p ",";p5;p "}";nl; },
|
'VARPIN' => sub { p "VARPIN what{";p1;p ",";p2;p ",";p3;p ",";p4;p ",";p5;p "}";nl; },
|
||||||
'VARREF' => sub { a1; },
|
'VARREF' => sub { a1; },
|
||||||
@@ -331,7 +331,7 @@ Displays this message and program version and exits.
|
|||||||
|
|
||||||
=head1 DISTRIBUTION
|
=head1 DISTRIBUTION
|
||||||
|
|
||||||
Copyright 2005-2011 by Wilson Snyder. Verilator is free software; you can
|
Copyright 2005-2012 by Wilson Snyder. Verilator is free software; you can
|
||||||
redistribute it and/or modify it under the terms of either the GNU Lesser
|
redistribute it and/or modify it under the terms of either the GNU Lesser
|
||||||
General Public License Version 3 or the Perl Artistic License Version 2.0.
|
General Public License Version 3 or the Perl Artistic License Version 2.0.
|
||||||
|
|
||||||
|
|||||||
+14
-11
@@ -9,7 +9,7 @@ This is the Verilator Package README file.
|
|||||||
|
|
||||||
=head1 DISTRIBUTION
|
=head1 DISTRIBUTION
|
||||||
|
|
||||||
This package is Copyright 2003-2011 by Wilson Snyder. (Report bugs to
|
This package is Copyright 2003-2012 by Wilson Snyder. (Report bugs to
|
||||||
L<http://www.veripool.org/>.)
|
L<http://www.veripool.org/>.)
|
||||||
|
|
||||||
Verilator is free software; you can redistribute it and/or modify it under
|
Verilator is free software; you can redistribute it and/or modify it under
|
||||||
@@ -72,14 +72,10 @@ Download the latest package from that site, and decompress.
|
|||||||
|
|
||||||
If you will be using SystemC (vs straight C++ output), download SystemC
|
If you will be using SystemC (vs straight C++ output), download SystemC
|
||||||
2.0.1 from L<http://www.systemc.org>. Follow their installation
|
2.0.1 from L<http://www.systemc.org>. Follow their installation
|
||||||
instructions. You will need to set the SYSTEMC environment variable to
|
instructions. You will need to set SYSTEMC_INCLUDE to point to the
|
||||||
point to this download. Also, setenv SYSTEMC_ARCH to the architecture name
|
include directory with systemc.h in it, and SYSTEMC_LIBDIR to points
|
||||||
you used with SystemC, generally 'linux' or 'cygwin'.
|
to the directory with libsystemc.a in it. (Older installations may
|
||||||
|
set SYSTEMC and SYSTEMC_ARCH instead.)
|
||||||
Verilator assumes you did a make in the SystemC kit directory and SYSTEMC
|
|
||||||
points to that directory. There must be appropriate files in
|
|
||||||
C<$SYSTEMC/include> and C<$SYSTEMC/lib-linux> for SystemC compilation to
|
|
||||||
work.
|
|
||||||
|
|
||||||
=item
|
=item
|
||||||
|
|
||||||
@@ -91,14 +87,18 @@ headers.
|
|||||||
|
|
||||||
=item
|
=item
|
||||||
|
|
||||||
|
You will need the C<flex> and C<bison> packages installed.
|
||||||
|
|
||||||
|
=item
|
||||||
|
|
||||||
C<cd> to the Verilator directory containing this README.
|
C<cd> to the Verilator directory containing this README.
|
||||||
|
|
||||||
=item
|
=item
|
||||||
|
|
||||||
You now have to decide how you're going to eventually install the kit.
|
You now have to decide how you're going to eventually install the kit.
|
||||||
|
|
||||||
Note Verilator builds the current value of VERILATOR_ROOT, SYSTEMC,
|
Note Verilator builds the current value of VERILATOR_ROOT, SYSTEMC_INCLUDE,
|
||||||
SYSTEMC_ARCH, SYSTEMPERL, and SYSTEMPERL_INCLUDE as defaults into the
|
SYSTEMC_LIBDIR, SYSTEMPERL, and SYSTEMPERL_INCLUDE as defaults into the
|
||||||
executable, so try to have them correct before configuring.
|
executable, so try to have them correct before configuring.
|
||||||
|
|
||||||
=over 4
|
=over 4
|
||||||
@@ -147,6 +147,9 @@ most GNU tools support:
|
|||||||
unsetenv VERILATOR_ROOT # if your shell is csh
|
unsetenv VERILATOR_ROOT # if your shell is csh
|
||||||
./configure --prefix /opt/verilator-VERSION
|
./configure --prefix /opt/verilator-VERSION
|
||||||
|
|
||||||
|
Then after installing you will need to add /opt/verilator-VERSION/bin to
|
||||||
|
PATH.
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
=item
|
=item
|
||||||
|
|||||||
-197
@@ -1,197 +0,0 @@
|
|||||||
\input texinfo @c -*-texinfo-*-
|
|
||||||
@c %**start of header
|
|
||||||
@setfilename readme.info
|
|
||||||
@settitle Verilator Installation
|
|
||||||
@c %**end of header
|
|
||||||
|
|
||||||
@c DESCRIPTION: TexInfo: DOCUMENT source run through texinfo to produce README file
|
|
||||||
@c Use 'make README' to produce the output file
|
|
||||||
@c Before release, run C-u C-c C-u C-a (texinfo-all-menus-update)
|
|
||||||
|
|
||||||
@node Top, Copyright, (dir), (dir)
|
|
||||||
@chapter Verilator
|
|
||||||
|
|
||||||
This is the Verilator Package.
|
|
||||||
|
|
||||||
@menu
|
|
||||||
* Copyright::
|
|
||||||
* Description::
|
|
||||||
* Obtaining Distribution::
|
|
||||||
* Directory Structure::
|
|
||||||
* Supported Systems::
|
|
||||||
* Installation::
|
|
||||||
* Limitations::
|
|
||||||
@end menu
|
|
||||||
|
|
||||||
@node Copyright, Description, Top, Top
|
|
||||||
@section Copyright
|
|
||||||
|
|
||||||
This package is Copyright 2003-2011 by Wilson Snyder @email{wsnyder@@wsnyder.org}.
|
|
||||||
|
|
||||||
Verilator is free software; you can redistribute it and/or modify it
|
|
||||||
under the terms of either the GNU Lesser General Public License
|
|
||||||
Version 3 or the Perl Artistic License Version 2.0. (See the
|
|
||||||
documentation for more details.)
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful, but
|
|
||||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
General Public License for more details.
|
|
||||||
|
|
||||||
@node Description, Obtaining Distribution, Copyright, Top
|
|
||||||
@section Description
|
|
||||||
|
|
||||||
Verilator converts synthesizable (not behavioral) Verilog code into C++ or
|
|
||||||
SystemC code. It is not a complete simulator, just a translator.
|
|
||||||
|
|
||||||
Verilator is invoked with parameters similar to GCC or Synopsys's VCS. It
|
|
||||||
reads the specified Verilog code, lints it, and optionally adds coverage
|
|
||||||
code. For C++ format, it outputs .cpp and .h files. For SystemC format,
|
|
||||||
it outputs .sp files for the SystemPerl preprocessor available at
|
|
||||||
http://www.veripool.org.
|
|
||||||
|
|
||||||
The resulting files are then compiled with C++. The user writes a little
|
|
||||||
C++ wrapper file, which instantiates the top level module. This is
|
|
||||||
compiled in C++, and linked with the Verilated files.
|
|
||||||
|
|
||||||
The resulting executable will perform the actual simulation.
|
|
||||||
|
|
||||||
@node Obtaining Distribution, Directory Structure, Description, Top
|
|
||||||
@section Obtaining Distribution
|
|
||||||
|
|
||||||
The latest version is available at
|
|
||||||
@uref{http://www.veripool.org/verilator}
|
|
||||||
|
|
||||||
Download the latest package from that site, and decompress.
|
|
||||||
@samp{tar xvzf verilator_version.tgz}
|
|
||||||
|
|
||||||
@node Directory Structure, Supported Systems, Obtaining Distribution, Top
|
|
||||||
@section Directory Structure
|
|
||||||
|
|
||||||
The directories after de-taring are as follows:
|
|
||||||
|
|
||||||
@itemize @bullet
|
|
||||||
@item bin/verilator => Compiler Wrapper invoked on user Verilog code
|
|
||||||
@item include/ => Files that should be in your -I compiler path
|
|
||||||
@item include/verilated.cpp => Global routines to link into your simulator
|
|
||||||
@item include/verilated.h => Global headers
|
|
||||||
@item include/verilated.v => Stub defines for linting
|
|
||||||
@item include/verilated.mk => Common makefile
|
|
||||||
@item src/ => Translator source code
|
|
||||||
@item test_v => Example Verilog code for other test dirs
|
|
||||||
@item test_c => Example Verilog->C++ conversion
|
|
||||||
@item test_sc => Example Verilog->SystemC conversion
|
|
||||||
@item test_sp => Example Verilog->SystemPerl conversion
|
|
||||||
@item test_vcs => Example Verilog->VCS conversion (test the test)
|
|
||||||
@item test_verilated => Internal tests
|
|
||||||
@item test_regress => Internal tests
|
|
||||||
@end itemize
|
|
||||||
|
|
||||||
@node Supported Systems, Installation, Directory Structure, Top
|
|
||||||
@section Supported Systems
|
|
||||||
|
|
||||||
This version of verilator has been built and tested on:
|
|
||||||
|
|
||||||
@itemize @bullet
|
|
||||||
@item SuSE AMD64 i686-linux-2.6.5
|
|
||||||
@end itemize
|
|
||||||
|
|
||||||
Other users report success with Redhat Linux 2.4, Windows under
|
|
||||||
Cygwin, HPUX and Solaris. It should run with minor porting on any
|
|
||||||
Unix system.
|
|
||||||
|
|
||||||
@node Installation, Limitations, Supported Systems, Top
|
|
||||||
@section Installation
|
|
||||||
|
|
||||||
@enumerate
|
|
||||||
@item
|
|
||||||
If you will be using SystemC (vs straight C++ output), download
|
|
||||||
SystemC 2.0.1 from @url{http://www.systemc.org}. Follow their
|
|
||||||
installation instructions. As described in the System-Perl README,
|
|
||||||
you will need to set SYSTEMC and/or SYSTEMC_KIT to point to this
|
|
||||||
download. Also, set SYSTEMC_ARCH to the architecture name you used
|
|
||||||
with SystemC, generally 'linux' or 'cygwin'.
|
|
||||||
|
|
||||||
@item
|
|
||||||
If you will be using SystemC, download and install Verilog-Perl,
|
|
||||||
@url{http://search.cpan.org/search?module=Verilog::Language}.
|
|
||||||
|
|
||||||
@item
|
|
||||||
If you will be using SystemC, download and install System-Perl,
|
|
||||||
@url{http://search.cpan.org/search?module=SystemC::Netlist}. Note
|
|
||||||
you'll need to set a @samp{SYSTEMPERL} environment variable to point
|
|
||||||
to the downloaded kit. Optionally also set @samp{SYSTEMPERL_INCLUDE}
|
|
||||||
to point to the installed headers.
|
|
||||||
|
|
||||||
@item
|
|
||||||
@code{cd} to the Verilator directory containing this README.
|
|
||||||
|
|
||||||
@item
|
|
||||||
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, SYSTEMPERL, and SYSTEMPERL_INCLUDE and build
|
|
||||||
them as defaults into the executable.
|
|
||||||
|
|
||||||
@item
|
|
||||||
Type @samp{make} to compile Verilator.
|
|
||||||
|
|
||||||
On Cygwin (Windows) you may get a error about libperl.a not being
|
|
||||||
found. You need to copy your perl libraries as follows.
|
|
||||||
|
|
||||||
@enumerate
|
|
||||||
@item
|
|
||||||
Type @samp{perl -MExtUtils::Embed -e ldopts}
|
|
||||||
@item
|
|
||||||
It will show a directory name ending in /CORE. cd to that directory.
|
|
||||||
@item
|
|
||||||
@samp{cp libperl5_6_1.a libperl.a}
|
|
||||||
@item
|
|
||||||
@samp{cp libperl5_6_1.dll libperl.dll}
|
|
||||||
@item
|
|
||||||
@samp{cp libperl5_6_1.def libperl.def}
|
|
||||||
@end enumerate
|
|
||||||
|
|
||||||
@item
|
|
||||||
Type @samp{make test} to check the compilation.
|
|
||||||
|
|
||||||
You may get a error about the Bit::Vector perl package. You will need to install
|
|
||||||
it if you want the tests to pass. (Try @samp{make test_c} for a smaller test that
|
|
||||||
doesn't require it.)
|
|
||||||
|
|
||||||
You may get a error about a typedef conflict for uint32_t. Edit verilated.h to change
|
|
||||||
the typedef to work, probably to @samp{typedef unsigned long uint32_t;}.
|
|
||||||
|
|
||||||
If you get warnings, you might want to edit @samp{include/verilated.mk} to delete the
|
|
||||||
lines that define VK_CPPFLAGS_WALL.
|
|
||||||
|
|
||||||
@item
|
|
||||||
|
|
||||||
There is no installation at present; this package runs from the
|
|
||||||
distribution directory. Programs should set the environment variable
|
|
||||||
VERILATOR_ROOT to point to this distribution, then execute
|
|
||||||
$VERILATOR_ROOT/bin/verilator, which will find the path to all needed
|
|
||||||
files.
|
|
||||||
|
|
||||||
Verilator assumes you did a make in the SystemC kit directory. If not, you will need
|
|
||||||
to populate @samp{$SYSTEMC/include} and @samp{$SYSTEMC/lib-linux} appropriately.
|
|
||||||
|
|
||||||
If you will be modifying Verilator, you will probably want a second
|
|
||||||
stable copy of this kit for others to use while you experiment.
|
|
||||||
|
|
||||||
@item
|
|
||||||
Detailed documentation and the man page can be seen by running:
|
|
||||||
|
|
||||||
bin/verilator --help
|
|
||||||
|
|
||||||
or reading verilator.txt in the same directory as this README.
|
|
||||||
|
|
||||||
@end enumerate
|
|
||||||
|
|
||||||
@node Limitations, , Installation, Top
|
|
||||||
@section Limitations
|
|
||||||
|
|
||||||
See verilator.txt (or execute @samp{bin/verilator --help}) for limitations.
|
|
||||||
|
|
||||||
+14
-25
@@ -7,7 +7,7 @@
|
|||||||
#
|
#
|
||||||
#*****************************************************************************
|
#*****************************************************************************
|
||||||
#
|
#
|
||||||
# Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
# Copyright 2003-2012 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
|
||||||
# Lesser General Public License Version 3 or the Perl Artistic License
|
# Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
# Version 2.0.
|
# Version 2.0.
|
||||||
@@ -24,6 +24,7 @@
|
|||||||
srcdir = @srcdir@
|
srcdir = @srcdir@
|
||||||
VPATH = @srcdir@
|
VPATH = @srcdir@
|
||||||
PERL = @PERL@
|
PERL = @PERL@
|
||||||
|
EXEEXT = @EXEEXT@
|
||||||
|
|
||||||
#### End of system configuration section. ####
|
#### End of system configuration section. ####
|
||||||
|
|
||||||
@@ -32,25 +33,11 @@ default: dbg opt
|
|||||||
debug: dbg
|
debug: dbg
|
||||||
optimize: opt
|
optimize: opt
|
||||||
|
|
||||||
ifeq ($(OBJCACHE_HOSTS),)
|
|
||||||
ifneq ($(SLCHOOSED_HOST),)
|
|
||||||
ifeq ($(VERILATOR_AUTHOR_SITE),1)
|
|
||||||
export OBJCACHE_HOSTS := $(shell rschedule --no-allow-reserved --similar hostnames)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(OBJCACHE_JOBS),)
|
|
||||||
ifneq ($(OBJCACHE_HOSTS),)
|
|
||||||
export OBJCACHE_JOBS := -j $(shell objcache --jobs "$(OBJCACHE_HOSTS)")
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifneq ($(words $(CURDIR)),1)
|
ifneq ($(words $(CURDIR)),1)
|
||||||
$(error Unsupported: GNU Make cannot build in directories containing spaces, build elsewhere: '$(CURDIR)')
|
$(error Unsupported: GNU Make cannot build in directories containing spaces, build elsewhere: '$(CURDIR)')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
UNDER_GIT = $(wildcard ../.git/logs/HEAD)
|
UNDER_GIT = $(wildcard ${srcdir}/../.git/logs/HEAD)
|
||||||
|
|
||||||
#*********************************************************************
|
#*********************************************************************
|
||||||
|
|
||||||
@@ -65,26 +52,25 @@ opt: ../verilator_bin
|
|||||||
ifeq ($(VERILATOR_NO_OPT_BUILD),1) # Faster laptop development... One build
|
ifeq ($(VERILATOR_NO_OPT_BUILD),1) # Faster laptop development... One build
|
||||||
../verilator_bin: ../verilator_bin_dbg
|
../verilator_bin: ../verilator_bin_dbg
|
||||||
-rm -rf $@ $@.exe
|
-rm -rf $@ $@.exe
|
||||||
-cp -p $< $@
|
-cp -p $<$(EXEEXT) $@$(EXEEXT)
|
||||||
-cp -p $<.exe $@.exe
|
|
||||||
else
|
else
|
||||||
../verilator_bin: obj_opt prefiles
|
../verilator_bin: obj_opt prefiles
|
||||||
cd obj_opt && $(MAKE) -j 1 TGT=../$@ -f ../Makefile_obj serial
|
cd obj_opt && $(MAKE) -j 1 TGT=../$@ -f ../Makefile_obj serial
|
||||||
cd obj_opt && $(MAKE) $(OBJCACHE_JOBS) TGT=../$@ -f ../Makefile_obj
|
cd obj_opt && $(MAKE) TGT=../$@ -f ../Makefile_obj
|
||||||
endif
|
endif
|
||||||
|
|
||||||
dbg: ../verilator_bin_dbg
|
dbg: ../verilator_bin_dbg
|
||||||
../verilator_bin_dbg: obj_dbg prefiles
|
../verilator_bin_dbg: obj_dbg prefiles
|
||||||
cd obj_dbg && $(MAKE) -j 1 TGT=../$@ VL_DEBUG=1 -f ../Makefile_obj serial
|
cd obj_dbg && $(MAKE) -j 1 TGT=../$@ VL_DEBUG=1 -f ../Makefile_obj serial
|
||||||
cd obj_dbg && $(MAKE) $(OBJCACHE_JOBS) TGT=../$@ VL_DEBUG=1 -f ../Makefile_obj
|
cd obj_dbg && $(MAKE) TGT=../$@ VL_DEBUG=1 -f ../Makefile_obj
|
||||||
|
|
||||||
prefiles::
|
prefiles::
|
||||||
|
|
||||||
ifneq ($(UNDER_GIT),) # If local git tree... Else don't burden users
|
ifneq ($(UNDER_GIT),) # If local git tree... 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 if locally configured, as we need to distribute it as part of the kit.
|
||||||
config_rev.h: config_rev.pl ../.git/logs/HEAD
|
config_rev.h: ${srcdir}/config_rev.pl ${srcdir}/../.git/logs/HEAD
|
||||||
$(PERL) config_rev.pl . >$@
|
$(PERL) ${srcdir}/config_rev.pl ${srcdir} >$@
|
||||||
endif
|
endif
|
||||||
|
|
||||||
maintainer-copy::
|
maintainer-copy::
|
||||||
@@ -96,3 +82,6 @@ clean mostlyclean distclean maintainer-clean::
|
|||||||
|
|
||||||
distclean maintainer-clean::
|
distclean maintainer-clean::
|
||||||
-rm -f Makefile Makefile_obj config_build.h
|
-rm -f Makefile Makefile_obj config_build.h
|
||||||
|
|
||||||
|
maintainer-clean::
|
||||||
|
-rm -f config_rev.h
|
||||||
|
|||||||
+17
-15
@@ -7,7 +7,7 @@
|
|||||||
#
|
#
|
||||||
#*****************************************************************************
|
#*****************************************************************************
|
||||||
#
|
#
|
||||||
# Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
# Copyright 2003-2012 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
|
||||||
# Lesser General Public License Version 3 or the Perl Artistic License
|
# Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
# Version 2.0.
|
# Version 2.0.
|
||||||
@@ -57,9 +57,11 @@ datarootdir = @datarootdir@
|
|||||||
pkgdatadir = @pkgdatadir@
|
pkgdatadir = @pkgdatadir@
|
||||||
|
|
||||||
# Compile options
|
# Compile options
|
||||||
|
CFG_WITH_CCWARN = @CFG_WITH_CCWARN@
|
||||||
CFG_WITH_DEFENV = @CFG_WITH_DEFENV@
|
CFG_WITH_DEFENV = @CFG_WITH_DEFENV@
|
||||||
CPPFLAGSNOWALL += @CPPFLAGS@
|
CPPFLAGS += @CPPFLAGS@
|
||||||
LDFLAGS += @LDFLAGS@
|
LDFLAGS += @LDFLAGS@
|
||||||
|
EXEEXT = @EXEEXT@
|
||||||
|
|
||||||
#### End of system configuration section. ####
|
#### End of system configuration section. ####
|
||||||
|
|
||||||
@@ -85,17 +87,18 @@ endif
|
|||||||
# -lfl not needed as Flex invoked with %nowrap option
|
# -lfl not needed as Flex invoked with %nowrap option
|
||||||
LIBS = -lm
|
LIBS = -lm
|
||||||
|
|
||||||
CPPFLAGSNOWALL += -MMD
|
CPPFLAGS += -MMD
|
||||||
CPPFLAGSNOWALL += -I. -I$(bldsrc) -I$(srcdir) -I$(incdir)
|
CPPFLAGS += -I. -I$(bldsrc) -I$(srcdir) -I$(incdir)
|
||||||
CPPFLAGSNOWALL += -DYYDEBUG # Required to get nice error messages
|
CPPFLAGS += -DYYDEBUG # Required to get nice error messages
|
||||||
#CPPFLAGSNOWALL += -DVL_LEAK_CHECKS # If running valgrind or other hunting tool
|
#CPPFLAGS += -DVL_LEAK_CHECKS # If running valgrind or other hunting tool
|
||||||
CPPFLAGSNOWALL += $(COPT)
|
CPPFLAGS += $(COPT)
|
||||||
CPPFLAGS = $(CPPFLAGSNOWALL)
|
CPPFLAGS += -MP # Only works on recent GCC versions
|
||||||
ifeq ($(VERILATOR_AUTHOR_SITE),1) # Local... Else don't burden users
|
ifeq ($(CFG_WITH_CCWARN),yes) # Local... Else don't burden users
|
||||||
CPPFLAGSNOWALL += -MP # Only works on recent GCC versions
|
|
||||||
CPPFLAGS += -W -Wall -Wno-unused-parameter -Wno-char-subscripts -Werror
|
CPPFLAGS += -W -Wall -Wno-unused-parameter -Wno-char-subscripts -Werror
|
||||||
#CPPFLAGS += -pedantic-errors
|
#CPPFLAGS += -pedantic-errors
|
||||||
endif
|
endif
|
||||||
|
CPPFLAGSWALL = $(CPPFLAGS)
|
||||||
|
CPPFLAGSNOWALL = $(CPPFLAGS) -Wno-unused
|
||||||
|
|
||||||
ifneq ($(SYSTEMPERL),) # Intuit SYSTEMPERL_INCLUDE as it's new
|
ifneq ($(SYSTEMPERL),) # Intuit SYSTEMPERL_INCLUDE as it's new
|
||||||
SYSTEMPERL_INCLUDE ?= $(SYSTEMPERL)/src
|
SYSTEMPERL_INCLUDE ?= $(SYSTEMPERL)/src
|
||||||
@@ -108,6 +111,8 @@ endif
|
|||||||
ifeq ($(CFG_WITH_DEFENV),yes)
|
ifeq ($(CFG_WITH_DEFENV),yes)
|
||||||
CPPFLAGS += -DDEFENV_SYSTEMC=\"$(SYSTEMC)\"
|
CPPFLAGS += -DDEFENV_SYSTEMC=\"$(SYSTEMC)\"
|
||||||
CPPFLAGS += -DDEFENV_SYSTEMC_ARCH=\"$(SYSTEMC_ARCH)\"
|
CPPFLAGS += -DDEFENV_SYSTEMC_ARCH=\"$(SYSTEMC_ARCH)\"
|
||||||
|
CPPFLAGS += -DDEFENV_SYSTEMC_INCLUDE=\"$(SYSTEMC_INCLUDE)\"
|
||||||
|
CPPFLAGS += -DDEFENV_SYSTEMC_LIBDIR=\"$(SYSTEMC_LIBDIR)\"
|
||||||
CPPFLAGS += -DDEFENV_SYSTEMPERL=\"$(SYSTEMPERL)\"
|
CPPFLAGS += -DDEFENV_SYSTEMPERL=\"$(SYSTEMPERL)\"
|
||||||
CPPFLAGS += -DDEFENV_SYSTEMPERL_INCLUDE=\"$(SYSTEMPERL_INCLUDE)\"
|
CPPFLAGS += -DDEFENV_SYSTEMPERL_INCLUDE=\"$(SYSTEMPERL_INCLUDE)\"
|
||||||
ifeq ($(VERILATOR_ROOT),) # Use what we're given, or intuit
|
ifeq ($(VERILATOR_ROOT),) # Use what we're given, or intuit
|
||||||
@@ -209,7 +214,6 @@ RAW_OBJS = \
|
|||||||
V3PreShell.o \
|
V3PreShell.o \
|
||||||
V3Premit.o \
|
V3Premit.o \
|
||||||
V3Scope.o \
|
V3Scope.o \
|
||||||
V3Signed.o \
|
|
||||||
V3Slice.o \
|
V3Slice.o \
|
||||||
V3Split.o \
|
V3Split.o \
|
||||||
V3SplitAs.o \
|
V3SplitAs.o \
|
||||||
@@ -251,8 +255,6 @@ $(TGT): V3Ast__gen_classes.h $(OBJS)
|
|||||||
@echo " Linking $@..."
|
@echo " Linking $@..."
|
||||||
-rm -rf $@ [email protected]
|
-rm -rf $@ [email protected]
|
||||||
${LINK} ${LDFLAGS} -o $@ $(OBJS) $(CCMALLOC) ${LIBS}
|
${LINK} ${LDFLAGS} -o $@ $(OBJS) $(CCMALLOC) ${LIBS}
|
||||||
@-(cp [email protected] $@ || true)
|
|
||||||
# ok if cp failes on linux, it's there to insure executable works on NT
|
|
||||||
|
|
||||||
V3Number_test: V3Number_test.o
|
V3Number_test: V3Number_test.o
|
||||||
${LINK} ${LDFLAGS} -o $@ $^ ${LIBS}
|
${LINK} ${LDFLAGS} -o $@ $^ ${LIBS}
|
||||||
@@ -263,9 +265,9 @@ V3Number_test: V3Number_test.o
|
|||||||
$(PERL) $(ASTGEN) -I$(srcdir) $*.cpp
|
$(PERL) $(ASTGEN) -I$(srcdir) $*.cpp
|
||||||
|
|
||||||
%.o: %.cpp
|
%.o: %.cpp
|
||||||
$(OBJCACHE) ${CXX} ${CPPFLAGS} -c $<
|
$(OBJCACHE) ${CXX} ${CPPFLAGSWALL} -c $<
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
$(OBJCACHE) ${CC} ${CPPFLAGS} -c $<
|
$(OBJCACHE) ${CC} ${CPPFLAGSWALL} -c $<
|
||||||
|
|
||||||
V3ParseLex.o: V3ParseLex.cpp V3Lexer.yy.cpp V3ParseBison.c
|
V3ParseLex.o: V3ParseLex.cpp V3Lexer.yy.cpp V3ParseBison.c
|
||||||
$(OBJCACHE) ${CXX} ${CPPFLAGSNOWALL} -c $<
|
$(OBJCACHE) ${CXX} ${CPPFLAGSNOWALL} -c $<
|
||||||
|
|||||||
+7
-3
@@ -7,7 +7,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
@@ -148,7 +148,11 @@ public:
|
|||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
// CONSTUCTORS
|
// CONSTUCTORS
|
||||||
ActiveNamer() {}
|
ActiveNamer() {
|
||||||
|
m_scopep = NULL;
|
||||||
|
m_iActivep = NULL;
|
||||||
|
m_cActivep = NULL;
|
||||||
|
}
|
||||||
virtual ~ActiveNamer() {}
|
virtual ~ActiveNamer() {}
|
||||||
void main(AstScope* nodep) {
|
void main(AstScope* nodep) {
|
||||||
nodep->accept(*this);
|
nodep->accept(*this);
|
||||||
@@ -390,7 +394,7 @@ private:
|
|||||||
nodep->unlinkFrBack()->deleteTree(); nodep=NULL;
|
nodep->unlinkFrBack()->deleteTree(); nodep=NULL;
|
||||||
} else if (nodep->varrefp()) {
|
} else if (nodep->varrefp()) {
|
||||||
// V3LinkResolve should have cleaned most of these up
|
// V3LinkResolve should have cleaned most of these up
|
||||||
if (nodep->varrefp()->width()>1) nodep->v3error("Unsupported: Non-single bit wide signal pos/negedge sensitivity: "
|
if (!nodep->varrefp()->width1()) nodep->v3error("Unsupported: Non-single bit wide signal pos/negedge sensitivity: "
|
||||||
<<nodep->varrefp()->prettyName());
|
<<nodep->varrefp()->prettyName());
|
||||||
m_itemSequent = true;
|
m_itemSequent = true;
|
||||||
nodep->varrefp()->varp()->usedClock(true);
|
nodep->varrefp()->varp()->usedClock(true);
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
|
|||||||
+6
-6
@@ -7,7 +7,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2005-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2005-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
@@ -184,7 +184,7 @@ private:
|
|||||||
}
|
}
|
||||||
if (nodep->fullPragma() || nodep->priorityPragma()) {
|
if (nodep->fullPragma() || nodep->priorityPragma()) {
|
||||||
// Simply need to add a default if there isn't one already
|
// Simply need to add a default if there isn't one already
|
||||||
m_statAsFull++;
|
++m_statAsFull;
|
||||||
if (!has_default) {
|
if (!has_default) {
|
||||||
nodep->addItemsp(new AstCaseItem(nodep->fileline(), NULL/*DEFAULT*/,
|
nodep->addItemsp(new AstCaseItem(nodep->fileline(), NULL/*DEFAULT*/,
|
||||||
newFireAssert(nodep, "synthesis full_case, but non-match found")));
|
newFireAssert(nodep, "synthesis full_case, but non-match found")));
|
||||||
@@ -193,7 +193,7 @@ private:
|
|||||||
if (nodep->parallelPragma() || nodep->uniquePragma() || nodep->unique0Pragma()) {
|
if (nodep->parallelPragma() || nodep->uniquePragma() || nodep->unique0Pragma()) {
|
||||||
// Need to check that one, and only one of the case items match at any moment
|
// Need to check that one, and only one of the case items match at any moment
|
||||||
// If there's a default, we allow none to match, else exactly one must match
|
// If there's a default, we allow none to match, else exactly one must match
|
||||||
m_statAsFull++;
|
++m_statAsFull;
|
||||||
if (!has_default && !nodep->itemsp()) {
|
if (!has_default && !nodep->itemsp()) {
|
||||||
// Not parallel, but harmlessly so.
|
// Not parallel, but harmlessly so.
|
||||||
} else {
|
} else {
|
||||||
@@ -241,18 +241,18 @@ private:
|
|||||||
if (m_beginp && nodep->name() == "") nodep->name(m_beginp->name());
|
if (m_beginp && nodep->name() == "") nodep->name(m_beginp->name());
|
||||||
newPslAssertion(nodep, nodep->propp(), nodep->sentreep(),
|
newPslAssertion(nodep, nodep->propp(), nodep->sentreep(),
|
||||||
nodep->stmtsp(), nodep->name()); nodep=NULL;
|
nodep->stmtsp(), nodep->name()); nodep=NULL;
|
||||||
m_statAsCover++;
|
++m_statAsCover;
|
||||||
}
|
}
|
||||||
virtual void visit(AstPslAssert* nodep, AstNUser*) {
|
virtual void visit(AstPslAssert* nodep, AstNUser*) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
newPslAssertion(nodep, nodep->propp(), nodep->sentreep(),
|
newPslAssertion(nodep, nodep->propp(), nodep->sentreep(),
|
||||||
NULL, nodep->name()); nodep=NULL;
|
NULL, nodep->name()); nodep=NULL;
|
||||||
m_statAsPsl++;
|
++m_statAsPsl;
|
||||||
}
|
}
|
||||||
virtual void visit(AstVAssert* nodep, AstNUser*) {
|
virtual void visit(AstVAssert* nodep, AstNUser*) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
newVAssertion(nodep, nodep->propp()); nodep=NULL;
|
newVAssertion(nodep, nodep->propp()); nodep=NULL;
|
||||||
m_statAsSV++;
|
++m_statAsSV;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2005-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2005-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2005-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2005-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2005-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2005-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
|
|||||||
+7
-5
@@ -7,7 +7,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
@@ -74,7 +74,9 @@ void AstNode::init() {
|
|||||||
m_clonep = NULL;
|
m_clonep = NULL;
|
||||||
m_cloneCnt = 0;
|
m_cloneCnt = 0;
|
||||||
// Attributes
|
// Attributes
|
||||||
m_signed = false;
|
m_numeric = (int)AstNumeric::UNSIGNED;
|
||||||
|
m_didWidth = false;
|
||||||
|
m_doingWidth = false;
|
||||||
m_width = 0;
|
m_width = 0;
|
||||||
m_widthMin = 0;
|
m_widthMin = 0;
|
||||||
m_user1p = NULL;
|
m_user1p = NULL;
|
||||||
@@ -428,7 +430,7 @@ void AstNode::replaceWith(AstNode* newp) {
|
|||||||
repHandle.relink(newp);
|
repHandle.relink(newp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AstNRelinker::dump(ostream& str) {
|
void AstNRelinker::dump(ostream& str) const {
|
||||||
str<<" BK="<<(uint32_t*)m_backp;
|
str<<" BK="<<(uint32_t*)m_backp;
|
||||||
str<<" ITER="<<(uint32_t*)m_iterpp;
|
str<<" ITER="<<(uint32_t*)m_iterpp;
|
||||||
str<<" CHG="<<(m_chg==RELINK_NEXT?"[NEXT] ":"");
|
str<<" CHG="<<(m_chg==RELINK_NEXT?"[NEXT] ":"");
|
||||||
@@ -873,7 +875,7 @@ bool AstNode::sameTreeIter(AstNode* node2p, bool ignNext) {
|
|||||||
if (this==NULL || node2p==NULL) return false;
|
if (this==NULL || node2p==NULL) return false;
|
||||||
if (this->type() != node2p->type()
|
if (this->type() != node2p->type()
|
||||||
|| this->width() != node2p->width()
|
|| this->width() != node2p->width()
|
||||||
|| this->isSigned() != node2p->isSigned()
|
|| this->numeric() != node2p->numeric()
|
||||||
|| !this->same(node2p)) {
|
|| !this->same(node2p)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -945,7 +947,7 @@ void AstNode::checkTree() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AstNode::dumpPtrs(ostream& os) {
|
void AstNode::dumpPtrs(ostream& os) const {
|
||||||
os<<"This="<<typeName()<<" "<<(void*)this;
|
os<<"This="<<typeName()<<" "<<(void*)this;
|
||||||
os<<" back="<<(void*)backp();
|
os<<" back="<<(void*)backp();
|
||||||
if (nextp()) os<<" next="<<(void*)nextp();
|
if (nextp()) os<<" next="<<(void*)nextp();
|
||||||
|
|||||||
+101
-35
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
@@ -26,7 +26,9 @@
|
|||||||
#include "verilatedos.h"
|
#include "verilatedos.h"
|
||||||
#include "V3Error.h"
|
#include "V3Error.h"
|
||||||
#include "V3Number.h"
|
#include "V3Number.h"
|
||||||
|
#include "V3Global.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
#include "V3Ast__gen_classes.h" // From ./astgen
|
#include "V3Ast__gen_classes.h" // From ./astgen
|
||||||
// Things like:
|
// Things like:
|
||||||
@@ -56,9 +58,40 @@ public:
|
|||||||
|
|
||||||
//######################################################################
|
//######################################################################
|
||||||
|
|
||||||
|
class AstNumeric {
|
||||||
|
public:
|
||||||
|
enum en {
|
||||||
|
UNSIGNED,
|
||||||
|
SIGNED,
|
||||||
|
DOUBLE
|
||||||
|
// Limited to 2 bits, unless change V3Ast's packing function
|
||||||
|
};
|
||||||
|
enum en m_e;
|
||||||
|
const char* ascii() const {
|
||||||
|
static const char* names[] = {
|
||||||
|
"UNSIGNED","SIGNED","DOUBLE"
|
||||||
|
};
|
||||||
|
return names[m_e];
|
||||||
|
};
|
||||||
|
inline AstNumeric () : m_e(UNSIGNED) {}
|
||||||
|
inline AstNumeric (en _e) : m_e(_e) {}
|
||||||
|
explicit inline AstNumeric (int _e) : m_e(static_cast<en>(_e)) {}
|
||||||
|
operator en () const { return m_e; }
|
||||||
|
inline bool isDouble() const { return m_e==DOUBLE; }
|
||||||
|
inline bool isSigned() const { return m_e==SIGNED; }
|
||||||
|
inline bool isUnsigned() const { return m_e==UNSIGNED; }
|
||||||
|
};
|
||||||
|
inline bool operator== (AstNumeric lhs, AstNumeric rhs) { return (lhs.m_e == rhs.m_e); }
|
||||||
|
inline bool operator== (AstNumeric lhs, AstNumeric::en rhs) { return (lhs.m_e == rhs); }
|
||||||
|
inline bool operator== (AstNumeric::en lhs, AstNumeric rhs) { return (lhs == rhs.m_e); }
|
||||||
|
inline ostream& operator<<(ostream& os, AstNumeric rhs) { return os<<rhs.ascii(); }
|
||||||
|
|
||||||
|
//######################################################################
|
||||||
|
|
||||||
class AstPragmaType {
|
class AstPragmaType {
|
||||||
public:
|
public:
|
||||||
enum en {
|
enum en {
|
||||||
|
ILLEGAL,
|
||||||
COVERAGE_BLOCK_OFF,
|
COVERAGE_BLOCK_OFF,
|
||||||
INLINE_MODULE,
|
INLINE_MODULE,
|
||||||
NO_INLINE_MODULE,
|
NO_INLINE_MODULE,
|
||||||
@@ -67,7 +100,7 @@ public:
|
|||||||
PUBLIC_TASK
|
PUBLIC_TASK
|
||||||
};
|
};
|
||||||
enum en m_e;
|
enum en m_e;
|
||||||
inline AstPragmaType () {}
|
inline AstPragmaType () : m_e(ILLEGAL) {}
|
||||||
inline AstPragmaType (en _e) : m_e(_e) {}
|
inline AstPragmaType (en _e) : m_e(_e) {}
|
||||||
explicit inline AstPragmaType (int _e) : m_e(static_cast<en>(_e)) {}
|
explicit inline AstPragmaType (int _e) : m_e(static_cast<en>(_e)) {}
|
||||||
operator en () const { return m_e; }
|
operator en () const { return m_e; }
|
||||||
@@ -90,7 +123,7 @@ public:
|
|||||||
TRACE_CHANGE_SUB
|
TRACE_CHANGE_SUB
|
||||||
};
|
};
|
||||||
enum en m_e;
|
enum en m_e;
|
||||||
inline AstCFuncType () {}
|
inline AstCFuncType () : m_e(FT_NORMAL) {}
|
||||||
inline AstCFuncType (en _e) : m_e(_e) {}
|
inline AstCFuncType (en _e) : m_e(_e) {}
|
||||||
explicit inline AstCFuncType (int _e) : m_e(static_cast<en>(_e)) {}
|
explicit inline AstCFuncType (int _e) : m_e(static_cast<en>(_e)) {}
|
||||||
operator en () const { return m_e; }
|
operator en () const { return m_e; }
|
||||||
@@ -158,7 +191,7 @@ public:
|
|||||||
};
|
};
|
||||||
return names[m_e];
|
return names[m_e];
|
||||||
};
|
};
|
||||||
inline AstEdgeType () {}
|
inline AstEdgeType () : m_e(ET_ILLEGAL) {}
|
||||||
inline AstEdgeType (en _e) : m_e(_e) {}
|
inline AstEdgeType (en _e) : m_e(_e) {}
|
||||||
explicit inline AstEdgeType (int _e) : m_e(static_cast<en>(_e)) {}
|
explicit inline AstEdgeType (int _e) : m_e(static_cast<en>(_e)) {}
|
||||||
operator en () const { return m_e; }
|
operator en () const { return m_e; }
|
||||||
@@ -172,6 +205,7 @@ public:
|
|||||||
class AstAttrType {
|
class AstAttrType {
|
||||||
public:
|
public:
|
||||||
enum en {
|
enum en {
|
||||||
|
ILLEGAL,
|
||||||
EXPR_BITS, // V3Const converts to constant
|
EXPR_BITS, // V3Const converts to constant
|
||||||
//
|
//
|
||||||
VAR_BASE, // V3LinkResolve creates for AstPreSel, V3LinkParam removes
|
VAR_BASE, // V3LinkResolve creates for AstPreSel, V3LinkParam removes
|
||||||
@@ -182,19 +216,20 @@ public:
|
|||||||
VAR_PUBLIC_FLAT_RD, // V3LinkParse moves to AstVar::sigPublic
|
VAR_PUBLIC_FLAT_RD, // V3LinkParse moves to AstVar::sigPublic
|
||||||
VAR_PUBLIC_FLAT_RW, // V3LinkParse moves to AstVar::sigPublic
|
VAR_PUBLIC_FLAT_RW, // V3LinkParse moves to AstVar::sigPublic
|
||||||
VAR_ISOLATE_ASSIGNMENTS, // V3LinkParse moves to AstVar::attrIsolateAssign
|
VAR_ISOLATE_ASSIGNMENTS, // V3LinkParse moves to AstVar::attrIsolateAssign
|
||||||
|
VAR_SC_BV, // V3LinkParse moves to AstVar::attrScBv
|
||||||
VAR_SFORMAT // V3LinkParse moves to AstVar::attrSFormat
|
VAR_SFORMAT // V3LinkParse moves to AstVar::attrSFormat
|
||||||
};
|
};
|
||||||
enum en m_e;
|
enum en m_e;
|
||||||
const char* ascii() const {
|
const char* ascii() const {
|
||||||
static const char* names[] = {
|
static const char* names[] = {
|
||||||
"EXPR_BITS", "VAR_BASE",
|
"%E-AT", "EXPR_BITS", "VAR_BASE",
|
||||||
"VAR_CLOCK", "VAR_CLOCK_ENABLE", "VAR_PUBLIC",
|
"VAR_CLOCK", "VAR_CLOCK_ENABLE", "VAR_PUBLIC",
|
||||||
"VAR_PUBLIC_FLAT", "VAR_PUBLIC_FLAT_RD","VAR_PUBLIC_FLAT_RW",
|
"VAR_PUBLIC_FLAT", "VAR_PUBLIC_FLAT_RD","VAR_PUBLIC_FLAT_RW",
|
||||||
"VAR_ISOLATE_ASSIGNMENTS", "VAR_SFORMAT"
|
"VAR_ISOLATE_ASSIGNMENTS", "VAR_SC_BV", "VAR_SFORMAT"
|
||||||
};
|
};
|
||||||
return names[m_e];
|
return names[m_e];
|
||||||
};
|
};
|
||||||
inline AstAttrType () {}
|
inline AstAttrType () : m_e(ILLEGAL) {}
|
||||||
inline AstAttrType (en _e) : m_e(_e) {}
|
inline AstAttrType (en _e) : m_e(_e) {}
|
||||||
explicit inline AstAttrType (int _e) : m_e(static_cast<en>(_e)) {}
|
explicit inline AstAttrType (int _e) : m_e(static_cast<en>(_e)) {}
|
||||||
operator en () const { return m_e; }
|
operator en () const { return m_e; }
|
||||||
@@ -208,8 +243,9 @@ public:
|
|||||||
class AstBasicDTypeKwd {
|
class AstBasicDTypeKwd {
|
||||||
public:
|
public:
|
||||||
enum en {
|
enum en {
|
||||||
|
UNKNOWN,
|
||||||
BIT, BYTE, CHANDLE, INT, INTEGER, LOGIC, LONGINT,
|
BIT, BYTE, CHANDLE, INT, INTEGER, LOGIC, LONGINT,
|
||||||
REAL, REALTIME, SHORTINT, SHORTREAL, TIME,
|
DOUBLE, SHORTINT, FLOAT, TIME,
|
||||||
// Closer to a class type, but limited usage
|
// Closer to a class type, but limited usage
|
||||||
STRING,
|
STRING,
|
||||||
// Internal types for mid-steps
|
// Internal types for mid-steps
|
||||||
@@ -220,8 +256,9 @@ public:
|
|||||||
enum en m_e;
|
enum en m_e;
|
||||||
const char* ascii() const {
|
const char* ascii() const {
|
||||||
static const char* names[] = {
|
static const char* names[] = {
|
||||||
|
"%E-unk",
|
||||||
"bit", "byte", "chandle", "int", "integer", "logic", "longint",
|
"bit", "byte", "chandle", "int", "integer", "logic", "longint",
|
||||||
"real", "realtime", "shortint", "shortreal", "time",
|
"real", "shortint", "shortreal", "time",
|
||||||
"string",
|
"string",
|
||||||
"VerilatedScope*", "char*",
|
"VerilatedScope*", "char*",
|
||||||
"LOGIC_IMPLICIT"
|
"LOGIC_IMPLICIT"
|
||||||
@@ -230,15 +267,16 @@ public:
|
|||||||
};
|
};
|
||||||
const char* dpiType() const {
|
const char* dpiType() const {
|
||||||
static const char* names[] = {
|
static const char* names[] = {
|
||||||
|
"%E-unk",
|
||||||
"unsigned char", "char", "void*", "int", "int", "svLogic", "long long",
|
"unsigned char", "char", "void*", "int", "int", "svLogic", "long long",
|
||||||
"double", "double", "short int", "float", "long long",
|
"double", "short int", "float", "long long",
|
||||||
"const char*",
|
"const char*",
|
||||||
"dpiScope", "const char*",
|
"dpiScope", "const char*",
|
||||||
""
|
""
|
||||||
};
|
};
|
||||||
return names[m_e];
|
return names[m_e];
|
||||||
};
|
};
|
||||||
inline AstBasicDTypeKwd () {}
|
inline AstBasicDTypeKwd () : m_e(UNKNOWN) {}
|
||||||
inline AstBasicDTypeKwd (en _e) : m_e(_e) {}
|
inline AstBasicDTypeKwd (en _e) : m_e(_e) {}
|
||||||
explicit inline AstBasicDTypeKwd (int _e) : m_e(static_cast<en>(_e)) {}
|
explicit inline AstBasicDTypeKwd (int _e) : m_e(static_cast<en>(_e)) {}
|
||||||
operator en () const { return m_e; }
|
operator en () const { return m_e; }
|
||||||
@@ -251,6 +289,8 @@ public:
|
|||||||
case INTEGER: return 32;
|
case INTEGER: return 32;
|
||||||
case LOGIC: return 1;
|
case LOGIC: return 1;
|
||||||
case LONGINT: return 64;
|
case LONGINT: return 64;
|
||||||
|
case DOUBLE: return 64;
|
||||||
|
case FLOAT: return 32;
|
||||||
case SHORTINT: return 16;
|
case SHORTINT: return 16;
|
||||||
case TIME: return 64;
|
case TIME: return 64;
|
||||||
case STRING: return 64; // Just the pointer, for today
|
case STRING: return 64; // Just the pointer, for today
|
||||||
@@ -265,7 +305,7 @@ public:
|
|||||||
}
|
}
|
||||||
bool isZeroInit() const { // Otherwise initializes to X
|
bool isZeroInit() const { // Otherwise initializes to X
|
||||||
return (m_e==BIT || m_e==BYTE || m_e==CHANDLE || m_e==INT || m_e==LONGINT || m_e==SHORTINT
|
return (m_e==BIT || m_e==BYTE || m_e==CHANDLE || m_e==INT || m_e==LONGINT || m_e==SHORTINT
|
||||||
|| m_e==STRING);
|
|| m_e==STRING || m_e==DOUBLE || m_e==FLOAT);
|
||||||
}
|
}
|
||||||
bool isSloppy() const { // Don't be as anal about width warnings
|
bool isSloppy() const { // Don't be as anal about width warnings
|
||||||
return !(m_e==LOGIC || m_e==BIT);
|
return !(m_e==LOGIC || m_e==BIT);
|
||||||
@@ -274,10 +314,13 @@ public:
|
|||||||
return (m_e==LOGIC || m_e==BIT);
|
return (m_e==LOGIC || m_e==BIT);
|
||||||
}
|
}
|
||||||
bool isDpiUnsupported() const {
|
bool isDpiUnsupported() const {
|
||||||
return (m_e==LOGIC || m_e==TIME || m_e==REALTIME);
|
return (m_e==LOGIC || m_e==TIME);
|
||||||
}
|
}
|
||||||
bool isOpaque() const { // IE not a simple number we can bit optimize
|
bool isOpaque() const { // IE not a simple number we can bit optimize
|
||||||
return (m_e==STRING || m_e==SCOPEPTR || m_e==CHARPTR);
|
return (m_e==STRING || m_e==SCOPEPTR || m_e==CHARPTR || m_e==DOUBLE || m_e==FLOAT);
|
||||||
|
}
|
||||||
|
bool isDouble() const {
|
||||||
|
return (m_e==DOUBLE);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
inline bool operator== (AstBasicDTypeKwd lhs, AstBasicDTypeKwd rhs) { return (lhs.m_e == rhs.m_e); }
|
inline bool operator== (AstBasicDTypeKwd lhs, AstBasicDTypeKwd rhs) { return (lhs.m_e == rhs.m_e); }
|
||||||
@@ -316,7 +359,7 @@ public:
|
|||||||
XTEMP
|
XTEMP
|
||||||
};
|
};
|
||||||
enum en m_e;
|
enum en m_e;
|
||||||
inline AstVarType () {}
|
inline AstVarType () : m_e(UNKNOWN) {}
|
||||||
inline AstVarType (en _e) : m_e(_e) {}
|
inline AstVarType (en _e) : m_e(_e) {}
|
||||||
explicit inline AstVarType (int _e) : m_e(static_cast<en>(_e)) {}
|
explicit inline AstVarType (int _e) : m_e(static_cast<en>(_e)) {}
|
||||||
operator en () const { return m_e; }
|
operator en () const { return m_e; }
|
||||||
@@ -374,7 +417,7 @@ public:
|
|||||||
CT_CASEZ
|
CT_CASEZ
|
||||||
};
|
};
|
||||||
enum en m_e;
|
enum en m_e;
|
||||||
inline AstCaseType () {}
|
inline AstCaseType () : m_e(CT_CASE) {}
|
||||||
inline AstCaseType (en _e) : m_e(_e) {}
|
inline AstCaseType (en _e) : m_e(_e) {}
|
||||||
explicit inline AstCaseType (int _e) : m_e(static_cast<en>(_e)) {}
|
explicit inline AstCaseType (int _e) : m_e(static_cast<en>(_e)) {}
|
||||||
operator en () const { return m_e; }
|
operator en () const { return m_e; }
|
||||||
@@ -396,7 +439,7 @@ public:
|
|||||||
DT_FATAL
|
DT_FATAL
|
||||||
};
|
};
|
||||||
enum en m_e;
|
enum en m_e;
|
||||||
inline AstDisplayType () {}
|
inline AstDisplayType () : m_e(DT_DISPLAY) {}
|
||||||
inline AstDisplayType (en _e) : m_e(_e) {}
|
inline AstDisplayType (en _e) : m_e(_e) {}
|
||||||
explicit inline AstDisplayType (int _e) : m_e(static_cast<en>(_e)) {}
|
explicit inline AstDisplayType (int _e) : m_e(static_cast<en>(_e)) {}
|
||||||
operator en () const { return m_e; }
|
operator en () const { return m_e; }
|
||||||
@@ -606,7 +649,7 @@ public:
|
|||||||
AstNRelinker() { m_backp=NULL; m_chg=RELINK_BAD; m_iterpp=NULL;}
|
AstNRelinker() { m_backp=NULL; m_chg=RELINK_BAD; m_iterpp=NULL;}
|
||||||
void relink(AstNode* newp);
|
void relink(AstNode* newp);
|
||||||
AstNode* oldp() const { return m_oldp; }
|
AstNode* oldp() const { return m_oldp; }
|
||||||
void dump(ostream& str=cout);
|
void dump(ostream& str=cout) const;
|
||||||
};
|
};
|
||||||
inline ostream& operator<<(ostream& os, AstNRelinker& rhs) { rhs.dump(os); return os;}
|
inline ostream& operator<<(ostream& os, AstNRelinker& rhs) { rhs.dump(os); return os;}
|
||||||
|
|
||||||
@@ -684,7 +727,9 @@ class AstNode {
|
|||||||
static int s_cloneCntGbl; // Count of which userp is set
|
static int s_cloneCntGbl; // Count of which userp is set
|
||||||
|
|
||||||
// Attributes
|
// Attributes
|
||||||
bool m_signed:1; // Node is signed
|
uint32_t m_numeric:2; // Node is real/signed - important that bitfields remain unsigned
|
||||||
|
bool m_didWidth:1; // Did V3Width computation
|
||||||
|
bool m_doingWidth:1; // Inside V3Width
|
||||||
// // Space for more bools here
|
// // Space for more bools here
|
||||||
|
|
||||||
int m_width; // Bit width of operation
|
int m_width; // Bit width of operation
|
||||||
@@ -717,6 +762,7 @@ class AstNode {
|
|||||||
void deleteTreeIter();
|
void deleteTreeIter();
|
||||||
void deleteNode();
|
void deleteNode();
|
||||||
static void relinkOneLink(AstNode*& pointpr, AstNode* newp);
|
static void relinkOneLink(AstNode*& pointpr, AstNode* newp);
|
||||||
|
// cppcheck-suppress functionConst
|
||||||
void debugTreeChange(const char* prefix, int lineno, bool next);
|
void debugTreeChange(const char* prefix, int lineno, bool next);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -780,6 +826,9 @@ public:
|
|||||||
static int instrCountLd() { return 2; } ///< Instruction cycles to load memory
|
static int instrCountLd() { return 2; } ///< Instruction cycles to load memory
|
||||||
static int instrCountMul() { return 3; } ///< Instruction cycles to multiply integers
|
static int instrCountMul() { return 3; } ///< Instruction cycles to multiply integers
|
||||||
static int instrCountPli() { return 20; } ///< Instruction cycles to call pli routines
|
static int instrCountPli() { return 20; } ///< Instruction cycles to call pli routines
|
||||||
|
static int instrCountDouble() { return 8; } ///< Instruction cycles to convert or do floats
|
||||||
|
static int instrCountDoubleDiv() { return 40; } ///< Instruction cycles to divide floats
|
||||||
|
static int instrCountDoubleTrig() { return 200; } ///< Instruction cycles to do triganomics
|
||||||
static int instrCountCall() { return instrCountBranch()+10; } ///< Instruction cycles to call subroutine
|
static int instrCountCall() { return instrCountBranch()+10; } ///< Instruction cycles to call subroutine
|
||||||
static int instrCountTime() { return instrCountCall()+5; } ///< Instruction cycles to determine simulation time
|
static int instrCountTime() { return instrCountCall()+5; } ///< Instruction cycles to determine simulation time
|
||||||
|
|
||||||
@@ -807,10 +856,18 @@ public:
|
|||||||
bool widthSized() const { return !m_widthMin || m_widthMin==m_width; }
|
bool widthSized() const { return !m_widthMin || m_widthMin==m_width; }
|
||||||
void width(int width, int sized) { m_width=width; m_widthMin=sized; }
|
void width(int width, int sized) { m_width=width; m_widthMin=sized; }
|
||||||
void widthFrom(AstNode* fromp) { if (fromp) { m_width=fromp->m_width; m_widthMin=fromp->m_widthMin; }}
|
void widthFrom(AstNode* fromp) { if (fromp) { m_width=fromp->m_width; m_widthMin=fromp->m_widthMin; }}
|
||||||
void widthSignedFrom(AstNode* fromp) { widthFrom(fromp); signedFrom(fromp); }
|
void widthSignedFrom(AstNode* fromp) { widthFrom(fromp); numericFrom(fromp); }
|
||||||
void signedFrom(AstNode* fromp) { if (fromp) { m_signed=fromp->m_signed; }}
|
void numericFrom(AstNode* fromp) { numeric(fromp->numeric()); }
|
||||||
void isSigned(bool flag) { m_signed=flag; }
|
void numeric(AstNumeric flag) { m_numeric = (int)flag; if (flag.isDouble()) width(64,64); }
|
||||||
bool isSigned() const { return m_signed; }
|
AstNumeric numeric() const { return AstNumeric(m_numeric); }
|
||||||
|
bool isDouble() const { return numeric().isDouble(); }
|
||||||
|
bool isSigned() const { return numeric().isSigned(); }
|
||||||
|
void isSigned(bool flag) { numeric(flag ? AstNumeric::SIGNED : AstNumeric::UNSIGNED); }
|
||||||
|
bool isUnsigned() const { return numeric().isUnsigned(); }
|
||||||
|
void didWidth(bool flag) { m_didWidth=flag; }
|
||||||
|
bool didWidth() const { return m_didWidth; }
|
||||||
|
void doingWidth(bool flag) { m_doingWidth=flag; }
|
||||||
|
bool doingWidth() const { return m_doingWidth; }
|
||||||
bool isQuad() const { return (width()>VL_WORDSIZE && width()<=VL_QUADSIZE); }
|
bool isQuad() const { return (width()>VL_WORDSIZE && width()<=VL_QUADSIZE); }
|
||||||
bool isWide() const { return (width()>VL_QUADSIZE); }
|
bool isWide() const { return (width()>VL_QUADSIZE); }
|
||||||
|
|
||||||
@@ -875,15 +932,21 @@ public:
|
|||||||
bool isAllOnes();
|
bool isAllOnes();
|
||||||
bool isAllOnesV(); // Verilog width rules apply
|
bool isAllOnesV(); // Verilog width rules apply
|
||||||
|
|
||||||
// METHODS
|
// METHODS - data type changes especially for initial creation
|
||||||
|
void dtypeChgBool() { numeric(AstNumeric::UNSIGNED); width(1,1); }
|
||||||
|
void dtypeChgDouble() { numeric(AstNumeric::DOUBLE); }
|
||||||
|
|
||||||
|
// METHODS - dump and error
|
||||||
|
void v3errorEnd(ostringstream& str) const;
|
||||||
|
virtual void dump(ostream& str=cout);
|
||||||
|
|
||||||
|
// METHODS - Tree modifications
|
||||||
AstNode* addNext(AstNode* newp); // Returns this, adds to end of list
|
AstNode* addNext(AstNode* newp); // Returns this, adds to end of list
|
||||||
AstNode* addNextNull(AstNode* newp); // Returns this, adds to end of list, NULL is OK
|
AstNode* addNextNull(AstNode* newp); // Returns this, adds to end of list, NULL is OK
|
||||||
void addNextHere(AstNode* newp); // Adds after speced node
|
void addNextHere(AstNode* newp); // Adds after speced node
|
||||||
void addPrev(AstNode* newp) { replaceWith(newp); newp->addNext(this); }
|
void addPrev(AstNode* newp) { replaceWith(newp); newp->addNext(this); }
|
||||||
void addHereThisAsNext(AstNode* newp); // Adds at old place of this, this becomes next
|
void addHereThisAsNext(AstNode* newp); // Adds at old place of this, this becomes next
|
||||||
void replaceWith(AstNode* newp); // Replace current node in tree with new node
|
void replaceWith(AstNode* newp); // Replace current node in tree with new node
|
||||||
void v3errorEnd(ostringstream& str) const;
|
|
||||||
virtual void dump(ostream& str=cout);
|
|
||||||
AstNode* unlinkFrBack(AstNRelinker* linkerp=NULL); // Unlink this from whoever points to it.
|
AstNode* unlinkFrBack(AstNRelinker* linkerp=NULL); // Unlink this from whoever points to it.
|
||||||
AstNode* unlinkFrBackWithNext(AstNRelinker* linkerp=NULL); // Unlink this from whoever points to it, keep entire next list with unlinked node
|
AstNode* unlinkFrBackWithNext(AstNRelinker* linkerp=NULL); // Unlink this from whoever points to it, keep entire next list with unlinked node
|
||||||
void swapWith(AstNode* bp);
|
void swapWith(AstNode* bp);
|
||||||
@@ -898,13 +961,14 @@ public:
|
|||||||
bool sameTree(AstNode* node2p); // Does tree of this == node2p?
|
bool sameTree(AstNode* node2p); // Does tree of this == node2p?
|
||||||
void deleteTree(); // Always deletes the next link
|
void deleteTree(); // Always deletes the next link
|
||||||
void checkTree(); // User Interface version
|
void checkTree(); // User Interface version
|
||||||
void dumpPtrs(ostream& str=cout);
|
void dumpPtrs(ostream& str=cout) const;
|
||||||
void dumpTree(ostream& str=cout, const string& indent=" ", int maxDepth=0);
|
void dumpTree(ostream& str=cout, const string& indent=" ", int maxDepth=0);
|
||||||
void dumpTreeAndNext(ostream& str=cout, const string& indent=" ", int maxDepth=0);
|
void dumpTreeAndNext(ostream& str=cout, const string& indent=" ", int maxDepth=0);
|
||||||
void dumpTreeFile(const string& filename, bool append=false);
|
void dumpTreeFile(const string& filename, bool append=false);
|
||||||
|
|
||||||
// METHODS - queries
|
// METHODS - queries
|
||||||
virtual bool isSplittable() const { return true; } // Else a $display, etc, that must be ordered with other displays
|
virtual bool isPure() const { return true; } // Else a $display, etc, that must be ordered with other displays
|
||||||
|
virtual bool isBrancher() const { return false; } // Changes control flow, disable some optimizations
|
||||||
virtual bool isGateOptimizable() const { return true; } // Else a AstTime etc that can't be pushed out
|
virtual bool isGateOptimizable() const { return true; } // Else a AstTime etc that can't be pushed out
|
||||||
virtual bool isSubstOptimizable() const { return true; } // Else a AstTime etc that can't be substituted out
|
virtual bool isSubstOptimizable() const { return true; } // Else a AstTime etc that can't be substituted out
|
||||||
virtual bool isPredictOptimizable() const { return true; } // Else a AstTime etc which output can't be predicted from input
|
virtual bool isPredictOptimizable() const { return true; } // Else a AstTime etc which output can't be predicted from input
|
||||||
@@ -965,6 +1029,7 @@ struct AstNodeTermop : public AstNodeMath {
|
|||||||
ASTNODE_BASE_FUNCS(NodeTermop)
|
ASTNODE_BASE_FUNCS(NodeTermop)
|
||||||
// Know no children, and hot function, so skip iterator for speed
|
// Know no children, and hot function, so skip iterator for speed
|
||||||
// See checkTreeIter also that asserts no children
|
// See checkTreeIter also that asserts no children
|
||||||
|
// cppcheck-suppress functionConst
|
||||||
void iterateChildren(AstNVisitor& v, AstNUser* vup=NULL) { }
|
void iterateChildren(AstNVisitor& v, AstNUser* vup=NULL) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -981,6 +1046,8 @@ struct AstNodeUniop : public AstNodeMath {
|
|||||||
virtual void numberOperate(V3Number& out, const V3Number& lhs) = 0; // Set out to evaluation of a AstConst'ed lhs
|
virtual void numberOperate(V3Number& out, const V3Number& lhs) = 0; // Set out to evaluation of a AstConst'ed lhs
|
||||||
virtual bool cleanLhs() = 0;
|
virtual bool cleanLhs() = 0;
|
||||||
virtual bool sizeMattersLhs() = 0; // True if output result depends on lhs size
|
virtual bool sizeMattersLhs() = 0; // True if output result depends on lhs size
|
||||||
|
virtual bool signedFlavor() const { return false; } // Signed flavor of nodes with both flavors?
|
||||||
|
virtual bool doubleFlavor() const { return false; } // D flavor of nodes with both flavors?
|
||||||
virtual int instrCount() const { return widthInstrs(); }
|
virtual int instrCount() const { return widthInstrs(); }
|
||||||
virtual V3Hash sameHash() const { return V3Hash(); }
|
virtual V3Hash sameHash() const { return V3Hash(); }
|
||||||
virtual bool same(AstNode*) const { return true; }
|
virtual bool same(AstNode*) const { return true; }
|
||||||
@@ -1003,6 +1070,7 @@ struct AstNodeBiop : public AstNodeMath {
|
|||||||
virtual bool sizeMattersLhs() = 0; // True if output result depends on lhs size
|
virtual bool sizeMattersLhs() = 0; // True if output result depends on lhs size
|
||||||
virtual bool sizeMattersRhs() = 0; // True if output result depends on rhs size
|
virtual bool sizeMattersRhs() = 0; // True if output result depends on rhs size
|
||||||
virtual bool signedFlavor() const { return false; } // Signed flavor of nodes with both flavors?
|
virtual bool signedFlavor() const { return false; } // Signed flavor of nodes with both flavors?
|
||||||
|
virtual bool doubleFlavor() const { return false; } // D flavor of nodes with both flavors?
|
||||||
virtual int instrCount() const { return widthInstrs(); }
|
virtual int instrCount() const { return widthInstrs(); }
|
||||||
virtual V3Hash sameHash() const { return V3Hash(); }
|
virtual V3Hash sameHash() const { return V3Hash(); }
|
||||||
virtual bool same(AstNode*) const { return true; }
|
virtual bool same(AstNode*) const { return true; }
|
||||||
@@ -1069,7 +1137,7 @@ struct AstNodeCond : public AstNodeTriop {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct AstNodePreSel : public AstNode {
|
struct AstNodePreSel : public AstNode {
|
||||||
// Something that becomes a AstSel
|
// Something that becomes an AstSel
|
||||||
AstNodePreSel(FileLine* fl, AstNode* lhs, AstNode* rhs, AstNode* ths)
|
AstNodePreSel(FileLine* fl, AstNode* lhs, AstNode* rhs, AstNode* ths)
|
||||||
: AstNode(fl) {
|
: AstNode(fl) {
|
||||||
setOp1p(lhs); setOp2p(rhs); setNOp3p(ths); }
|
setOp1p(lhs); setOp2p(rhs); setNOp3p(ths); }
|
||||||
@@ -1224,6 +1292,7 @@ public:
|
|||||||
void packagep(AstPackage* nodep) { m_packagep=nodep; }
|
void packagep(AstPackage* nodep) { m_packagep=nodep; }
|
||||||
// Know no children, and hot function, so skip iterator for speed
|
// Know no children, and hot function, so skip iterator for speed
|
||||||
// See checkTreeIter also that asserts no children
|
// See checkTreeIter also that asserts no children
|
||||||
|
// cppcheck-suppress functionConst
|
||||||
void iterateChildren(AstNVisitor& v, AstNUser* vup=NULL) { }
|
void iterateChildren(AstNVisitor& v, AstNUser* vup=NULL) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1275,7 +1344,6 @@ private:
|
|||||||
string m_name; // Name of task
|
string m_name; // Name of task
|
||||||
string m_cname; // Name of task if DPI import
|
string m_cname; // Name of task if DPI import
|
||||||
bool m_taskPublic:1; // Public task
|
bool m_taskPublic:1; // Public task
|
||||||
bool m_didSigning:1; // V3Signed completed; can skip iteration
|
|
||||||
bool m_attrIsolateAssign:1;// User isolate_assignments attribute
|
bool m_attrIsolateAssign:1;// User isolate_assignments attribute
|
||||||
bool m_prototype:1; // Just a prototype
|
bool m_prototype:1; // Just a prototype
|
||||||
bool m_dpiExport:1; // DPI exported
|
bool m_dpiExport:1; // DPI exported
|
||||||
@@ -1286,7 +1354,7 @@ private:
|
|||||||
public:
|
public:
|
||||||
AstNodeFTask(FileLine* fileline, const string& name, AstNode* stmtsp)
|
AstNodeFTask(FileLine* fileline, const string& name, AstNode* stmtsp)
|
||||||
: AstNode(fileline)
|
: AstNode(fileline)
|
||||||
, m_name(name), m_taskPublic(false), m_didSigning(false)
|
, m_name(name), m_taskPublic(false)
|
||||||
, m_attrIsolateAssign(false), m_prototype(false)
|
, m_attrIsolateAssign(false), m_prototype(false)
|
||||||
, m_dpiExport(false), m_dpiImport(false), m_dpiContext(false)
|
, m_dpiExport(false), m_dpiImport(false), m_dpiContext(false)
|
||||||
, m_dpiTask(false), m_pure(false) {
|
, m_dpiTask(false), m_pure(false) {
|
||||||
@@ -1313,8 +1381,6 @@ public:
|
|||||||
void scopeNamep(AstNode* nodep) { setNOp4p(nodep); }
|
void scopeNamep(AstNode* nodep) { setNOp4p(nodep); }
|
||||||
void taskPublic(bool flag) { m_taskPublic=flag; }
|
void taskPublic(bool flag) { m_taskPublic=flag; }
|
||||||
bool taskPublic() const { return m_taskPublic; }
|
bool taskPublic() const { return m_taskPublic; }
|
||||||
void didSigning(bool flag) { m_didSigning=flag; }
|
|
||||||
bool didSigning() const { return m_didSigning; }
|
|
||||||
void attrIsolateAssign(bool flag) { m_attrIsolateAssign = flag; }
|
void attrIsolateAssign(bool flag) { m_attrIsolateAssign = flag; }
|
||||||
bool attrIsolateAssign() const { return m_attrIsolateAssign; }
|
bool attrIsolateAssign() const { return m_attrIsolateAssign; }
|
||||||
void prototype(bool flag) { m_prototype = flag; }
|
void prototype(bool flag) { m_prototype = flag; }
|
||||||
@@ -1434,7 +1500,7 @@ public:
|
|||||||
inline bool AstNode::isZero() { return (this->castConst() && this->castConst()->num().isEqZero()); }
|
inline bool AstNode::isZero() { return (this->castConst() && this->castConst()->num().isEqZero()); }
|
||||||
inline bool AstNode::isNeqZero() { return (this->castConst() && this->castConst()->num().isNeqZero()); }
|
inline bool AstNode::isNeqZero() { return (this->castConst() && this->castConst()->num().isNeqZero()); }
|
||||||
inline bool AstNode::isOne() { return (this->castConst() && this->castConst()->num().isEqOne()); }
|
inline bool AstNode::isOne() { return (this->castConst() && this->castConst()->num().isEqOne()); }
|
||||||
inline bool AstNode::isAllOnes() { return (this->castConst() && this->castConst()->num().isEqAllOnes(this->width())); }
|
inline bool AstNode::isAllOnes() { return (this->castConst() && this->castConst()->isEqAllOnes()); }
|
||||||
inline bool AstNode::isAllOnesV() { return (this->castConst() && this->castConst()->num().isEqAllOnes(this->widthMin())); }
|
inline bool AstNode::isAllOnesV() { return (this->castConst() && this->castConst()->isEqAllOnesV()); }
|
||||||
|
|
||||||
#endif // Guard
|
#endif // Guard
|
||||||
|
|||||||
+13
-6
@@ -7,7 +7,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
@@ -70,7 +70,7 @@ bool AstVar::isScQuad() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool AstVar::isScBv() const {
|
bool AstVar::isScBv() const {
|
||||||
return (isSc() && width() >= v3Global.opt.pinsBv());
|
return ((isSc() && width() >= v3Global.opt.pinsBv()) || m_attrScBv);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AstVar::combineType(AstVarType type) {
|
void AstVar::combineType(AstVarType type) {
|
||||||
@@ -113,6 +113,10 @@ string AstVar::vlArgType(bool named, bool forReturn) const {
|
|||||||
arg += "const char*";
|
arg += "const char*";
|
||||||
} else if (bdtypep && bdtypep->keyword()==AstBasicDTypeKwd::SCOPEPTR) {
|
} else if (bdtypep && bdtypep->keyword()==AstBasicDTypeKwd::SCOPEPTR) {
|
||||||
arg += "const VerilatedScope*";
|
arg += "const VerilatedScope*";
|
||||||
|
} else if (bdtypep && bdtypep->keyword()==AstBasicDTypeKwd::DOUBLE) {
|
||||||
|
arg += "double";
|
||||||
|
} else if (bdtypep && bdtypep->keyword()==AstBasicDTypeKwd::FLOAT) {
|
||||||
|
arg += "float";
|
||||||
} else if (strtype) {
|
} else if (strtype) {
|
||||||
if (isInOnly()) arg += "const ";
|
if (isInOnly()) arg += "const ";
|
||||||
arg += "string";
|
arg += "string";
|
||||||
@@ -185,7 +189,7 @@ string AstVar::cPubArgType(bool named, bool forReturn) const {
|
|||||||
} else if (isWide()) {
|
} else if (isWide()) {
|
||||||
arg += "uint32_t"; // []'s added later
|
arg += "uint32_t"; // []'s added later
|
||||||
} else {
|
} else {
|
||||||
arg += "uint64_t";
|
arg += "vluint64_t";
|
||||||
}
|
}
|
||||||
if (isWide()) {
|
if (isWide()) {
|
||||||
if (forReturn) v3error("Unsupported: Public functions with >64 bit outputs; make an output of a public task instead");
|
if (forReturn) v3error("Unsupported: Public functions with >64 bit outputs; make an output of a public task instead");
|
||||||
@@ -237,7 +241,7 @@ string AstVar::scType() const {
|
|||||||
return "uint32_t";
|
return "uint32_t";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return "uint64_t";
|
return "vluint64_t";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -497,8 +501,9 @@ void AstNode::dump(ostream& os) {
|
|||||||
//<<" "<<(void*)this->m_backp
|
//<<" "<<(void*)this->m_backp
|
||||||
<<" <e"<<dec<<editCount()
|
<<" <e"<<dec<<editCount()
|
||||||
<<((editCount()>=editCountLast())?"#>":">")
|
<<((editCount()>=editCountLast())?"#>":">")
|
||||||
<<" {"<<dec<<fileline()->lineno()<<"}"
|
<<" {"<<fileline()->filenameLetters()<<dec<<fileline()->lineno()<<"}"
|
||||||
<<" "<<(isSigned()?"s":"")
|
<<" "<<(isSigned()?"s":"")
|
||||||
|
<<(isDouble()?"d":"")
|
||||||
<<"w"<<(widthSized()?"":"u")<<width();
|
<<"w"<<(widthSized()?"":"u")<<width();
|
||||||
if (!widthSized()) os<<"/"<<widthMin();
|
if (!widthSized()) os<<"/"<<widthMin();
|
||||||
if (name()!="") os<<" "<<AstNode::quoteName(name());
|
if (name()!="") os<<" "<<AstNode::quoteName(name());
|
||||||
@@ -608,7 +613,8 @@ void AstVar::dump(ostream& str) {
|
|||||||
else if (isInput()) str<<" [I]";
|
else if (isInput()) str<<" [I]";
|
||||||
else if (isOutput()) str<<" [O]";
|
else if (isOutput()) str<<" [O]";
|
||||||
}
|
}
|
||||||
if (isUsedClock()) str<<" [C]";
|
if (isConst()) str<<" [CONST]";
|
||||||
|
if (isUsedClock()) str<<" [CLK]";
|
||||||
if (isSigPublic()) str<<" [P]";
|
if (isSigPublic()) str<<" [P]";
|
||||||
if (isUsedLoopIdx()) str<<" [LOOP]";
|
if (isUsedLoopIdx()) str<<" [LOOP]";
|
||||||
if (attrClockEn()) str<<" [aCLKEN]";
|
if (attrClockEn()) str<<" [aCLKEN]";
|
||||||
@@ -654,6 +660,7 @@ void AstNodeFTask::dump(ostream& str) {
|
|||||||
void AstBegin::dump(ostream& str) {
|
void AstBegin::dump(ostream& str) {
|
||||||
this->AstNode::dump(str);
|
this->AstNode::dump(str);
|
||||||
if (unnamed()) str<<" [UNNAMED]";
|
if (unnamed()) str<<" [UNNAMED]";
|
||||||
|
if (hidden()) str<<" [HIDDEN]";
|
||||||
}
|
}
|
||||||
void AstCoverDecl::dump(ostream& str) {
|
void AstCoverDecl::dump(ostream& str) {
|
||||||
this->AstNode::dump(str);
|
this->AstNode::dump(str);
|
||||||
|
|||||||
+530
-137
File diff suppressed because it is too large
Load Diff
+22
-9
@@ -7,7 +7,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
@@ -102,18 +102,31 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remap var names and replace lower Begins
|
// Remap var names and replace lower Begins
|
||||||
nodep->iterateChildren(*this);
|
nodep->stmtsp()->iterateAndNext(*this);
|
||||||
|
|
||||||
if (AstNode* stmtsp = nodep->stmtsp()) {
|
|
||||||
stmtsp->unlinkFrBackWithNext();
|
|
||||||
nodep->replaceWith(stmtsp);
|
|
||||||
} else {
|
|
||||||
nodep->unlinkFrBack();
|
|
||||||
}
|
|
||||||
pushDeletep(nodep); nodep=NULL;
|
|
||||||
}
|
}
|
||||||
m_namedScope = oldScope;
|
m_namedScope = oldScope;
|
||||||
m_unnamedScope = oldUnnamed;
|
m_unnamedScope = oldUnnamed;
|
||||||
|
|
||||||
|
// Don't change var names of generate FOR() variables, but do recurse into a child FOR
|
||||||
|
nodep->flatsp()->iterateAndNext(*this);
|
||||||
|
|
||||||
|
// Cleanup
|
||||||
|
AstNode* addsp = NULL;
|
||||||
|
if (AstNode* stmtsp = nodep->stmtsp()) {
|
||||||
|
stmtsp->unlinkFrBackWithNext();
|
||||||
|
addsp = addsp->addNextNull(stmtsp);
|
||||||
|
}
|
||||||
|
if (AstNode* stmtsp = nodep->flatsp()) {
|
||||||
|
stmtsp->unlinkFrBackWithNext();
|
||||||
|
addsp = addsp->addNextNull(stmtsp);
|
||||||
|
}
|
||||||
|
if (addsp) {
|
||||||
|
nodep->replaceWith(addsp);
|
||||||
|
} else {
|
||||||
|
nodep->unlinkFrBack();
|
||||||
|
}
|
||||||
|
pushDeletep(nodep); nodep=NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstVar* nodep, AstNUser*) {
|
virtual void visit(AstVar* nodep, AstNUser*) {
|
||||||
if (m_unnamedScope != "") {
|
if (m_unnamedScope != "") {
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
|
|||||||
+9
-7
@@ -7,7 +7,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
@@ -204,14 +204,16 @@ private:
|
|||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep, AstNUser*) {
|
||||||
BrokenTable::setUnder(nodep,true);
|
BrokenTable::setUnder(nodep,true);
|
||||||
if (nodep->broken()) {
|
if (nodep->broken()) {
|
||||||
nodep->v3fatalSrc("Broken link in node (or something without maybePointedTo)\n");
|
nodep->v3fatalSrc("Broken link in node (or something without maybePointedTo)");
|
||||||
}
|
}
|
||||||
if (v3Global.assertWidthsSame()) {
|
if (v3Global.assertDTypesResolved()) {
|
||||||
if (nodep->width() != nodep->widthMin()) {
|
|
||||||
nodep->v3fatalSrc("Width != WidthMin\n");
|
|
||||||
}
|
|
||||||
if (!nodep->width() && nodep->castNodeMath()) {
|
if (!nodep->width() && nodep->castNodeMath()) {
|
||||||
nodep->v3fatalSrc("Math node has no assigned width\n");
|
nodep->v3fatalSrc("Math node has no assigned width");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (v3Global.assertWidthsMatch()) {
|
||||||
|
if (nodep->width() != nodep->widthMin()) {
|
||||||
|
nodep->v3fatalSrc("Width != WidthMin");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
|
|||||||
+9
-5
@@ -7,7 +7,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
@@ -148,17 +148,19 @@ private:
|
|||||||
|
|
||||||
bool isCaseTreeFast(AstCase* nodep) {
|
bool isCaseTreeFast(AstCase* nodep) {
|
||||||
int width = 0;
|
int width = 0;
|
||||||
|
bool opaque = false;
|
||||||
m_caseItems = 0;
|
m_caseItems = 0;
|
||||||
m_caseNoOverlapsAllCovered = true;
|
m_caseNoOverlapsAllCovered = true;
|
||||||
for (AstCaseItem* itemp = nodep->itemsp(); itemp; itemp=itemp->nextp()->castCaseItem()) {
|
for (AstCaseItem* itemp = nodep->itemsp(); itemp; itemp=itemp->nextp()->castCaseItem()) {
|
||||||
for (AstNode* icondp = itemp->condsp(); icondp!=NULL; icondp=icondp->nextp()) {
|
for (AstNode* icondp = itemp->condsp(); icondp!=NULL; icondp=icondp->nextp()) {
|
||||||
if (icondp->width() > width) width = icondp->width();
|
if (icondp->width() > width) width = icondp->width();
|
||||||
|
if (icondp->isDouble()) opaque = true;
|
||||||
if (!icondp->castConst()) width = CASE_BARF; // Can't parse; not a constant
|
if (!icondp->castConst()) width = CASE_BARF; // Can't parse; not a constant
|
||||||
m_caseItems++;
|
m_caseItems++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_caseWidth = width;
|
m_caseWidth = width;
|
||||||
if (width==0 || width > CASE_OVERLAP_WIDTH) {
|
if (width==0 || width > CASE_OVERLAP_WIDTH || opaque) {
|
||||||
m_caseNoOverlapsAllCovered = false;
|
m_caseNoOverlapsAllCovered = false;
|
||||||
return false; // Too wide for analysis
|
return false; // Too wide for analysis
|
||||||
}
|
}
|
||||||
@@ -348,7 +350,9 @@ private:
|
|||||||
and1p = cexprp->cloneTree(false);
|
and1p = cexprp->cloneTree(false);
|
||||||
and2p = icondp;
|
and2p = icondp;
|
||||||
}
|
}
|
||||||
AstEq* condp = new AstEq(itemp->fileline(), and1p, and2p);
|
AstNodeBiop* condp = (and1p->isDouble()
|
||||||
|
? (new AstEqD(itemp->fileline(), and1p, and2p))->castNodeBiop()
|
||||||
|
: (new AstEq(itemp->fileline(), and1p, and2p))->castNodeBiop());
|
||||||
if (!ifexprp) {
|
if (!ifexprp) {
|
||||||
ifexprp = condp;
|
ifexprp = condp;
|
||||||
} else {
|
} else {
|
||||||
@@ -448,10 +452,10 @@ private:
|
|||||||
if (isCaseTreeFast(nodep) && v3Global.opt.oCase()) {
|
if (isCaseTreeFast(nodep) && v3Global.opt.oCase()) {
|
||||||
// It's a simple priority encoder or complete statement
|
// It's a simple priority encoder or complete statement
|
||||||
// we can make a tree of statements to avoid extra comparisons
|
// we can make a tree of statements to avoid extra comparisons
|
||||||
m_statCaseFast++;
|
++m_statCaseFast;
|
||||||
replaceCaseFast(nodep); nodep=NULL;
|
replaceCaseFast(nodep); nodep=NULL;
|
||||||
} else {
|
} else {
|
||||||
m_statCaseSlow++;
|
++m_statCaseSlow;
|
||||||
replaceCaseComplicated(nodep); nodep=NULL;
|
replaceCaseComplicated(nodep); nodep=NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
|
|||||||
+2
-2
@@ -7,7 +7,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2004-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2004-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
@@ -135,7 +135,7 @@ private:
|
|||||||
insureLower32Cast(nodep);
|
insureLower32Cast(nodep);
|
||||||
nodep->user1(1);
|
nodep->user1(1);
|
||||||
}
|
}
|
||||||
virtual void visit(AstUnaryMin* nodep, AstNUser*) {
|
virtual void visit(AstNegate* nodep, AstNUser*) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
nodep->user1(nodep->lhsp()->user1());
|
nodep->user1(nodep->lhsp()->user1());
|
||||||
if (nodep->lhsp()->widthMin()==1) {
|
if (nodep->lhsp()->widthMin()==1) {
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2004-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2004-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
|
|||||||
+12
-2
@@ -7,7 +7,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
@@ -476,6 +476,12 @@ private:
|
|||||||
|
|
||||||
void edgeReport() {
|
void edgeReport() {
|
||||||
// Make report of all signal names and what clock edges they have
|
// Make report of all signal names and what clock edges they have
|
||||||
|
//
|
||||||
|
// Due to flattening, many interesting direct-connect signals are
|
||||||
|
// lost, so we can't make a report showing I/Os for a low level
|
||||||
|
// module. Disabling flattening though makes us consider each
|
||||||
|
// signal in it's own unique clock domain.
|
||||||
|
|
||||||
UINFO(3,__FUNCTION__<<": "<<endl);
|
UINFO(3,__FUNCTION__<<": "<<endl);
|
||||||
|
|
||||||
// Trace all sources and sinks
|
// Trace all sources and sinks
|
||||||
@@ -505,6 +511,10 @@ private:
|
|||||||
|
|
||||||
ostringstream os;
|
ostringstream os;
|
||||||
os.setf(ios::left);
|
os.setf(ios::left);
|
||||||
|
// Module name - doesn't work due to flattening having lost the original
|
||||||
|
// so we assume the modulename matches the filebasename
|
||||||
|
string fname = vvertexp->varScp()->fileline()->filebasename() + ":";
|
||||||
|
os<<" "<<setw(20)<<fname;
|
||||||
os<<" "<<setw(8)<<whatp;
|
os<<" "<<setw(8)<<whatp;
|
||||||
os<<" "<<setw(40)<<vvertexp->varScp()->prettyName();
|
os<<" "<<setw(40)<<vvertexp->varScp()->prettyName();
|
||||||
os<<" SRC=";
|
os<<" SRC=";
|
||||||
@@ -739,7 +749,7 @@ public:
|
|||||||
|
|
||||||
nodep->accept(*this);
|
nodep->accept(*this);
|
||||||
analyze();
|
analyze();
|
||||||
//edgeReport(); // Not useful at the moment
|
if (debug()>=1) edgeReport(); // Not useful to users at the moment
|
||||||
|
|
||||||
if (0) { *m_ofp<<"\nDBG-test-dumper\n"; V3EmitV::verilogPrefixedTree(nodep, *m_ofp, "DBG ",40,NULL,true); *m_ofp<<endl; }
|
if (0) { *m_ofp<<"\nDBG-test-dumper\n"; V3EmitV::verilogPrefixedTree(nodep, *m_ofp, "DBG ",40,NULL,true); *m_ofp<<endl; }
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
|
|||||||
+2
-2
@@ -7,7 +7,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
@@ -73,7 +73,7 @@ private:
|
|||||||
AstVar* varp = vscp->varp();
|
AstVar* varp = vscp->varp();
|
||||||
vscp->v3warn(IMPERFECTSCH,"Imperfect scheduling of variable: "<<vscp);
|
vscp->v3warn(IMPERFECTSCH,"Imperfect scheduling of variable: "<<vscp);
|
||||||
if (!varp->dtypeSkipRefp()->castBasicDType()) {
|
if (!varp->dtypeSkipRefp()->castBasicDType()) {
|
||||||
vscp->v3error("Unsupported: Can't detect changes on arrayed variable (probably with UNOPTFLAT warning suppressed): "<<varp->prettyName());
|
vscp->v3warn(E_DETECTARRAY, "Unsupported: Can't detect changes on arrayed variable (probably with UNOPTFLAT warning suppressed): "<<varp->prettyName());
|
||||||
} else {
|
} else {
|
||||||
string newvarname = "__Vchglast__"+vscp->scopep()->nameDotless()+"__"+varp->shortName();
|
string newvarname = "__Vchglast__"+vscp->scopep()->nameDotless()+"__"+varp->shortName();
|
||||||
// Create: VARREF(_last)
|
// Create: VARREF(_last)
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
|
|||||||
+3
-3
@@ -7,7 +7,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
// 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.
|
||||||
// Resize operands to C++ 32/64/wide types.
|
// Resize operands to C++ 32/64/wide types.
|
||||||
// Copy all width() values to minWidth() so RANGE, etc can still see orig widths
|
// Copy all width() values to widthMin() so RANGE, etc can still see orig widths
|
||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ private:
|
|||||||
// NODE STATE
|
// NODE STATE
|
||||||
// Entire netlist:
|
// Entire netlist:
|
||||||
// AstNode::user() -> CleanState. For this node, 0==UNKNOWN
|
// AstNode::user() -> CleanState. For this node, 0==UNKNOWN
|
||||||
// AstNode::user2() -> bool. True indicates minWidth has been propagated
|
// AstNode::user2() -> bool. True indicates widthMin has been propagated
|
||||||
AstUser1InUse m_inuser1;
|
AstUser1InUse m_inuser1;
|
||||||
AstUser2InUse m_inuser2;
|
AstUser2InUse m_inuser2;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
|
|||||||
+5
-4
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2008-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2008-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
@@ -315,6 +315,7 @@ public:
|
|||||||
m_exprp = exprp;
|
m_exprp = exprp;
|
||||||
m_original = original;
|
m_original = original;
|
||||||
m_state = STATE_UNKNOWN;
|
m_state = STATE_UNKNOWN;
|
||||||
|
m_cloning = false;
|
||||||
if (debug()>=9) nodep->dumpTree(cout," GateBodyIn: ");
|
if (debug()>=9) nodep->dumpTree(cout," GateBodyIn: ");
|
||||||
nodep->bodysp()->iterateAndNext(*this);
|
nodep->bodysp()->iterateAndNext(*this);
|
||||||
if (debug()>=9) nodep->dumpTree(cout," GateBodyOut: ");
|
if (debug()>=9) nodep->dumpTree(cout," GateBodyOut: ");
|
||||||
@@ -696,7 +697,7 @@ class GaterVisitor : public GaterBaseVisitor {
|
|||||||
// Blow old statements from new body
|
// Blow old statements from new body
|
||||||
GaterBodyVisitor(alwp,exprp,false);
|
GaterBodyVisitor(alwp,exprp,false);
|
||||||
|
|
||||||
m_statGaters++;
|
++m_statGaters;
|
||||||
if (debug()>=9) alwp->dumpTree(cout," new: ");
|
if (debug()>=9) alwp->dumpTree(cout," new: ");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -861,9 +862,9 @@ class GaterVisitor : public GaterBaseVisitor {
|
|||||||
m_stmtVscp = NULL;
|
m_stmtVscp = NULL;
|
||||||
m_stmtInPli = false;
|
m_stmtInPli = false;
|
||||||
}
|
}
|
||||||
if (!nodep->isSplittable()) {
|
if (!nodep->isPure() || nodep->isBrancher()) {
|
||||||
// May also be a new statement (above if); if so we mark it immediately
|
// May also be a new statement (above if); if so we mark it immediately
|
||||||
UINFO(9," NotSplittable "<<nodep<<endl);
|
UINFO(9," NotPure "<<nodep<<endl);
|
||||||
scoreboardPli(nodep);
|
scoreboardPli(nodep);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
|
|||||||
+2
-3
@@ -7,7 +7,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
@@ -83,10 +83,9 @@ private:
|
|||||||
AstVarScope* getCreateLastClk(AstVarScope* vscp) {
|
AstVarScope* getCreateLastClk(AstVarScope* vscp) {
|
||||||
if (vscp->user1p()) return ((AstVarScope*)vscp->user1p());
|
if (vscp->user1p()) return ((AstVarScope*)vscp->user1p());
|
||||||
AstVar* varp = vscp->varp();
|
AstVar* varp = vscp->varp();
|
||||||
if (varp->width()!=1) varp->v3error("Unsupported: Clock edge on non-single bit signal: "<<varp->prettyName());
|
if (!varp->width1()) varp->v3error("Unsupported: Clock edge on non-single bit signal: "<<varp->prettyName());
|
||||||
string newvarname = ((string)"__Vclklast__"+vscp->scopep()->nameDotless()+"__"+varp->shortName());
|
string newvarname = ((string)"__Vclklast__"+vscp->scopep()->nameDotless()+"__"+varp->shortName());
|
||||||
AstVar* newvarp = new AstVar (vscp->fileline(), AstVarType::MODULETEMP, newvarname, AstLogicPacked(), 1);
|
AstVar* newvarp = new AstVar (vscp->fileline(), AstVarType::MODULETEMP, newvarname, AstLogicPacked(), 1);
|
||||||
newvarp->width(1,1);
|
|
||||||
m_modp->addStmtp(newvarp);
|
m_modp->addStmtp(newvarp);
|
||||||
AstVarScope* newvscp = new AstVarScope(vscp->fileline(), m_scopep, newvarp);
|
AstVarScope* newvscp = new AstVarScope(vscp->fileline(), m_scopep, newvarp);
|
||||||
vscp->user1p(newvscp);
|
vscp->user1p(newvscp);
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
|
|||||||
+7
-5
@@ -7,7 +7,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
@@ -70,8 +70,8 @@ protected:
|
|||||||
virtual ~CombBaseVisitor() {}
|
virtual ~CombBaseVisitor() {}
|
||||||
|
|
||||||
//***** optimization levels
|
//***** optimization levels
|
||||||
bool emptyFunctionDeletion() { return true; }
|
static bool emptyFunctionDeletion() { return true; }
|
||||||
bool duplicateFunctionCombine() { return true; }
|
static bool duplicateFunctionCombine() { return true; }
|
||||||
// Note this is disabled, it still needed work
|
// Note this is disabled, it still needed work
|
||||||
// Also repair it for DPI functions; when make __common need to insure proper
|
// Also repair it for DPI functions; when make __common need to insure proper
|
||||||
// flags get inherited from the old to new AstCFunc, and that AstText doesn't
|
// flags get inherited from the old to new AstCFunc, and that AstText doesn't
|
||||||
@@ -146,7 +146,9 @@ private:
|
|||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
// CONSTRUCTORS
|
// CONSTRUCTORS
|
||||||
CombCallVisitor() {}
|
CombCallVisitor() {
|
||||||
|
m_find = false;
|
||||||
|
}
|
||||||
virtual ~CombCallVisitor() {}
|
virtual ~CombCallVisitor() {}
|
||||||
void main(AstNetlist* nodep) {
|
void main(AstNetlist* nodep) {
|
||||||
nodep->accept(*this);
|
nodep->accept(*this);
|
||||||
@@ -257,7 +259,7 @@ private:
|
|||||||
UINFO(5," DupFunc "<<hex<<V3Hash(newfuncp->user4p())<<" "<<newfuncp<<endl);
|
UINFO(5," DupFunc "<<hex<<V3Hash(newfuncp->user4p())<<" "<<newfuncp<<endl);
|
||||||
UINFO(5," and "<<hex<<V3Hash(oldfuncp->user4p())<<" "<<oldfuncp<<endl);
|
UINFO(5," and "<<hex<<V3Hash(oldfuncp->user4p())<<" "<<oldfuncp<<endl);
|
||||||
// Mark user3p on entire old tree, so we don't process it more
|
// Mark user3p on entire old tree, so we don't process it more
|
||||||
m_statCombs++;
|
++m_statCombs;
|
||||||
CombMarkVisitor visitor(oldfuncp);
|
CombMarkVisitor visitor(oldfuncp);
|
||||||
m_call.replaceFunc(oldfuncp, newfuncp);
|
m_call.replaceFunc(oldfuncp, newfuncp);
|
||||||
oldfuncp->unlinkFrBack();
|
oldfuncp->unlinkFrBack();
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2010-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2010-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2010-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2010-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
|
|||||||
+70
-32
@@ -7,7 +7,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
@@ -37,7 +37,6 @@
|
|||||||
#include "V3Const.h"
|
#include "V3Const.h"
|
||||||
#include "V3Ast.h"
|
#include "V3Ast.h"
|
||||||
#include "V3Width.h"
|
#include "V3Width.h"
|
||||||
#include "V3Signed.h"
|
|
||||||
#include "V3Simulate.h"
|
#include "V3Simulate.h"
|
||||||
|
|
||||||
//######################################################################
|
//######################################################################
|
||||||
@@ -105,6 +104,7 @@ private:
|
|||||||
bool m_warn; // Output warnings
|
bool m_warn; // Output warnings
|
||||||
bool m_doExpensive; // Enable computationally expensive optimizations
|
bool m_doExpensive; // Enable computationally expensive optimizations
|
||||||
bool m_doNConst; // Enable non-constant-child simplifications
|
bool m_doNConst; // Enable non-constant-child simplifications
|
||||||
|
bool m_doShort; // Remove expressions that short circuit
|
||||||
bool m_doV; // Verilog, not C++ conversion
|
bool m_doV; // Verilog, not C++ conversion
|
||||||
AstNodeModule* m_modp; // Current module
|
AstNodeModule* m_modp; // Current module
|
||||||
AstNode* m_scopep; // Current scope
|
AstNode* m_scopep; // Current scope
|
||||||
@@ -229,11 +229,13 @@ private:
|
|||||||
}
|
}
|
||||||
bool operandHugeShiftL(AstNodeBiop* nodep) {
|
bool operandHugeShiftL(AstNodeBiop* nodep) {
|
||||||
return (nodep->rhsp()->castConst()
|
return (nodep->rhsp()->castConst()
|
||||||
&& nodep->rhsp()->castConst()->toUInt() >= (uint32_t)(nodep->width()));
|
&& nodep->rhsp()->castConst()->toUInt() >= (uint32_t)(nodep->width())
|
||||||
|
&& isTPure(nodep->lhsp()));
|
||||||
}
|
}
|
||||||
bool operandHugeShiftR(AstNodeBiop* nodep) {
|
bool operandHugeShiftR(AstNodeBiop* nodep) {
|
||||||
return (nodep->rhsp()->castConst()
|
return (nodep->rhsp()->castConst()
|
||||||
&& nodep->rhsp()->castConst()->toUInt() >= (uint32_t)(nodep->lhsp()->width()));
|
&& nodep->rhsp()->castConst()->toUInt() >= (uint32_t)(nodep->lhsp()->width())
|
||||||
|
&& isTPure(nodep->lhsp()));
|
||||||
}
|
}
|
||||||
bool operandIsTwo(AstNode* nodep) {
|
bool operandIsTwo(AstNode* nodep) {
|
||||||
return (nodep->castConst()
|
return (nodep->castConst()
|
||||||
@@ -354,6 +356,14 @@ private:
|
|||||||
return nodep;
|
return nodep;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isTPure(AstNode* nodep) {
|
||||||
|
// Pure checks - if this node and all nodes under it are free of
|
||||||
|
// side effects can do this optimization
|
||||||
|
// Eventually we'll recurse through tree when unknown, memoizing results so far,
|
||||||
|
// but for now can disable en-mass until V3Purify takes effect.
|
||||||
|
return m_doShort || nodep->castVarRef() || nodep->castConst();
|
||||||
|
}
|
||||||
|
|
||||||
// Extraction checks
|
// Extraction checks
|
||||||
bool warnSelect(AstSel* nodep) {
|
bool warnSelect(AstSel* nodep) {
|
||||||
AstNode* basefromp = AstArraySel::baseFromp(nodep);
|
AstNode* basefromp = AstArraySel::baseFromp(nodep);
|
||||||
@@ -456,6 +466,21 @@ private:
|
|||||||
void replaceZero(AstNode* nodep) {
|
void replaceZero(AstNode* nodep) {
|
||||||
replaceNum(nodep, 0); nodep=NULL;
|
replaceNum(nodep, 0); nodep=NULL;
|
||||||
}
|
}
|
||||||
|
void replaceZeroChkPure(AstNode* nodep, AstNode* checkp) {
|
||||||
|
// For example, "0 * n" -> 0 if n has no side effects
|
||||||
|
// Else strength reduce it to 0 & n.
|
||||||
|
// If ever change the operation note AstAnd rule specially ignores this created pattern
|
||||||
|
if (isTPure(checkp)) {
|
||||||
|
replaceNum(nodep, 0); nodep=NULL;
|
||||||
|
} else {
|
||||||
|
AstNode* newp = new AstAnd(nodep->fileline(),
|
||||||
|
new AstConst(nodep->fileline(), 0),
|
||||||
|
checkp->unlinkFrBack());
|
||||||
|
newp->widthSignedFrom(nodep);
|
||||||
|
nodep->replaceWith(newp);
|
||||||
|
nodep->deleteTree(); nodep=NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
void replaceAllOnes (AstNode* nodep) {
|
void replaceAllOnes (AstNode* nodep) {
|
||||||
V3Number ones (nodep->fileline(), nodep->width(), 0);
|
V3Number ones (nodep->fileline(), nodep->width(), 0);
|
||||||
ones.setMask(nodep->width());
|
ones.setMask(nodep->width());
|
||||||
@@ -822,7 +847,9 @@ private:
|
|||||||
AstNodeAssign* asn2ap=nodep->cloneType(lc2p, sel2p)->castNodeAssign();
|
AstNodeAssign* asn2ap=nodep->cloneType(lc2p, sel2p)->castNodeAssign();
|
||||||
asn1ap->width(msb1-lsb1+1,msb1-lsb1+1);
|
asn1ap->width(msb1-lsb1+1,msb1-lsb1+1);
|
||||||
asn2ap->width(msb2-lsb2+1,msb2-lsb2+1);
|
asn2ap->width(msb2-lsb2+1,msb2-lsb2+1);
|
||||||
|
// cppcheck-suppress nullPointer // addNext deals with it
|
||||||
newp = newp->addNext(asn1ap);
|
newp = newp->addNext(asn1ap);
|
||||||
|
// cppcheck-suppress nullPointer // addNext deals with it
|
||||||
newp = newp->addNext(asn2ap);
|
newp = newp->addNext(asn2ap);
|
||||||
} else {
|
} else {
|
||||||
if (!m_modp) nodep->v3fatalSrc("Not under module");
|
if (!m_modp) nodep->v3fatalSrc("Not under module");
|
||||||
@@ -853,12 +880,16 @@ private:
|
|||||||
asn2ap->width(msb2-lsb2+1,msb2-lsb2+1);
|
asn2ap->width(msb2-lsb2+1,msb2-lsb2+1);
|
||||||
asn2bp->width(msb2-lsb2+1,msb2-lsb2+1);
|
asn2bp->width(msb2-lsb2+1,msb2-lsb2+1);
|
||||||
// This order matters
|
// This order matters
|
||||||
|
// cppcheck-suppress nullPointer // addNext deals with it
|
||||||
newp = newp->addNext(asn1ap);
|
newp = newp->addNext(asn1ap);
|
||||||
|
// cppcheck-suppress nullPointer // addNext deals with it
|
||||||
newp = newp->addNext(asn2ap);
|
newp = newp->addNext(asn2ap);
|
||||||
|
// cppcheck-suppress nullPointer // addNext deals with it
|
||||||
newp = newp->addNext(asn1bp);
|
newp = newp->addNext(asn1bp);
|
||||||
|
// cppcheck-suppress nullPointer // addNext deals with it
|
||||||
newp = newp->addNext(asn2bp);
|
newp = newp->addNext(asn2bp);
|
||||||
}
|
}
|
||||||
if (debug()>=9) newp->dumpTreeAndNext(cout," _new: ");
|
if (debug()>=9 && newp) newp->dumpTreeAndNext(cout," _new: ");
|
||||||
nodep->addNextHere(newp);
|
nodep->addNextHere(newp);
|
||||||
// Cleanup
|
// Cleanup
|
||||||
nodep->unlinkFrBack()->deleteTree(); nodep=NULL;
|
nodep->unlinkFrBack()->deleteTree(); nodep=NULL;
|
||||||
@@ -1519,7 +1550,7 @@ private:
|
|||||||
if (!inPct && ch=='%') {
|
if (!inPct && ch=='%') {
|
||||||
inPct = true;
|
inPct = true;
|
||||||
fmt = ch;
|
fmt = ch;
|
||||||
} else if (inPct && isdigit(ch)) {
|
} else if (inPct && (isdigit(ch) || ch=='.')) {
|
||||||
fmt += ch;
|
fmt += ch;
|
||||||
} else if (inPct) {
|
} else if (inPct) {
|
||||||
inPct = false;
|
inPct = false;
|
||||||
@@ -1535,7 +1566,7 @@ private:
|
|||||||
UINFO(9," DispConst: "<<fmt<<" -> "<<out<<" for "<<argp<<endl);
|
UINFO(9," DispConst: "<<fmt<<" -> "<<out<<" for "<<argp<<endl);
|
||||||
{ // fmt = out w/ replace % with %% as it must be literal.
|
{ // fmt = out w/ replace % with %% as it must be literal.
|
||||||
fmt = "";
|
fmt = "";
|
||||||
for (string::iterator pos = out.begin(); pos != out.end(); pos++) {
|
for (string::iterator pos = out.begin(); pos != out.end(); ++pos) {
|
||||||
if (*pos == '%') fmt += '%';
|
if (*pos == '%') fmt += '%';
|
||||||
fmt += *pos;
|
fmt += *pos;
|
||||||
}
|
}
|
||||||
@@ -1649,28 +1680,28 @@ private:
|
|||||||
TREEOPC("AstNodeUniop{$lhsp.castConst, !nodep->isOpaque()}", "replaceConst(nodep)");
|
TREEOPC("AstNodeUniop{$lhsp.castConst, !nodep->isOpaque()}", "replaceConst(nodep)");
|
||||||
// Zero on one side or the other
|
// Zero on one side or the other
|
||||||
TREEOP ("AstAdd {$lhsp.isZero, $rhsp}", "replaceWRhs(nodep)");
|
TREEOP ("AstAdd {$lhsp.isZero, $rhsp}", "replaceWRhs(nodep)");
|
||||||
TREEOP ("AstAnd {$lhsp.isZero, $rhsp}", "replaceZero(nodep)");
|
TREEOP ("AstAnd {$lhsp.isZero, $rhsp, isTPure($rhsp)}", "replaceZero(nodep)"); // Can't use replaceZeroChkPure as we make this pattern in ChkPure
|
||||||
TREEOP ("AstLogAnd{$lhsp.isZero, $rhsp}", "replaceZero(nodep)");
|
TREEOP ("AstLogAnd{$lhsp.isZero, $rhsp}", "replaceZero(nodep)");
|
||||||
TREEOP ("AstLogOr {$lhsp.isZero, $rhsp}", "replaceWRhs(nodep)");
|
TREEOP ("AstLogOr {$lhsp.isZero, $rhsp}", "replaceWRhs(nodep)");
|
||||||
TREEOP ("AstDiv {$lhsp.isZero, $rhsp}", "replaceZero(nodep)");
|
TREEOP ("AstDiv {$lhsp.isZero, $rhsp}", "replaceZeroChkPure(nodep,$rhsp)");
|
||||||
TREEOP ("AstDivS {$lhsp.isZero, $rhsp}", "replaceZero(nodep)");
|
TREEOP ("AstDivS {$lhsp.isZero, $rhsp}", "replaceZeroChkPure(nodep,$rhsp)");
|
||||||
TREEOP ("AstMul {$lhsp.isZero, $rhsp}", "replaceZero(nodep)");
|
TREEOP ("AstMul {$lhsp.isZero, $rhsp}", "replaceZeroChkPure(nodep,$rhsp)");
|
||||||
TREEOP ("AstMulS {$lhsp.isZero, $rhsp}", "replaceZero(nodep)");
|
TREEOP ("AstMulS {$lhsp.isZero, $rhsp}", "replaceZeroChkPure(nodep,$rhsp)");
|
||||||
TREEOP ("AstPow {$lhsp.isZero, $rhsp}", "replaceZero(nodep)");
|
TREEOP ("AstPow {$lhsp.isZero, $rhsp}", "replaceZeroChkPure(nodep,$rhsp)");
|
||||||
TREEOP ("AstPowS {$lhsp.isZero, $rhsp}", "replaceZero(nodep)");
|
TREEOP ("AstPowS {$lhsp.isZero, $rhsp}", "replaceZeroChkPure(nodep,$rhsp)");
|
||||||
TREEOP ("AstOr {$lhsp.isZero, $rhsp}", "replaceWRhs(nodep)");
|
TREEOP ("AstOr {$lhsp.isZero, $rhsp}", "replaceWRhs(nodep)");
|
||||||
TREEOP ("AstShiftL{$lhsp.isZero, $rhsp}", "replaceZero(nodep)");
|
TREEOP ("AstShiftL{$lhsp.isZero, $rhsp}", "replaceZeroChkPure(nodep,$rhsp)");
|
||||||
TREEOP ("AstShiftR{$lhsp.isZero, $rhsp}", "replaceZero(nodep)");
|
TREEOP ("AstShiftR{$lhsp.isZero, $rhsp}", "replaceZeroChkPure(nodep,$rhsp)");
|
||||||
TREEOP ("AstShiftRS{$lhsp.isZero, $rhsp}", "replaceZero(nodep)");
|
TREEOP ("AstShiftRS{$lhsp.isZero, $rhsp}", "replaceZeroChkPure(nodep,$rhsp)");
|
||||||
TREEOP ("AstXor {$lhsp.isZero, $rhsp}", "replaceWRhs(nodep)");
|
TREEOP ("AstXor {$lhsp.isZero, $rhsp}", "replaceWRhs(nodep)");
|
||||||
TREEOP ("AstXnor {$lhsp.isZero, $rhsp}", "AstNot{$rhsp}");
|
TREEOP ("AstXnor {$lhsp.isZero, $rhsp}", "AstNot{$rhsp}");
|
||||||
TREEOP ("AstSub {$lhsp.isZero, $rhsp}", "AstUnaryMin{$rhsp}");
|
TREEOP ("AstSub {$lhsp.isZero, $rhsp}", "AstNegate{$rhsp}");
|
||||||
TREEOP ("AstAdd {$lhsp, $rhsp.isZero}", "replaceWLhs(nodep)");
|
TREEOP ("AstAdd {$lhsp, $rhsp.isZero}", "replaceWLhs(nodep)");
|
||||||
TREEOP ("AstAnd {$lhsp, $rhsp.isZero}", "replaceZero(nodep)");
|
TREEOP ("AstAnd {$lhsp, $rhsp.isZero}", "replaceZeroChkPure(nodep,$lhsp)");
|
||||||
TREEOP ("AstLogAnd{$lhsp, $rhsp.isZero}", "replaceZero(nodep)");
|
TREEOP ("AstLogAnd{$lhsp, $rhsp.isZero}", "replaceZeroChkPure(nodep,$lhsp)");
|
||||||
TREEOP ("AstLogOr {$lhsp, $rhsp.isZero}", "replaceWLhs(nodep)");
|
TREEOP ("AstLogOr {$lhsp, $rhsp.isZero}", "replaceWLhs(nodep)");
|
||||||
TREEOP ("AstMul {$lhsp, $rhsp.isZero}", "replaceZero(nodep)");
|
TREEOP ("AstMul {$lhsp, $rhsp.isZero}", "replaceZeroChkPure(nodep,$lhsp)");
|
||||||
TREEOP ("AstMulS {$lhsp, $rhsp.isZero}", "replaceZero(nodep)");
|
TREEOP ("AstMulS {$lhsp, $rhsp.isZero}", "replaceZeroChkPure(nodep,$lhsp)");
|
||||||
TREEOP ("AstOr {$lhsp, $rhsp.isZero}", "replaceWLhs(nodep)");
|
TREEOP ("AstOr {$lhsp, $rhsp.isZero}", "replaceWLhs(nodep)");
|
||||||
TREEOP ("AstShiftL{$lhsp, $rhsp.isZero}", "replaceWLhs(nodep)");
|
TREEOP ("AstShiftL{$lhsp, $rhsp.isZero}", "replaceWLhs(nodep)");
|
||||||
TREEOP ("AstShiftR{$lhsp, $rhsp.isZero}", "replaceWLhs(nodep)");
|
TREEOP ("AstShiftR{$lhsp, $rhsp.isZero}", "replaceWLhs(nodep)");
|
||||||
@@ -1681,12 +1712,12 @@ private:
|
|||||||
// Non-zero on one side or the other
|
// Non-zero on one side or the other
|
||||||
TREEOP ("AstAnd {$lhsp.isAllOnes, $rhsp}", "replaceWRhs(nodep)");
|
TREEOP ("AstAnd {$lhsp.isAllOnes, $rhsp}", "replaceWRhs(nodep)");
|
||||||
TREEOP ("AstLogAnd{$lhsp.isNeqZero, $rhsp}", "replaceWRhs(nodep)");
|
TREEOP ("AstLogAnd{$lhsp.isNeqZero, $rhsp}", "replaceWRhs(nodep)");
|
||||||
TREEOP ("AstOr {$lhsp.isAllOnes, $rhsp}", "replaceWLhs(nodep)"); //->allOnes
|
TREEOP ("AstOr {$lhsp.isAllOnes, $rhsp, isTPure($rhsp)}", "replaceWLhs(nodep)"); //->allOnes
|
||||||
TREEOP ("AstLogOr {$lhsp.isNeqZero, $rhsp}", "replaceNum(nodep,1)");
|
TREEOP ("AstLogOr {$lhsp.isNeqZero, $rhsp}", "replaceNum(nodep,1)");
|
||||||
TREEOP ("AstAnd {$lhsp, $rhsp.isAllOnes}", "replaceWLhs(nodep)");
|
TREEOP ("AstAnd {$lhsp, $rhsp.isAllOnes}", "replaceWLhs(nodep)");
|
||||||
TREEOP ("AstLogAnd{$lhsp, $rhsp.isNeqZero}", "replaceWLhs(nodep)");
|
TREEOP ("AstLogAnd{$lhsp, $rhsp.isNeqZero}", "replaceWLhs(nodep)");
|
||||||
TREEOP ("AstOr {$lhsp, $rhsp.isAllOnes}", "replaceWRhs(nodep)"); //->allOnes
|
TREEOP ("AstOr {$lhsp, $rhsp.isAllOnes, isTPure($lhsp)}", "replaceWRhs(nodep)"); //->allOnes
|
||||||
TREEOP ("AstLogOr {$lhsp, $rhsp.isNeqZero}", "replaceNum(nodep,1)");
|
TREEOP ("AstLogOr {$lhsp, $rhsp.isNeqZero, isTPure($lhsp)}", "replaceNum(nodep,1)");
|
||||||
TREEOP ("AstXor {$lhsp.isAllOnes, $rhsp}", "AstNot{$rhsp}");
|
TREEOP ("AstXor {$lhsp.isAllOnes, $rhsp}", "AstNot{$rhsp}");
|
||||||
TREEOP ("AstXnor {$lhsp.isAllOnes, $rhsp}", "replaceWRhs(nodep)");
|
TREEOP ("AstXnor {$lhsp.isAllOnes, $rhsp}", "replaceWRhs(nodep)");
|
||||||
TREEOP ("AstMul {$lhsp.isOne, $rhsp}", "replaceWRhs(nodep)");
|
TREEOP ("AstMul {$lhsp.isOne, $rhsp}", "replaceWRhs(nodep)");
|
||||||
@@ -1705,10 +1736,10 @@ private:
|
|||||||
TREEOPC("AstNodeCond{$condp.isNeqZero, $expr1p.castConst, $expr2p.castConst}", "replaceWChild(nodep,$expr1p)");
|
TREEOPC("AstNodeCond{$condp.isNeqZero, $expr1p.castConst, $expr2p.castConst}", "replaceWChild(nodep,$expr1p)");
|
||||||
TREEOP ("AstNodeCond{$condp, operandsSame($expr1p,,$expr2p)}","replaceWChild(nodep,$expr1p)");
|
TREEOP ("AstNodeCond{$condp, operandsSame($expr1p,,$expr2p)}","replaceWChild(nodep,$expr1p)");
|
||||||
TREEOP ("AstCond{$condp->castNot(), $expr1p, $expr2p}", "AstCond{$condp->op1p(), $expr2p, $expr1p}");
|
TREEOP ("AstCond{$condp->castNot(), $expr1p, $expr2p}", "AstCond{$condp->op1p(), $expr2p, $expr1p}");
|
||||||
TREEOP ("AstNodeCond{$condp.width1, $expr1p.width1, $expr1p.isAllOnes, $expr2p}", "AstOr {$condp, $expr2p}"); // a?1:b == a|b
|
TREEOP ("AstNodeCond{$condp.width1, $expr1p.width1, $expr1p.isAllOnes, $expr2p}", "AstLogOr {$condp, $expr2p}"); // a?1:b == a||b
|
||||||
TREEOP ("AstNodeCond{$condp.width1, $expr1p.width1, $expr1p, $expr2p.isZero}", "AstAnd{$condp, $expr1p}"); // a?b:0 == a&b
|
TREEOP ("AstNodeCond{$condp.width1, $expr1p.width1, $expr1p, $expr2p.isZero}", "AstLogAnd{$condp, $expr1p}"); // a?b:0 == a&&b
|
||||||
TREEOP ("AstNodeCond{$condp.width1, $expr1p.width1, $expr1p, $expr2p.isAllOnes}", "AstOr {AstNot{$condp}, $expr1p}"); // a?b:1 == ~a|b
|
TREEOP ("AstNodeCond{$condp.width1, $expr1p.width1, $expr1p, $expr2p.isAllOnes}", "AstLogOr {AstNot{$condp}, $expr1p}"); // a?b:1 == ~a||b
|
||||||
TREEOP ("AstNodeCond{$condp.width1, $expr1p.width1, $expr1p.isZero, $expr2p}", "AstAnd{AstNot{$condp}, $expr2p}"); // a?0:b == ~a&b
|
TREEOP ("AstNodeCond{$condp.width1, $expr1p.width1, $expr1p.isZero, $expr2p}", "AstLogAnd{AstNot{$condp}, $expr2p}"); // a?0:b == ~a&&b
|
||||||
TREEOP ("AstNodeCond{!$condp.width1, operandBoolShift(nodep->condp())}", "replaceBoolShift(nodep->condp())");
|
TREEOP ("AstNodeCond{!$condp.width1, operandBoolShift(nodep->condp())}", "replaceBoolShift(nodep->condp())");
|
||||||
// Prefer constants on left, since that often needs a shift, it lets constant red remove the shift
|
// Prefer constants on left, since that often needs a shift, it lets constant red remove the shift
|
||||||
TREEOP ("AstNodeBiCom{!$lhsp.castConst, $rhsp.castConst}", "swapSides(nodep)");
|
TREEOP ("AstNodeBiCom{!$lhsp.castConst, $rhsp.castConst}", "swapSides(nodep)");
|
||||||
@@ -1783,17 +1814,23 @@ private:
|
|||||||
TREEOP ("AstXnor {operandsSame($lhsp,,$rhsp)}", "replaceAllOnes(nodep)");
|
TREEOP ("AstXnor {operandsSame($lhsp,,$rhsp)}", "replaceAllOnes(nodep)");
|
||||||
TREEOP ("AstXor {operandsSame($lhsp,,$rhsp)}", "replaceZero(nodep)");
|
TREEOP ("AstXor {operandsSame($lhsp,,$rhsp)}", "replaceZero(nodep)");
|
||||||
TREEOP ("AstEq {operandsSame($lhsp,,$rhsp)}", "replaceNum(nodep,1)"); // We let X==X -> 1, although in a true 4-state sim it's X.
|
TREEOP ("AstEq {operandsSame($lhsp,,$rhsp)}", "replaceNum(nodep,1)"); // We let X==X -> 1, although in a true 4-state sim it's X.
|
||||||
|
TREEOP ("AstEqD {operandsSame($lhsp,,$rhsp)}", "replaceNum(nodep,1)"); // We let X==X -> 1, although in a true 4-state sim it's X.
|
||||||
TREEOP ("AstEqCase {operandsSame($lhsp,,$rhsp)}", "replaceNum(nodep,1)");
|
TREEOP ("AstEqCase {operandsSame($lhsp,,$rhsp)}", "replaceNum(nodep,1)");
|
||||||
TREEOP ("AstEqWild {operandsSame($lhsp,,$rhsp)}", "replaceNum(nodep,1)");
|
TREEOP ("AstEqWild {operandsSame($lhsp,,$rhsp)}", "replaceNum(nodep,1)");
|
||||||
TREEOP ("AstGt {operandsSame($lhsp,,$rhsp)}", "replaceZero(nodep)");
|
TREEOP ("AstGt {operandsSame($lhsp,,$rhsp)}", "replaceZero(nodep)");
|
||||||
|
TREEOP ("AstGtD {operandsSame($lhsp,,$rhsp)}", "replaceZero(nodep)");
|
||||||
TREEOP ("AstGtS {operandsSame($lhsp,,$rhsp)}", "replaceZero(nodep)");
|
TREEOP ("AstGtS {operandsSame($lhsp,,$rhsp)}", "replaceZero(nodep)");
|
||||||
TREEOP ("AstGte {operandsSame($lhsp,,$rhsp)}", "replaceNum(nodep,1)");
|
TREEOP ("AstGte {operandsSame($lhsp,,$rhsp)}", "replaceNum(nodep,1)");
|
||||||
|
TREEOP ("AstGteD {operandsSame($lhsp,,$rhsp)}", "replaceNum(nodep,1)");
|
||||||
TREEOP ("AstGteS {operandsSame($lhsp,,$rhsp)}", "replaceNum(nodep,1)");
|
TREEOP ("AstGteS {operandsSame($lhsp,,$rhsp)}", "replaceNum(nodep,1)");
|
||||||
TREEOP ("AstLt {operandsSame($lhsp,,$rhsp)}", "replaceZero(nodep)");
|
TREEOP ("AstLt {operandsSame($lhsp,,$rhsp)}", "replaceZero(nodep)");
|
||||||
|
TREEOP ("AstLtD {operandsSame($lhsp,,$rhsp)}", "replaceZero(nodep)");
|
||||||
TREEOP ("AstLtS {operandsSame($lhsp,,$rhsp)}", "replaceZero(nodep)");
|
TREEOP ("AstLtS {operandsSame($lhsp,,$rhsp)}", "replaceZero(nodep)");
|
||||||
TREEOP ("AstLte {operandsSame($lhsp,,$rhsp)}", "replaceNum(nodep,1)");
|
TREEOP ("AstLte {operandsSame($lhsp,,$rhsp)}", "replaceNum(nodep,1)");
|
||||||
|
TREEOP ("AstLteD {operandsSame($lhsp,,$rhsp)}", "replaceNum(nodep,1)");
|
||||||
TREEOP ("AstLteS {operandsSame($lhsp,,$rhsp)}", "replaceNum(nodep,1)");
|
TREEOP ("AstLteS {operandsSame($lhsp,,$rhsp)}", "replaceNum(nodep,1)");
|
||||||
TREEOP ("AstNeq {operandsSame($lhsp,,$rhsp)}", "replaceZero(nodep)");
|
TREEOP ("AstNeq {operandsSame($lhsp,,$rhsp)}", "replaceZero(nodep)");
|
||||||
|
TREEOP ("AstNeqD {operandsSame($lhsp,,$rhsp)}", "replaceZero(nodep)");
|
||||||
TREEOP ("AstNeqCase{operandsSame($lhsp,,$rhsp)}", "replaceZero(nodep)");
|
TREEOP ("AstNeqCase{operandsSame($lhsp,,$rhsp)}", "replaceZero(nodep)");
|
||||||
TREEOP ("AstNeqWild{operandsSame($lhsp,,$rhsp)}", "replaceZero(nodep)");
|
TREEOP ("AstNeqWild{operandsSame($lhsp,,$rhsp)}", "replaceZero(nodep)");
|
||||||
TREEOP ("AstLogAnd {operandsSame($lhsp,,$rhsp), $lhsp.width1}", "replaceWLhs(nodep)");
|
TREEOP ("AstLogAnd {operandsSame($lhsp,,$rhsp), $lhsp.width1}", "replaceWLhs(nodep)");
|
||||||
@@ -1827,9 +1864,9 @@ private:
|
|||||||
TREEOPV("AstOneHot{$lhsp.width1}", "replaceWLhs(nodep)");
|
TREEOPV("AstOneHot{$lhsp.width1}", "replaceWLhs(nodep)");
|
||||||
TREEOPV("AstOneHot0{$lhsp.width1}", "replaceNum(nodep,1)");
|
TREEOPV("AstOneHot0{$lhsp.width1}", "replaceNum(nodep,1)");
|
||||||
// Binary AND/OR is faster than logical and/or (usually)
|
// Binary AND/OR is faster than logical and/or (usually)
|
||||||
TREEOPV("AstLogAnd{$lhsp.width1, $rhsp.width1}", "AstAnd{$lhsp,$rhsp}");
|
TREEOPV("AstLogAnd{$lhsp.width1, $rhsp.width1, isTPure($lhsp), isTPure($rhsp)}", "AstAnd{$lhsp,$rhsp}");
|
||||||
TREEOPV("AstLogOr {$lhsp.width1, $rhsp.width1}", "AstOr{$lhsp,$rhsp}");
|
TREEOPV("AstLogOr {$lhsp.width1, $rhsp.width1, isTPure($lhsp), isTPure($rhsp)}", "AstOr{$lhsp,$rhsp}");
|
||||||
TREEOPV("AstLogNot{$lhsp.width1}", "AstNot{$lhsp}");
|
TREEOPV("AstLogNot{$lhsp.width1, isTPure($lhsp)}", "AstNot{$lhsp}");
|
||||||
// CONCAT(CONCAT({a},{b}),{c}) -> CONCAT({a},CONCAT({b},{c}))
|
// CONCAT(CONCAT({a},{b}),{c}) -> CONCAT({a},CONCAT({b},{c}))
|
||||||
// CONCAT({const},CONCAT({const},{c})) -> CONCAT((constifiedCONC{const|const},{c}))
|
// CONCAT({const},CONCAT({const},{c})) -> CONCAT((constifiedCONC{const|const},{c}))
|
||||||
TREEOPV("AstConcat{operandConcatMove(nodep)}", "moveConcat(nodep)");
|
TREEOPV("AstConcat{operandConcatMove(nodep)}", "moveConcat(nodep)");
|
||||||
@@ -1917,6 +1954,7 @@ public:
|
|||||||
m_required = false;
|
m_required = false;
|
||||||
m_doExpensive = false;
|
m_doExpensive = false;
|
||||||
m_doNConst = false;
|
m_doNConst = false;
|
||||||
|
m_doShort = true; // Presently always done
|
||||||
m_doV = false;
|
m_doV = false;
|
||||||
m_warn = false;
|
m_warn = false;
|
||||||
m_wremove = true; // Overridden in visitors
|
m_wremove = true; // Overridden in visitors
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
@@ -97,7 +97,7 @@ private:
|
|||||||
removep->unlinkFrBack(); pushDeletep(removep); removep=NULL;
|
removep->unlinkFrBack(); pushDeletep(removep); removep=NULL;
|
||||||
// Remove node from comparison so don't hit it again
|
// Remove node from comparison so don't hit it again
|
||||||
hashed.erase(dupit);
|
hashed.erase(dupit);
|
||||||
m_statToggleJoins++;
|
++m_statToggleJoins;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
|
|||||||
+2
-4
@@ -7,7 +7,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
@@ -224,7 +224,6 @@ private:
|
|||||||
}
|
}
|
||||||
//
|
//
|
||||||
//=== Setting/not setting boolean: __Vdlyvset__
|
//=== Setting/not setting boolean: __Vdlyvset__
|
||||||
bool sharedVset = false;
|
|
||||||
AstVarScope* setvscp;
|
AstVarScope* setvscp;
|
||||||
|
|
||||||
if (nodep->user3p()) {
|
if (nodep->user3p()) {
|
||||||
@@ -232,9 +231,8 @@ private:
|
|||||||
// then we told this nodep->user3 we can use its Vdlyvset rather than making a new one.
|
// then we told this nodep->user3 we can use its Vdlyvset rather than making a new one.
|
||||||
// This is good for code like:
|
// This is good for code like:
|
||||||
// for (i=0; i<5; i++) vector[i] <= something;
|
// for (i=0; i<5; i++) vector[i] <= something;
|
||||||
sharedVset = true;
|
|
||||||
setvscp = nodep->user3p()->castNode()->castVarScope();
|
setvscp = nodep->user3p()->castNode()->castVarScope();
|
||||||
m_statSharedSet++;
|
++m_statSharedSet;
|
||||||
} else { // Create new one
|
} else { // Create new one
|
||||||
string setvarname = (string("__Vdlyvset__")+oldvarp->shortName()+"__v"+cvtToStr(modVecNum));
|
string setvarname = (string("__Vdlyvset__")+oldvarp->shortName()+"__v"+cvtToStr(modVecNum));
|
||||||
setvscp = createVarSc(varrefp->varScopep(), setvarname, 1);
|
setvscp = createVarSc(varrefp->varScopep(), setvarname, 1);
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
|
|||||||
+48
-13
@@ -7,7 +7,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
@@ -55,9 +55,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ACCESSORS
|
// ACCESSORS
|
||||||
int splitFilenum() { return m_splitFilenum; }
|
int splitFilenum() const { return m_splitFilenum; }
|
||||||
int splitFilenumInc() { m_splitSize = 0; return ++m_splitFilenum; }
|
int splitFilenumInc() { m_splitSize = 0; return ++m_splitFilenum; }
|
||||||
int splitSize() { return m_splitSize; }
|
int splitSize() const { return m_splitSize; }
|
||||||
void splitSizeInc(AstNode* nodep) { m_splitSize += EmitCBaseCounterVisitor(nodep).count(); }
|
void splitSizeInc(AstNode* nodep) { m_splitSize += EmitCBaseCounterVisitor(nodep).count(); }
|
||||||
bool splitNeeded() { return (splitSize() && v3Global.opt.outputSplit() > 1
|
bool splitNeeded() { return (splitSize() && v3Global.opt.outputSplit() > 1
|
||||||
&& v3Global.opt.outputSplit() < splitSize()); }
|
&& v3Global.opt.outputSplit() < splitSize()); }
|
||||||
@@ -344,13 +344,11 @@ public:
|
|||||||
puts(");\n");
|
puts(");\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstFClose* nodep, AstNUser*) {
|
virtual void visit(AstFClose* nodep, AstNUser*) {
|
||||||
puts("if (");
|
puts("VL_FCLOSE_I(");
|
||||||
nodep->filep()->iterateAndNext(*this);
|
nodep->filep()->iterateAndNext(*this);
|
||||||
puts(") { fclose (VL_CVT_Q_FP(");
|
puts("); ");
|
||||||
nodep->filep()->iterateAndNext(*this);
|
|
||||||
puts(")); ");
|
|
||||||
nodep->filep()->iterateAndNext(*this); // For saftey, so user doesn't later WRITE with it.
|
nodep->filep()->iterateAndNext(*this); // For saftey, so user doesn't later WRITE with it.
|
||||||
puts("=0; }\n");
|
puts("=0;\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstFFlush* nodep, AstNUser*) {
|
virtual void visit(AstFFlush* nodep, AstNUser*) {
|
||||||
if (!nodep->filep()) {
|
if (!nodep->filep()) {
|
||||||
@@ -358,11 +356,35 @@ public:
|
|||||||
} else {
|
} else {
|
||||||
puts("if (");
|
puts("if (");
|
||||||
nodep->filep()->iterateAndNext(*this);
|
nodep->filep()->iterateAndNext(*this);
|
||||||
puts(") { fflush (VL_CVT_Q_FP(");
|
puts(") { fflush (VL_CVT_I_FP(");
|
||||||
nodep->filep()->iterateAndNext(*this);
|
nodep->filep()->iterateAndNext(*this);
|
||||||
puts(")); }\n");
|
puts(")); }\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
virtual void visit(AstSystemT* nodep, AstNUser*) {
|
||||||
|
puts("(void)VL_SYSTEM_I");
|
||||||
|
emitIQW(nodep->lhsp());
|
||||||
|
puts("(");
|
||||||
|
if (nodep->lhsp()->isWide()) {
|
||||||
|
puts(cvtToStr(nodep->lhsp()->widthWords()));
|
||||||
|
putbs(", ");
|
||||||
|
}
|
||||||
|
checkMaxWords(nodep->lhsp());
|
||||||
|
nodep->lhsp()->iterateAndNext(*this);
|
||||||
|
puts(");\n");
|
||||||
|
}
|
||||||
|
virtual void visit(AstSystemF* nodep, AstNUser*) {
|
||||||
|
puts("VL_SYSTEM_I");
|
||||||
|
emitIQW(nodep->lhsp());
|
||||||
|
puts("(");
|
||||||
|
if (nodep->lhsp()->isWide()) {
|
||||||
|
puts(cvtToStr(nodep->lhsp()->widthWords()));
|
||||||
|
putbs(", ");
|
||||||
|
}
|
||||||
|
checkMaxWords(nodep->lhsp());
|
||||||
|
nodep->lhsp()->iterateAndNext(*this);
|
||||||
|
puts(")");
|
||||||
|
}
|
||||||
virtual void visit(AstJumpGo* nodep, AstNUser*) {
|
virtual void visit(AstJumpGo* nodep, AstNUser*) {
|
||||||
puts("goto __Vlabel"+cvtToStr(nodep->labelp()->labelNum())+";\n");
|
puts("goto __Vlabel"+cvtToStr(nodep->labelp()->labelNum())+";\n");
|
||||||
}
|
}
|
||||||
@@ -530,7 +552,7 @@ public:
|
|||||||
nodep->v3error("Unsupported: 4-state numbers in this context");
|
nodep->v3error("Unsupported: 4-state numbers in this context");
|
||||||
} else if (nodep->isWide()) {
|
} else if (nodep->isWide()) {
|
||||||
putbs("VL_CONST_W_");
|
putbs("VL_CONST_W_");
|
||||||
puts(cvtToStr(VL_WORDS_I(nodep->num().minWidth())));
|
puts(cvtToStr(VL_WORDS_I(nodep->num().widthMin())));
|
||||||
puts("X(");
|
puts("X(");
|
||||||
puts(cvtToStr(nodep->widthMin()));
|
puts(cvtToStr(nodep->widthMin()));
|
||||||
puts(",");
|
puts(",");
|
||||||
@@ -542,11 +564,13 @@ public:
|
|||||||
} else {
|
} else {
|
||||||
assigntop->iterateAndNext(*this);
|
assigntop->iterateAndNext(*this);
|
||||||
}
|
}
|
||||||
for (int word=VL_WORDS_I(nodep->num().minWidth())-1; word>0; word--) {
|
for (int word=VL_WORDS_I(nodep->num().widthMin())-1; word>0; word--) {
|
||||||
// Only 32 bits - llx + long long here just to appease CPP format warning
|
// Only 32 bits - llx + long long here just to appease CPP format warning
|
||||||
ofp()->printf(",0x%08" VL_PRI64 "x", (vluint64_t)(nodep->num().dataWord(word)));
|
ofp()->printf(",0x%08" VL_PRI64 "x", (vluint64_t)(nodep->num().dataWord(word)));
|
||||||
}
|
}
|
||||||
ofp()->printf(",0x%08" VL_PRI64 "x)", (vluint64_t)(nodep->num().dataWord(0)));
|
ofp()->printf(",0x%08" VL_PRI64 "x)", (vluint64_t)(nodep->num().dataWord(0)));
|
||||||
|
} else if (nodep->isDouble()) {
|
||||||
|
ofp()->printf("%.17g", nodep->num().toDouble());
|
||||||
} else if (nodep->isQuad()) {
|
} else if (nodep->isQuad()) {
|
||||||
vluint64_t num = nodep->toUQuad();
|
vluint64_t num = nodep->toUQuad();
|
||||||
if (num<10) ofp()->printf("VL_ULL(%" VL_PRI64 "d)", num);
|
if (num<10) ofp()->printf("VL_ULL(%" VL_PRI64 "d)", num);
|
||||||
@@ -830,6 +854,8 @@ class EmitCImp : EmitCStmts {
|
|||||||
public:
|
public:
|
||||||
EmitCImp() {
|
EmitCImp() {
|
||||||
m_modp = NULL;
|
m_modp = NULL;
|
||||||
|
m_slow = false;
|
||||||
|
m_fast = false;
|
||||||
}
|
}
|
||||||
virtual ~EmitCImp() {}
|
virtual ~EmitCImp() {}
|
||||||
void main(AstNodeModule* modp, bool slow, bool fast);
|
void main(AstNodeModule* modp, bool slow, bool fast);
|
||||||
@@ -1212,6 +1238,7 @@ void EmitCStmts::displayNode(AstNode* nodep, AstScopeName* scopenamep,
|
|||||||
switch (tolower(pos[0])) {
|
switch (tolower(pos[0])) {
|
||||||
case '0': case '1': case '2': case '3': case '4':
|
case '0': case '1': case '2': case '3': case '4':
|
||||||
case '5': case '6': case '7': case '8': case '9':
|
case '5': case '6': case '7': case '8': case '9':
|
||||||
|
case '.':
|
||||||
// Digits, like %5d, etc.
|
// Digits, like %5d, etc.
|
||||||
vfmt += pos[0];
|
vfmt += pos[0];
|
||||||
inPct = true; // Get more digits
|
inPct = true; // Get more digits
|
||||||
@@ -1230,6 +1257,9 @@ void EmitCStmts::displayNode(AstNode* nodep, AstScopeName* scopenamep,
|
|||||||
case 'h':
|
case 'h':
|
||||||
case 'x': displayArg(nodep,&elistp,isScan, vfmt,'x'); break;
|
case 'x': displayArg(nodep,&elistp,isScan, vfmt,'x'); break;
|
||||||
case 's': displayArg(nodep,&elistp,isScan, vfmt,'s'); break;
|
case 's': displayArg(nodep,&elistp,isScan, vfmt,'s'); break;
|
||||||
|
case 'e': displayArg(nodep,&elistp,isScan, vfmt,'e'); break;
|
||||||
|
case 'f': displayArg(nodep,&elistp,isScan, vfmt,'f'); break;
|
||||||
|
case 'g': displayArg(nodep,&elistp,isScan, vfmt,'g'); break;
|
||||||
case 'm': {
|
case 'm': {
|
||||||
if (!scopenamep) nodep->v3fatalSrc("Display with %m but no AstScopeName");
|
if (!scopenamep) nodep->v3fatalSrc("Display with %m but no AstScopeName");
|
||||||
string suffix = scopenamep->scopePrettyName();
|
string suffix = scopenamep->scopePrettyName();
|
||||||
@@ -1420,6 +1450,7 @@ void EmitCImp::emitStaticDecl(AstNodeModule* modp) {
|
|||||||
// Need implementation here. Be careful of alignment code; needs to be uniquified
|
// Need implementation here. Be careful of alignment code; needs to be uniquified
|
||||||
// with module name to avoid multiple symbols.
|
// with module name to avoid multiple symbols.
|
||||||
//emitVarList(modp->stmtsp(), EVL_ALL, modp->name());
|
//emitVarList(modp->stmtsp(), EVL_ALL, modp->name());
|
||||||
|
puts(""); // NOP for cppcheck, otherwise const function
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmitCImp::emitTextSection(AstType type) {
|
void EmitCImp::emitTextSection(AstType type) {
|
||||||
@@ -2011,7 +2042,9 @@ class EmitCTrace : EmitCStmts {
|
|||||||
return varp->isSc() && varp->isScBv();
|
return varp->isSc() && varp->isScBv();
|
||||||
}
|
}
|
||||||
void emitTraceInitOne(AstTraceDecl* nodep) {
|
void emitTraceInitOne(AstTraceDecl* nodep) {
|
||||||
if (nodep->isWide()) {
|
if (nodep->isDouble()) {
|
||||||
|
puts("vcdp->declDouble");
|
||||||
|
} else if (nodep->isWide()) {
|
||||||
puts("vcdp->declArray");
|
puts("vcdp->declArray");
|
||||||
} else if (nodep->isQuad()) {
|
} else if (nodep->isQuad()) {
|
||||||
puts("vcdp->declQuad ");
|
puts("vcdp->declQuad ");
|
||||||
@@ -2040,7 +2073,9 @@ class EmitCTrace : EmitCStmts {
|
|||||||
string full = ((m_funcp->funcType() == AstCFuncType::TRACE_FULL
|
string full = ((m_funcp->funcType() == AstCFuncType::TRACE_FULL
|
||||||
|| m_funcp->funcType() == AstCFuncType::TRACE_FULL_SUB)
|
|| m_funcp->funcType() == AstCFuncType::TRACE_FULL_SUB)
|
||||||
? "full":"chg");
|
? "full":"chg");
|
||||||
if (nodep->isWide() || emitTraceIsScBv(nodep)) {
|
if (nodep->isDouble()) {
|
||||||
|
puts("vcdp->"+full+"Double");
|
||||||
|
} else if (nodep->isWide() || emitTraceIsScBv(nodep)) {
|
||||||
puts("vcdp->"+full+"Array");
|
puts("vcdp->"+full+"Array");
|
||||||
} else if (nodep->isQuad()) {
|
} else if (nodep->isQuad()) {
|
||||||
puts("vcdp->"+full+"Quad ");
|
puts("vcdp->"+full+"Quad ");
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
@@ -48,11 +48,12 @@ class EmitCInlines : EmitCBaseVisitor {
|
|||||||
virtual void visit(AstVar* nodep, AstNUser*) {
|
virtual void visit(AstVar* nodep, AstNUser*) {
|
||||||
// All wide constants load into variables, so we can just hunt for them
|
// All wide constants load into variables, so we can just hunt for them
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (nodep->widthWords() >= EMITCINLINES_NUM_CONSTW ) {
|
int words = nodep->widthWords();
|
||||||
if (int(m_wordWidths.size()) <= nodep->widthWords()) {
|
if (words >= EMITCINLINES_NUM_CONSTW ) {
|
||||||
m_wordWidths.resize(nodep->widthWords()+5);
|
if (int(m_wordWidths.size()) <= words) {
|
||||||
|
m_wordWidths.resize(words+5);
|
||||||
}
|
}
|
||||||
++ m_wordWidths.at(nodep->widthWords());
|
++ m_wordWidths.at(words);
|
||||||
v3Global.needHInlines(true);
|
v3Global.needHInlines(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -7,7 +7,7 @@
|
|||||||
//
|
//
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright 2003-2011 by Wilson Snyder. This program is free software; you can
|
// Copyright 2003-2012 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
|
||||||
// Lesser General Public License Version 3 or the Perl Artistic License
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
// Version 2.0.
|
// Version 2.0.
|
||||||
@@ -526,8 +526,8 @@ void EmitCSyms::emitDpiHdr() {
|
|||||||
puts("#endif\n");
|
puts("#endif\n");
|
||||||
puts("\n");
|
puts("\n");
|
||||||
|
|
||||||
bool firstExp = false;
|
int firstExp = 0;
|
||||||
bool firstImp = false;
|
int firstImp = 0;
|
||||||
for (vector<AstCFunc*>::iterator it = m_dpis.begin(); it != m_dpis.end(); ++it) {
|
for (vector<AstCFunc*>::iterator it = m_dpis.begin(); it != m_dpis.end(); ++it) {
|
||||||
AstCFunc* nodep = *it;
|
AstCFunc* nodep = *it;
|
||||||
if (nodep->dpiExportWrapper()) {
|
if (nodep->dpiExportWrapper()) {
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user