Merge from master for release.
This commit is contained in:
commit
8cc31c6cf1
|
|
@ -29,7 +29,7 @@ jobs:
|
|||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-22.04, ubuntu-20.04, ubuntu-18.04]
|
||||
os: [ubuntu-22.04, ubuntu-20.04]
|
||||
compiler:
|
||||
- { cc: clang, cxx: clang++ }
|
||||
- { cc: gcc, cxx: g++ }
|
||||
|
|
@ -97,7 +97,7 @@ jobs:
|
|||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-22.04, ubuntu-20.04, ubuntu-18.04]
|
||||
os: [ubuntu-22.04, ubuntu-20.04]
|
||||
compiler:
|
||||
- { cc: clang, cxx: clang++ }
|
||||
- { cc: gcc, cxx: g++ }
|
||||
|
|
|
|||
|
|
@ -0,0 +1,51 @@
|
|||
# DESCRIPTION: Github actions config
|
||||
# This name is key to badges in README.rst, so we use the name build
|
||||
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
name: msbuild
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 0 * * 0' # weekly
|
||||
|
||||
env:
|
||||
CI_OS_NAME: win
|
||||
CI_COMMIT: ${{ github.sha }}
|
||||
CCACHE_COMPRESS: 1
|
||||
CCACHE_DIR: ${{ github.workspace }}/.ccache
|
||||
CCACHE_LIMIT_MULTIPLE: 0.95
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: repo
|
||||
|
||||
jobs:
|
||||
|
||||
windows:
|
||||
name: run on windows
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
path: repo
|
||||
- name: Cache $CCACHE_DIR
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ${{ env.CCACHE_DIR }}
|
||||
key: msbuild-msvc-cmake
|
||||
- name: compile
|
||||
env:
|
||||
WIN_FLEX_BISON: ${{ github.workspace }}/.ccache
|
||||
run: ./ci/ci-win-compile.ps1
|
||||
- name: test build
|
||||
run: ./ci/ci-win-test.ps1
|
||||
- name: Zip up repository
|
||||
run: Compress-Archive -LiteralPath install -DestinationPath verilator.zip
|
||||
- name: Upload zip archive
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
path: ${{ github.workspace }}/repo/verilator.zip
|
||||
name: verilator-win.zip
|
||||
|
|
@ -0,0 +1,123 @@
|
|||
#*****************************************************************************
|
||||
#
|
||||
# DESCRIPTION: Script for build tool cmake on both unix and windows
|
||||
#
|
||||
#*****************************************************************************
|
||||
#
|
||||
# Copyright 2003-2023 by Wilson Snyder. This program 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.
|
||||
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
#
|
||||
#****************************************************************************/
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
cmake_policy(SET CMP0091 NEW) # Use MSVC_RUNTIME_LIBRARY to select the runtime
|
||||
project(Verilator
|
||||
VERSION 5.003
|
||||
HOMEPAGE_URL https://verilator.org
|
||||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
option(DEBUG_AND_RELEASE_AND_COVERAGE
|
||||
"Builds both the debug and release binaries, overriding CMAKE_BUILD_TYPE. Not supported under MSBuild.")
|
||||
|
||||
set(PYTHON3 python)
|
||||
set(CMAKE_INSTALL_DATADIR ${CMAKE_INSTALL_PREFIX})
|
||||
include(GNUInstallDirs)
|
||||
include(CMakePackageConfigHelpers)
|
||||
include(CheckStructHasMember)
|
||||
include(ExternalProject)
|
||||
|
||||
if (NOT WIN32)
|
||||
message(WARNING "CMake support on Linux/OSX is experimental.")
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
if (DEFINED ENV{WIN_FLEX_BISON})
|
||||
set(WIN_FLEX_BISON "$ENV{WIN_FLEX_BISON}")
|
||||
endif()
|
||||
if (EXISTS ${WIN_FLEX_BISON})
|
||||
list(APPEND CMAKE_PREFIX_PATH ${WIN_FLEX_BISON})
|
||||
endif()
|
||||
if (NOT WIN_FLEX_BISON)
|
||||
message(FATAL_ERROR "Please install https://github.com/lexxmark/winflexbison and set WIN_FLEX_BISON environment variable. Please use install cmake target after a successful build.")
|
||||
endif()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++20")
|
||||
else()
|
||||
if (NOT DEFINED ENV{FLEX_INCLUDE})
|
||||
message(FATAL_ERROR "Please set environment variable FLEX_INCLUDE to the directory containing FlexLexer.h")
|
||||
endif()
|
||||
set(WIN_FLEX_BISON "$ENV{FLEX_INCLUDE}")
|
||||
if (WIN32 AND NOT MINGW)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++20")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_package(BISON)
|
||||
find_package(FLEX)
|
||||
|
||||
# Build
|
||||
#set_property(GLOBAL PROPERTY JOB_POOLS one_job=1)
|
||||
|
||||
if (DEBUG_AND_RELEASE_AND_COVERAGE)
|
||||
if (CMAKE_GENERATOR MATCHES "^Visual Studio ")
|
||||
error("%Error: The DEBUG_AND_RELEASE_AND_COVERAGE option is not supported in MSBuild-based builds.")
|
||||
endif()
|
||||
set(saved_build_type ${CMAKE_BUILD_TYPE})
|
||||
set(CMAKE_BUILD_TYPE Debug)
|
||||
add_subdirectory(src build-Debug)
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
add_subdirectory(src build-Release)
|
||||
set(CMAKE_BUILD_TYPE Coverage)
|
||||
add_subdirectory(src build-Coverage)
|
||||
set(CMAKE_BUILD_TYPE ${saved_build_type})
|
||||
else()
|
||||
add_subdirectory(src)
|
||||
endif()
|
||||
|
||||
# Configuration and Installation
|
||||
|
||||
set(PACKAGE_NAME ${PROJECT_NAME})
|
||||
set(PACKAGE_VERSION ${PROJECT_VERSION})
|
||||
|
||||
configure_file(include/verilated_config.h.in include/verilated_config.h @ONLY)
|
||||
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/include/verilated_config.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
|
||||
|
||||
configure_package_config_file(verilator-config.cmake.in verilator-config.cmake
|
||||
INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}
|
||||
)
|
||||
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/verilator-config.cmake DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
|
||||
configure_package_config_file(verilator-config-version.cmake.in verilator-config-version.cmake
|
||||
INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}
|
||||
)
|
||||
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/verilator-config-version.cmake DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
|
||||
foreach (program
|
||||
verilator_gantt
|
||||
verilator_ccache_report
|
||||
verilator_difftree
|
||||
verilator_profcfunc
|
||||
)
|
||||
install(PROGRAMS bin/${program} TYPE BIN)
|
||||
endforeach()
|
||||
|
||||
install(DIRECTORY examples TYPE DATA FILES_MATCHING
|
||||
PATTERN "examples/*/*.[chv]*"
|
||||
PATTERN "examples/*/Makefile*"
|
||||
PATTERN "examples/*/CMakeLists.txt"
|
||||
)
|
||||
|
||||
install(DIRECTORY include TYPE DATA FILES_MATCHING
|
||||
PATTERN "include/verilated_config.h"
|
||||
PATTERN "include/verilated.mk"
|
||||
PATTERN "include/*.[chv]"
|
||||
PATTERN "include/*.cpp"
|
||||
PATTERN "include/gtkwave/*.[chv]*"
|
||||
PATTERN "include/vltstd/*.[chv]*"
|
||||
)
|
||||
46
Changes
46
Changes
|
|
@ -8,6 +8,44 @@ The changes in each Verilator version are described below. The
|
|||
contributors that suggested a given feature are shown in []. Thanks!
|
||||
|
||||
|
||||
Verilator 5.006 2022-01-22
|
||||
==========================
|
||||
|
||||
**Minor:**
|
||||
|
||||
* Support clocking blocks (#3674). [Krzysztof Bieganski, Antmicro Ltd]
|
||||
* Support packed structs (#3802). [Aleksander Kiryk, Antmicro Ltd]
|
||||
* Support Windows-native builds using cmake (#3814). [Kritik Bhimani]
|
||||
* Support p format for UnpackArray (#3877). [Aleksander Kiryk, Antmicro Ltd]
|
||||
* Support property calls without parenthesis (#3879) (#3893). [Ryszard Rozak, Antmicro Ltd]
|
||||
* Support import/export lists in modport (#3886). [Gökçe Aydos]
|
||||
* Support class queue equality (#3895). [Ilya Barkov]
|
||||
* Add IMPLICITSTATIC warning when a ftask/function is implicitly static (#3839). [Ryszard Rozak, Antmicro Ltd]
|
||||
* Add VL_VALUE_STRING_MAX_WORDS override (#3869). [Andrew Nolte]
|
||||
* Optimize expansion of extend operators.
|
||||
* Internal multithreading tests. [Mariusz Glebocki, et al, Antmicro Ltd]
|
||||
* Fix VPI one-time timed callbacks (#2778). [Marlon James, et al]
|
||||
* Fix initiation of function variables (#3815). [Dan Gisselquist]
|
||||
* Fix to zero possibly uninitialized bits in replications (#3815).
|
||||
* Fix crash in DFT due to width use after free (#3817) (#3820). [Jevin Sweval]
|
||||
* Fix signed/unsigned comparison compile warning (#3822). [Kamil Rakoczy]
|
||||
* Fix OS-X weak symbols with -U linker flag (#3823). [Jevin Sweval]
|
||||
* Fix wrong bit op tree optimization (#3824) (#3825). [Yutetsu TAKATSUKASA]
|
||||
* Fix self references when param class instantiated (#3833). [Ryszard Rozak, Antmicro Ltd]
|
||||
* Fix memory leak in V3Sched, etc. (#3834). [Geza Lore]
|
||||
* Fix compatibility with musl libc / Alpine Linux (#3845). [Sören Tempel]
|
||||
* Fix empty case items crash (#3851). [rporter]
|
||||
* Fix VL_CPU_RELAX on MIPS/Armel/s390/sparc (#3843) (#3891). [Kamil Rakoczy]
|
||||
* Fix module parameter name collision (#3854) (#3855). [James Shi]
|
||||
* Fix unpacked array expansion (#3861). [Joey Liu]
|
||||
* Fix signed/unsigned parameter types (#3866). [James Shi]
|
||||
* Fix chain call of abstract class constructor (#3868) (#3883). [Ilya Barkov]
|
||||
* Fix to use same std in Verilator and Verilated compile (#3881). [Kamil Rakoczy, Antmicro Ltd]
|
||||
* Fix foreach unnamedblk duplicate error (#3885). [Ilya Barkov]
|
||||
* Fix elaboration of member selected classes (#3890). [Ilya Barkov]
|
||||
* Fix mismatched widths in DFG (#3872). [Geza Lore, Yike Zhou]
|
||||
|
||||
|
||||
Verilator 5.004 2022-12-14
|
||||
==========================
|
||||
|
||||
|
|
@ -36,7 +74,7 @@ Verilator 5.004 2022-12-14
|
|||
* Add error when use --exe with --lib-create (#3785). [Yinan Xu]
|
||||
* Fix jump handling in do while loops (#3731). [Ryszard Rozak, Antmicro Ltd]
|
||||
* Fix 'with' clause handling in functions (#3739). [Ryszard Rozak, Antmicro Ltd]
|
||||
* Fix CONTEXT compile error on mingw64 (#3741). [William D. Jones]
|
||||
* Fix CONTEXT compile error on MingW (#3741). [William D. Jones]
|
||||
* Fix MSVC compiler errors (#3742) (#3746). [Kritik Bhimani]
|
||||
* Fix CASEINCOMPLETE when covers all enum values (#3745) (#3782). [Guy-Armand Kamendje]
|
||||
* Fix return type of $countbits functions to int (#3725). [Ryszard Rozak, Antmicro Ltd]
|
||||
|
|
@ -45,9 +83,9 @@ Verilator 5.004 2022-12-14
|
|||
* Fix missing UNUSED warnings with --coverage (#3736). [alejandro-castro-ortegon]
|
||||
* Fix tracing parameters overridden with -G (#3723). [Iztok Jeras]
|
||||
* Fix folding of LogAnd with non-bool operands (#3726). [Geza Lore]
|
||||
* Fix Dfg optimization issues (#3740) (#3771). [Geza Lore]
|
||||
* Fix DFG optimization issues (#3740) (#3771). [Geza Lore]
|
||||
* Fix pre/postincrement operations (#3744) (#3756). [Ryszard Rozak, Antmicro Ltd]
|
||||
* Fix cross-compile for MingW, Arm and RiscV (#3752). [Miodrag Milanović]
|
||||
* Fix cross-compile for MingW, Arm and RISC-V (#3752). [Miodrag Milanović]
|
||||
* Fix $unit as base package for other packages (#3755). [Ryszard Rozak, Antmicro Ltd]
|
||||
* Fix make jobserver with submakes (#3758). [Gus Smith]
|
||||
* Fix to escape VERILATOR_ROOT file paths (#3764) (#3765). [Jiacheng Qian]
|
||||
|
|
@ -4041,7 +4079,7 @@ Verilator 0.0 1994-07-08
|
|||
Copyright
|
||||
=========
|
||||
|
||||
Copyright 2001-2022 by Wilson Snyder. This program is free software; you
|
||||
Copyright 2001-2023 by Wilson Snyder. This program 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.
|
||||
|
|
|
|||
21
Makefile.in
21
Makefile.in
|
|
@ -7,7 +7,7 @@
|
|||
#
|
||||
#*****************************************************************************
|
||||
#
|
||||
# Copyright 2003-2022 by Wilson Snyder. This program is free software; you
|
||||
# Copyright 2003-2023 by Wilson Snyder. This program 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.
|
||||
|
|
@ -53,7 +53,6 @@ INSTALL_DATA = @INSTALL_DATA@
|
|||
MAKEINFO = makeinfo
|
||||
POD2TEXT = pod2text
|
||||
MKINSTALLDIRS = $(SHELL) $(srcdir)/src/mkinstalldirs
|
||||
PERL = @PERL@
|
||||
|
||||
# Version (for docs/guide/conf.py)
|
||||
PACKAGE_VERSION_NUMBER = @PACKAGE_VERSION_NUMBER@
|
||||
|
|
@ -126,7 +125,12 @@ EXAMPLES_FIRST = \
|
|||
EXAMPLES = $(EXAMPLES_FIRST) $(filter-out $(EXAMPLES_FIRST), $(sort $(wildcard examples/*)))
|
||||
|
||||
# See uninstall also - don't put wildcards in this variable, it might uninstall other stuff
|
||||
VL_INST_MAN_FILES = verilator.1 verilator_coverage.1
|
||||
# No verilator_ccache_report.1, verilator_difftree.1 as those are not bin/ installed
|
||||
VL_INST_MAN_FILES = \
|
||||
verilator.1 \
|
||||
verilator_coverage.1 \
|
||||
verilator_gantt.1 \
|
||||
verilator_profcfunc.1 \
|
||||
|
||||
default: all
|
||||
all: all_nomsg msg_test
|
||||
|
|
@ -179,8 +183,12 @@ docs: info
|
|||
|
||||
info: $(INFOS)
|
||||
|
||||
%.1: ${srcdir}/bin/%
|
||||
verilator.1: ${srcdir}/bin/verilator
|
||||
pod2man $< $@
|
||||
verilator_coverage.1: ${srcdir}/bin/verilator_coverage
|
||||
pod2man $< $@
|
||||
%.1: ${srcdir}/bin/%
|
||||
help2man --no-info --no-discard-stderr --version-string=- $< -o $@
|
||||
|
||||
.PHONY: verilator.html
|
||||
verilator.html:
|
||||
|
|
@ -193,7 +201,7 @@ verilator.pdf: Makefile
|
|||
|
||||
# See uninstall also - don't put wildcards in this variable, it might uninstall other stuff
|
||||
VL_INST_BIN_FILES = verilator verilator_bin$(EXEEXT) verilator_bin_dbg$(EXEEXT) verilator_coverage_bin_dbg$(EXEEXT) \
|
||||
verilator_ccache_report verilator_coverage verilator_gantt verilator_includer verilator_profcfunc
|
||||
verilator_ccache_report verilator_coverage verilator_difftree verilator_gantt verilator_includer verilator_profcfunc
|
||||
# Some scripts go into both the search path and pkgdatadir,
|
||||
# so they can be found by the user, and under $VERILATOR_ROOT.
|
||||
|
||||
|
|
@ -226,6 +234,7 @@ installbin:
|
|||
$(MKINSTALLDIRS) $(DESTDIR)$(pkgdatadir)/bin
|
||||
( cd ${srcdir}/bin ; $(INSTALL_PROGRAM) verilator_includer $(DESTDIR)$(pkgdatadir)/bin/verilator_includer )
|
||||
( cd ${srcdir}/bin ; $(INSTALL_PROGRAM) verilator_ccache_report $(DESTDIR)$(pkgdatadir)/bin/verilator_ccache_report )
|
||||
( cd ${srcdir}/bin ; $(INSTALL_PROGRAM) verilator_difftree $(DESTDIR)$(pkgdatadir)/bin/verilator_difftree )
|
||||
|
||||
# Man files can either be part of the original kit, or built in current directory
|
||||
# So important we use $^ so VPATH is searched
|
||||
|
|
@ -384,6 +393,7 @@ PY_PROGRAMS = \
|
|||
bin/verilator_ccache_report \
|
||||
bin/verilator_difftree \
|
||||
bin/verilator_gantt \
|
||||
bin/verilator_includer \
|
||||
bin/verilator_profcfunc \
|
||||
examples/xml_py/vl_file_copy \
|
||||
examples/xml_py/vl_hier_graph \
|
||||
|
|
@ -397,6 +407,7 @@ PY_PROGRAMS = \
|
|||
src/flexfix \
|
||||
src/vlcovgen \
|
||||
test_regress/t/*.pf \
|
||||
nodist/clang_check_attributes \
|
||||
nodist/code_coverage \
|
||||
nodist/dot_importer \
|
||||
nodist/fuzzer/actual_fail \
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ Related Projects
|
|||
Open License
|
||||
============
|
||||
|
||||
Verilator is Copyright 2003-2022 by Wilson Snyder. (Report bugs to
|
||||
Verilator is Copyright 2003-2023 by Wilson Snyder. (Report bugs to
|
||||
`Verilator Issues <https://verilator.org/issues>`_.)
|
||||
|
||||
Verilator is free software; you can redistribute it and/or modify it under
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env perl
|
||||
######################################################################
|
||||
#
|
||||
# Copyright 2003-2022 by Wilson Snyder. This program is free software; you
|
||||
# Copyright 2003-2023 by Wilson Snyder. This program 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.
|
||||
|
|
@ -416,6 +416,7 @@ detailed descriptions of these arguments.
|
|||
--no-skip-identical Disable skipping identical output
|
||||
--stats Create statistics file
|
||||
--stats-vars Provide statistics on variables
|
||||
--structs-packed Convert all unpacked structures to packed structures
|
||||
-sv Enable SystemVerilog parsing
|
||||
+systemverilogext+<ext> Synonym for +1800-2017ext+<ext>
|
||||
--threads <threads> Enable multithreading
|
||||
|
|
@ -444,7 +445,7 @@ detailed descriptions of these arguments.
|
|||
--unused-regexp <regexp> Tune UNUSED lint signals
|
||||
-V Verbose version and config
|
||||
-v <filename> Verilog library
|
||||
--no-verilate Skip verilation and just compile previously Verilated code
|
||||
--no-verilate Skip Verilation and just compile previously Verilated code
|
||||
+verilog1995ext+<ext> Synonym for +1364-1995ext+<ext>
|
||||
+verilog2001ext+<ext> Synonym for +1364-2001ext+<ext>
|
||||
--version Displays program version and exits
|
||||
|
|
@ -495,7 +496,7 @@ description of these arguments.
|
|||
|
||||
The latest version is available from L<https://verilator.org>.
|
||||
|
||||
Copyright 2003-2022 by Wilson Snyder. This program is free software; you can
|
||||
Copyright 2003-2023 by Wilson Snyder. This program is free software; you can
|
||||
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
|
||||
License Version 2.0.
|
||||
|
|
|
|||
|
|
@ -12,9 +12,12 @@ from datetime import datetime
|
|||
parser = argparse.ArgumentParser(
|
||||
allow_abbrev=False,
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||
description="""Report ccache behavior of a Verilated model build.""",
|
||||
description="""Report ccache behavior of a Verilated model build.
|
||||
|
||||
For documentation see
|
||||
https://verilator.org/guide/latest/exe_verilator_ccache_report.html""",
|
||||
epilog=
|
||||
"""Copyright 2002-2022 by Wilson Snyder. This program is free software; you
|
||||
"""Copyright 2002-2023 by Wilson Snyder. This program 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.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env perl
|
||||
######################################################################
|
||||
#
|
||||
# Copyright 2003-2022 by Wilson Snyder. This program is free software; you
|
||||
# Copyright 2003-2023 by Wilson Snyder. This program 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.
|
||||
|
|
@ -187,7 +187,7 @@ L<https://verilator.org/guide/latest/exe_verilator_coverage.html>.
|
|||
|
||||
The latest version is available from L<https://verilator.org>.
|
||||
|
||||
Copyright 2003-2022 by Wilson Snyder. This program is free software; you
|
||||
Copyright 2003-2023 by Wilson Snyder. This program is free software; you
|
||||
can 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 License Version 2.0.
|
||||
|
|
|
|||
|
|
@ -104,16 +104,13 @@ def filterf(fn1, fn2):
|
|||
parser = argparse.ArgumentParser(
|
||||
allow_abbrev=False,
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||
description="""Compare two Verilator debugging trees""",
|
||||
epilog=
|
||||
"""Verilator_difftree is used for debugging Verilator tree output files.
|
||||
description="""Compare two Verilator debugging trees.
|
||||
|
||||
Verilator_difftree is used for debugging Verilator tree output files.
|
||||
It performs a diff between two files, or all files common between two
|
||||
directories, ignoring irrelevant pointer differences.
|
||||
|
||||
For documentation see
|
||||
https://verilator.org/guide/latest/exe_verilator_difftree.html
|
||||
|
||||
Copyright 2005-2022 by Wilson Snyder. This program is free software; you
|
||||
directories, ignoring irrelevant pointer differences.""",
|
||||
epilog=
|
||||
"""Copyright 2005-2023 by Wilson Snyder. This program 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.
|
||||
|
|
|
|||
|
|
@ -475,16 +475,16 @@ def write_vcd(filename):
|
|||
parser = argparse.ArgumentParser(
|
||||
allow_abbrev=False,
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||
description="""Create Gantt chart of multi-threaded execution""",
|
||||
epilog=
|
||||
"""Verilator_gantt creates a visual representation to help analyze Verilator
|
||||
description="""Create Gantt chart of multi-threaded execution.
|
||||
|
||||
Verilator_gantt creates a visual representation to help analyze Verilator
|
||||
#xmultithreaded simulation performance, by showing when each macro-task
|
||||
#xstarts and ends, and showing when each thread is busy or idle.
|
||||
|
||||
For documentation see
|
||||
https://verilator.org/guide/latest/exe_verilator_gantt.html
|
||||
|
||||
Copyright 2018-2022 by Wilson Snyder. This program is free software; you
|
||||
https://verilator.org/guide/latest/exe_verilator_gantt.html""",
|
||||
epilog=
|
||||
"""Copyright 2018-2023 by Wilson Snyder. This program 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.
|
||||
|
|
|
|||
|
|
@ -1,20 +1,29 @@
|
|||
#!/usr/bin/env perl
|
||||
# DESCRIPTION: Print include statements for each ARGV
|
||||
#!/usr/bin/env python3
|
||||
# pylint: disable=C0114,C0209
|
||||
#
|
||||
# Copyright 2003-2023 by Wilson Snyder. This program is free software; you
|
||||
# can 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 License Version 2.0.
|
||||
#
|
||||
# Copyright 2003-2022 by Wilson Snyder. This program 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.
|
||||
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
######################################################################
|
||||
|
||||
require 5.005;
|
||||
use warnings;
|
||||
print "// DESCR" . "IPTION: Generated by verilator_includer via makefile\n";
|
||||
foreach my $param (@ARGV) {
|
||||
if ($param =~ /^-D([^=]+)=(.*)/) {
|
||||
print "#define $1 $2\n";
|
||||
} else {
|
||||
print "#include \"$param\"\n";
|
||||
}
|
||||
}
|
||||
import re
|
||||
import sys
|
||||
|
||||
print("// DESCR" + "IPTION: Generated by verilator_includer via makefile")
|
||||
|
||||
re_arg_d = re.compile(r'^-D([^=]+)=(.*)')
|
||||
|
||||
for arg in sys.argv[1:]:
|
||||
match_d = re_arg_d.match(arg)
|
||||
if match_d:
|
||||
print("#define %s %s" % (match_d.group(1), match_d.group(2)))
|
||||
else:
|
||||
print("#include \"%s\"" % (arg))
|
||||
|
||||
######################################################################
|
||||
# Local Variables:
|
||||
# compile-command: "./verilator_includer -Ddef=value -Ddef2=value2 file1.h file2.h"
|
||||
# End:
|
||||
|
|
|
|||
|
|
@ -171,17 +171,17 @@ def profcfunc(filename):
|
|||
parser = argparse.ArgumentParser(
|
||||
allow_abbrev=False,
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||
description="""Read gprof report created with --prof-cfuncs""",
|
||||
epilog=
|
||||
"""Verilator_profcfunc reads a profile report created by gprof. The names of
|
||||
description="""Read gprof report created with --prof-cfuncs.
|
||||
|
||||
Verilator_profcfunc reads a profile report created by gprof. The names of
|
||||
the functions are then transformed, assuming the user used Verilator's
|
||||
--prof-cfuncs, and a report printed showing the percentage of time, etc,
|
||||
in each Verilog block.
|
||||
|
||||
For documentation see
|
||||
https://verilator.org/guide/latest/exe_verilator_profcfunc.html
|
||||
|
||||
Copyright 2002-2022 by Wilson Snyder. This program is free software; you
|
||||
https://verilator.org/guide/latest/exe_verilator_profcfunc.html""",
|
||||
epilog=
|
||||
"""Copyright 2002-2023 by Wilson Snyder. This program 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.
|
||||
|
|
|
|||
|
|
@ -57,19 +57,24 @@ if [ "$CI_BUILD_STAGE_NAME" = "build" ]; then
|
|||
# build Verilator
|
||||
|
||||
if [ "$CI_OS_NAME" = "linux" ]; then
|
||||
sudo apt-get update ||
|
||||
sudo apt-get update
|
||||
sudo apt-get install libfl-dev ccache
|
||||
sudo apt-get install ccache help2man libfl-dev ||
|
||||
sudo apt-get install ccache help2man libfl-dev
|
||||
if [ "$CI_RUNS_ON" != "ubuntu-22.04" ]; then
|
||||
# Some conflict of libunwind verison on 22.04, can live without it for now
|
||||
sudo apt-get install libgoogle-perftools-dev ||
|
||||
sudo apt-get install libgoogle-perftools-dev
|
||||
fi
|
||||
if [ "$CI_RUNS_ON" = "ubuntu-20.04" ] || [ "$CI_RUNS_ON" = "ubuntu-22.04" ]; then
|
||||
sudo apt-get install libsystemc libsystemc-dev ||
|
||||
sudo apt-get install libsystemc libsystemc-dev
|
||||
fi
|
||||
if [ "$COVERAGE" = 1 ]; then
|
||||
yes yes | sudo cpan -fi Parallel::Forker
|
||||
fi
|
||||
if [ "$CI_M32" = 1 ]; then
|
||||
sudo apt-get install gcc-multilib g++-multilib ||
|
||||
sudo apt-get install gcc-multilib g++-multilib
|
||||
fi
|
||||
elif [ "$CI_OS_NAME" = "osx" ]; then
|
||||
|
|
@ -90,13 +95,23 @@ elif [ "$CI_BUILD_STAGE_NAME" = "test" ]; then
|
|||
# run the tests
|
||||
|
||||
if [ "$CI_OS_NAME" = "linux" ]; then
|
||||
sudo apt-get update ||
|
||||
sudo apt-get update
|
||||
# libfl-dev needed for internal coverage's test runs
|
||||
sudo apt-get install gdb gtkwave lcov libfl-dev ccache ||
|
||||
sudo apt-get install gdb gtkwave lcov libfl-dev ccache
|
||||
# Required for test_regress/t/t_dist_attributes.pl
|
||||
if [ "$CI_RUNS_ON" = "ubuntu-22.04" ]; then
|
||||
sudo apt-get install libclang-dev ||
|
||||
sudo apt-get install libclang-dev
|
||||
pip3 install clang==14.0
|
||||
fi
|
||||
if [ "$CI_RUNS_ON" = "ubuntu-20.04" ] || [ "$CI_RUNS_ON" = "ubuntu-22.04" ]; then
|
||||
sudo apt-get install libsystemc-dev ||
|
||||
sudo apt-get install libsystemc-dev
|
||||
fi
|
||||
if [ "$CI_M32" = 1 ]; then
|
||||
sudo apt-get install lib32z1-dev gcc-multilib g++-multilib ||
|
||||
sudo apt-get install lib32z1-dev gcc-multilib g++-multilib
|
||||
fi
|
||||
elif [ "$CI_OS_NAME" = "osx" ]; then
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ elif [ "$CI_BUILD_STAGE_NAME" = "test" ]; then
|
|||
|
||||
if [ "$CI_OS_NAME" = "osx" ]; then
|
||||
export VERILATOR_TEST_NO_GDB=1 # Pain to get GDB to work on OS X
|
||||
# TODO below may no longer be requried as configure checks for -pg
|
||||
# TODO below may no longer be required as configure checks for -pg
|
||||
export VERILATOR_TEST_NO_GPROF=1 # Apple Clang has no -pg
|
||||
# export PATH="/Applications/gtkwave.app/Contents/Resources/bin:$PATH" # fst2vcd
|
||||
file bin/verilator_bin
|
||||
|
|
@ -85,7 +85,7 @@ elif [ "$CI_BUILD_STAGE_NAME" = "test" ]; then
|
|||
"$MAKE" -j "$NPROC" -k
|
||||
elif [ "$CI_OS_NAME" = "freebsd" ]; then
|
||||
export VERILATOR_TEST_NO_GDB=1 # Disable for now, ideally should run
|
||||
# TODO below may no longer be requried as configure checks for -pg
|
||||
# TODO below may no longer be required as configure checks for -pg
|
||||
export VERILATOR_TEST_NO_GPROF=1 # gprof is a bit different on FreeBSD, disable
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
if (-Not (Test-Path $PWD/../.ccache/win_bison.exe)) {
|
||||
git clone --depth 1 https://github.com/lexxmark/winflexbison
|
||||
cd winflexbison
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. --install-prefix $PWD/../../../.ccache
|
||||
cmake --build . --config Release
|
||||
cmake --install . --prefix $PWD/../../../.ccache
|
||||
cd ../..
|
||||
}
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. --install-prefix $PWD/../install
|
||||
cmake --build . --config Release
|
||||
cmake --install . --prefix $PWD/../install
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
cd install
|
||||
$Env:VERILATOR_ROOT=$PWD
|
||||
cd examples/cmake_tracing_c
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
cmake --build . --config Release
|
||||
Release/example.exe
|
||||
cd ..
|
||||
Remove-Item -path build -recurse
|
||||
|
|
@ -23,6 +23,7 @@ RUN apt-get update \
|
|||
gdb \
|
||||
git \
|
||||
gtkwave \
|
||||
help2man \
|
||||
libfl2 \
|
||||
libfl-dev \
|
||||
libgoogle-perftools-dev \
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
.. Copyright 2003-2023 by Wilson Snyder.
|
||||
.. SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
Verilator Build Docker Container
|
||||
================================
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
.. Copyright 2003-2023 by Wilson Snyder.
|
||||
.. SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
Verilator Executable Docker Container
|
||||
=====================================
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# DESCRIPTION: codecov.io config
|
||||
#
|
||||
# Copyright 2020-2022 by Wilson Snyder. This program is free software; you
|
||||
# Copyright 2020-2023 by Wilson Snyder. This program 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.
|
||||
|
|
|
|||
26
configure.ac
26
configure.ac
|
|
@ -1,6 +1,6 @@
|
|||
# DESCRIPTION: Process this file with autoconf to produce a configure script.
|
||||
#
|
||||
# Copyright 2003-2022 by Wilson Snyder. Verilator is free software; you
|
||||
# Copyright 2003-2023 by Wilson Snyder. 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.
|
||||
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
# Then 'make maintainer-dist'
|
||||
#AC_INIT([Verilator],[#.### YYYY-MM-DD])
|
||||
#AC_INIT([Verilator],[#.### devel])
|
||||
AC_INIT([Verilator],[5.004 2022-12-14],
|
||||
AC_INIT([Verilator],[5.006 2023-01-22],
|
||||
[https://verilator.org],
|
||||
[verilator],[https://verilator.org])
|
||||
|
||||
|
|
@ -112,7 +112,7 @@ 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
|
||||
in Verilator binrary and Verilated makefiles])],
|
||||
in Verilator binary and Verilated makefiles])],
|
||||
[case "${enableval}" in
|
||||
yes) CFG_WITH_CCWARN=yes ;;
|
||||
no) CFG_WITH_CCWARN=no ;;
|
||||
|
|
@ -351,15 +351,11 @@ AC_SUBST(CFG_CXXFLAGS_PROFILE)
|
|||
# Currently enable c++17/c++14 due to packaged SystemC dependency
|
||||
# c++17 is the newest that Verilator is regularly tested to support
|
||||
# c++11 is the oldest that Verilator supports
|
||||
# gnu is requried for Cygwin to compile verilated.h successfully
|
||||
# gnu is required for Cygwin to compile verilated.h successfully
|
||||
#_MY_CXX_CHECK_SET(CFG_CXXFLAGS_STD_NEWEST,-std=gnu++20)
|
||||
#_MY_CXX_CHECK_SET(CFG_CXXFLAGS_STD_NEWEST,-std=c++20)
|
||||
case "$(which lsb_release 2>&1 > /dev/null && lsb_release -d)" in
|
||||
*Arch*Linux* | *Ubuntu*22.04*)
|
||||
_MY_CXX_CHECK_SET(CFG_CXXFLAGS_STD_NEWEST,-std=gnu++17)
|
||||
_MY_CXX_CHECK_SET(CFG_CXXFLAGS_STD_NEWEST,-std=c++17)
|
||||
;;
|
||||
esac
|
||||
_MY_CXX_CHECK_SET(CFG_CXXFLAGS_STD_NEWEST,-std=gnu++14)
|
||||
_MY_CXX_CHECK_SET(CFG_CXXFLAGS_STD_NEWEST,-std=c++14)
|
||||
_MY_CXX_CHECK_SET(CFG_CXXFLAGS_STD_NEWEST,-std=gnu++11)
|
||||
|
|
@ -532,15 +528,22 @@ AC_DEFUN([_MY_CXX_CHECK_CXX_VER],
|
|||
[_my_result=no])
|
||||
])
|
||||
|
||||
# Add $CFG_CXXFLAGS_STD only if can't compile correctly otherwise,
|
||||
# as adding std= when not needed can cause errors with the C++ std library.
|
||||
CFG_CXXFLAGS_STD=$CFG_CXXFLAGS_STD_NEWEST
|
||||
AC_MSG_CHECKING(whether $CXX supports C++11)
|
||||
_MY_CXX_CHECK_CXX_VER()
|
||||
AC_MSG_RESULT($_my_result)
|
||||
if test "$_my_result" = "no" ; then
|
||||
CXXFLAGS="$CXXFLAGS $CFG_CXXFLAGS_STD_NEWEST"
|
||||
CFG_CXX_FLAGS_CMAKE="$CFG_CXX_FLAGS_CMAKE $CFG_CXXFLAGS_STD_NEWEST"
|
||||
AC_MSG_CHECKING(whether $CXX supports C++11 with $CFG_CXXFLAGS_STD_NEWEST)
|
||||
CXXFLAGS="$CXXFLAGS $CFG_CXXFLAGS_STD"
|
||||
CFG_CXX_FLAGS_CMAKE="$CFG_CXX_FLAGS_CMAKE $CFG_CXXFLAGS_STD"
|
||||
AC_MSG_CHECKING(whether $CXX supports C++11 with $CFG_CXXFLAGS_STD)
|
||||
_MY_CXX_CHECK_CXX_VER()
|
||||
AC_MSG_RESULT($_my_result)
|
||||
else
|
||||
# CFG_CXXFLAGS_STD is also propagated to include/verilated.mk.in
|
||||
# make sure we use the same std flag while compiling verilator and verilated design
|
||||
CFG_CXXFLAGS_STD=""
|
||||
fi
|
||||
if test "$_my_result" = "no" ; then
|
||||
AC_MSG_NOTICE([[]])
|
||||
|
|
@ -549,6 +552,7 @@ if test "$_my_result" = "no" ; then
|
|||
Verilator requires a C++11 or newer compiler.]])
|
||||
|
||||
fi
|
||||
AC_SUBST(CFG_CXXFLAGS_STD)
|
||||
|
||||
# Checks for library functions.
|
||||
AC_CHECK_MEMBER([struct stat.st_mtim.tv_nsec],
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ Did you write a patch that fixes a bug?
|
|||
Creative Commons Public Domain (CC0), unless you request otherwise or
|
||||
put a GNU/Artistic license on your file.
|
||||
|
||||
- Most important is we get your patch. If you’d like to clean up
|
||||
- Most important is we get your patch. If you'd like to clean up
|
||||
indentation and related issues ahead of our feedback, that is
|
||||
appreciated; please see the coding conventions in `docs/internals
|
||||
<internals.rst>`__.
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ Garrett Smith
|
|||
Geza Lore
|
||||
Gianfranco Costamagna
|
||||
Glen Gibb
|
||||
Gökçe Aydos
|
||||
Graham Rushton
|
||||
Guokai Chen
|
||||
Gustav Svensk
|
||||
|
|
@ -45,18 +46,22 @@ HungMingWu
|
|||
HyungKi Jeong
|
||||
Iru Cai
|
||||
Ivan Vnučec
|
||||
Ilya Barkov
|
||||
Iztok Jeras
|
||||
Jake Merdich
|
||||
James Hanlon
|
||||
James Hutchinson
|
||||
James Pallister
|
||||
James Shi
|
||||
Jamey Hicks
|
||||
Jamie Iles
|
||||
Jan Van Winkel
|
||||
Jean Berniolles
|
||||
Jeremy Bennett
|
||||
Jevin Sweval
|
||||
Jiacheng Qian
|
||||
Jiuyang Liu
|
||||
Joey Liu
|
||||
John Coiner
|
||||
John Demme
|
||||
Jonathan Drolet
|
||||
|
|
@ -117,6 +122,7 @@ Sergi Granell
|
|||
Stefan Wallentowitz
|
||||
Stephen Henry
|
||||
Steven Hugg
|
||||
Sören Tempel
|
||||
Teng Huang
|
||||
Tim Snyder
|
||||
Tobias Rosenkranz
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#
|
||||
# Code available from: https://verilator.org
|
||||
#
|
||||
# Copyright 2003-2022 by Wilson Snyder. This program is free software; you
|
||||
# Copyright 2003-2023 by Wilson Snyder. This program 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.
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ parser = argparse.ArgumentParser(
|
|||
formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||
description="""Read a file and extract documentation data.""",
|
||||
epilog=
|
||||
""" Copyright 2021-2022 by Wilson Snyder. This package is free software;
|
||||
""" Copyright 2021-2023 by Wilson Snyder. This package 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.
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ parser = argparse.ArgumentParser(
|
|||
formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||
description="""Post-process Sphinx HTML.""",
|
||||
epilog=
|
||||
""" Copyright 2021-2022 by Wilson Snyder. This package is free software;
|
||||
""" Copyright 2021-2023 by Wilson Snyder. This package 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.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
.. Copyright 2003-2022 by Wilson Snyder.
|
||||
.. Copyright 2003-2023 by Wilson Snyder.
|
||||
.. SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
****************
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
# pylint: disable=C0103,C0114,C0116,C0301,E0402,W0622
|
||||
#
|
||||
# Configuration file for Verilator's Sphinx documentation builder.
|
||||
# Copyright 2003-2023 by Wilson Snyder.
|
||||
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
#
|
||||
# This file only contains overridden options. For a full list:
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
.. Copyright 2003-2022 by Wilson Snyder.
|
||||
.. Copyright 2003-2023 by Wilson Snyder.
|
||||
.. SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
.. _Connecting:
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
.. Copyright 2003-2022 by Wilson Snyder.
|
||||
.. Copyright 2003-2023 by Wilson Snyder.
|
||||
.. SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
*******************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
.. Copyright 2003-2022 by Wilson Snyder.
|
||||
.. Copyright 2003-2023 by Wilson Snyder.
|
||||
.. SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
.. Copyright 2003-2022 by Wilson Snyder.
|
||||
.. Copyright 2003-2023 by Wilson Snyder.
|
||||
.. SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
*********
|
||||
|
|
@ -8,7 +8,7 @@ Copyright
|
|||
The latest version of Verilator is available from `https://verilator.org
|
||||
<https://verilator.org>`_.
|
||||
|
||||
Copyright 2003-2022 by Wilson Snyder. This program is free software; you
|
||||
Copyright 2003-2023 by Wilson Snyder. This program is free software; you
|
||||
can 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 License Version 2.0.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
.. Copyright 2003-2022 by Wilson Snyder.
|
||||
.. Copyright 2003-2023 by Wilson Snyder.
|
||||
.. SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
Deprecations
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
.. Copyright 2003-2022 by Wilson Snyder.
|
||||
.. Copyright 2003-2023 by Wilson Snyder.
|
||||
.. SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
Environment
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
.. Copyright 2003-2022 by Wilson Snyder.
|
||||
.. Copyright 2003-2023 by Wilson Snyder.
|
||||
.. SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
.. _Example Create-Binary Execution:
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
.. Copyright 2003-2022 by Wilson Snyder.
|
||||
.. Copyright 2003-2023 by Wilson Snyder.
|
||||
.. SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
.. _Example C++ Execution:
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
.. Copyright 2003-2022 by Wilson Snyder.
|
||||
.. Copyright 2003-2023 by Wilson Snyder.
|
||||
.. SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
First you need Verilator installed, see :ref:`Installation`. In brief, if
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
.. Copyright 2003-2022 by Wilson Snyder.
|
||||
.. Copyright 2003-2023 by Wilson Snyder.
|
||||
.. SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
.. _Examples in the Distribution:
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
.. Copyright 2003-2022 by Wilson Snyder.
|
||||
.. Copyright 2003-2023 by Wilson Snyder.
|
||||
.. SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
.. _Example SystemC Execution:
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
.. Copyright 2003-2022 by Wilson Snyder.
|
||||
.. Copyright 2003-2023 by Wilson Snyder.
|
||||
.. SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
.. _Examples:
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
.. Copyright 2003-2022 by Wilson Snyder.
|
||||
.. Copyright 2003-2023 by Wilson Snyder.
|
||||
.. SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
.. _Simulation Runtime Arguments:
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
.. Copyright 2003-2022 by Wilson Snyder.
|
||||
.. Copyright 2003-2023 by Wilson Snyder.
|
||||
.. SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
verilator Arguments
|
||||
|
|
@ -1203,11 +1203,10 @@ Summary:
|
|||
|
||||
.. option:: --structs-packed
|
||||
|
||||
Converts all unpacked structures to packed structures and issues an
|
||||
:option:`UNPACKED` warning. Currently, this is the default, and
|
||||
:vlopt:`--no-structs-packed <--structs-packed>` will not work.
|
||||
Specifying this option allows forward compatibility when a future
|
||||
version of Verilator no longer always packs unpacked structures.
|
||||
Converts all unpacked structures to packed structures, and issues an
|
||||
:option:`UNPACKED` warning. Specifying this option allows for backward
|
||||
compatibility with versions before Verilator 5.006, when Verilator would
|
||||
always pack unpacked structures.
|
||||
|
||||
.. option:: -sv
|
||||
|
||||
|
|
@ -1503,7 +1502,7 @@ Summary:
|
|||
Disable all lint-related warning messages, and all style warnings. This is
|
||||
equivalent to ``-Wno-ALWCOMBORDER -Wno-BSSPACE -Wno-CASEINCOMPLETE
|
||||
-Wno-CASEOVERLAP -Wno-CASEX -Wno-CASTCONST -Wno-CASEWITHX -Wno-CMPCONST -Wno-COLONPLUS
|
||||
-Wno-IMPLICIT -Wno-LITENDIAN -Wno-PINCONNECTEMPTY
|
||||
-Wno-IMPLICIT -Wno-IMPLICITSTATIC -Wno-LITENDIAN -Wno-PINCONNECTEMPTY
|
||||
-Wno-PINMISSING -Wno-SYNCASYNCNET -Wno-UNDRIVEN -Wno-UNSIGNED
|
||||
-Wno-UNUSEDGENVAR -Wno-UNUSEDPARAM -Wno-UNUSEDSIGNAL
|
||||
-Wno-WIDTH`` plus the list shown for Wno-style.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
.. Copyright 2003-2022 by Wilson Snyder.
|
||||
.. Copyright 2003-2023 by Wilson Snyder.
|
||||
.. SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
verilator_coverage
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
.. Copyright 2003-2022 by Wilson Snyder.
|
||||
.. Copyright 2003-2023 by Wilson Snyder.
|
||||
.. SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
verilator_gantt
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
.. Copyright 2003-2022 by Wilson Snyder.
|
||||
.. Copyright 2003-2023 by Wilson Snyder.
|
||||
.. SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
verilator_profcfunc
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
.. Copyright 2003-2022 by Wilson Snyder.
|
||||
.. Copyright 2003-2023 by Wilson Snyder.
|
||||
.. SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
*********************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
.. Copyright 2003-2022 by Wilson Snyder.
|
||||
.. Copyright 2003-2023 by Wilson Snyder.
|
||||
.. SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
*******************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
.. Copyright 2003-2022 by Wilson Snyder.
|
||||
.. Copyright 2003-2023 by Wilson Snyder.
|
||||
.. SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
******************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
.. Copyright 2003-2022 by Wilson Snyder.
|
||||
.. Copyright 2003-2023 by Wilson Snyder.
|
||||
.. SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
*****
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
.. Copyright 2003-2022 by Wilson Snyder.
|
||||
.. Copyright 2003-2023 by Wilson Snyder.
|
||||
.. SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
######################
|
||||
|
|
@ -12,6 +12,7 @@ Verilator User's Guide
|
|||
overview.rst
|
||||
examples.rst
|
||||
install.rst
|
||||
install-cmake.rst
|
||||
|
||||
|
||||
.. toctree::
|
||||
|
|
|
|||
|
|
@ -0,0 +1,72 @@
|
|||
.. Copyright 2003-2023 by Wilson Snyder.
|
||||
.. SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
.. _CMakeInstallation:
|
||||
|
||||
******************
|
||||
CMake Installation
|
||||
******************
|
||||
|
||||
This section discusses how to build and install Verilator using cmake.
|
||||
Currently cmake is only officially supported for Windows builds (not Linux).
|
||||
|
||||
.. _Tools Install:
|
||||
|
||||
Quick Install
|
||||
=============
|
||||
|
||||
1. Install Python for your platform from https://www.python.org/downloads/.
|
||||
2. Install CMake for your platform from https://cmake.org/download/ or build it from source.
|
||||
3. If the compiler of your choice is MSVC, then install https://visualstudio.microsoft.com/downloads/.
|
||||
If the compiler of your choice is Clang, then install https://releases.llvm.org/download.html or build it from source.
|
||||
4. For flex and bison use https://github.com/lexxmark/winflexbison to build and install.
|
||||
5. For build on Windows using MSVC set environment variable WIN_FLEX_BISON to install directory.
|
||||
For build on Windows/Linux/OS-X using ninja set the environment variable
|
||||
FLEX_INCLUDE to the directory containing FlexLexer.h and ensure that flex/bison
|
||||
is available within the PATH.
|
||||
|
||||
To obtain verilator sources download https://github.com/verilator/verilator/archive/refs/heads/master.zip
|
||||
or clone https://github.com/verilator/verilator using git :ref:`Obtain Sources`.
|
||||
|
||||
To build using MSVC:
|
||||
|
||||
::
|
||||
|
||||
cd verilator # directory containing source files of verilator
|
||||
mkdir build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release --install-prefix $PWD/../install
|
||||
cmake --build . --config Release
|
||||
cmake --install . --prefix $PWD/../install
|
||||
|
||||
|
||||
To build using ninja:
|
||||
|
||||
::
|
||||
|
||||
cd verilator
|
||||
mkdir build
|
||||
cmake -G Ninja .. -DCMAKE_BUILD_TYPE=Release --install-prefix $PWD/../install -DCMAKE_MAKE_PROGRAM=<path to ninja binary> -DBISON_EXECUTABLE=<path to bison> -DFLEX_EXECUTABLE=<path to flex>
|
||||
<path to ninja binary> #execute ninja
|
||||
cmake --install . --prefix $PWD/../install
|
||||
|
||||
|
||||
.. _CMake Usage:
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
To use Verilator set the environment variable ``VERILATOR_ROOT`` to the
|
||||
install directory specified in the above build.
|
||||
|
||||
Example
|
||||
=======
|
||||
|
||||
::
|
||||
|
||||
cd verilator/examples
|
||||
cd cmake_hello_c
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. # cmake -G Ninja ..
|
||||
cmake --build . --config Release # ninja
|
||||
# execute the generated binary
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
.. Copyright 2003-2022 by Wilson Snyder.
|
||||
.. Copyright 2003-2023 by Wilson Snyder.
|
||||
.. SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
.. _Installation:
|
||||
|
|
@ -91,7 +91,7 @@ To build or run Verilator, you need these standard packages:
|
|||
|
||||
::
|
||||
|
||||
sudo apt-get install git perl python3 make
|
||||
sudo apt-get install git help2man perl python3 make
|
||||
sudo apt-get install g++ # Alternatively, clang
|
||||
sudo apt-get install libgz # Non-Ubuntu (ignore if gives error)
|
||||
sudo apt-get install libfl2 # Ubuntu only (ignore if gives error)
|
||||
|
|
@ -125,8 +125,8 @@ Those developing Verilator itself may also want these (see internals.rst):
|
|||
::
|
||||
|
||||
sudo apt-get install gdb graphviz cmake clang clang-format-14 gprof lcov
|
||||
sudo apt-get install yapf3
|
||||
sudo pip3 install sphinx sphinx_rtd_theme sphinxcontrib-spelling breathe
|
||||
sudo apt-get install libclang-dev yapf3
|
||||
sudo pip3 install clang sphinx sphinx_rtd_theme sphinxcontrib-spelling breathe
|
||||
cpan install Pod::Perldoc
|
||||
cpan install Parallel::Forker
|
||||
|
||||
|
|
@ -150,6 +150,8 @@ To make use of Verilator FST tracing you will want `GTKwave
|
|||
required at Verilator build time.
|
||||
|
||||
|
||||
.. _Obtain Sources:
|
||||
|
||||
Obtain Sources
|
||||
--------------
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
.. Copyright 2003-2022 by Wilson Snyder.
|
||||
.. Copyright 2003-2023 by Wilson Snyder.
|
||||
.. SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
***************
|
||||
|
|
@ -130,11 +130,11 @@ simulation (perhaps using :vlopt:`--build`) and run it.
|
|||
With :vlopt:`--no-timing`, all timing controls cause the :option:`NOTIMING`
|
||||
error, except:
|
||||
|
||||
* delay statements – they are ignored (as they are in synthesis), though they
|
||||
* delay statements - they are ignored (as they are in synthesis), though they
|
||||
do issue a :option:`STMTDLY` warning,
|
||||
* intra-assignment timing controls – they are ignored, though they do issue an
|
||||
* intra-assignment timing controls - they are ignored, though they do issue an
|
||||
:option:`ASSIGNDLY` warning,
|
||||
* net delays – they are ignored,
|
||||
* net delays - they are ignored,
|
||||
* event controls at the top of the procedure,
|
||||
|
||||
Forks cause this error as well, except:
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
.. Copyright 2003-2022 by Wilson Snyder.
|
||||
.. Copyright 2003-2023 by Wilson Snyder.
|
||||
.. SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
********
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
.. Copyright 2003-2022 by Wilson Snyder.
|
||||
.. Copyright 2003-2023 by Wilson Snyder.
|
||||
.. SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
.. _Simulating:
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
.. Copyright 2003-2022 by Wilson Snyder.
|
||||
.. Copyright 2003-2023 by Wilson Snyder.
|
||||
.. SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
**********
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
.. Copyright 2003-2022 by Wilson Snyder.
|
||||
.. Copyright 2003-2023 by Wilson Snyder.
|
||||
.. SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
*******************
|
||||
|
|
@ -727,6 +727,27 @@ List Of Warnings
|
|||
implicit definition of wire '...'".
|
||||
|
||||
|
||||
.. option:: IMPLICITSTATIC
|
||||
|
||||
Warns that the lifetime of a task or a function was not provided and so
|
||||
was implicitly set to static. The warning is suppressed when no
|
||||
variables inside the task or a function are assigned to.
|
||||
|
||||
This is a warning because the static default differs from C++, differs
|
||||
from class member function/tasks. Static is a more dangerous default
|
||||
then automatic as static prevents the function from being reinterant,
|
||||
which may be a source of bugs, and/or performance issues.
|
||||
|
||||
If the function does not require static behavior, change it to "function
|
||||
automatic".
|
||||
|
||||
If the function requires static behavior, change it to "function
|
||||
static".
|
||||
|
||||
Ignoring this warning will only suppress the lint check; it will
|
||||
simulate correctly.
|
||||
|
||||
|
||||
.. option:: IMPORTSTAR
|
||||
|
||||
.. TODO better example
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -213,6 +213,7 @@ Milanovic
|
|||
Millis
|
||||
MinW
|
||||
Mindspeed
|
||||
MingW
|
||||
Miodrag
|
||||
ModelSim
|
||||
Modport
|
||||
|
|
@ -416,6 +417,7 @@ bitop
|
|||
bitstoreal
|
||||
blackbox
|
||||
bokke
|
||||
bool
|
||||
brancoliticus
|
||||
buf
|
||||
bufif
|
||||
|
|
@ -626,6 +628,7 @@ iostream
|
|||
ish
|
||||
isunbounded
|
||||
isunknown
|
||||
jobserver
|
||||
killua
|
||||
lang
|
||||
lcov
|
||||
|
|
@ -731,6 +734,8 @@ portlists
|
|||
posedge
|
||||
posix
|
||||
postfix
|
||||
postincreemnt
|
||||
postincrement
|
||||
pragma
|
||||
pragmas
|
||||
pre
|
||||
|
|
@ -820,6 +825,7 @@ structs
|
|||
subcell
|
||||
subcells
|
||||
subexpressions
|
||||
submakes
|
||||
submodule
|
||||
submodules
|
||||
substring
|
||||
|
|
@ -932,3 +938,4 @@ ypq
|
|||
yurivict
|
||||
zdave
|
||||
Øyvind
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
PROJECT_NAME = "Verilog to Routing - ABC"
|
||||
PROJECT_NAME = "Verilator"
|
||||
INPUT = ../../include
|
||||
OUTPUT_DIRECTORY = _build/doxygen/verilated
|
||||
|
||||
|
|
|
|||
|
|
@ -70,8 +70,10 @@ The XML document consists of 4 sections within the top level
|
|||
Distribution
|
||||
============
|
||||
|
||||
Copyright 2020-2022 by Wilson Snyder. Verilator is free software; you can
|
||||
Copyright 2020-2023 by Wilson Snyder. 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.
|
||||
|
||||
SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
.. |Logo| image:: https://www.veripool.org/img/verilator_256_200_min.png
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Code available from: https://verilator.org
|
||||
//
|
||||
// Copyright 2003-2022 by Wilson Snyder. This program is free software; you can
|
||||
// Copyright 2003-2023 by Wilson Snyder. This program 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.
|
||||
|
|
@ -67,7 +67,7 @@
|
|||
#if defined(_WIN32) || defined(__MINGW32__)
|
||||
# include <direct.h> // mkdir
|
||||
#endif
|
||||
#ifdef __linux__
|
||||
#ifdef __GLIBC__
|
||||
# include <execinfo.h>
|
||||
# define _VL_HAVE_STACKTRACE
|
||||
#endif
|
||||
|
|
@ -355,10 +355,9 @@ WDataOutP VL_RAND_RESET_W(int obits, WDataOutP outwp) VL_MT_SAFE {
|
|||
outwp[VL_WORDS_I(obits) - 1] = VL_RAND_RESET_I(32) & VL_MASK_E(obits);
|
||||
return outwp;
|
||||
}
|
||||
|
||||
WDataOutP VL_ZERO_RESET_W(int obits, WDataOutP outwp) VL_MT_SAFE {
|
||||
for (int i = 0; i < VL_WORDS_I(obits); ++i) outwp[i] = 0;
|
||||
return outwp;
|
||||
// Not inlined to speed up compilation of slowpath code
|
||||
return VL_ZERO_W(obits, outwp);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
|
@ -611,7 +610,7 @@ std::string VL_DECIMAL_NW(int width, const WDataInP lwp) VL_MT_SAFE {
|
|||
const int maxdecwidth = (width + 3) * 4 / 3;
|
||||
// Or (maxdecwidth+7)/8], but can't have more than 4 BCD bits per word
|
||||
VlWide<VL_VALUE_STRING_MAX_WIDTH / 4 + 2> bcd;
|
||||
VL_ZERO_RESET_W(maxdecwidth, bcd);
|
||||
VL_ZERO_W(maxdecwidth, bcd);
|
||||
VlWide<VL_VALUE_STRING_MAX_WIDTH / 4 + 2> tmp;
|
||||
VlWide<VL_VALUE_STRING_MAX_WIDTH / 4 + 2> tmp2;
|
||||
int from_bit = width - 1;
|
||||
|
|
@ -622,7 +621,7 @@ std::string VL_DECIMAL_NW(int width, const WDataInP lwp) VL_MT_SAFE {
|
|||
// Any digits >= 5 need an add 3 (via tmp)
|
||||
for (int nibble_bit = 0; nibble_bit < maxdecwidth; nibble_bit += 4) {
|
||||
if ((VL_BITRSHIFT_W(bcd, nibble_bit) & 0xf) >= 5) {
|
||||
VL_ZERO_RESET_W(maxdecwidth, tmp2);
|
||||
VL_ZERO_W(maxdecwidth, tmp2);
|
||||
tmp2[VL_BITWORD_E(nibble_bit)] |= VL_EUL(0x3) << VL_BITBIT_E(nibble_bit);
|
||||
VL_ASSIGN_W(maxdecwidth, tmp, bcd);
|
||||
VL_ADD_W(VL_WORDS_I(maxdecwidth), bcd, tmp, tmp2);
|
||||
|
|
@ -1083,7 +1082,8 @@ static void _vl_vsss_read_str(FILE* fp, int& floc, const WDataInP fromp, const s
|
|||
// VL_DBG_MSGF(" _read got='"<<tmpp<<"'\n");
|
||||
}
|
||||
static char* _vl_vsss_read_bin(FILE* fp, int& floc, const WDataInP fromp, const std::string& fstr,
|
||||
char* beginp, std::size_t n, const bool inhibit = false) {
|
||||
char* beginp, std::size_t n,
|
||||
const bool inhibit = false) VL_MT_SAFE {
|
||||
// Variant of _vl_vsss_read_str using the same underlying I/O functions but optimized
|
||||
// specifically for block reads of N bytes (read operations are not demarcated by
|
||||
// whitespace). In the fp case, except descriptor to have been opened in binary mode.
|
||||
|
|
@ -1095,12 +1095,13 @@ static char* _vl_vsss_read_bin(FILE* fp, int& floc, const WDataInP fromp, const
|
|||
}
|
||||
return beginp;
|
||||
}
|
||||
static void _vl_vsss_setbit(WDataOutP owp, int obits, int lsb, int nbits, IData ld) VL_MT_SAFE {
|
||||
for (; nbits && lsb < obits; nbits--, lsb++, ld >>= 1) { VL_ASSIGNBIT_WI(lsb, owp, ld & 1); }
|
||||
static void _vl_vsss_setbit(WDataOutP iowp, int obits, int lsb, int nbits, IData ld) VL_MT_SAFE {
|
||||
for (; nbits && lsb < obits; nbits--, lsb++, ld >>= 1) VL_ASSIGNBIT_WI(lsb, iowp, ld & 1);
|
||||
}
|
||||
static void _vl_vsss_based(WDataOutP owp, int obits, int baseLog2, const char* strp,
|
||||
size_t posstart, size_t posend) VL_MT_SAFE {
|
||||
// Read in base "2^^baseLog2" digits from strp[posstart..posend-1] into owp of size obits.
|
||||
VL_ZERO_W(obits, owp);
|
||||
int lsb = 0;
|
||||
for (int i = 0, pos = static_cast<int>(posend) - 1;
|
||||
i < obits && pos >= static_cast<int>(posstart); --pos) {
|
||||
|
|
@ -1381,7 +1382,7 @@ static IData getLine(std::string& str, IData fpi, size_t maxLen) VL_MT_SAFE {
|
|||
str.push_back(c);
|
||||
if (c == '\n') break;
|
||||
}
|
||||
return str.size();
|
||||
return static_cast<IData>(str.size());
|
||||
}
|
||||
|
||||
IData VL_FGETS_IXI(int obits, void* destp, IData fpi) VL_MT_SAFE {
|
||||
|
|
@ -1612,7 +1613,7 @@ IData VL_FREAD_I(int width, int array_lsb, int array_size, void* memp, IData fpi
|
|||
*datap |= ((static_cast<QData>(c) << static_cast<QData>(shift)) & VL_MASK_Q(width));
|
||||
} else {
|
||||
WDataOutP datap = &(reinterpret_cast<WDataOutP>(memp))[entry * VL_WORDS_I(width)];
|
||||
if (shift == start_shift) VL_ZERO_RESET_W(width, datap);
|
||||
if (shift == start_shift) VL_ZERO_W(width, datap);
|
||||
datap[VL_BITWORD_E(shift)] |= (static_cast<EData>(c) << VL_BITBIT_E(shift));
|
||||
}
|
||||
// Prep for next
|
||||
|
|
@ -1631,12 +1632,12 @@ std::string VL_STACKTRACE_N() VL_MT_SAFE {
|
|||
static VerilatedMutex s_stackTraceMutex;
|
||||
const VerilatedLockGuard lock{s_stackTraceMutex};
|
||||
|
||||
constexpr int BT_BUF_SIZE = 100;
|
||||
void* buffer[BT_BUF_SIZE];
|
||||
int nptrs = 0;
|
||||
char** strings = nullptr;
|
||||
|
||||
#ifdef _VL_HAVE_STACKTRACE
|
||||
constexpr int BT_BUF_SIZE = 100;
|
||||
void* buffer[BT_BUF_SIZE];
|
||||
nptrs = backtrace(buffer, BT_BUF_SIZE);
|
||||
strings = backtrace_symbols(buffer, nptrs);
|
||||
#endif
|
||||
|
|
@ -1701,7 +1702,7 @@ IData VL_VALUEPLUSARGS_INW(int rbits, const std::string& ld, WDataOutP rwp) VL_M
|
|||
const char* const dp = match.c_str() + 1 /*leading + */ + prefix.length();
|
||||
if (match.empty()) return 0;
|
||||
|
||||
VL_ZERO_RESET_W(rbits, rwp);
|
||||
VL_ZERO_W(rbits, rwp);
|
||||
switch (std::tolower(fmt)) {
|
||||
case 'd': {
|
||||
int64_t lld = 0;
|
||||
|
|
@ -1807,7 +1808,7 @@ std::string VL_TOUPPER_NN(const std::string& ld) VL_PURE {
|
|||
return out;
|
||||
}
|
||||
|
||||
std::string VL_CVT_PACK_STR_NW(int lwords, const WDataInP lwp) VL_MT_SAFE {
|
||||
std::string VL_CVT_PACK_STR_NW(int lwords, const WDataInP lwp) VL_PURE {
|
||||
// See also _vl_vint_to_string
|
||||
char destout[VL_VALUE_STRING_MAX_CHARS + 1];
|
||||
const int obits = lwords * VL_EDATASIZE;
|
||||
|
|
@ -2023,7 +2024,7 @@ void VlReadMem::setData(void* valuep, const std::string& rhs) {
|
|||
& VL_MASK_Q(m_bits);
|
||||
} else {
|
||||
WDataOutP datap = reinterpret_cast<WDataOutP>(valuep);
|
||||
if (!innum) VL_ZERO_RESET_W(m_bits, datap);
|
||||
if (!innum) VL_ZERO_W(m_bits, datap);
|
||||
_vl_shiftl_inplace_w(m_bits, datap, static_cast<IData>(shift));
|
||||
datap[0] |= value;
|
||||
}
|
||||
|
|
@ -2567,7 +2568,7 @@ std::pair<int, char**> VerilatedContextImp::argc_argv() VL_MT_SAFE_EXCLUDES(m_ar
|
|||
static char** s_argvp = nullptr;
|
||||
if (VL_UNLIKELY(!s_loaded)) {
|
||||
s_loaded = true;
|
||||
s_argc = m_args.m_argVec.size();
|
||||
s_argc = static_cast<int>(m_args.m_argVec.size());
|
||||
s_argvp = new char*[s_argc + 1];
|
||||
int in = 0;
|
||||
for (const auto& i : m_args.m_argVec) {
|
||||
|
|
@ -2789,27 +2790,38 @@ static struct {
|
|||
VoidPCbList s_exitCbs VL_GUARDED_BY(s_exitMutex);
|
||||
} VlCbStatic;
|
||||
|
||||
static void addCb(Verilated::VoidPCb cb, void* datap, VoidPCbList& cbs) VL_MT_UNSAFE {
|
||||
static void addCbFlush(Verilated::VoidPCb cb, void* datap)
|
||||
VL_MT_SAFE_EXCLUDES(VlCbStatic.s_flushMutex) {
|
||||
const VerilatedLockGuard lock{VlCbStatic.s_flushMutex};
|
||||
std::pair<Verilated::VoidPCb, void*> pair(cb, datap);
|
||||
cbs.remove(pair); // Just in case it's a duplicate
|
||||
cbs.push_back(pair);
|
||||
VlCbStatic.s_flushCbs.remove(pair); // Just in case it's a duplicate
|
||||
VlCbStatic.s_flushCbs.push_back(pair);
|
||||
}
|
||||
static void removeCb(Verilated::VoidPCb cb, void* datap, VoidPCbList& cbs) VL_MT_UNSAFE {
|
||||
static void addCbExit(Verilated::VoidPCb cb, void* datap)
|
||||
VL_MT_SAFE_EXCLUDES(VlCbStatic.s_exitMutex) {
|
||||
const VerilatedLockGuard lock{VlCbStatic.s_exitMutex};
|
||||
std::pair<Verilated::VoidPCb, void*> pair(cb, datap);
|
||||
cbs.remove(pair);
|
||||
VlCbStatic.s_exitCbs.remove(pair); // Just in case it's a duplicate
|
||||
VlCbStatic.s_exitCbs.push_back(pair);
|
||||
}
|
||||
static void removeCbFlush(Verilated::VoidPCb cb, void* datap)
|
||||
VL_MT_SAFE_EXCLUDES(VlCbStatic.s_flushMutex) {
|
||||
const VerilatedLockGuard lock{VlCbStatic.s_flushMutex};
|
||||
std::pair<Verilated::VoidPCb, void*> pair(cb, datap);
|
||||
VlCbStatic.s_flushCbs.remove(pair);
|
||||
}
|
||||
static void removeCbExit(Verilated::VoidPCb cb, void* datap)
|
||||
VL_MT_SAFE_EXCLUDES(VlCbStatic.s_exitMutex) {
|
||||
const VerilatedLockGuard lock{VlCbStatic.s_exitMutex};
|
||||
std::pair<Verilated::VoidPCb, void*> pair(cb, datap);
|
||||
VlCbStatic.s_exitCbs.remove(pair);
|
||||
}
|
||||
static void runCallbacks(const VoidPCbList& cbs) VL_MT_SAFE {
|
||||
for (const auto& i : cbs) i.first(i.second);
|
||||
}
|
||||
|
||||
void Verilated::addFlushCb(VoidPCb cb, void* datap) VL_MT_SAFE {
|
||||
const VerilatedLockGuard lock{VlCbStatic.s_flushMutex};
|
||||
addCb(cb, datap, VlCbStatic.s_flushCbs);
|
||||
}
|
||||
void Verilated::removeFlushCb(VoidPCb cb, void* datap) VL_MT_SAFE {
|
||||
const VerilatedLockGuard lock{VlCbStatic.s_flushMutex};
|
||||
removeCb(cb, datap, VlCbStatic.s_flushCbs);
|
||||
}
|
||||
void Verilated::addFlushCb(VoidPCb cb, void* datap) VL_MT_SAFE { addCbFlush(cb, datap); }
|
||||
void Verilated::removeFlushCb(VoidPCb cb, void* datap) VL_MT_SAFE { removeCbFlush(cb, datap); }
|
||||
void Verilated::runFlushCallbacks() VL_MT_SAFE {
|
||||
// Flush routines may call flush, so avoid mutex deadlock
|
||||
static std::atomic<int> s_recursing;
|
||||
|
|
@ -2826,14 +2838,8 @@ void Verilated::runFlushCallbacks() VL_MT_SAFE {
|
|||
VL_GCOV_DUMP();
|
||||
}
|
||||
|
||||
void Verilated::addExitCb(VoidPCb cb, void* datap) VL_MT_SAFE {
|
||||
const VerilatedLockGuard lock{VlCbStatic.s_exitMutex};
|
||||
addCb(cb, datap, VlCbStatic.s_exitCbs);
|
||||
}
|
||||
void Verilated::removeExitCb(VoidPCb cb, void* datap) VL_MT_SAFE {
|
||||
const VerilatedLockGuard lock{VlCbStatic.s_exitMutex};
|
||||
removeCb(cb, datap, VlCbStatic.s_exitCbs);
|
||||
}
|
||||
void Verilated::addExitCb(VoidPCb cb, void* datap) VL_MT_SAFE { addCbExit(cb, datap); }
|
||||
void Verilated::removeExitCb(VoidPCb cb, void* datap) VL_MT_SAFE { removeCbExit(cb, datap); }
|
||||
void Verilated::runExitCallbacks() VL_MT_SAFE {
|
||||
static std::atomic<int> s_recursing;
|
||||
if (!s_recursing++) {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Code available from: https://verilator.org
|
||||
//
|
||||
// Copyright 2003-2022 by Wilson Snyder. This program is free software; you can
|
||||
// Copyright 2003-2023 by Wilson Snyder. This program 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.
|
||||
|
|
@ -364,7 +364,7 @@ protected:
|
|||
// assumption is that the restore is allowed to pass different arguments
|
||||
struct NonSerializedCommandArgs {
|
||||
// Medium speed
|
||||
std::vector<std::string> m_argVec; // Aargument list
|
||||
std::vector<std::string> m_argVec; // Argument list
|
||||
bool m_argVecLoaded = false; // Ever loaded argument list
|
||||
} m_args VL_GUARDED_BY(m_argMutex);
|
||||
|
||||
|
|
@ -469,7 +469,7 @@ public:
|
|||
int randSeed() const VL_MT_SAFE { return m_s.m_randSeed; }
|
||||
|
||||
// Time handling
|
||||
/// Returns current simulation time.
|
||||
/// Returns current simulation time in units of timeprecision().
|
||||
///
|
||||
/// How Verilator runtime gets the current simulation time:
|
||||
///
|
||||
|
|
@ -600,7 +600,7 @@ private:
|
|||
// Fastpath:
|
||||
VerilatedSyms* m_symsp = nullptr; // Symbol table
|
||||
void** m_callbacksp = nullptr; // Callback table pointer (Fastpath)
|
||||
int m_funcnumMax = 0; // Maxium function number stored (Fastpath)
|
||||
int m_funcnumMax = 0; // Maximum function number stored (Fastpath)
|
||||
// 4 bytes padding (on -m64), for rent.
|
||||
VerilatedVarNameMap* m_varsp = nullptr; // Variable map
|
||||
const char* m_namep = nullptr; // Scope name (Slowpath)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
######################################################################
|
||||
# DESCRIPTION: Makefile commands for all verilated target files
|
||||
#
|
||||
# Copyright 2003-2022 by Wilson Snyder. This program is free software; you
|
||||
# Copyright 2003-2023 by Wilson Snyder. This program 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.
|
||||
|
|
@ -21,7 +21,9 @@ CFG_WITH_LONGTESTS = @CFG_WITH_LONGTESTS@
|
|||
|
||||
# Compiler flags to enable profiling
|
||||
CFG_CXXFLAGS_PROFILE = @CFG_CXXFLAGS_PROFILE@
|
||||
# Select newest language
|
||||
# Select language required to compile (often empty)
|
||||
CFG_CXXFLAGS_STD = @CFG_CXXFLAGS_STD@
|
||||
# Select newest language (unused by this Makefile, for some test's Makefiles)
|
||||
CFG_CXXFLAGS_STD_NEWEST = @CFG_CXXFLAGS_STD_NEWEST@
|
||||
# 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@
|
||||
|
|
@ -36,7 +38,7 @@ CFG_LDLIBS_THREADS = @CFG_LDLIBS_THREADS@
|
|||
# Programs
|
||||
|
||||
VERILATOR_COVERAGE = $(PERL) $(VERILATOR_ROOT)/bin/verilator_coverage
|
||||
VERILATOR_INCLUDER = $(PERL) $(VERILATOR_ROOT)/bin/verilator_includer
|
||||
VERILATOR_INCLUDER = $(PYTHON3) $(VERILATOR_ROOT)/bin/verilator_includer
|
||||
VERILATOR_CCACHE_REPORT = $(PYTHON3) $(VERILATOR_ROOT)/bin/verilator_ccache_report
|
||||
|
||||
######################################################################
|
||||
|
|
@ -46,6 +48,10 @@ ifneq ($(words $(CURDIR)),1)
|
|||
$(error Unsupported: GNU Make cannot build in directories containing spaces, build elsewhere: '$(CURDIR)')
|
||||
endif
|
||||
|
||||
######################################################################
|
||||
# OS detection
|
||||
UNAME_S := $(shell uname -s)
|
||||
|
||||
######################################################################
|
||||
# C Preprocessor flags
|
||||
|
||||
|
|
@ -78,6 +84,12 @@ CPPFLAGS += $(OPT)
|
|||
CPPFLAGS += $(M32)
|
||||
LDFLAGS += $(M32)
|
||||
|
||||
# On macOS, specify all weak symbols as dynamic_lookup.
|
||||
# Otherwise, you get undefined symbol errors.
|
||||
ifeq ($(UNAME_S),Darwin)
|
||||
LDFLAGS += -Wl,-U,__Z15vl_time_stamp64v,-U,__Z13sc_time_stampv
|
||||
endif
|
||||
|
||||
# Allow upper level user makefiles to specify flags they want.
|
||||
# These aren't ever set by Verilator, so users are free to override them.
|
||||
CPPFLAGS += $(USER_CPPFLAGS)
|
||||
|
|
@ -130,7 +142,7 @@ endif
|
|||
#######################################################################
|
||||
##### Threaded builds
|
||||
|
||||
CPPFLAGS += $(CFG_CXXFLAGS_STD_NEWEST)
|
||||
CPPFLAGS += $(CFG_CXXFLAGS_STD)
|
||||
LDLIBS += $(CFG_LDLIBS_THREADS)
|
||||
|
||||
ifneq ($(VM_TIMING),0)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
//
|
||||
// Code available from: https://verilator.org
|
||||
//
|
||||
// Copyright 2003-2022 by Wilson Snyder. This program is free software; you can
|
||||
// Copyright 2003-2023 by Wilson Snyder. This program 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.
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Code available from: https://verilator.org
|
||||
//
|
||||
// Copyright 2003-2022 by Wilson Snyder. This program is free software; you can
|
||||
// Copyright 2003-2023 by Wilson Snyder. This program 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.
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Code available from: https://verilator.org
|
||||
//
|
||||
// Copyright 2001-2022 by Wilson Snyder. This program is free software; you
|
||||
// Copyright 2001-2023 by Wilson Snyder. This program 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.
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Code available from: https://verilator.org
|
||||
//
|
||||
// Copyright 2001-2022 by Wilson Snyder. This program is free software; you
|
||||
// Copyright 2001-2023 by Wilson Snyder. This program 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.
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Code available from: https://verilator.org
|
||||
//
|
||||
// Copyright 2001-2022 by Wilson Snyder. This program is free software; you
|
||||
// Copyright 2001-2023 by Wilson Snyder. This program 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.
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Code available from: https://verilator.org
|
||||
//
|
||||
// Copyright 2009-2022 by Wilson Snyder. This program is free software; you can
|
||||
// Copyright 2009-2023 by Wilson Snyder. This program 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.
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Code available from: https://verilator.org
|
||||
//
|
||||
// Copyright 2003-2022 by Wilson Snyder. This program is free software; you can
|
||||
// Copyright 2003-2023 by Wilson Snyder. This program 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.
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Code available from: https://verilator.org
|
||||
//
|
||||
// Copyright 2001-2022 by Wilson Snyder. This program is free software; you
|
||||
// Copyright 2001-2023 by Wilson Snyder. This program 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.
|
||||
|
|
@ -191,7 +191,7 @@ void VerilatedFst::declare(uint32_t code, const char* name, int dtypenum, fstVar
|
|||
if ((new_it->back() & 0x80)) {
|
||||
tmpModName = *new_it;
|
||||
tmpModName.pop_back();
|
||||
// If the scope ends with a non-ascii character, it will be 0x80 + fstScopeType
|
||||
// If the scope ends with a non-ASCII character, it will be 0x80 + fstScopeType
|
||||
fstWriterSetScope(m_fst, static_cast<fstScopeType>(new_it->back() & 0x7f),
|
||||
tmpModName.c_str(), nullptr);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Code available from: https://verilator.org
|
||||
//
|
||||
// Copyright 2001-2022 by Wilson Snyder. This program is free software; you
|
||||
// Copyright 2001-2023 by Wilson Snyder. This program 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.
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// THIS MODULE IS PUBLICLY LICENSED
|
||||
//
|
||||
// Copyright 2001-2022 by Wilson Snyder. This program is free software; you
|
||||
// Copyright 2001-2023 by Wilson Snyder. This program 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.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// -*- mode: C++; c-file-style: "cc-mode" -*-
|
||||
//=============================================================================
|
||||
//
|
||||
// Copyright 2001-2022 by Wilson Snyder. This program is free software; you can
|
||||
// Copyright 2001-2023 by Wilson Snyder. This program 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.
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Code available from: https://verilator.org
|
||||
//
|
||||
// Copyright 2003-2022 by Wilson Snyder. This program is free software; you can
|
||||
// Copyright 2003-2023 by Wilson Snyder. This program 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.
|
||||
|
|
@ -100,12 +100,11 @@ inline IData VL_URANDOM_RANGE_I(IData hi, IData lo) {
|
|||
}
|
||||
}
|
||||
|
||||
// These are init time only, so slow is fine
|
||||
/// Random reset a signal of given width
|
||||
/// Random reset a signal of given width (init time only)
|
||||
extern IData VL_RAND_RESET_I(int obits) VL_MT_SAFE;
|
||||
/// Random reset a signal of given width
|
||||
/// Random reset a signal of given width (init time only)
|
||||
extern QData VL_RAND_RESET_Q(int obits) VL_MT_SAFE;
|
||||
/// Random reset a signal of given width
|
||||
/// Random reset a signal of given width (init time only)
|
||||
extern WDataOutP VL_RAND_RESET_W(int obits, WDataOutP outwp) VL_MT_SAFE;
|
||||
/// Zero reset a signal (slow - else use VL_ZERO_W)
|
||||
extern WDataOutP VL_ZERO_RESET_W(int obits, WDataOutP outwp) VL_MT_SAFE;
|
||||
|
|
@ -507,7 +506,7 @@ static inline void VL_ASSIGNBIT_WO(int bit, WDataOutP owp) VL_MT_SAFE {
|
|||
int32_t lsb = 0; \
|
||||
uint32_t* chunkp = _butemp.get_raw(); \
|
||||
while (lsb + VL_SC_BITS_PER_DIGIT < (obits)) { \
|
||||
static_assert(std::is_same<IData, EData>::value, "IData and EData missmatch"); \
|
||||
static_assert(std::is_same<IData, EData>::value, "IData and EData mismatch"); \
|
||||
const uint32_t data = VL_SEL_IWII(lsb + VL_SC_BITS_PER_DIGIT + 1, (rwp).data(), lsb, \
|
||||
VL_SC_BITS_PER_DIGIT); \
|
||||
*chunkp = data & VL_MASK_E(VL_SC_BITS_PER_DIGIT); \
|
||||
|
|
@ -1246,7 +1245,7 @@ static inline void _vl_insert_QQ(QData& lhsr, QData ld, int hbit, int lbit, int
|
|||
const QData insmask = (VL_MASK_Q(hbit - lbit + 1)) << lbit;
|
||||
lhsr = (lhsr & ~insmask) | ((ld << lbit) & (insmask & cleanmask));
|
||||
}
|
||||
static inline void _vl_insert_WI(WDataOutP owp, IData ld, int hbit, int lbit,
|
||||
static inline void _vl_insert_WI(WDataOutP iowp, IData ld, int hbit, int lbit,
|
||||
int rbits = 0) VL_MT_SAFE {
|
||||
const int hoffset = VL_BITBIT_E(hbit);
|
||||
const int loffset = VL_BITBIT_E(lbit);
|
||||
|
|
@ -1258,28 +1257,28 @@ static inline void _vl_insert_WI(WDataOutP owp, IData ld, int hbit, int lbit,
|
|||
|
||||
if (hoffset == VL_SIZEBITS_E && loffset == 0) {
|
||||
// Fast and common case, word based insertion
|
||||
owp[VL_BITWORD_E(lbit)] = ld & cleanmask;
|
||||
iowp[VL_BITWORD_E(lbit)] = ld & cleanmask;
|
||||
} else {
|
||||
const EData lde = static_cast<EData>(ld);
|
||||
if (hword == lword) { // know < EData bits because above checks it
|
||||
// Assignment is contained within one word of destination
|
||||
const EData insmask = (VL_MASK_E(hoffset - loffset + 1)) << loffset;
|
||||
owp[lword] = (owp[lword] & ~insmask) | ((lde << loffset) & (insmask & cleanmask));
|
||||
iowp[lword] = (iowp[lword] & ~insmask) | ((lde << loffset) & (insmask & cleanmask));
|
||||
} else {
|
||||
// Assignment crosses a word boundary in destination
|
||||
const EData hinsmask = (VL_MASK_E(hoffset - 0 + 1)) << 0;
|
||||
const EData linsmask = (VL_MASK_E((VL_EDATASIZE - 1) - loffset + 1)) << loffset;
|
||||
const int nbitsonright = VL_EDATASIZE - loffset; // bits that end up in lword
|
||||
owp[lword] = (owp[lword] & ~linsmask) | ((lde << loffset) & linsmask);
|
||||
owp[hword]
|
||||
= (owp[hword] & ~hinsmask) | ((lde >> nbitsonright) & (hinsmask & cleanmask));
|
||||
iowp[lword] = (iowp[lword] & ~linsmask) | ((lde << loffset) & linsmask);
|
||||
iowp[hword]
|
||||
= (iowp[hword] & ~hinsmask) | ((lde >> nbitsonright) & (hinsmask & cleanmask));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// INTERNAL: Stuff large LHS bit 0++ into OUTPUT at specified offset
|
||||
// lwp may be "dirty"
|
||||
static inline void _vl_insert_WW(WDataOutP owp, WDataInP const lwp, int hbit, int lbit,
|
||||
static inline void _vl_insert_WW(WDataOutP iowp, WDataInP const lwp, int hbit, int lbit,
|
||||
int rbits = 0) VL_MT_SAFE {
|
||||
const int hoffset = VL_BITBIT_E(hbit);
|
||||
const int loffset = VL_BITBIT_E(lbit);
|
||||
|
|
@ -1294,14 +1293,14 @@ static inline void _vl_insert_WW(WDataOutP owp, WDataInP const lwp, int hbit, in
|
|||
|
||||
if (hoffset == VL_SIZEBITS_E && loffset == 0) {
|
||||
// Fast and common case, word based insertion
|
||||
for (int i = 0; i < (words - 1); ++i) owp[lword + i] = lwp[i];
|
||||
owp[hword] = lwp[words - 1] & cleanmask;
|
||||
for (int i = 0; i < (words - 1); ++i) iowp[lword + i] = lwp[i];
|
||||
iowp[hword] = lwp[words - 1] & cleanmask;
|
||||
} else if (loffset == 0) {
|
||||
// Non-32bit, but nicely aligned, so stuff all but the last word
|
||||
for (int i = 0; i < (words - 1); ++i) owp[lword + i] = lwp[i];
|
||||
for (int i = 0; i < (words - 1); ++i) iowp[lword + i] = lwp[i];
|
||||
// Know it's not a full word as above fast case handled it
|
||||
const EData hinsmask = (VL_MASK_E(hoffset - 0 + 1));
|
||||
owp[hword] = (owp[hword] & ~hinsmask) | (lwp[words - 1] & (hinsmask & cleanmask));
|
||||
iowp[hword] = (iowp[hword] & ~hinsmask) | (lwp[words - 1] & (hinsmask & cleanmask));
|
||||
} else {
|
||||
const EData hinsmask = (VL_MASK_E(hoffset - 0 + 1)) << 0;
|
||||
const EData linsmask = (VL_MASK_E((VL_EDATASIZE - 1) - loffset + 1)) << loffset;
|
||||
|
|
@ -1312,22 +1311,22 @@ static inline void _vl_insert_WW(WDataOutP owp, WDataInP const lwp, int hbit, in
|
|||
{ // Lower word
|
||||
const int oword = lword + i;
|
||||
const EData d = lwp[i] << loffset;
|
||||
const EData od = (owp[oword] & ~linsmask) | (d & linsmask);
|
||||
const EData od = (iowp[oword] & ~linsmask) | (d & linsmask);
|
||||
if (oword == hword) {
|
||||
owp[oword] = (owp[oword] & ~hinsmask) | (od & (hinsmask & cleanmask));
|
||||
iowp[oword] = (iowp[oword] & ~hinsmask) | (od & (hinsmask & cleanmask));
|
||||
} else {
|
||||
owp[oword] = od;
|
||||
iowp[oword] = od;
|
||||
}
|
||||
}
|
||||
{ // Upper word
|
||||
const int oword = lword + i + 1;
|
||||
if (oword <= hword) {
|
||||
const EData d = lwp[i] >> nbitsonright;
|
||||
const EData od = (d & ~linsmask) | (owp[oword] & linsmask);
|
||||
const EData od = (d & ~linsmask) | (iowp[oword] & linsmask);
|
||||
if (oword == hword) {
|
||||
owp[oword] = (owp[oword] & ~hinsmask) | (od & (hinsmask & cleanmask));
|
||||
iowp[oword] = (iowp[oword] & ~hinsmask) | (od & (hinsmask & cleanmask));
|
||||
} else {
|
||||
owp[oword] = od;
|
||||
iowp[oword] = od;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1335,11 +1334,11 @@ static inline void _vl_insert_WW(WDataOutP owp, WDataInP const lwp, int hbit, in
|
|||
}
|
||||
}
|
||||
|
||||
static inline void _vl_insert_WQ(WDataOutP owp, QData ld, int hbit, int lbit,
|
||||
static inline void _vl_insert_WQ(WDataOutP iowp, QData ld, int hbit, int lbit,
|
||||
int rbits = 0) VL_MT_SAFE {
|
||||
VlWide<VL_WQ_WORDS_E> lwp;
|
||||
VL_SET_WQ(lwp, ld);
|
||||
_vl_insert_WW(owp, lwp, hbit, lbit, rbits);
|
||||
_vl_insert_WW(iowp, lwp, hbit, lbit, rbits);
|
||||
}
|
||||
|
||||
// EMIT_RULE: VL_REPLICATE: oclean=clean>width32, dirty<=width32; lclean=clean; rclean==clean;
|
||||
|
|
@ -1366,6 +1365,9 @@ static inline QData VL_REPLICATE_QII(int lbits, IData ld, IData rep) VL_PURE {
|
|||
static inline WDataOutP VL_REPLICATE_WII(int lbits, WDataOutP owp, IData ld,
|
||||
IData rep) VL_MT_SAFE {
|
||||
owp[0] = ld;
|
||||
// Zeroing all words isn't strictly needed but allows compiler to know
|
||||
// it does not need to preserve data in word(s) not being written
|
||||
for (unsigned i = 1; i < VL_WORDS_I(static_cast<unsigned>(lbits) * rep); ++i) owp[i] = 0;
|
||||
for (unsigned i = 1; i < rep; ++i) {
|
||||
_vl_insert_WI(owp, ld, i * lbits + lbits - 1, i * lbits);
|
||||
}
|
||||
|
|
@ -1374,6 +1376,9 @@ static inline WDataOutP VL_REPLICATE_WII(int lbits, WDataOutP owp, IData ld,
|
|||
static inline WDataOutP VL_REPLICATE_WQI(int lbits, WDataOutP owp, QData ld,
|
||||
IData rep) VL_MT_SAFE {
|
||||
VL_SET_WQ(owp, ld);
|
||||
// Zeroing all words isn't strictly needed but allows compiler to know
|
||||
// it does not need to preserve data in word(s) not being written
|
||||
for (unsigned i = 2; i < VL_WORDS_I(static_cast<unsigned>(lbits) * rep); ++i) owp[i] = 0;
|
||||
for (unsigned i = 1; i < rep; ++i) {
|
||||
_vl_insert_WQ(owp, ld, i * lbits + lbits - 1, i * lbits);
|
||||
}
|
||||
|
|
@ -1381,7 +1386,12 @@ static inline WDataOutP VL_REPLICATE_WQI(int lbits, WDataOutP owp, QData ld,
|
|||
}
|
||||
static inline WDataOutP VL_REPLICATE_WWI(int lbits, WDataOutP owp, WDataInP const lwp,
|
||||
IData rep) VL_MT_SAFE {
|
||||
for (int i = 0; i < VL_WORDS_I(lbits); ++i) owp[i] = lwp[i];
|
||||
for (unsigned i = 0; i < VL_WORDS_I(static_cast<unsigned>(lbits)); ++i) owp[i] = lwp[i];
|
||||
// Zeroing all words isn't strictly needed but allows compiler to know
|
||||
// it does not need to preserve data in word(s) not being written
|
||||
for (unsigned i = VL_WORDS_I(static_cast<unsigned>(lbits));
|
||||
i < VL_WORDS_I(static_cast<unsigned>(lbits * rep)); ++i)
|
||||
owp[i] = 0;
|
||||
for (unsigned i = 1; i < rep; ++i) {
|
||||
_vl_insert_WW(owp, lwp, i * lbits + lbits - 1, i * lbits);
|
||||
}
|
||||
|
|
@ -1706,7 +1716,7 @@ static inline WDataOutP VL_SHIFTR_WWQ(int obits, int lbits, int rbits, WDataOutP
|
|||
}
|
||||
|
||||
static inline IData VL_SHIFTR_IIW(int obits, int, int rbits, IData lhs,
|
||||
WDataInP const rwp) VL_MT_SAFE {
|
||||
WDataInP const rwp) VL_PURE {
|
||||
for (int i = 1; i < VL_WORDS_I(rbits); ++i) {
|
||||
if (VL_UNLIKELY(rwp[i])) { // Huge shift 1>>32 or more
|
||||
return 0;
|
||||
|
|
@ -1715,7 +1725,7 @@ static inline IData VL_SHIFTR_IIW(int obits, int, int rbits, IData lhs,
|
|||
return VL_CLEAN_II(obits, obits, lhs >> rwp[0]);
|
||||
}
|
||||
static inline QData VL_SHIFTR_QQW(int obits, int, int rbits, QData lhs,
|
||||
WDataInP const rwp) VL_MT_SAFE {
|
||||
WDataInP const rwp) VL_PURE {
|
||||
for (int i = 1; i < VL_WORDS_I(rbits); ++i) {
|
||||
if (VL_UNLIKELY(rwp[i])) { // Huge shift 1>>32 or more
|
||||
return 0;
|
||||
|
|
@ -1724,11 +1734,11 @@ static inline QData VL_SHIFTR_QQW(int obits, int, int rbits, QData lhs,
|
|||
// Above checks rwp[1]==0 so not needed in below shift
|
||||
return VL_CLEAN_QQ(obits, obits, lhs >> (static_cast<QData>(rwp[0])));
|
||||
}
|
||||
static inline IData VL_SHIFTR_IIQ(int obits, int, int, IData lhs, QData rhs) VL_MT_SAFE {
|
||||
static inline IData VL_SHIFTR_IIQ(int obits, int, int, IData lhs, QData rhs) VL_PURE {
|
||||
if (VL_UNLIKELY(rhs >= VL_IDATASIZE)) return 0;
|
||||
return VL_CLEAN_QQ(obits, obits, lhs >> rhs);
|
||||
}
|
||||
static inline QData VL_SHIFTR_QQQ(int obits, int, int, QData lhs, QData rhs) VL_MT_SAFE {
|
||||
static inline QData VL_SHIFTR_QQQ(int obits, int, int, QData lhs, QData rhs) VL_PURE {
|
||||
if (VL_UNLIKELY(rhs >= VL_QUADSIZE)) return 0;
|
||||
return VL_CLEAN_QQ(obits, obits, lhs >> rhs);
|
||||
}
|
||||
|
|
@ -1803,7 +1813,7 @@ static inline WDataOutP VL_SHIFTRS_WWQ(int obits, int lbits, int rbits, WDataOut
|
|||
return VL_SHIFTRS_WWW(obits, lbits, rbits, owp, lwp, rwp);
|
||||
}
|
||||
static inline IData VL_SHIFTRS_IIW(int obits, int lbits, int rbits, IData lhs,
|
||||
WDataInP const rwp) VL_MT_SAFE {
|
||||
WDataInP const rwp) VL_PURE {
|
||||
EData overshift = 0; // Huge shift 1>>32 or more
|
||||
for (int i = 1; i < VL_WORDS_I(rbits); ++i) overshift |= rwp[i];
|
||||
if (VL_UNLIKELY(overshift || rwp[0] >= static_cast<IData>(obits))) {
|
||||
|
|
@ -1813,7 +1823,7 @@ static inline IData VL_SHIFTRS_IIW(int obits, int lbits, int rbits, IData lhs,
|
|||
return VL_SHIFTRS_III(obits, lbits, 32, lhs, rwp[0]);
|
||||
}
|
||||
static inline QData VL_SHIFTRS_QQW(int obits, int lbits, int rbits, QData lhs,
|
||||
WDataInP const rwp) VL_MT_SAFE {
|
||||
WDataInP const rwp) VL_PURE {
|
||||
EData overshift = 0; // Huge shift 1>>32 or more
|
||||
for (int i = 1; i < VL_WORDS_I(rbits); ++i) overshift |= rwp[i];
|
||||
if (VL_UNLIKELY(overshift || rwp[0] >= static_cast<IData>(obits))) {
|
||||
|
|
@ -1822,8 +1832,7 @@ static inline QData VL_SHIFTRS_QQW(int obits, int lbits, int rbits, QData lhs,
|
|||
}
|
||||
return VL_SHIFTRS_QQI(obits, lbits, 32, lhs, rwp[0]);
|
||||
}
|
||||
static inline IData VL_SHIFTRS_IIQ(int obits, int lbits, int rbits, IData lhs,
|
||||
QData rhs) VL_MT_SAFE {
|
||||
static inline IData VL_SHIFTRS_IIQ(int obits, int lbits, int rbits, IData lhs, QData rhs) VL_PURE {
|
||||
VlWide<VL_WQ_WORDS_E> rwp;
|
||||
VL_SET_WQ(rwp, rhs);
|
||||
return VL_SHIFTRS_IIW(obits, lbits, rbits, lhs, rwp);
|
||||
|
|
@ -1985,17 +1994,17 @@ static inline void VL_ASSIGNSEL_QQ(int rbits, int obits, int lsb, QData& lhsr, Q
|
|||
}
|
||||
// static inline void VL_ASSIGNSEL_IIIW(int obits, int lsb, IData& lhsr, WDataInP const rwp)
|
||||
// VL_MT_SAFE { Illegal, as lhs width >= rhs width
|
||||
static inline void VL_ASSIGNSEL_WI(int rbits, int obits, int lsb, WDataOutP owp,
|
||||
static inline void VL_ASSIGNSEL_WI(int rbits, int obits, int lsb, WDataOutP iowp,
|
||||
IData rhs) VL_MT_SAFE {
|
||||
_vl_insert_WI(owp, rhs, lsb + obits - 1, lsb, rbits);
|
||||
_vl_insert_WI(iowp, rhs, lsb + obits - 1, lsb, rbits);
|
||||
}
|
||||
static inline void VL_ASSIGNSEL_WQ(int rbits, int obits, int lsb, WDataOutP owp,
|
||||
static inline void VL_ASSIGNSEL_WQ(int rbits, int obits, int lsb, WDataOutP iowp,
|
||||
QData rhs) VL_MT_SAFE {
|
||||
_vl_insert_WQ(owp, rhs, lsb + obits - 1, lsb, rbits);
|
||||
_vl_insert_WQ(iowp, rhs, lsb + obits - 1, lsb, rbits);
|
||||
}
|
||||
static inline void VL_ASSIGNSEL_WW(int rbits, int obits, int lsb, WDataOutP owp,
|
||||
static inline void VL_ASSIGNSEL_WW(int rbits, int obits, int lsb, WDataOutP iowp,
|
||||
WDataInP const rwp) VL_MT_SAFE {
|
||||
_vl_insert_WW(owp, rwp, lsb + obits - 1, lsb, rbits);
|
||||
_vl_insert_WW(iowp, rwp, lsb + obits - 1, lsb, rbits);
|
||||
}
|
||||
|
||||
//======================================================================
|
||||
|
|
@ -2172,7 +2181,7 @@ extern IData VL_DIST_UNIFORM(IData& seedr, IData ustart, IData uend) VL_MT_SAFE;
|
|||
//======================================================================
|
||||
// Conversion functions
|
||||
|
||||
extern std::string VL_CVT_PACK_STR_NW(int lwords, const WDataInP lwp) VL_MT_SAFE;
|
||||
extern std::string VL_CVT_PACK_STR_NW(int lwords, const WDataInP lwp) VL_PURE;
|
||||
inline std::string VL_CVT_PACK_STR_NQ(QData lhs) VL_PURE {
|
||||
VlWide<VL_WQ_WORDS_E> lw;
|
||||
VL_SET_WQ(lw, lhs);
|
||||
|
|
@ -2198,7 +2207,7 @@ inline std::string VL_REPLICATEN_NNI(const std::string& lhs, IData rep) VL_PURE
|
|||
return VL_REPLICATEN_NNQ(lhs, rep);
|
||||
}
|
||||
|
||||
inline IData VL_LEN_IN(const std::string& ld) { return ld.length(); }
|
||||
inline IData VL_LEN_IN(const std::string& ld) { return static_cast<IData>(ld.length()); }
|
||||
extern std::string VL_TOLOWER_NN(const std::string& ld) VL_PURE;
|
||||
extern std::string VL_TOUPPER_NN(const std::string& ld) VL_PURE;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Code available from: https://verilator.org
|
||||
//
|
||||
// Copyright 2010-2022 by Wilson Snyder. This program is free software; you can
|
||||
// Copyright 2010-2023 by Wilson Snyder. This program 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.
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Code available from: https://verilator.org
|
||||
//
|
||||
// Copyright 2009-2022 by Wilson Snyder. This program is free software; you can
|
||||
// Copyright 2009-2023 by Wilson Snyder. This program 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.
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Code available from: https://verilator.org
|
||||
//
|
||||
// Copyright 2003-2022 by Wilson Snyder. This program is free software; you can
|
||||
// Copyright 2003-2023 by Wilson Snyder. This program 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.
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Code available from: https://verilator.org
|
||||
//
|
||||
// Copyright 2003-2022 by Wilson Snyder. This program is free software; you can
|
||||
// Copyright 2003-2023 by Wilson Snyder. This program 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.
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Code available from: https://verilator.org
|
||||
//
|
||||
// Copyright 2012-2022 by Wilson Snyder. This program is free software; you can
|
||||
// Copyright 2012-2023 by Wilson Snyder. This program 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.
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Code available from: https://verilator.org
|
||||
//
|
||||
// Copyright 2012-2022 by Wilson Snyder. This program is free software; you
|
||||
// Copyright 2012-2023 by Wilson Snyder. This program 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.
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Code available from: https://verilator.org
|
||||
//
|
||||
// Copyright 2001-2022 by Wilson Snyder. This program is free software; you
|
||||
// Copyright 2001-2023 by Wilson Snyder. This program 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.
|
||||
|
|
@ -60,7 +60,7 @@ static const char* const VLTSAVE_TRAILER_STR = "vltsaved";
|
|||
//=============================================================================
|
||||
//=============================================================================
|
||||
//=============================================================================
|
||||
// Searalization
|
||||
// Serialization
|
||||
|
||||
bool VerilatedDeserialize::readDiffers(const void* __restrict datap,
|
||||
size_t size) VL_MT_UNSAFE_ONE {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Code available from: https://verilator.org
|
||||
//
|
||||
// Copyright 2000-2022 by Wilson Snyder. This program is free software; you
|
||||
// Copyright 2000-2023 by Wilson Snyder. This program 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.
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Code available from: https://verilator.org
|
||||
//
|
||||
// Copyright 2009-2022 by Wilson Snyder. This program is free software; you can
|
||||
// Copyright 2009-2023 by Wilson Snyder. This program 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.
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
//
|
||||
//*************************************************************************
|
||||
//
|
||||
// Copyright 2022 by Wilson Snyder. This program is free software; you can
|
||||
// Copyright 2022-2023 by Wilson Snyder. This program 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.
|
||||
// SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Code available from: https://verilator.org
|
||||
//
|
||||
// Copyright 2003-2022 by Wilson Snyder. This program is free software; you can
|
||||
// Copyright 2003-2023 by Wilson Snyder. This program 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.
|
||||
|
|
@ -182,7 +182,7 @@ public:
|
|||
}
|
||||
// Total size in bytes (note DPI limited to 4GB)
|
||||
size_t totalSize() const;
|
||||
// Adjust a data pointer to access a given array element, NuLL if something goes bad
|
||||
// Adjust a data pointer to access a given array element, NULL if something goes bad
|
||||
void* datapAdjustIndex(void* datap, int dim, int indx) const;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Code available from: https://verilator.org
|
||||
//
|
||||
// Copyright 2003-2022 by Wilson Snyder. This program is free software; you can
|
||||
// Copyright 2003-2023 by Wilson Snyder. This program 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.
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Code available from: https://verilator.org
|
||||
//
|
||||
// Copyright 2012-2022 by Wilson Snyder. This program is free software; you can
|
||||
// Copyright 2012-2023 by Wilson Snyder. This program 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.
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Code available from: https://verilator.org
|
||||
//
|
||||
// Copyright 2012-2022 by Wilson Snyder. This program is free software; you
|
||||
// Copyright 2012-2023 by Wilson Snyder. This program 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.
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Code available from: https://verilator.org
|
||||
//
|
||||
// Copyright 2001-2022 by Wilson Snyder. This program is free software; you
|
||||
// Copyright 2001-2023 by Wilson Snyder. This program 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.
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Code available from: https://verilator.org
|
||||
//
|
||||
// Copyright 2001-2022 by Wilson Snyder. This program is free software; you
|
||||
// Copyright 2001-2023 by Wilson Snyder. This program 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.
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Code available from: https://verilator.org
|
||||
//
|
||||
// Copyright 2001-2022 by Wilson Snyder. This program is free software; you
|
||||
// Copyright 2001-2023 by Wilson Snyder. This program 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.
|
||||
|
|
@ -497,7 +497,7 @@ void VerilatedTrace<VL_SUB_T, VL_BUF_T>::runCallbacks(const std::vector<Callback
|
|||
const unsigned threads = threadPoolp->numThreads() + 1;
|
||||
// Main thread executes all jobs with index % threads == 0
|
||||
std::vector<ParallelWorkerData*> mainThreadWorkerData;
|
||||
// Enuque all the jobs
|
||||
// Enqueue all the jobs
|
||||
for (unsigned i = 0; i < cbVec.size(); ++i) {
|
||||
const CallbackRecord& cbr = cbVec[i];
|
||||
// Always get the trace buffer on the main thread
|
||||
|
|
@ -793,7 +793,7 @@ static inline void cvtSDataToStr(char* dstp, SData value) {
|
|||
static inline void cvtIDataToStr(char* dstp, IData value) {
|
||||
#ifdef VL_HAVE_AVX2
|
||||
// Similar to cvtSDataToStr but the bottom 16-bits are processed in the
|
||||
// top half of the YMM registerss
|
||||
// top half of the YMM registers
|
||||
const __m256i a = _mm256_insert_epi32(_mm256_undefined_si256(), value, 0);
|
||||
const __m256i b = _mm256_permute4x64_epi64(a, 0);
|
||||
const __m256i s = _mm256_set_epi8(0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Code available from: https://verilator.org
|
||||
//
|
||||
// Copyright 2003-2022 by Wilson Snyder. This program is free software; you can
|
||||
// Copyright 2003-2023 by Wilson Snyder. This program 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.
|
||||
|
|
@ -212,9 +212,9 @@ struct VlWide final {
|
|||
|
||||
// OPERATOR METHODS
|
||||
// Default copy assignment operators are used.
|
||||
operator WDataOutP() { return &m_storage[0]; } // This also allows []
|
||||
operator WDataInP() const { return &m_storage[0]; } // This also allows []
|
||||
bool operator!=(const VlWide<T_Words>& that) const {
|
||||
operator WDataOutP() VL_PURE { return &m_storage[0]; } // This also allows []
|
||||
operator WDataInP() const VL_PURE { return &m_storage[0]; } // This also allows []
|
||||
bool operator!=(const VlWide<T_Words>& that) const VL_PURE {
|
||||
for (size_t i = 0; i < T_Words; ++i) {
|
||||
if (m_storage[i] != that.m_storage[i]) return true;
|
||||
}
|
||||
|
|
@ -273,6 +273,8 @@ public:
|
|||
VlQueue(VlQueue&&) = default;
|
||||
VlQueue& operator=(const VlQueue&) = default;
|
||||
VlQueue& operator=(VlQueue&&) = default;
|
||||
bool operator==(const VlQueue& rhs) const { return m_deque == rhs.m_deque; }
|
||||
bool operator!=(const VlQueue& rhs) const { return m_deque != rhs.m_deque; }
|
||||
|
||||
// Standard copy constructor works. Verilog: assoca = assocb
|
||||
// Also must allow conversion from a different T_MaxSize queue
|
||||
|
|
@ -692,6 +694,8 @@ public:
|
|||
VlAssocArray(VlAssocArray&&) = default;
|
||||
VlAssocArray& operator=(const VlAssocArray&) = default;
|
||||
VlAssocArray& operator=(VlAssocArray&&) = default;
|
||||
bool operator==(const VlAssocArray& rhs) const { return m_map == rhs.m_map; }
|
||||
bool operator!=(const VlAssocArray& rhs) const { return m_map != rhs.m_map; }
|
||||
|
||||
// METHODS
|
||||
T_Value& atDefault() { return m_defaultValue; }
|
||||
|
|
@ -1225,6 +1229,9 @@ public:
|
|||
T_Class* operator->() const { return m_objp; }
|
||||
// For 'if (ptr)...'
|
||||
operator bool() const { return m_objp; }
|
||||
// In SV A == B iff both are handles to the same object (IEEE 1800-2017 8.4)
|
||||
bool operator==(const VlClassRef& rhs) const { return m_objp == rhs.m_objp; };
|
||||
bool operator!=(const VlClassRef& rhs) const { return m_objp != rhs.m_objp; };
|
||||
};
|
||||
|
||||
template <typename T, typename U>
|
||||
|
|
@ -1238,6 +1245,42 @@ static inline bool VL_CAST_DYNAMIC(VlClassRef<T> in, VlClassRef<U>& outr) {
|
|||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// VlSampleQueue stores samples for input clockvars in clocking blocks. At a clocking event,
|
||||
// samples from this queue should be written to the correct input clockvar.
|
||||
|
||||
template <typename T_Sampled>
|
||||
class VlSampleQueue final {
|
||||
// TYPES
|
||||
// Type representing a single value sample at a point in time
|
||||
struct VlSample {
|
||||
uint64_t m_timestamp; // Timestamp at which the value was sampled
|
||||
T_Sampled m_value; // The sampled value
|
||||
};
|
||||
|
||||
// MEMBERS
|
||||
std::deque<VlSample> m_queue; // Queue of samples with timestamps
|
||||
|
||||
public:
|
||||
// METHODS
|
||||
// Push a new sample with the given timestamp to the end of the queue
|
||||
void push(uint64_t time, const T_Sampled& value) { m_queue.push_back({time, value}); }
|
||||
// Get the latest sample with its timestamp less than or equal to the given skew
|
||||
void pop(uint64_t time, uint64_t skew, T_Sampled& value) {
|
||||
if (time < skew) return;
|
||||
// Find the last element not greater than (time - skew). Do a binary search, as the queue
|
||||
// should be ordered.
|
||||
auto it = std::lower_bound(m_queue.rbegin(), m_queue.rend(), VlSample{time - skew, {}},
|
||||
[](const VlSample& sample, const VlSample& skewed) {
|
||||
return sample.m_timestamp > skewed.m_timestamp;
|
||||
});
|
||||
if (it != m_queue.rend()) {
|
||||
value = it->m_value;
|
||||
m_queue.erase(m_queue.begin(), it.base());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//======================================================================
|
||||
|
||||
#define VL_NEW(Class, ...) \
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Code available from: https://verilator.org
|
||||
//
|
||||
// Copyright 2001-2022 by Wilson Snyder. This program is free software; you
|
||||
// Copyright 2001-2023 by Wilson Snyder. This program 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.
|
||||
|
|
@ -527,7 +527,7 @@ void VerilatedVcd::declare(uint32_t code, const char* name, const char* wirep, b
|
|||
std::strlen(buf)); // Code (overwrite separator if isBit)
|
||||
entryp[length + !isBit] = '\n'; // Replace '\0' with line termination '\n'
|
||||
// Set length of suffix (used to increment write pointer)
|
||||
entryp[VL_TRACE_SUFFIX_ENTRY_SIZE - 1] = !isBit + length + 1;
|
||||
entryp[VL_TRACE_SUFFIX_ENTRY_SIZE - 1] = static_cast<char>(length + !isBit + 1);
|
||||
decl += " ";
|
||||
decl += basename;
|
||||
if (array) {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Code available from: https://verilator.org
|
||||
//
|
||||
// Copyright 2001-2022 by Wilson Snyder. This program is free software; you
|
||||
// Copyright 2001-2023 by Wilson Snyder. This program 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.
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Code available from: https://verilator.org
|
||||
//
|
||||
// Copyright 2001-2022 by Wilson Snyder. This program is free software; you
|
||||
// Copyright 2001-2023 by Wilson Snyder. This program 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.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// -*- mode: C++; c-file-style: "cc-mode" -*-
|
||||
//=============================================================================
|
||||
//
|
||||
// Copyright 2001-2022 by Wilson Snyder. This program is free software; you can
|
||||
// Copyright 2001-2023 by Wilson Snyder. This program 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.
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Code available from: https://verilator.org
|
||||
//
|
||||
// Copyright 2009-2022 by Wilson Snyder. This program is free software; you can
|
||||
// Copyright 2009-2023 by Wilson Snyder. This program 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.
|
||||
|
|
@ -126,34 +126,18 @@ public:
|
|||
virtual PLI_INT32 dovpi_remove_cb() { return 0; }
|
||||
};
|
||||
|
||||
class VerilatedVpioTimedCb final : public VerilatedVpio {
|
||||
// A handle to a timed callback created with vpi_register_cb
|
||||
// User can call vpi_remove_cb or vpi_release_handle on it
|
||||
const uint64_t m_id; // Unique id/sequence number to find schedule's event
|
||||
const QData m_time;
|
||||
|
||||
public:
|
||||
VerilatedVpioTimedCb(uint64_t id, QData time)
|
||||
: m_id{id}
|
||||
, m_time{time} {}
|
||||
~VerilatedVpioTimedCb() override = default;
|
||||
static VerilatedVpioTimedCb* castp(vpiHandle h) {
|
||||
return dynamic_cast<VerilatedVpioTimedCb*>(reinterpret_cast<VerilatedVpioTimedCb*>(h));
|
||||
}
|
||||
uint32_t type() const override { return vpiCallback; }
|
||||
PLI_INT32 dovpi_remove_cb() override;
|
||||
};
|
||||
|
||||
class VerilatedVpioReasonCb final : public VerilatedVpio {
|
||||
// A handle to a non-timed callback created with vpi_register_cb
|
||||
// A handle to a timed or non-timed callback created with vpi_register_cb
|
||||
// User can call vpi_remove_cb or vpi_release_handle on it
|
||||
const uint64_t m_id; // Unique id/sequence number to find schedule's event
|
||||
const QData m_time; // Scheduled time, or 0 = not timed
|
||||
const PLI_INT32 m_reason; // VPI callback reason code
|
||||
|
||||
public:
|
||||
// cppcheck-suppress uninitVar // m_value
|
||||
VerilatedVpioReasonCb(uint64_t id, PLI_INT32 reason)
|
||||
VerilatedVpioReasonCb(uint64_t id, QData time, PLI_INT32 reason)
|
||||
: m_id{id}
|
||||
, m_time{time}
|
||||
, m_reason{reason} {}
|
||||
~VerilatedVpioReasonCb() override = default;
|
||||
static VerilatedVpioReasonCb* castp(vpiHandle h) {
|
||||
|
|
@ -474,7 +458,7 @@ using VerilatedPliCb = PLI_INT32 (*)(struct t_cb_data*);
|
|||
|
||||
class VerilatedVpiCbHolder final {
|
||||
// Holds information needed to call a callback
|
||||
uint64_t m_id;
|
||||
uint64_t m_id; // Unique id/sequence number to find schedule's event, 0 = invalid
|
||||
s_cb_data m_cbData;
|
||||
s_vpi_value m_value;
|
||||
VerilatedVpioVar m_varo; // If a cbValueChange callback, the object we will return
|
||||
|
|
@ -515,13 +499,15 @@ struct VerilatedVpiTimedCbsCmp {
|
|||
class VerilatedVpiError;
|
||||
|
||||
class VerilatedVpiImp final {
|
||||
enum { CB_ENUM_MAX_VALUE = cbAtEndOfSimTime + 1 }; // Maxium callback reason
|
||||
enum { CB_ENUM_MAX_VALUE = cbAtEndOfSimTime + 1 }; // Maximum callback reason
|
||||
using VpioCbList = std::list<VerilatedVpiCbHolder>;
|
||||
using VpioTimedCbs = std::map<std::pair<QData, uint64_t>, VerilatedVpiCbHolder>;
|
||||
using VpioFutureCbs = std::map<std::pair<QData, uint64_t>, VerilatedVpiCbHolder>;
|
||||
|
||||
// All only medium-speed, so use singleton function
|
||||
VpioCbList m_cbObjLists[CB_ENUM_MAX_VALUE]; // Callbacks for each supported reason
|
||||
VpioTimedCbs m_timedCbs; // Time based callbacks
|
||||
// Callbacks that are past or at current timestamp
|
||||
std::array<VpioCbList, CB_ENUM_MAX_VALUE> m_cbCurrentLists;
|
||||
VpioFutureCbs m_futureCbs; // Time based callbacks for future timestamps
|
||||
VpioFutureCbs m_nextCbs; // cbNextSimTime callbacks
|
||||
VerilatedVpiError* m_errorInfop = nullptr; // Container for vpi error info
|
||||
VerilatedAssertOneThread m_assertOne; // Assert only called from single thread
|
||||
uint64_t m_nextCallbackId = 1; // Id to identify callback
|
||||
|
|
@ -535,7 +521,7 @@ public:
|
|||
static void assertOneCheck() { s().m_assertOne.check(); }
|
||||
static uint64_t nextCallbackId() { return ++s().m_nextCallbackId; }
|
||||
|
||||
static void cbReasonAdd(uint64_t id, const s_cb_data* cb_data_p) {
|
||||
static void cbCurrentAdd(uint64_t id, const s_cb_data* cb_data_p) {
|
||||
// The passed cb_data_p was property of the user, so need to recreate
|
||||
if (VL_UNCOVERABLE(cb_data_p->reason >= CB_ENUM_MAX_VALUE)) {
|
||||
VL_FATAL_MT(__FILE__, __LINE__, "", "vpi bb reason too large");
|
||||
|
|
@ -544,82 +530,109 @@ public:
|
|||
cb_data_p->reason, id, cb_data_p->obj););
|
||||
VerilatedVpioVar* varop = nullptr;
|
||||
if (cb_data_p->reason == cbValueChange) varop = VerilatedVpioVar::castp(cb_data_p->obj);
|
||||
s().m_cbObjLists[cb_data_p->reason].emplace_back(id, cb_data_p, varop);
|
||||
s().m_cbCurrentLists[cb_data_p->reason].emplace_back(id, cb_data_p, varop);
|
||||
}
|
||||
static void cbTimedAdd(uint64_t id, const s_cb_data* cb_data_p, QData time) {
|
||||
static void cbFutureAdd(uint64_t id, const s_cb_data* cb_data_p, QData time) {
|
||||
// The passed cb_data_p was property of the user, so need to recreate
|
||||
VL_DEBUG_IF_PLI(VL_DBG_MSGF("- vpi: vpi_register_cb reason=%d id=%" PRId64
|
||||
" delay=%" PRIu64 "\n",
|
||||
cb_data_p->reason, id, time););
|
||||
s().m_timedCbs.emplace(std::piecewise_construct,
|
||||
std::forward_as_tuple(std::make_pair(time, id)),
|
||||
std::forward_as_tuple(id, cb_data_p, nullptr));
|
||||
VL_DEBUG_IF_PLI(VL_DBG_MSGF("- vpi: vpi_register_cb reason=%d id=%" PRId64 " time=%" PRIu64
|
||||
" obj=%p\n",
|
||||
cb_data_p->reason, id, time, cb_data_p->obj););
|
||||
s().m_futureCbs.emplace(std::piecewise_construct,
|
||||
std::forward_as_tuple(std::make_pair(time, id)),
|
||||
std::forward_as_tuple(id, cb_data_p, nullptr));
|
||||
}
|
||||
static void cbReasonRemove(uint64_t id, uint32_t reason) {
|
||||
static void cbNextAdd(uint64_t id, const s_cb_data* cb_data_p, QData time) {
|
||||
// The passed cb_data_p was property of the user, so need to recreate
|
||||
VL_DEBUG_IF_PLI(VL_DBG_MSGF("- vpi: vpi_register_cb reason=%d(NEXT) id=%" PRId64
|
||||
" time=%" PRIu64 " obj=%p\n",
|
||||
cb_data_p->reason, id, time, cb_data_p->obj););
|
||||
s().m_nextCbs.emplace(std::piecewise_construct,
|
||||
std::forward_as_tuple(std::make_pair(time, id)),
|
||||
std::forward_as_tuple(id, cb_data_p, nullptr));
|
||||
}
|
||||
static void cbReasonRemove(uint64_t id, uint32_t reason, QData time) {
|
||||
// Id might no longer exist, if already removed due to call after event, or teardown
|
||||
VpioCbList& cbObjList = s().m_cbObjLists[reason];
|
||||
// We do not remove it now as we may be iterating the list,
|
||||
// instead set to nullptr and will cleanup later
|
||||
for (auto& ir : cbObjList) {
|
||||
if (ir.id() == id) ir.invalidate();
|
||||
// Remove from cbCurrent queue
|
||||
for (auto& ir : s().m_cbCurrentLists[reason]) {
|
||||
if (ir.id() == id) {
|
||||
ir.invalidate();
|
||||
return; // Once found, it won't also be in m_futureCbs
|
||||
}
|
||||
}
|
||||
{ // Remove from cbFuture queue
|
||||
const auto it = s().m_futureCbs.find(std::make_pair(time, id));
|
||||
if (it != s().m_futureCbs.end()) {
|
||||
it->second.invalidate();
|
||||
return;
|
||||
}
|
||||
}
|
||||
{ // Remove from cbNext
|
||||
const auto it = s().m_nextCbs.find(std::make_pair(time, id));
|
||||
if (it != s().m_nextCbs.end()) {
|
||||
it->second.invalidate();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
static void cbTimedRemove(uint64_t id, QData time) {
|
||||
// Id might no longer exist, if already removed due to call after event, or teardown
|
||||
const auto it = s().m_timedCbs.find(std::make_pair(time, id));
|
||||
if (VL_LIKELY(it != s().m_timedCbs.end())) it->second.invalidate();
|
||||
}
|
||||
static void callTimedCbs() VL_MT_UNSAFE_ONE {
|
||||
assertOneCheck();
|
||||
static void moveFutureCbs() VL_MT_UNSAFE_ONE {
|
||||
// For any events past current time, move from cbFuture queue to cbCurrent queue
|
||||
if (s().m_futureCbs.empty() && s().m_nextCbs.empty()) return;
|
||||
// VL_DEBUG_IF_PLI(VL_DBG_MSGF("- vpi: moveFutureCbs\n"); dumpCbs(); );
|
||||
const QData time = VL_TIME_Q();
|
||||
for (auto it = s().m_timedCbs.begin(); it != s().m_timedCbs.end();) {
|
||||
if (VL_UNLIKELY(it->first.first <= time)) {
|
||||
VerilatedVpiCbHolder& ho = it->second;
|
||||
const auto last_it = it;
|
||||
++it;
|
||||
if (VL_UNLIKELY(!ho.invalid())) {
|
||||
VL_DEBUG_IF_PLI(
|
||||
VL_DBG_MSGF("- vpi: timed_callback id=%" PRId64 "\n", ho.id()););
|
||||
ho.invalidate(); // Timed callbacks are one-shot
|
||||
(ho.cb_rtnp())(ho.cb_datap());
|
||||
}
|
||||
s().m_timedCbs.erase(last_it);
|
||||
} else {
|
||||
++it;
|
||||
for (auto it = s().m_futureCbs.begin(); //
|
||||
VL_UNLIKELY(it != s().m_futureCbs.end() && it->first.first <= time);) {
|
||||
VerilatedVpiCbHolder& hor = it->second;
|
||||
const auto last_it = it;
|
||||
++it;
|
||||
if (VL_UNLIKELY(!hor.invalid())) {
|
||||
VL_DEBUG_IF_PLI(VL_DBG_MSGF("- vpi: moveFutureCbs id=%" PRId64 "\n", hor.id()););
|
||||
s().m_cbCurrentLists[hor.cb_datap()->reason].emplace_back(hor);
|
||||
}
|
||||
s().m_futureCbs.erase(last_it);
|
||||
}
|
||||
for (auto it = s().m_nextCbs.begin(); //
|
||||
VL_UNLIKELY(it != s().m_nextCbs.end() && it->first.first < time);) {
|
||||
VerilatedVpiCbHolder& hor = it->second;
|
||||
const auto last_it = it;
|
||||
++it;
|
||||
if (VL_UNLIKELY(!hor.invalid())) {
|
||||
VL_DEBUG_IF_PLI(VL_DBG_MSGF("- vpi: moveFutureCbs id=%" PRId64 "\n", hor.id()););
|
||||
s().m_cbCurrentLists[hor.cb_datap()->reason].emplace_back(hor);
|
||||
}
|
||||
s().m_nextCbs.erase(last_it);
|
||||
}
|
||||
}
|
||||
static QData cbNextDeadline() {
|
||||
const auto it = s().m_timedCbs.cbegin();
|
||||
if (VL_LIKELY(it != s().m_timedCbs.cend())) return it->first.first;
|
||||
const auto it = s().m_futureCbs.cbegin();
|
||||
if (VL_LIKELY(it != s().m_futureCbs.cend())) return it->first.first;
|
||||
return ~0ULL; // maxquad
|
||||
}
|
||||
static bool callCbs(const uint32_t reason) VL_MT_UNSAFE_ONE {
|
||||
VpioCbList& cbObjList = s().m_cbObjLists[reason];
|
||||
VL_DEBUG_IF_PLI(VL_DBG_MSGF("- vpi: callCbs reason=%u\n", reason););
|
||||
assertOneCheck();
|
||||
moveFutureCbs();
|
||||
if (s().m_cbCurrentLists[reason].empty()) return false;
|
||||
// Iterate on old list, making new list empty, to prevent looping over newly added elements
|
||||
VpioCbList cbObjList;
|
||||
std::swap(s().m_cbCurrentLists[reason], cbObjList);
|
||||
bool called = false;
|
||||
if (cbObjList.empty()) return called;
|
||||
const auto last = std::prev(cbObjList.end()); // prevent looping over newly added elements
|
||||
for (auto it = cbObjList.begin(); true;) {
|
||||
for (VerilatedVpiCbHolder& ihor : cbObjList) {
|
||||
// cbReasonRemove sets to nullptr, so we know on removal the old end() will still exist
|
||||
const bool was_last = it == last;
|
||||
if (VL_UNLIKELY(it->invalid())) { // Deleted earlier, cleanup
|
||||
it = cbObjList.erase(it);
|
||||
if (was_last) break;
|
||||
continue;
|
||||
if (VL_LIKELY(!ihor.invalid())) { // Not deleted earlier
|
||||
VL_DEBUG_IF_PLI(VL_DBG_MSGF("- vpi: reason_callback reason=%d id=%" PRId64 "\n",
|
||||
reason, ihor.id()););
|
||||
ihor.invalidate(); // Timed callbacks are one-shot
|
||||
(ihor.cb_rtnp())(ihor.cb_datap());
|
||||
called = true;
|
||||
}
|
||||
VerilatedVpiCbHolder& ho = *it;
|
||||
VL_DEBUG_IF_PLI(VL_DBG_MSGF("- vpi: reason_callback reason=%d id=%" PRId64 "\n",
|
||||
reason, ho.id()););
|
||||
(ho.cb_rtnp())(ho.cb_datap());
|
||||
called = true;
|
||||
if (was_last) break;
|
||||
++it;
|
||||
}
|
||||
return called;
|
||||
}
|
||||
static bool callValueCbs() VL_MT_UNSAFE_ONE {
|
||||
assertOneCheck();
|
||||
VpioCbList& cbObjList = s().m_cbObjLists[cbValueChange];
|
||||
VpioCbList& cbObjList = s().m_cbCurrentLists[cbValueChange];
|
||||
bool called = false;
|
||||
std::unordered_set<VerilatedVpioVar*> update; // set of objects to update after callbacks
|
||||
if (cbObjList.empty()) return called;
|
||||
|
|
@ -658,7 +671,7 @@ public:
|
|||
}
|
||||
return called;
|
||||
}
|
||||
|
||||
static void dumpCbs() VL_MT_UNSAFE_ONE;
|
||||
static VerilatedVpiError* error_info() VL_MT_UNSAFE_ONE; // getter for vpi error info
|
||||
};
|
||||
|
||||
|
|
@ -742,23 +755,21 @@ public:
|
|||
//======================================================================
|
||||
// VerilatedVpi implementation
|
||||
|
||||
void VerilatedVpi::callTimedCbs() VL_MT_UNSAFE_ONE { VerilatedVpiImp::callTimedCbs(); }
|
||||
|
||||
bool VerilatedVpi::callValueCbs() VL_MT_UNSAFE_ONE { return VerilatedVpiImp::callValueCbs(); }
|
||||
|
||||
bool VerilatedVpi::callCbs(uint32_t reason) VL_MT_UNSAFE_ONE {
|
||||
return VerilatedVpiImp::callCbs(reason);
|
||||
}
|
||||
|
||||
// Historical, before we had multiple kinds of timed callbacks
|
||||
void VerilatedVpi::callTimedCbs() VL_MT_UNSAFE_ONE { VerilatedVpiImp::callCbs(cbAfterDelay); }
|
||||
|
||||
bool VerilatedVpi::callValueCbs() VL_MT_UNSAFE_ONE { return VerilatedVpiImp::callValueCbs(); }
|
||||
|
||||
QData VerilatedVpi::cbNextDeadline() VL_MT_UNSAFE_ONE { return VerilatedVpiImp::cbNextDeadline(); }
|
||||
|
||||
PLI_INT32 VerilatedVpioTimedCb::dovpi_remove_cb() {
|
||||
VerilatedVpiImp::cbTimedRemove(m_id, m_time);
|
||||
delete this; // IEEE 37.2.2 a vpi_remove_cb does a vpi_release_handle
|
||||
return 1;
|
||||
}
|
||||
void VerilatedVpi::dumpCbs() VL_MT_UNSAFE_ONE { VerilatedVpiImp::dumpCbs(); }
|
||||
|
||||
PLI_INT32 VerilatedVpioReasonCb::dovpi_remove_cb() {
|
||||
VerilatedVpiImp::cbReasonRemove(m_id, m_reason);
|
||||
VerilatedVpiImp::cbReasonRemove(m_id, m_reason, m_time);
|
||||
delete this; // IEEE 37.2.2 a vpi_remove_cb does a vpi_release_handle
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -766,6 +777,42 @@ PLI_INT32 VerilatedVpioReasonCb::dovpi_remove_cb() {
|
|||
//======================================================================
|
||||
// VerilatedVpiImp implementation
|
||||
|
||||
void VerilatedVpiImp::dumpCbs() VL_MT_UNSAFE_ONE {
|
||||
assertOneCheck();
|
||||
VL_DBG_MSGF("- vpi: dumpCbs\n");
|
||||
for (uint32_t reason = 0; reason < CB_ENUM_MAX_VALUE; ++reason) {
|
||||
VpioCbList& cbObjList = s().m_cbCurrentLists[reason];
|
||||
for (auto& ho : cbObjList) {
|
||||
if (VL_UNLIKELY(!ho.invalid())) {
|
||||
VL_DBG_MSGF("- vpi: reason=%d=%s id=%" PRId64 "\n", reason,
|
||||
VerilatedVpiError::strFromVpiCallbackReason(reason), ho.id());
|
||||
}
|
||||
}
|
||||
}
|
||||
for (auto& ifuture : s().m_nextCbs) {
|
||||
const QData time = ifuture.first.first;
|
||||
const uint64_t id = ifuture.first.second;
|
||||
VerilatedVpiCbHolder& ho = ifuture.second;
|
||||
if (VL_UNLIKELY(!ho.invalid())) {
|
||||
VL_DBG_MSGF("- vpi: time=%" PRId64 "(NEXT) reason=%d=%s id=%" PRId64 "\n", time,
|
||||
ho.cb_datap()->reason,
|
||||
VerilatedVpiError::strFromVpiCallbackReason(ho.cb_datap()->reason),
|
||||
ho.id());
|
||||
}
|
||||
}
|
||||
for (auto& ifuture : s().m_futureCbs) {
|
||||
const QData time = ifuture.first.first;
|
||||
const uint64_t id = ifuture.first.second;
|
||||
VerilatedVpiCbHolder& ho = ifuture.second;
|
||||
if (VL_UNLIKELY(!ho.invalid())) {
|
||||
VL_DBG_MSGF("- vpi: time=%" PRId64 " reason=%d=%s id=%" PRId64 "\n", time,
|
||||
ho.cb_datap()->reason,
|
||||
VerilatedVpiError::strFromVpiCallbackReason(ho.cb_datap()->reason),
|
||||
ho.id());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VerilatedVpiError* VerilatedVpiImp::error_info() VL_MT_UNSAFE_ONE {
|
||||
VerilatedVpiImp::assertOneCheck();
|
||||
if (VL_UNLIKELY(!s().m_errorInfop)) s().m_errorInfop = new VerilatedVpiError;
|
||||
|
|
@ -1306,34 +1353,54 @@ vpiHandle vpi_register_cb(p_cb_data cb_data_p) {
|
|||
VL_VPI_WARNING_(__FILE__, __LINE__, "%s : callback data pointer is null", __func__);
|
||||
return nullptr;
|
||||
}
|
||||
switch (cb_data_p->reason) {
|
||||
case cbAfterDelay: {
|
||||
QData time = 0;
|
||||
if (cb_data_p->time) time = VL_SET_QII(cb_data_p->time->high, cb_data_p->time->low);
|
||||
const QData abstime = VL_TIME_Q() + time;
|
||||
const PLI_INT32 reason = cb_data_p->reason;
|
||||
switch (reason) {
|
||||
case cbAfterDelay: // FALLTHRU // One-shot; time relative
|
||||
case cbAtEndOfSimTime: // FALLTHRU // One-shot; time absolute; supported via vlt_main.cpp
|
||||
case cbAtStartOfSimTime: // FALLTHRU // One-shot; time absolute; supported via vlt_main.cpp
|
||||
case cbReadOnlySynch: // FALLTHRU // One-shot; time relative; supported via vlt_main.cpp
|
||||
case cbReadWriteSynch: { // One-shot; time relative; supported via vlt_main.cpp
|
||||
const bool abs = reason == cbAtStartOfSimTime || reason == cbAtEndOfSimTime;
|
||||
const QData time = VL_TIME_Q();
|
||||
QData abstime = 0;
|
||||
if (cb_data_p->time) {
|
||||
if (abs) {
|
||||
abstime = VL_SET_QII(cb_data_p->time->high, cb_data_p->time->low);
|
||||
} else {
|
||||
abstime = time + VL_SET_QII(cb_data_p->time->high, cb_data_p->time->low);
|
||||
}
|
||||
}
|
||||
const uint64_t id = VerilatedVpiImp::nextCallbackId();
|
||||
VerilatedVpioTimedCb* const vop = new VerilatedVpioTimedCb{id, abstime};
|
||||
VerilatedVpiImp::cbTimedAdd(id, cb_data_p, abstime);
|
||||
VerilatedVpioReasonCb* const vop = new VerilatedVpioReasonCb{id, abstime, reason};
|
||||
if (abstime <= time) {
|
||||
VerilatedVpiImp::cbCurrentAdd(id, cb_data_p);
|
||||
} else {
|
||||
VerilatedVpiImp::cbFutureAdd(id, cb_data_p, abstime);
|
||||
}
|
||||
return vop->castVpiHandle();
|
||||
}
|
||||
case cbReadWriteSynch: // FALLTHRU // Supported via vlt_main.cpp
|
||||
case cbReadOnlySynch: // FALLTHRU // Supported via vlt_main.cpp
|
||||
case cbNextSimTime: // FALLTHRU // Supported via vlt_main.cpp
|
||||
case cbStartOfSimulation: // FALLTHRU // Supported via vlt_main.cpp
|
||||
case cbEndOfSimulation: // FALLTHRU // Supported via vlt_main.cpp
|
||||
case cbValueChange: // FALLTHRU // Supported via vlt_main.cpp
|
||||
case cbPLIError: // FALLTHRU // NOP, but need to return handle, so make object
|
||||
case cbNextSimTime: { // One-shot; time always next; supported via vlt_main.cpp
|
||||
const QData time = VL_TIME_Q();
|
||||
const uint64_t id = VerilatedVpiImp::nextCallbackId();
|
||||
VerilatedVpioReasonCb* const vop = new VerilatedVpioReasonCb{id, 0, reason};
|
||||
VerilatedVpiImp::cbNextAdd(id, cb_data_p, time);
|
||||
return vop->castVpiHandle();
|
||||
}
|
||||
case cbEndOfSimulation: // FALLTHRU // One-shot; time ignored; supported via vlt_main.cpp
|
||||
case cbEnterInteractive: // FALLTHRU // NOP, but need to return handle, so make object
|
||||
case cbExitInteractive: // FALLTHRU // NOP, but need to return handle, so make object
|
||||
case cbInteractiveScopeChange: { // FALLTHRU // NOP, but need to return handle, so make object
|
||||
case cbInteractiveScopeChange: // FALLTHRU // NOP, but need to return handle, so make object
|
||||
case cbPLIError: // FALLTHRU // NOP, but need to return handle, so make object
|
||||
case cbStartOfSimulation: // FALLTHRU // One-shot; time ignored; supported via vlt_main.cpp
|
||||
case cbValueChange: { // Multi-shot; supported via vlt_main.cpp
|
||||
const uint64_t id = VerilatedVpiImp::nextCallbackId();
|
||||
VerilatedVpioReasonCb* const vop = new VerilatedVpioReasonCb{id, cb_data_p->reason};
|
||||
VerilatedVpiImp::cbReasonAdd(id, cb_data_p);
|
||||
VerilatedVpioReasonCb* const vop = new VerilatedVpioReasonCb{id, 0, reason};
|
||||
VerilatedVpiImp::cbCurrentAdd(id, cb_data_p);
|
||||
return vop->castVpiHandle();
|
||||
}
|
||||
default:
|
||||
VL_VPI_WARNING_(__FILE__, __LINE__, "%s: Unsupported callback type %s", __func__,
|
||||
VerilatedVpiError::strFromVpiCallbackReason(cb_data_p->reason));
|
||||
VerilatedVpiError::strFromVpiCallbackReason(reason));
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
|
@ -1583,7 +1650,7 @@ PLI_INT32 vpi_get(PLI_INT32 property, vpiHandle object) {
|
|||
return vop->type();
|
||||
}
|
||||
case vpiDirection: {
|
||||
// By forthought, the directions already are vpi enumerated
|
||||
// By forethought, the directions already are vpi enumerated
|
||||
const VerilatedVpioVarBase* const vop = VerilatedVpioVarBase::castp(object);
|
||||
if (VL_UNLIKELY(!vop)) return 0;
|
||||
return vop->varp()->vldir();
|
||||
|
|
@ -1751,13 +1818,13 @@ void vl_get_value(const VerilatedVar* varp, void* varDatap, p_vpi_value valuep,
|
|||
int i;
|
||||
if (bits > t_outStrSz) {
|
||||
// limit maximum size of output to size of buffer to prevent overrun.
|
||||
bits = t_outStrSz;
|
||||
VL_VPI_WARNING_(
|
||||
__FILE__, __LINE__,
|
||||
"%s: Truncating string value of %s for %s"
|
||||
" as buffer size (%d, VL_VALUE_STRING_MAX_WORDS=%d) is less than required (%d)",
|
||||
__func__, VerilatedVpiError::strFromVpiVal(valuep->format), fullname, t_outStrSz,
|
||||
VL_VALUE_STRING_MAX_WORDS, bits);
|
||||
bits = t_outStrSz;
|
||||
}
|
||||
for (i = 0; i < bits; ++i) {
|
||||
const char val = (datap[i >> 3] >> (i & 7)) & 1;
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue