Merge from master for release.

This commit is contained in:
Wilson Snyder 2025-07-08 23:17:56 -04:00
commit 318b1c1a34
737 changed files with 21094 additions and 8141 deletions

30
.bake.toml Normal file
View File

@ -0,0 +1,30 @@
# mbake configuration file
[formatter]
# Indentation settings
use_tabs = true
tab_width = 2
# Spacing settings
space_around_assignment = true
space_before_colon = false
space_after_colon = true
# Line continuation settings
normalize_line_continuations = true
max_line_length = 100
# PHONY settings
group_phony_declarations = false
phony_at_top = false
auto_insert_phony_declarations = false
# General settings
remove_trailing_whitespace = true
ensure_final_newline = true
normalize_empty_lines = true
max_consecutive_empty_lines = 2
# Global settings
debug = false
verbose = false

View File

@ -12,13 +12,16 @@ on:
schedule:
- cron: '0 0 * * 0' # weekly
permissions:
contents: read
defaults:
run:
shell: bash
working-directory: repo
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
group: ${{ github.workflow }}-${{ github.actor }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
cancel-in-progress: true
jobs:

View File

@ -7,10 +7,12 @@ on:
push:
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
Test:
name: "'docs/CONTRIBUTORS' was signed"
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- run: test_regress/t/t_dist_contributors.py

View File

@ -9,6 +9,9 @@ on:
schedule:
- cron: '0 0 * * 0' # weekly
permissions:
contents: read
env:
CI_OS_NAME: linux
CI_COMMIT: ${{ github.sha }}
@ -23,10 +26,12 @@ defaults:
jobs:
Build:
runs-on: ubuntu-22.04
# Only run scheduled jobs if explicitly enabled for that repo (e.g.: not on forks)
if: ${{ github.event_name != 'schedule' || vars.ENABLE_SCHEDULED_JOBS == 'true' }}
runs-on: ubuntu-24.04
env:
CI_BUILD_STAGE_NAME: build
CI_RUNS_ON: ubuntu-22.04
CI_RUNS_ON: ubuntu-24.04
steps:
- name: Checkout
@ -59,11 +64,11 @@ jobs:
num: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
include:
- {test: dist, num: ''}
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
name: test-${{ matrix.test }}${{ matrix.num }}
env:
CI_BUILD_STAGE_NAME: test
CI_RUNS_ON: ubuntu-22.04
CI_RUNS_ON: ubuntu-24.04
steps:
- name: Download tar archive

View File

@ -22,11 +22,14 @@ on:
type: boolean
default: false
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
strategy:
matrix:

View File

@ -7,6 +7,8 @@ on:
push:
pull_request_target:
workflow_dispatch:
permissions:
contents: write
jobs:
format:
runs-on: ubuntu-22.04
@ -26,6 +28,7 @@ jobs:
run: |
bash ci/ci-install.bash &&
sudo apt-get install clang-format-14 yapf3 &&
sudo pip3 install gersemi mbake &&
git config --global user.email "action@example.com" &&
git config --global user.name "github action"
- name: Format code

View File

@ -10,6 +10,8 @@ on:
workflow_dispatch:
schedule:
- cron: 0 0 * * 0 # weekly
permissions:
contents: read
env:
CI_OS_NAME: win
CI_COMMIT: ${{ github.sha }}
@ -20,7 +22,7 @@ defaults:
run:
working-directory: repo
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
group: ${{ github.workflow }}-${{ github.actor }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
cancel-in-progress: true
jobs:
windows:

View File

@ -16,10 +16,17 @@ on:
description: "Compiler to use: 'gcc' or 'clang'"
type: string
required: true
# Note: The combination of 'cases' and 'run-name' must be unique for all
# invocations of this workflow within a run of the parent workflow.
# These two are used together to generate a unique results file name.
cases:
description: "RTLMeter cases to run"
type: string
required: true
run-name:
description: "Run name (identifier) to add to collated results"
type: string
required: true
compileArgs:
description: "Additional Verilator command line arguments"
type: string
@ -84,7 +91,7 @@ jobs:
- name: Execute cases
working-directory: rtlmeter
continue-on-error: true # Do not fail on error, so we can at leat save the successful results
continue-on-error: true # Do not fail on error, so we can at leat save the successful results
run: |
./rtlmeter run --verbose --cases='${{ inputs.cases }}' --compileArgs='${{ inputs.compileArgs }}' --executeArgs='${{ inputs.executeArgs }}'
# My YAML highlighter sucks, so I put this comment here wiht a phony closing quote mark to make it work: '
@ -93,10 +100,10 @@ jobs:
id: results
working-directory: rtlmeter
run: |
# 'inputs.cases' has special characters, use its md5sum as unique id
hash=$(md5sum <<< '${{ inputs.cases }}' | awk '{print $1}')
# Use 'inputs.cases' and 'inputs.run-name' to generate a unique file name
hash=$(md5sum <<< '${{ inputs.cases }} ${{ inputs.run-name }}' | awk '{print $1}')
echo "hash=${hash}" >> $GITHUB_OUTPUT
./rtlmeter collate > ../results-${hash}.json
./rtlmeter collate --runName "${{ inputs.run-name }}" > ../results-${hash}.json
- name: Report results
working-directory: rtlmeter
@ -107,7 +114,7 @@ jobs:
uses: actions/upload-artifact@v4
with:
path: results-${{ steps.results.outputs.hash }}.json
name: rtlmeter-results-${{ inputs.runs-on }}-${{ inputs.cc }}-${{ steps.results.outputs.hash }}
name: rtlmeter-results-${{ steps.results.outputs.hash }}
overwrite: true
retention-days: 2

View File

@ -10,6 +10,9 @@ on:
schedule:
- cron: '0 2 * * *' # Daily, starting at 02:00 UTC
permissions:
contents: read
defaults:
run:
shell: bash
@ -21,6 +24,8 @@ concurrency:
jobs:
build-gcc:
name: Build GCC
# Only run scheduled jobs if explicitly enabled for that repo (e.g.: not on forks)
if: ${{ github.event_name != 'schedule' || vars.ENABLE_SCHEDULED_JOBS == 'true' }}
uses: ./.github/workflows/reusable-rtlmeter-build.yml
with:
runs-on: ubuntu-24.04
@ -28,6 +33,8 @@ jobs:
build-clang:
name: Build Clang
# Only run scheduled jobs if explicitly enabled for that repo (e.g.: not on forks)
if: ${{ github.event_name != 'schedule' || vars.ENABLE_SCHEDULED_JOBS == 'true' }}
uses: ./.github/workflows/reusable-rtlmeter-build.yml
with:
runs-on: ubuntu-24.04
@ -41,6 +48,7 @@ jobs:
runs-on: ubuntu-24.04
cc: gcc
cases: ${{ matrix.cases }}
run-name: "gcc"
compileArgs: ""
executeArgs: ""
strategy:
@ -52,7 +60,7 @@ jobs:
- "OpenPiton:1x1:*"
- "OpenPiton:2x2:*"
- "OpenPiton:4x4:*"
# - "OpenTitan:*"
- "OpenTitan:*"
- "VeeR-EH1:asic*"
- "VeeR-EH1:default*"
- "VeeR-EH1:hiperf*"
@ -64,10 +72,10 @@ jobs:
- "VeeR-EL2:hiperf*"
- "Vortex:mini:*"
- "Vortex:sane:*"
# - "XiangShan:default-chisel3:* !*:linux"
# - "XiangShan:default-chisel6:* !*:linux"
- "XiangShan:default-chisel3:* !*:linux"
- "XiangShan:default-chisel6:* !*:linux"
- "XiangShan:mini-chisel3:* !*:linux"
# - "XiangShan:mini-chisel6:* !*:linux"
- "XiangShan:mini-chisel6:* !*:linux"
- "XuanTie-E902:*"
- "XuanTie-E906:*"
- "XuanTie-C906:*"
@ -81,6 +89,7 @@ jobs:
runs-on: ubuntu-24.04
cc: clang
cases: ${{ matrix.cases }}
run-name: "clang --threads 4"
compileArgs: "--threads 4"
executeArgs: ""
strategy:
@ -92,7 +101,7 @@ jobs:
- "OpenPiton:1x1:*"
- "OpenPiton:2x2:*"
- "OpenPiton:4x4:*"
# - "OpenTitan:*"
- "OpenTitan:*"
- "VeeR-EH1:asic*"
- "VeeR-EH1:default*"
- "VeeR-EH1:hiperf*"
@ -115,44 +124,84 @@ jobs:
combine-results:
name: Combine results
needs:
- run-gcc
- run-clang
if: ${{ always() }} # Run even if dependencies failed
needs: [run-gcc, run-clang]
# Run if any of the dependencies have run, even if failed.
# That is: do not run if all skipped, or the workflow was cancelled.
if: ${{ (contains(needs.*.result, 'success') || contains(needs.*.result, 'failure')) && !cancelled() }}
runs-on: ubuntu-24.04
steps:
- name: Download all GCC results
- name: Download all results
uses: actions/download-artifact@v4
with:
pattern: rtlmeter-results-ubuntu-24.04-gcc-*
path: all-results-gcc-${{ github.run_id }}
pattern: rtlmeter-results-*
path: all-results-${{ github.run_id }}
merge-multiple: true
- name: Download all Clang results
uses: actions/download-artifact@v4
with:
pattern: rtlmeter-results-ubuntu-24.04-clang-*
path: all-results-clang-${{ github.run_id }}
merge-multiple: true
- name: Tar up results
- name: Tar up all results into single archive
run: |
# Ensure combined result directories exists in case of no results
mkdir -p all-results-gcc-${{ github.run_id }}
mkdir -p all-results-clang-${{ github.run_id }}
ls -la all-results*
# Tar up each directory
tar --posix -c -z -f all-results-gcc-${{ github.run_id }}.tar.gz all-results-gcc-${{ github.run_id }}
tar --posix -c -z -f all-results-clang-${{ github.run_id }}.tar.gz all-results-clang-${{ github.run_id }}
- name: Upload combined GCC results
# Ensure combined result directory exists in case of no results
mkdir -p all-results-${{ github.run_id }}
ls -la all-results-${{ github.run_id }}
# Tar up the results directory
tar --posix -c -z -f all-results-${{ github.run_id }}.tar.gz all-results-${{ github.run_id }}
- name: Upload combined results
uses: actions/upload-artifact@v4
with:
path: all-results-gcc-${{ github.run_id }}.tar.gz
name: "all-results-gcc"
path: all-results-${{ github.run_id }}.tar.gz
name: all-results
overwrite: true
retention-days: 30
- name: Upload combined Clang results
uses: actions/upload-artifact@v4
publish-results:
name: Publish results to verilator/verilator-rtlmeter-results
needs: combine-results
# Only run on scheduled builds on the main repository. We also restrict
# the publishing to run only on the first run_attempt. This is required
# to prevent multiple uploads the same day (if rerunning), as the
# dashboard UI currently assumes there is only one data point per
# calendar day. Results from reruns can be imported manually if needed.
if: ${{ github.event_name == 'schedule' && github.repository == 'verilator/verilator' && github.run_attempt == 1 && contains(needs.*.result, 'success') && !cancelled() }}
runs-on: ubuntu-24.04
steps:
- name: Download combined results
uses: actions/download-artifact@v4
with:
path: all-results-clang-${{ github.run_id }}.tar.gz
name: "all-results-clang"
overwrite: true
retention-days: 30
name: all-results
path: results
- name: Extract combined results
working-directory: results
run: |
tar xzfv all-results-${{ github.run_id }}.tar.gz
ls -la
# Pushing to verilator/verilator-rtlmeter-results requires elevated permissions
- name: Generate access token
id: generate-token
uses: actions/create-github-app-token@v2.0.6
with:
app-id: ${{ vars.RTLMETER_RESULTS_CI_APP_ID }}
private-key: ${{ secrets.RTLMETER_RESULTS_CI_APP_PRIVATE_KEY }}
owner: verilator
repositories: verilator-rtlmeter-results
- name: Checkout verilator-rtlmeter-results
uses: actions/checkout@v4
with:
repository: "verilator/verilator-rtlmeter-results"
token: ${{ steps.generate-token.outputs.token }}
path: verilator-rtlmeter-results
- name: Import results
id: import-results
working-directory: verilator-rtlmeter-results
run: |
for f in $(find ../results -name "*.json"); do \
echo "Importing $f"; \
./bin/add-rtlmeter-result $f; \
done
test -z "$(git status --porcelain)" || echo "valid=1" >> "$GITHUB_OUTPUT"
- name: Push to verilator-rtlmeter-results
if: ${{ steps.import-results.outputs.valid }}
working-directory: verilator-rtlmeter-results
run: |
git config --global user.email "action@example.com"
git config --global user.name "github action"
git add .
git commit -m "Verilator CI: Results of 'RTLMeter' workflow run #${{ github.run_number }}"
git push origin

View File

@ -16,7 +16,7 @@ cmake_minimum_required(VERSION 3.15)
cmake_policy(SET CMP0091 NEW) # Use MSVC_RUNTIME_LIBRARY to select the runtime
project(
Verilator
VERSION 5.036
VERSION 5.038
HOMEPAGE_URL https://verilator.org
LANGUAGES CXX
)

93
Changes
View File

@ -5,7 +5,98 @@ Revision History and Change Log
===============================
The changes in each Verilator version are described below. The
contributors that suggested a given feature are shown in []. Thanks!
contributors that suggested or implemented a given issue are shown in []. Thanks!
Verilator 5.038 2025-07-08
==========================
**Important:**
* Change `--assert` to be the default; use `--no-assert` for legacy behavior and faster runtimes.
**Other:**
* Support redeclaring type as non-type; major parsing change (#2412) (#6020) (#6042) (#6044).
* Support scoped `new` (#4199).
* Support constrained random for associative arrays (#5985) (#5986). [Yilou Wang]
* Support assignments to concatenations with impure RHS (#6002). [Ryszard Rozak, Antmicro Ltd.]
* Support SARIF JSON diagnostic output with `--diagnostics-sarif`. (#6017)
* Support 1-bit params with -G and -pvalue (#6051) (#6082). [Paul Swirhun]
* Support `specparam` (#5767) (#6142).
* Support `$timeformat` with missing arguments (#6113). [Alex Solomatnikov]
* Support non-overlapping blocking/non-blocking assignments (#6137). [Geza Lore]
* Support parameter forward types.
* Support constant functions with left-hand-side concatenates.
* Add PROCINITASSIGN on initial assignments to process variables (#2481). [Niraj Menon]
* Add BADVLTPRAGMA on unknown Verilator pragmas (#5945). [Shou-Li Hsu]
* Add ternary operator into branch coverage (#5880). [Ryszard Rozak, Antmicro Ltd.]
* Add aggregate type error checks (#5570) (#5950). [Shou-Li Hsu]
* Add `--work` library-selection option (#5891 partial).
* Add `--filter-type` to verilator_coverage (#6030). [Ryszard Rozak, Antmicro Ltd.]
* Add `--hierarchical-threads` (#6037). [Bartłomiej Chmiel]
* Add `MODMISSING` error, in place of unnamed error (#6054). [Paul Swirhun]
* Add DFG binToOneHot pass to generate one-hot decoders (#6096). [Geza Lore]
* Add hint of the signed right-hand-side in oversized replication error (#6098). [Peter Birch]
* Improve hierarchical scheduling visualization in V3ExecGraph (#6009). [Bartłomiej Chmiel, Antmicro Ltd.]
* Improve DPI temporary 'for' loop performance (#6079). [Bartłomiej Chmiel, Antmicro Ltd.]
* Improve memory usage for SenTrees in V3OrderProcessDomains (#6112). [Geza Lore]
* Improve docker image size (#6139). [Tobias Rosenkranz, bitaggregat GmbH]
* Update docker base image to Ubuntu 24.04 (#6147). [Tobias Rosenkranz, bitaggregat GmbH]
* Optimize DFG De Morgan patterns (#6090). [Geza Lore]
* Optimize DFG variable elimination (#6091). [Geza Lore]
* Optimize DFG PUSH_SEL_THROUGH_CONCAT pattern (#6092). [Geza Lore]
* Optimize DFG before V3Gate (#6141). [Geza Lore]
* Optimize DFG peephole patterns (#6149). [Geza Lore]
* Optimize constification within Expand and Subst stages (#6111). [Geza Lore]
* Fix --x-initial and --x-assign random stability (#2662) (#5958) (#6018) (#6025) (#6075). [Todd Strader]
* Fix trace hierarchical-name runtime errors (#5668) (#6076). [Paul Swirhun]
* Fix streaming operator packing order (#5903) (#6077). [Paul Swirhun]
* Fix filename backslash escapes in C code (#5947).
* Fix C++ widths in V3Expand (#5953) (#5975). [Geza Lore]
* Fix dependencies from different hierarchical schedules (#5954). [Bartłomiej Chmiel, Antmicro Ltd.]
* Fix constant propagation of post-expand stages (#5955) (#5963) (#5969) (#5972) (#5983).
* Fix sign extension of signed compared with unsigned case items (#5968).
* Fix always processes ignoring $finish (#5971). [Hennadii Chernyshchyk]
* Fix method calls and new to access interface arrays (#5973). [Nick Brereton]
* Fix streaming to/from packed arrays (#5976). [Geza Lore]
* Fix segfault writing timestamp to VCD after buffer flush (#5978) (#5980). [Dominick Grochowina]
* Fix inconsistent assignment error with split-var (#5984) (#5988). [Yutetsu TAKATSUKASA]
* Fix AstAssignW conversion (#5991) (#5992). [Ryszard Rozak, Antmicro Ltd.]
* Fix const-bit-op-tree with single-bit masks (#5993) (#5998). [Yutetsu TAKATSUKASA]
* Fix arithmetic right-shift by constants over 32 bits (#5994). [Zhen Yan]
* Fix array bounds checking with class member selects (#5996) (#5997). [Krzysztof Starecki]
* Fix checking for too-wide divide and modulus (#6003) (#6006). [Zhen Yan]
* Fix folding of LteS in DfgPeephole (#6000) (#6004). [Geza Lore]
* Fix slicing of AstExprStmt nodes (#6005). [Ryszard Rozak, Antmicro Ltd.]
* Fix skipped generate blocks in toggle coverage (#6010). [Ryszard Rozak, Antmicro Ltd.]
* Fix arithmetic left-shift by constants over 32 bits (#6007) (#6015). [Zhen Yan]
* Fix concatenation and type casting (#6012) (#6013). [Todd Strader]
* Fix wrong optimization result of shifted out variable (#6016) (#6019). [Yutetsu TAKATSUKASA]
* Fix missing FreeBSD include (#6027) (#6028). [Joel Bodenmann]
* Fix associative arrays with enum keys (#6034) (#6035). [Petr Nohavica]
* Fix GCC 10 read-only linker error (#6040). [Todd Strader]
* Fix WIDTHCONCAT on packed pattern assignment (#6045). [Dan Petrisko]
* Fix type operator for interface signals (#6049) (#6050). [Todd Strader]
* Fix V3OrderParallel scoring contraction hang (#6052). [Bartłomiej Chmiel, Antmicro Ltd.]
* Fix virtual interface array typedef expressions (#6057).
* Fix DFG peephole select conditionals (#6064) (#6071). [Geza Lore]
* Fix `--skip-identical` skipping on some errors (#6066). [Todd Strader]
* Fix class typedef elaboration (#6080). [Kamil Rakoczy, Antmicro Ltd.]
* Fix unpacked to packed parameter assignment (#6081) (#6088). [Todd Strader]
* Fix casting reals to large integrals (#6085). [Todd Strader]
* Fix nested hier blocks workers error (#6087). [Bartłomiej Chmiel, Antmicro Ltd.]
* Fix `--lib-create` with double-underscore (#6099).
* Fix DFG binToOneHot table index missing driver (#6100). [Geza Lore]
* Fix decoding octal string escapes with 1-2 digits (#6108).
* Fix colon-divide operator without space (#6121). [Alex Solomatnikov]
* Fix variables declared in fork after taskify (#6126). [Kamil Rakoczy, Antmicro Ltd.]
* Fix method calls without parenthesis (#6127). [Alex Solomatnikov]
* Fix `pre_randomize`/`post_randomize` when no randomize (#6128). [Alex Solomatnikov]
* Fix wide non-blocking assignment mis-optimization (#6150) (#6152) (#6155). [Todd Strader]
* Fix interface array connections with non-zero low declaration index.
* Fix developer build error on MacOS/Flex2.6.4 (#6153). [Paul Swirhun]
* Fix crash with --dumpi-V3LinkDot without --debug (#6159). [Igor Zaworski]
Verilator 5.036 2025-04-27

View File

@ -104,45 +104,45 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
SHELL = /bin/sh
SUBDIRS = docs src test_regress \
examples/cmake_hello_c \
examples/cmake_hello_sc \
examples/cmake_tracing_c \
examples/cmake_tracing_sc \
examples/cmake_protect_lib \
examples/make_hello_binary \
examples/make_hello_c \
examples/make_hello_sc \
examples/make_tracing_c \
examples/make_tracing_sc \
examples/make_protect_lib \
examples/json_py \
examples/cmake_hello_c \
examples/cmake_hello_sc \
examples/cmake_tracing_c \
examples/cmake_tracing_sc \
examples/cmake_protect_lib \
examples/make_hello_binary \
examples/make_hello_c \
examples/make_hello_sc \
examples/make_tracing_c \
examples/make_tracing_sc \
examples/make_protect_lib \
examples/json_py \
INFOS = verilator.html verilator.pdf
INFOS_OLD = README README.html README.pdf
EXAMPLES_FIRST = \
examples/make_hello_c \
examples/make_hello_sc \
examples/make_hello_c \
examples/make_hello_sc \
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
# 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 \
verilator.1 \
verilator_coverage.1 \
verilator_gantt.1 \
verilator_profcfunc.1 \
default: all
all: all_nomsg msg_test
all_nomsg: verilator_exe $(VL_INST_MAN_FILES)
.PHONY:verilator_exe
.PHONY:verilator_bin$(EXEEXT)
.PHONY:verilator_bin_dbg$(EXEEXT)
.PHONY:verilator_coverage_bin_dbg$(EXEEXT)
.PHONY: verilator_exe
.PHONY: verilator_bin$(EXEEXT)
.PHONY: verilator_bin_dbg$(EXEEXT)
.PHONY: verilator_coverage_bin_dbg$(EXEEXT)
verilator_exe verilator_bin$(EXEEXT) verilator_bin_dbg$(EXEEXT) verilator_coverage_bin_dbg$(EXEEXT):
@echo ------------------------------------------------------------
@echo "making verilator in src"
@ -151,7 +151,7 @@ verilator_exe verilator_bin$(EXEEXT) verilator_bin_dbg$(EXEEXT) verilator_covera
######################################################################
# Tests
.PHONY:msg_test
.PHONY: msg_test
msg_test: all_nomsg
@echo "Build complete!"
@echo
@ -213,8 +213,8 @@ verilator.html:
verilator.pdf: Makefile
$(MAKE) -C docs verilator.pdf
TAGFILES=${srcdir}/*/*.cpp ${srcdir}/*/*.h ${srcdir}/*/*.in \
${srcdir}/*.in ${srcdir}/*.pod
TAGFILES = ${srcdir}/*/*.cpp ${srcdir}/*/*.h ${srcdir}/*/*.in \
${srcdir}/*.in ${srcdir}/*.pod
TAGS: $(TAGFILES)
etags $(TAGFILES)
@ -224,42 +224,49 @@ TAGS: $(TAGFILES)
doxygen:
$(MAKE) -C docs doxygen
.PHONY: spelling
spelling:
$(MAKE) -C docs spelling
######################################################################
# Install
# Public executables intended to be invoked directly by the user
# Don't put wildcards in these variables, it might cause an uninstall of other stuff
VL_INST_PUBLIC_SCRIPT_FILES = verilator \
verilator_coverage \
verilator_gantt \
verilator_profcfunc \
VL_INST_PUBLIC_SCRIPT_FILES = \
verilator \
verilator_coverage \
verilator_gantt \
verilator_profcfunc \
VL_INST_PUBLIC_BIN_FILES = verilator_bin$(EXEEXT) \
verilator_bin_dbg$(EXEEXT) \
verilator_coverage_bin_dbg$(EXEEXT) \
VL_INST_PUBLIC_BIN_FILES = \
verilator_bin$(EXEEXT) \
verilator_bin_dbg$(EXEEXT) \
verilator_coverage_bin_dbg$(EXEEXT) \
# Private executabels intended to be invoked by internals
# Don't put wildcards in these variables, it might cause an uninstall of other stuff
VL_INST_PRIVATE_SCRIPT_FILES = verilator_ccache_report \
verilator_includer \
VL_INST_PRIVATE_SCRIPT_FILES = \
verilator_ccache_report \
verilator_includer \
VL_INST_INC_BLDDIR_FILES = \
include/verilated_config.h \
include/verilated.mk \
include/verilated_config.h \
include/verilated.mk \
# Files under srcdir, instead of build time
VL_INST_INC_SRCDIR_FILES = \
include/*.[chv]* \
include/*.vlt \
include/*.sv \
include/gtkwave/*.[chv]* \
include/vltstd/*.[chv]* \
include/*.[chv]* \
include/*.vlt \
include/*.sv \
include/gtkwave/*.[chv]* \
include/vltstd/*.[chv]* \
VL_INST_DATA_SRCDIR_FILES = \
examples/*/*.[chv]* \
examples/*/CMakeLists.txt \
examples/*/Makefile* \
examples/*/vl_* \
examples/*/*.[chv]* \
examples/*/CMakeLists.txt \
examples/*/Makefile* \
examples/*/vl_* \
mkbindirs:
$(MKINSTALLDIRS) $(DESTDIR)$(pkgdatadir)/bin
@ -395,19 +402,22 @@ CPPCHECK6_CPP = $(wildcard $(srcdir)/src/V3[P-Z]*.cpp)
CPPCHECK7_CPP = $(wildcard $(srcdir)/src/V3[L-R]*.cpp)
CPPCHECK8_CPP = $(wildcard $(srcdir)/src/V3[S-Z]*.cpp)
CHECK_CPP = $(CPPCHECK1_CPP) $(CPPCHECK2_CPP) $(CPPCHECK3_CPP) $(CPPCHECK4_CPP) \
$(CPPCHECK5_CPP) $(CPPCHECK6_CPP) $(CPPCHECK7_CPP) $(CPPCHECK8_CPP)
$(CPPCHECK5_CPP) $(CPPCHECK6_CPP) $(CPPCHECK7_CPP) $(CPPCHECK8_CPP)
CHECK_H = $(wildcard \
$(srcdir)/include/*.h \
$(srcdir)/src/*.h )
$(srcdir)/include/*.h \
$(srcdir)/src/*.h )
CHECK_YL = $(wildcard \
$(srcdir)/src/*.y \
$(srcdir)/src/*.l )
$(srcdir)/src/*.y \
$(srcdir)/src/*.l )
CPPCHECK = src/cppcheck_filtered cppcheck
CPPCHECK_FLAGS = --enable=all --inline-suppr \
--suppress=cstyleCast --suppress=useInitializationList \
--suppress=nullPointer --suppress=nullPointerRedundantCheck --suppress=ctunullpointer \
--suppress=unusedFunction --suppress=unusedScopedObject \
--suppress=useStlAlgorithm
--suppress=cstyleCast --suppress=ctunullpointer \
--suppress=derefInvalidIteratorRedundantCheck \
--suppress=nullPointer --suppress=nullPointerRedundantCheck \
--suppress=templateRecursion \
--suppress=unusedFunction --suppress=unusedScopedObject \
--suppress=useInitializationList --suppress=useStlAlgorithm \
CPPCHECK_FLAGS += --xml
CPPCHECK_DEP = $(subst .cpp,.cppcheck,$(CHECK_CPP))
CPPCHECK_INC = -I$(srcdir)/include -I$(srcdir)/include/gtkwave -I$(srcdir)/include/vltstd -I$(srcdir)/src/obj_dbg -I$(srcdir)/src
@ -432,8 +442,8 @@ cppcheck-8:
CLANGTIDY = clang-tidy
CLANGTIDY_FLAGS = -config='' \
-header-filter='.*' \
-checks='-fuchsia-*,-cppcoreguidelines-avoid-c-arrays,-cppcoreguidelines-init-variables,-cppcoreguidelines-avoid-goto,-modernize-avoid-c-arrays,-readability-magic-numbers,-readability-simplify-boolean-expr,-cppcoreguidelines-macro-usage' \
-header-filter='.*' \
-checks='-fuchsia-*,-cppcoreguidelines-avoid-c-arrays,-cppcoreguidelines-init-variables,-cppcoreguidelines-avoid-goto,-modernize-avoid-c-arrays,-readability-magic-numbers,-readability-simplify-boolean-expr,-cppcoreguidelines-macro-usage' \
CLANGTIDY_DEP = $(subst .cpp,.cpp.tidy,$(CHECK_CPP))
CLANGTIDY_DEFS = -DVL_DEBUG=1 -DVL_CPPCHECK=1
@ -453,7 +463,7 @@ analyzer-include:
scan-build $(MAKE) -k examples
format:
$(MAKE) -j 4 format-c format-py format-exec
$(MAKE) -j 5 format-c format-cmake format-exec format-py
CLANGFORMAT = clang-format-14
CLANGFORMAT_FLAGS = -i
@ -461,7 +471,7 @@ CLANGFORMAT_FILES = $(CHECK_CPP) $(CHECK_H) $(CHECK_YL) test_regress/t/*.c* test
format-c clang-format:
@$(CLANGFORMAT) --version | egrep 14.0 > /dev/null \
|| echo "*** You are not using clang-format-14, indents may differ from master's ***"
|| echo "*** You are not using clang-format-14, indents may differ from master's ***"
$(CLANGFORMAT) $(CLANGFORMAT_FLAGS) $(CLANGFORMAT_FILES)
YAMLFIX = YAMLFIX_WHITELINES=1 YAMLFIX_LINE_LENGTH=130 YAMLFIX_preserve_quotes=true yamlfix
@ -471,50 +481,58 @@ yamlfix:
# CMake files
CMAKE_FILES = \
CMakeLists.txt \
examples/*/CMakeLists.txt \
src/CMakeLists.txt \
test_regress/CMakeLists.txt \
*.cmake.in \
CMakeLists.txt \
examples/*/CMakeLists.txt \
src/CMakeLists.txt \
test_regress/CMakeLists.txt \
*.cmake.in \
# Makefiles
MAKE_FILES = \
Makefile*.in \
docs/Makefile* \
include/verilated.mk.in \
examples/*/Makefile* \
src/Makefile*.in \
test_regress/Makefile* \
# Python programs, subject to format and lint
PY_PROGRAMS = \
bin/verilator_ccache_report \
bin/verilator_difftree \
bin/verilator_gantt \
bin/verilator_includer \
bin/verilator_profcfunc \
examples/json_py/vl_file_copy \
examples/json_py/vl_hier_graph \
docs/guide/conf.py \
docs/bin/vl_sphinx_extract \
docs/bin/vl_sphinx_fix \
src/astgen \
src/bisonpre \
src/config_rev \
src/cppcheck_filtered \
src/flexfix \
src/vlcovgen \
src/.gdbinit.py \
test_regress/*.py \
test_regress/t/*.pf \
nodist/clang_check_attributes \
nodist/code_coverage \
nodist/dot_importer \
nodist/fuzzer/actual_fail \
nodist/fuzzer/generate_dictionary \
nodist/install_test \
nodist/log_changes \
bin/verilator_ccache_report \
bin/verilator_difftree \
bin/verilator_gantt \
bin/verilator_includer \
bin/verilator_profcfunc \
examples/json_py/vl_file_copy \
examples/json_py/vl_hier_graph \
docs/guide/conf.py \
docs/bin/vl_sphinx_extract \
docs/bin/vl_sphinx_fix \
src/astgen \
src/bisonpre \
src/config_rev \
src/cppcheck_filtered \
src/flexfix \
src/vlcovgen \
src/.gdbinit.py \
test_regress/*.py \
test_regress/t/*.pf \
nodist/clang_check_attributes \
nodist/code_coverage \
nodist/dot_importer \
nodist/fuzzer/actual_fail \
nodist/fuzzer/generate_dictionary \
nodist/install_test \
nodist/log_changes \
# Python files, subject to format but not lint
PY_FILES = \
$(PY_PROGRAMS) \
nodist/code_coverage.dat \
test_regress/t/*.py \
$(PY_PROGRAMS) \
nodist/code_coverage.dat \
test_regress/t/*.py \
# Python files, test_regress tests
PY_TEST_FILES = \
test_regress/t/*.py \
PY_TEST_FILES = test_regress/t/*.py
YAPF = yapf3
YAPF_FLAGS = -i --parallel
@ -523,11 +541,17 @@ format-py yapf:
$(YAPF) $(YAPF_FLAGS) $(PY_FILES)
GERSEMI = gersemi
GERSEMI_FLAGS = -i
GERSEMI_FLAGS = -i --no-warn-about-unknown-commands
format-cmake:
$(GERSEMI) $(GERSEMI_FLAGS) $(CMAKE_FILES)
MBAKE = mbake
MBAKE_FLAGS = format --config ./.bake.toml
format-make:
$(MBAKE) $(MBAKE_FLAGS) $(MAKE_FILES)
format-yaml: yamlfix
PYLINT = pylint

View File

@ -1,7 +1,7 @@
.. Github doesn't render images unless absolute URL
.. Do not know of a conditional tag, "only: github" nor "github display" works
|badge1| |badge2| |badge3| |badge4| |badge5| |badge7|
|badge1| |badge2| |badge3| |badge4| |badge5| |badge7| |badge8|
.. |badge1| image:: https://img.shields.io/badge/Website-Verilator.org-181717.svg
:target: https://verilator.org
@ -15,6 +15,8 @@
:target: https://hub.docker.com/r/verilator/verilator
.. |badge7| image:: https://github.com/verilator/verilator/workflows/build/badge.svg
:target: https://github.com/verilator/verilator/actions?query=workflow%3Abuild
.. |badge8| image:: https://img.shields.io/github/actions/workflow/status/verilator/verilator/rtlmeter.yml?branch=master&event=schedule&label=benchmarks
:target: https://verilator.github.io/verilator-rtlmeter-results
Welcome to Verilator
@ -129,7 +131,7 @@ organizations; please see `Verilator Commercial Support
Related Projects
================
- `GTKwave <http://gtkwave.sourceforge.net/>`_ - Waveform viewer for
- `GTKwave <https://gtkwave.sourceforge.net/>`_ - Waveform viewer for
Verilator traces.
- `Icarus Verilog`_ - Icarus is a highly-featured interpreted Verilog

View File

@ -130,7 +130,7 @@ if ($opt_gdb) {
} elsif ($opt_valgrind) {
# Run under valgrind
my $valgrind_bin = ($ENV{VERILATOR_VALGRIND} || "valgrind --error-exitcode=1 --max-stackframe=2815880"
# Magic number sugested by valgrind, may need to be increased in future
# Magic number suggested by Valgrind, may need to be increased in future
# if you get warnings. See: https://valgrind.org/docs/manual/manual-core.html#opt.max-stackframe
);
@ -311,8 +311,8 @@ detailed descriptions of these arguments.
+1800-2012ext+<ext> Use SystemVerilog 2012 with file extension <ext>
+1800-2017ext+<ext> Use SystemVerilog 2017 with file extension <ext>
+1800-2023ext+<ext> Use SystemVerilog 2023 with file extension <ext>
--assert Enable all assertions
--assert-case Enable unique/unique0/priority case related checks
--no-assert Disable all assertions
--no-assert-case Disable unique/unique0/priority-case assertions
--autoflush Flush streams after all $displays
--bbox-sys Blackbox unknown $system calls
--bbox-unsup Blackbox unsupported language features
@ -345,6 +345,8 @@ detailed descriptions of these arguments.
--decorations <level> Set output comment and spacing level
--default-language <lang> Default language to parse
+define+<var>=<value> Set preprocessor define
--diagnostics-sarif Enable SARIF diagnostics output
--diagnostics-sarif-output <filename> Set SARIF diagnostics output file
--dpi-hdr-only Only produce the DPI header file
--dump-<srcfile> Enable dumping everything in source file
--dump-defines Show preprocessor defines with -E
@ -381,6 +383,7 @@ detailed descriptions of these arguments.
--help Show this help
--hierarchical Enable hierarchical Verilation
--hierarchical-params-file <name> Internal option that specifies parameters file for hier blocks
--hierarchical-threads <threads> Number of threads for hierarchical scheduling
-I<dir> Directory to search for includes
--if-depth <value> Tune IFDEPTH warning
+incdir+<dir> Directory to search for includes
@ -388,10 +391,10 @@ detailed descriptions of these arguments.
--instr-count-dpi <value> Assumed dynamic instruction count of DPI imports
-j <jobs> Parallelism for --build-jobs/--verilate-jobs
--no-json-edit-nums Don't dump editNum in .tree.json files
--no-json-ids Don't use short identifiers instead of adresses/paths in .tree.json
--no-json-ids Don't use short identifiers instead of addresses/paths in .tree.json
--json-only Create JSON parser output (.tree.json and .meta.json)
--json-only-meta-output .tree.meta.json output filename
--json-only-output .tree.json output filename
--json-only-meta-output <filename> Set .tree.meta.json output filename
--json-only-output <filename> Set .tree.json output filename
--l2-name <value> Verilog scope name of the top module
--language <lang> Default language standard to parse
-LDFLAGS <flags> Linker pre-object arguments for makefile
@ -448,7 +451,7 @@ detailed descriptions of these arguments.
--quiet-exit Don't print the command on failure
--quiet-stats Don't print statistics
--relative-includes Resolve includes relative to current file
--reloop-limit Minimum iterations for forming loops
--reloop-limit <value> Minimum iterations for forming loops
--report-unoptflat Extra diagnostics for UNOPTFLAT
--rr Run Verilator and record with rr
--runtime-debug Enable model runtime debugging
@ -510,6 +513,7 @@ detailed descriptions of these arguments.
-Wno-fatal Disable fatal exit on warnings
-Wno-lint Disable all lint warnings
-Wno-style Disable all style warnings
-work <libname> Set config library for following files
-Wpedantic Warn on compliance-test issues
-Wwarn-<message> Enable specified warning message
-Wwarn-lint Enable lint warning message

View File

@ -170,6 +170,7 @@ L<https://verilator.org/guide/latest/exe_verilator_coverage.html>.
--annotate-all All files should be shown.
--annotate-min <count> Minimum occurrence count for uncovered.
--annotate-points Annotates info from each coverage point.
--filter-type <regex> Keep only records of given coverage type.
--help Displays this message and version and exits.
--rank Compute relative importance of tests.
--unlink With --write, unlink all inputs

View File

@ -613,7 +613,7 @@ SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0""")
parser.add_argument('--debug', action='store_true', help='enable debug')
parser.add_argument('--no-vcd', help='disable creating vcd', action='store_true')
parser.add_argument('--vcd', help='filename for vcd outpue', default='profile_exec.vcd')
parser.add_argument('--vcd', help='filename for vcd output', default='profile_exec.vcd')
parser.add_argument('filename',
help='input profile_exec.dat filename to process',
default='profile_exec.dat')

View File

@ -6,7 +6,7 @@
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
FROM ubuntu:22.04
FROM ubuntu:24.04
# Create the user
RUN groupadd verilator \
@ -36,12 +36,14 @@ RUN apt-get update \
help2man \
libfl2 \
libfl-dev \
libclang-rt-18-dev \
libgoogle-perftools-dev \
libsystemc \
libsystemc-dev \
numactl \
perl \
python3 \
python3-distro \
wget \
z3 \
zlib1g \

View File

@ -13,7 +13,7 @@ Verilator build. It uses the following parameters:
- Source revision (default: master)
- Compiler (GCC 10.3.0, clang 10.0.0, default: 10.3.0)
- Compiler (GCC 13.3.0, clang 18.1.3, default: 13.3.0)
The container is published as ``verilator/verilator-buildenv`` on `docker
hub
@ -31,18 +31,18 @@ To also run tests:
docker run -ti verilator/verilator-buildenv test
To change the compiler:
To change the compiler use the `-e` switch to pass environment variables:
::
docker run -ti -e CC=clang-10 -e CXX=clang++-10 verilator/verilator-buildenv test
docker run -ti -e CC=clang-18 -e CXX=clang++-18 verilator/verilator-buildenv test
The tests that involve gdb are not working due to security restrictions.
To run those too:
The tests, that involve numactl are not working due to security restrictions.
To run those too, add the CAP_SYS_NICE capability during the start of the container:
::
docker run -ti -e CC=clang-10 -e CXX=clang++-10 --cap-add=SYS_PTRACE --security-opt seccomp=unconfined verilator/verilator-buildenv test
docker run -ti --cap-add=CAP_SYS_NICE verilator/verilator-buildenv test
Rather then building using a remote git repository you may prefer to use a
working copy on the local filesystem. Mount the local working copy path as
@ -52,7 +52,7 @@ top of a repository:
::
docker run -ti -v ${PWD}:/tmp/repo -e REPO=/tmp/repo -e REV=`git rev-parse --short HEAD` --cap-add=SYS_PTRACE --security-opt seccomp=unconfined verilator/verilator-buildenv test
docker run -ti -v ${PWD}:/tmp/repo -e REPO=/tmp/repo -e REV=`git rev-parse --short HEAD` verilator/verilator-buildenv test
Rebuilding

View File

@ -6,7 +6,7 @@
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
FROM ubuntu:22.04
FROM ubuntu:24.04
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive \
@ -48,7 +48,8 @@ RUN git clone "${REPO}" verilator && \
make && \
make install && \
cd .. && \
rm -r verilator
rm -r verilator && \
ccache -C
COPY verilator-wrap.sh /usr/local/bin/verilator-wrap.sh

View File

@ -10,7 +10,7 @@
# Then 'make maintainer-dist'
#AC_INIT([Verilator],[#.### YYYY-MM-DD])
#AC_INIT([Verilator],[#.### devel])
AC_INIT([Verilator],[5.036 2025-04-27],
AC_INIT([Verilator],[5.038 2025-07-08],
[https://verilator.org],
[verilator],[https://verilator.org])
@ -432,10 +432,10 @@ AC_SUBST(HAVE_COROUTINES)
# Flags for compiling Verilator internals including parser always
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-Qunused-arguments)
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-Wno-shadow)
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-Wno-unused-parameter)
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-Xclang -fno-pch-timestamp)
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-faligned-new)
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-Wno-unused-parameter)
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-Wno-shadow)
AC_SUBST(CFG_CXXFLAGS_SRC)
# Flags for compiling Verilator parser always (in addition to above CFG_CXXFLAGS_SRC)

View File

@ -3,6 +3,7 @@ under the Developer Certificate of Origin (https://developercertificate.org/).
Please see the Verilator manual for 200+ additional contributors. Thanks to all.
404allen404
Adam Bagley
Adrian Sampson
Adrien Le Masle
@ -11,7 +12,6 @@ Aidan McNay
Aleksander Kiryk
Alex Chadwick
Alex Solomatnikov
Àlex Torregrosa
Aliaksei Chapyzhenka
Ameya Vikram Singh
Andrea Calabrese
@ -37,14 +37,15 @@ Chykon
Conor McCullough
Dan Petrisko
Daniel Bates
Dave Sargeant
David Horton
David Ledger
David Metz
Dave Sargeant
David Stanford
David Turner
Dercury
Diego Roux
Dominick Grochowina
Don Williamson
Drew Ranck
Drew Taussig
@ -54,14 +55,13 @@ Eric Müller
Eric Rippey
Ethan Sifferman
Eyck Jentzsch
Furqan Nadir
Fabian Keßler
Fan Shupei
february cozzocrea
Felix Neumärker
Felix Yan
Frans Skarman
Fuad Ismail
Furqan Nadir
G-A. Kamendje
Garrett Smith
Geza Lore
@ -69,12 +69,12 @@ Gianfranco Costamagna
Gijs Burghoorn
Gilberto Abram
Glen Gibb
Gökçe Aydos
Graham Rushton
Greg Davill
Guokai Chen
Gus Smith
Gustav Svensk
Gökçe Aydos
Han Qi
Harald Heckmann
Hennadii Chernyshchyk
@ -83,7 +83,7 @@ Huang Rui
Huanghuang Zhou
HungMingWu
HyungKi Jeong
Ícaro Lima
Igor Zaworski
Ilya Barkov
Iru Cai
Ivan Vnučec
@ -97,16 +97,17 @@ James Shi
Jamey Hicks
Jamie Iles
Jan Van Winkel
Jiangjie Weng
Jean Berniolles
Jeremy Bennett
Jesse Taube
Jevin Sweval
Jiacheng Qian
Jiamin Zhu
Jitesh Nayak
Jiangjie Weng
Jinyan Xu
Jitesh Nayak
Jiuyang Liu
Joel Bodenmann
Joey Liu
John Coiner
John Demme
@ -157,8 +158,8 @@ Mateusz Gancarz
Matthew Ballance
Michael Bikovitsky
Michael Killough
Michaël Lefebvre
Michal Czyz
Michaël Lefebvre
Mike Popoloski
Miodrag Milanović
Mladen Slijepcevic
@ -180,9 +181,11 @@ Paul Wright
Pawel Jewstafjew
Pawel Sagan
Pengcheng Xu
Peter Birch
Peter Debacker
Peter Horvath
Peter Monsson
Petr Nohavica
Philip Axer
Philipp Wagner
Pierre-Henri Horrein
@ -206,29 +209,30 @@ Sean Cross
Sebastien Van Cauwenberghe
Sergi Granell
Seth Pellegrino
Shou-Li Hsu
Srinivasan Venkataramanan
Stefan Wallentowitz
Stephen Henry
Steven Hugg
sumpster
Szymon Gizler
Sören Tempel
Teng Huang
Tom Manner
Tim Hutt
Tim Snyder
Tobias Jensen
Tobias Rosenkranz
Tobias Wölfel
Todd Strader
Tom Manner
Tomasz Gorochowik
Topa Topino
Toru Niina
Trung Nguyen
Tudor Timi
Tymoteusz Blazejczyk
Udaya Raj Subedi
Udi Finkelstein
Unai Martinez-Corral
Udaya Raj Subedi
Valentin Atepalikhin
Varun Koyyalagunta
Vassilis Papaefstathiou
@ -249,9 +253,11 @@ Yuri Victorovich
Yutetsu TAKATSUKASA
Yves Mathieu
Zhanglei Wang
Zhen Yan
Zhou Shen
Zhouyi Shen
Zixi Li
أحمد المحمودي
404allen404
Tobias Jensen
february cozzocrea
sumpster
Àlex Torregrosa
Ícaro Lima

View File

@ -25,7 +25,7 @@ BUILDDIR = _build
SPHINXOPTS ?= -c guide -j 4
ifneq ($(VERILATOR_ANALYTICS_ID),)
SPHINXOPTS += -D html_theme_options.analytics_id=$(VERILATOR_ANALYTICS_ID)
SPHINXOPTS += -D html_theme_options.analytics_id=$(VERILATOR_ANALYTICS_ID)
endif
######################################################################

View File

@ -0,0 +1,5 @@
.. comment: generated by t_lint_badvltpragma_bad
.. code-block:: sv
:emphasize-lines: 1
// verilator lintt_off WIDTH //<--- Warning (lint_off misspelled)

View File

@ -0,0 +1,7 @@
.. comment: generated by t_lint_badvltpragma_bad
.. code-block::
:emphasize-lines: 1,2
%Error-BADVLTPRAGMA: example.v:1:4 Unknown verilator comment: '/*verilator lintt_off WIDTH <--- Warning (lint_off misspelled)*/'
7 | /*verilator lintt_off WIDTH <--- Warning (lint_off misspelled)*/
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -1,4 +1,4 @@
.. comment: generated by t_lint_pinmissing_bad
.. code-block::
%Warning-PINMISSING: example.v:1:8 Cell has missing pin: 'port'
%Warning-PINMISSING: example.v:1:8 Instance has missing pin: 'port'

View File

@ -1,11 +0,0 @@
.. comment: generated by t_lint_pkgnodecl_bad
.. code-block:: sv
:linenos:
:emphasize-lines: 2
module t;
initial Pkg::hello(); //<--- Warning
endmodule
package Pkg;
function void hello(); endfunction
endpackage

View File

@ -1,4 +0,0 @@
.. comment: generated by t_lint_pkgnodecl_bad
.. code-block::
%Error-PKGNODECL: example.v:1:12 Package/class 'Pkg' not found, and needs to be predeclared (IEEE 1800-2023 26.3)

View File

@ -0,0 +1,12 @@
.. comment: generated by t_lint_procassinit_bad
.. code-block:: sv
:linenos:
:emphasize-lines: 1,5
logic flop_out = 1; // <--- Warning
always @(posedge clk, negedge reset_l) begin
if (enable) begin
flop_out <= ~in; // <--- Use of initialized
end
end

View File

@ -0,0 +1,15 @@
.. comment: generated by t_lint_procassinit_bad
.. code-block:: sv
:linenos:
:emphasize-lines: 5
logic flop2_out;
always @(posedge clk, negedge reset_l) begin
if (!reset_l) begin
flop2_out <= '1; // <--- Added reset init
end
else if (enable) begin
flop2_out <= ~in;
end
end

View File

@ -0,0 +1,12 @@
.. comment: generated by t_lint_procassinit_bad
.. code-block::
%Warning-PROCASSINIT: example.v:1:21 Procedural assignment to declaration with initial value: 'flop_out'
: ... note: In instance 't'
: ... Location of variable initialization
26 | logic flop_out = 1;
| ^
example.v:1:10 ... Location of variable process write
: ... Perhaps should initialize instead using a reset in this process
30 | flop_out <= ~in;
| ^~~~~~~~

View File

@ -23,8 +23,8 @@ Contributors
Many people have provided ideas and other assistance with Verilator.
Verilator is receiving significant development support from the `CHIPS
Alliance <https://chipsalliance.org>`_, `Antmicro Ltd
<https://antmicro.com>`_ and `Shunyao CAD <https://shunyaocad.com>`_.
Alliance <https://chipsalliance.org>`_, and `Antmicro Ltd
<https://antmicro.com>`_.
Previous major corporate sponsors of Verilator, by providing significant
contributions of time or funds include: Antmicro Ltd., Atmel Corporation,

View File

@ -1,9 +1,9 @@
.. Copyright 2003-2025 by Wilson Snyder.
.. SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
=====================
verilator Arguments
=====================
===================
verilator Arguments
===================
The following arguments may be passed to the "verilator" executable.
@ -86,13 +86,19 @@ Summary:
grammar and other semantic extensions which might not be legal when
set to an older standard.
.. option:: --assert
.. option:: --no-assert
Enable all assertions. Implies :vlopt:`--assert-case`.
Disable all assertions. Implies :vlopt:`--no-assert-case`.
.. option:: --assert-case
In versions before 5.038, these were disabled by default, and `--assert`
was required to enable assertions.
Enable unique/unique0/priority case related checks.
.. option:: --no-assert-case
Disable unique/unique0/priority case related checks.
In versions before 5.038, these were disabled by default, and `--assert`
or `--assert-case` was required to enable case assertions.
.. option:: --autoflush
@ -183,7 +189,7 @@ Summary:
With :vlopt:`--clk`, the specified signal is marked as a clock signal.
The provided signal name is specified using a RTL hierarchy path. For
example, v.foo.bar. If the signal is the input to top-module, then
example, v.foo.bar. If the signal is the input to the top-module, then
directly provide the signal name. Alternatively, use a
:option:`/*verilator&32;clocker*/` metacomment in RTL file to mark the
signal directly.
@ -393,6 +399,22 @@ Summary:
standard across Verilog tools while :vlopt:`-D <-D<var>>` is similar to
:command:`gcc -D`.
.. option:: --diagnostics-sarif
Enables diagnostics output into a Static Analysis Results Interchange
Format (SARIF) file, a standard, JSON-based format for the output of
static analysis tools such as linters. See
[SARIF](https://sarifweb.azurewebsites.net/),
[sarif-tools](https://github.com/microsoft/sarif-tools), and the [SARIF
web-based viewer](https://microsoft.github.io/sarif-web-component/).
.. option:: --diagnostics-sarif-output <filename>
Specifies the filename for the SARIF output file (`.sarif`) of
:vlopt:`--diagnostics-sarif`. Using this option automatically sets
:vlopt:`--diagnostics-sarif`. If not specified, output defaults to
:file:`<prefix>.sarif`.
.. option:: --dpi-hdr-only
Only generate the DPI header file. This option does not affect on the
@ -446,9 +468,9 @@ Summary:
.. option:: --dump-tree-dot
Rarely needed. Enable dumping Ast .tree.dot debug files in Graphviz
Dot format. This option implies :vlopt:`--dump-tree`, unless
:vlopt:`--dumpi-tree` was passed explicitly.
Rarely needed - for developer use. Enable dumping Ast .tree.dot debug
files in Graphviz Dot format. This option implies :vlopt:`--dump-tree`,
unless :vlopt:`--dumpi-tree` was passed explicitly.
.. option:: --dump-tree-json
@ -568,34 +590,41 @@ Summary:
.. option:: -fno-const-before-dfg
Do not apply any global expression folding prior to the DFG pass. This
option is solely for the purpose of DFG testing and should not be used
otherwise.
Rarely needed. Do not apply any global expression folding prior to the
DFG pass. This option is solely for the purpose of DFG testing and
should not be used otherwise.
.. option:: -fno-const-bit-op-tree
.. option:: -fno-const-eager
.. option:: -fno-dedup
.. option:: -fno-dfg
Disable all use of the DFG-based combinational logic optimizer.
Alias for :vlopt:`-fno-dfg-pre-inline` and :vlopt:`-fno-dfg-post-inline`.
Rarely needed. Disable all use of the DFG-based combinational logic
optimizer. Alias for :vlopt:`-fno-dfg-pre-inline`,
:vlopt:`-fno-dfg-post-inline` and :vlopt:`-fno-dfg-scoped`.
.. option:: -fno-dfg-peephole
Disable the DFG peephole optimizer.
Rarely needed. Disable the DFG peephole optimizer.
.. option:: -fno-dfg-peephole-<pattern>
Disable individual DFG peephole optimizer pattern.
Rarely needed. Disable individual DFG peephole optimizer pattern.
.. option:: -fno-dfg-post-inline
Do not apply the DFG optimizer after inlining.
Rarely needed. Do not apply the DFG optimizer after inlining.
.. option:: -fno-dfg-pre-inline
Do not apply the DFG optimizer before inlining.
Rarely needed. Do not apply the DFG optimizer before inlining.
.. option:: -fno-dfg-scoped
Rarely needed. Do not apply the DFG optimizer across module scopes.
.. option:: -fno-expand
@ -607,6 +636,10 @@ Summary:
.. option:: -fno-gate
Rarely needed. Do not apply the gate-level wire optimizations. Using
this is not recommended as may cause additional warnings and ordering
issues.
.. option:: -fno-inline
.. option:: -fno-inline-funcs
@ -643,8 +676,9 @@ Summary:
.. option:: -fno-var-split
Do not attempt to split variables automatically. Variables explicitly
annotated with :option:`/*verilator&32;split_var*/` are still split.
Rarely needed. Do not attempt to split variables
automatically. Variables explicitly annotated with
:option:`/*verilator&32;split_var*/` are still split.
.. option:: -future0 <option>
@ -750,10 +784,19 @@ Summary:
.. option:: --hierarchical-params-file <filename>
Internal flag inserted used during :vlopt:`--hierarchical`; specifies
name of hierarchical parameters file for deparametrized modules with
:option:`/*verilator&32;hier_block*/` metacomment. See
:ref:`Hierarchical Verilation`.
Rarely needed - internal use. Internal flag inserted used during
:vlopt:`--hierarchical`; specifies name of hierarchical parameters file
for deparametrized modules with :option:`/*verilator&32;hier_block*/`
metacomment. See :ref:`Hierarchical Verilation`.
.. option:: --hierarchical-threads <threads>
Specifies the number of threads used for scheduling hierarchical blocks.
This allows scheduling multi-thread hierarchical blocks on multiple
threads, without increasing the parallelism of the entire design.
Set to :vlopt:`--threads` by default. For optimal performance should not
exceed the CPU thread count.
.. option:: -I<dir>
@ -824,13 +867,15 @@ Summary:
.. option:: --json-only-meta-output <filename>
Specifies the filename for the metadata output file (`.tree.meta.json`) of --json-only.
Using this option automatically sets :vlopt:`--json-only`.
Specifies the filename for the metadata output file (`.tree.meta.json`)
of :vlopt:`--json-only`. Using this option automatically sets
:vlopt:`--json-only`.
.. option:: --json-only-output <filename>
Specifies the filename for the main output file (`.tree.json`) of --json-only.
Using this option automatically sets :vlopt:`--json-only`.
Specifies the filename for the main output file (`.tree.json`) of
:vlopt:`--json-only`. Using this option automatically sets
:vlopt:`--json-only`.
.. option:: --l2-name <value>
@ -956,7 +1001,7 @@ Summary:
.. option:: --max-num-width <value>
Set the maximum number literal width (e.g., in 1024'd22 this
Set the maximum number literal width (e.g., in 1024'd22 the
1024). Defaults to 64K.
.. option:: --Mdir <directory>
@ -1184,8 +1229,8 @@ Summary:
.. option:: --private
Opposite of :vlopt:`--public`. This is the default; this option exists for
backwards compatibility.
Rarely needed. Opposite of :vlopt:`--public`. This is the default; this
option exists for backwards compatibility.
.. option:: --prof-c
@ -1273,8 +1318,8 @@ Summary:
.. option:: --public
This is only for historical debugging use and using it may result in
mis-simulation of generated clocks.
Rarely needed. This is only for historical debugging use and using it
may result in mis-simulation of generated clocks.
Declares all signals and modules public. This will turn off signal
optimizations as if all signals had a :option:`/*verilator&32;public*/`
@ -1340,7 +1385,7 @@ Summary:
the path of the referencing file, instead of relative to the current
directory.
.. option:: --reloop-limit
.. option:: --reloop-limit <value>
Rarely needed. Verilator attempts to turn some common sequences of
statements into loops in the output. This argument specifies the minimum
@ -1561,9 +1606,8 @@ Summary:
When the input Verilog contains more than one top-level module,
it specifies the name of the module to become the top-level module,
and sets the default for :vlopt:`--prefix` if not explicitly specified.
This is not needed with standard designs with only one top. See also
:option:`MULTITOP` warning.
This is not needed with standard designs with only one top.
See :ref:`Finding and Binding Modules`.
.. option:: --trace
@ -1720,8 +1764,8 @@ Summary:
.. option:: --valgrind
Run Verilator under `Valgrind <https://valgrind.org/>`_. The command may be
changed with :option:`VERILATOR_VALGRIND`.
Rarely needed. Run Verilator under `Valgrind <https://valgrind.org/>`_.
The command may be changed with :option:`VERILATOR_VALGRIND`.
.. option:: --no-verilate
@ -1774,7 +1818,7 @@ Summary:
them systematically.
The generated file is in the Verilator Configuration format, see
:ref:`Configuration Files`. The standard file extension is ".vlt".
:ref:`Verilator Control Files`. The standard file extension is ".vlt".
These files can directly be consumed by Verilator, typically by placing
the filename as part of the Verilator command line options. Waiver files
need to be listed on the command line before listing the files they are
@ -1847,6 +1891,19 @@ Summary:
``-Wno-UNUSEDGENVAR`` ``-Wno-UNUSEDPARAM`` ``-Wno-UNUSEDSIGNAL``
``-Wno-VARHIDDEN``.
.. option:: -work <libname>
Use the specified Verilog config library name for all cells read after
this argument. May be specified multiple times, it will apply to cells
read between the given arguments. E.g. `-work liba a.v -work libb b.v`
will use `liba` for modules inside `a.v` or in cells resolved
hierarchically under those modules, and will use `libb` for modules
inside `b.v` or hierarchically under.
Defaults to "work" (IEEE 1800-2023 3.3.1).
See :ref:`Finding and Binding Modules`.
.. option:: -Wpedantic
Warn on any construct demanded by IEEE, and disable all Verilator
@ -1880,9 +1937,9 @@ Summary:
``-Wwarn-ASSIGNDLY`` ``-Wwarn-BLKSEQ`` ``-Wwarn-DECLFILENAME``
``-Wwarn-DEFPARAM`` ``-Wwarn-EOFNEWLINE`` ``-Wwarn-GENUNNAMED``
``-Wwarn-IMPORTSTAR`` ``-Wwarn-INCABSPATH`` ``-Wwarn-PINCONNECTEMPTY``
``-Wwarn-PINNOCONNECT`` ``-Wwarn-SYNCASYNCNET`` ``-Wwarn-UNDRIVEN``
``-Wwarn-UNUSEDGENVAR`` ``-Wwarn-UNUSEDLOOP`` ``-Wwarn-UNUSEDPARAM``
``-Wwarn-UNUSEDSIGNAL`` ``-Wwarn-VARHIDDEN``.
``-Wwarn-PINNOCONNECT`` ``-Wwarn-PROCASSINIT`` ``-Wwarn-SYNCASYNCNET``
``-Wwarn-UNDRIVEN`` ``-Wwarn-UNUSEDGENVAR`` ``-Wwarn-UNUSEDLOOP``
``-Wwarn-UNUSEDPARAM`` ``-Wwarn-UNUSEDSIGNAL`` ``-Wwarn-VARHIDDEN``.
.. option:: --x-assign <mode>
@ -2015,18 +2072,20 @@ Summary:
filenames.
.. _Configuration Files:
.. _Verilator Control Files:
=====================
Configuration Files
=====================
=======================
Verilator Control Files
=======================
In addition to the command line, warnings and other features for the
:command:`verilator` command may be controlled with configuration files,
typically named with the `.vlt` extension (what makes it a configuration
file is the :option:`\`verilator_config` directive). These files, when
named `.vlt`, are read before source code files; if this behavior is
undesired, name the config file with a `.v` suffix.
:command:`verilator` command may be controlled with Verilator Control
Files, not to be confused with IEEE Configurations blocks
(`config...endconfig`). Typically named with the `.vlt` extension, what
makes it a Verilator Control File is the :option:`\`verilator_config`
directive. These files, when named `.vlt`, are read before source code
files; if this behavior is undesired, name the control file with a `.v` or
other suffix.
An example:
@ -2038,19 +2097,20 @@ An example:
This disables WIDTH warnings globally, and CASEX for a specific file.
Configuration files are fed through the normal Verilog preprocessor prior
to parsing, so "\`ifdef", "\`define", and comments may be used as if the
configuration file was standard Verilog code.
Verilator control files are fed through the normal Verilog
preprocessor prior to parsing, so "\`ifdef", "\`define", and comments may
be used as if the control file was standard Verilog code.
Note that file or line-specific configuration only applies to files read
after the configuration file. It is therefore recommended to pass the
configuration file to Verilator as the first file.
Note that file or line-specific control only applies to files read
after the control file. It is therefore recommended to pass the
control file to Verilator as the first file.
The grammar of configuration commands is as follows:
The grammar of control commands is as follows:
.. option:: `verilator_config
Take the remaining text and treat it as Verilator configuration commands.
Take the remaining text and treat it as Verilator Control File commands.
See :ref:`Verilator Control Files`.
.. option:: clock_enable -module "<modulename>" -var "<signame>"
@ -2201,7 +2261,7 @@ The grammar of configuration commands is as follows:
wildcard should be designed to match a single line; it is unspecified if
the wildcard is allowed to match across multiple lines. The input
contents does not include :vlopt:`--std <--no-std>` standard files, nor
configuration files (with :code:`verilator_config`). Typical use for
control files (with :code:`verilator_config`). Typical use for
this is to match a version number present in the Verilog sources, so
that the waiver will only apply to that version of the sources.
@ -2235,13 +2295,13 @@ The grammar of configuration commands is as follows:
order to improve model runtime performance. This option is not expected
to be used by users directly. See :ref:`Thread PGO`.
.. option:: public [-module "<modulename>"] [-task/-function "<taskname>"] -var "<signame>"
.. option:: public [-module "<modulename>"] [-task/-function "<taskname>"] [-var "<signame>"]
.. option:: public_flat [-module "<modulename>"] [-task/-function "<taskname>"] -var "<signame>"
.. option:: public_flat [-module "<modulename>"] [-task/-function "<taskname>"] [-var "<signame>"]
.. option:: public_flat_rd [-module "<modulename>"] [-task/-function "<taskname>"] -var "<signame>"
.. option:: public_flat_rd [-module "<modulename>"] [-task/-function "<taskname>"] [-var "<signame>"]
.. option:: public_flat_rw [-module "<modulename>"] [-task/-function "<taskname>"] -var "<signame>" "@(edge)"
.. option:: public_flat_rw [-module "<modulename>"] [-task/-function "<taskname>"] [-var "<signame>" "@(edge)"]
Sets the variable to be public. Same as
:option:`/*verilator&32;public*/` or

View File

@ -124,6 +124,12 @@ verilator_coverage Arguments
This option should be used together with :option:`--annotate`.
.. option:: --filter-type <regex>
Skips records of coverage types that matches with <regex>
Possible values are `toggle`, `line`, `branch`, `expr`, `user` and
a wildcard with `\*` or `?`. The default value is `\*`.
.. option:: --help
Displays a help summary, the program version, and exits.

View File

@ -30,7 +30,7 @@ or "`ifdef`"'s may break other tools.
Specifies the entire begin/end block should be ignored for coverage
analysis. Must be inside a code block, e.g., within a begin/end pair.
Same as :option:`coverage_block_off` in :ref:`Configuration Files`.
Same as :option:`coverage_block_off` in :ref:`Verilator Control Files`.
.. option:: `error [string]
@ -135,14 +135,15 @@ or "`ifdef`"'s may break other tools.
.. option:: `verilator_config
Take the remaining text up to the next :option:`\`verilog` mode switch and
treat it as Verilator configuration commands. See :ref:`Configuration Files`.
Take the remaining text up to the next :option:`\`verilog` mode switch
and treat it as Verilator Control File commands. See :ref:`Verilator
Control Files`.
.. option:: `VERILATOR_TIMING
The VERILATOR_TIMING define is set when :vlopt:`--timing` is used to
allow an "\`ifdef" of code dependent on this feature. Note that this define
is not affected by the :option:`timing_off` configuration file option
is not affected by the :option:`timing_off` control file option
nor timing metacomments.
.. option:: `verilog
@ -245,7 +246,7 @@ or "`ifdef`"'s may break other tools.
the scheduling algorithm, sometimes required for correct clock behavior,
and always improving performance.
Same as :option:`clock_enable` configuration file option.
Same as :option:`clock_enable` control file option.
.. t_dist_docs_style ignore /*verilator&32;no_clocker*/
@ -264,7 +265,7 @@ or "`ifdef`"'s may break other tools.
Specifies the entire begin/end block should be ignored for coverage
analysis purposes.
Same as :option:`coverage_block_off` configuration file option.
Same as :option:`coverage_block_off` control file option.
.. option:: /*verilator&32;coverage_off*/
@ -312,7 +313,7 @@ or "`ifdef`"'s may break other tools.
submodules will be named :code:`{submodule}__DOT__{subsignal}` as C++
does not allow "." in signal names.
Same as :option:`inline` configuration file option.
Same as :option:`inline` control file option.
.. option:: /*verilator&32;isolate_assignments*/
@ -355,7 +356,7 @@ or "`ifdef`"'s may break other tools.
end
end
Same as :option:`isolate_assignments` configuration file option.
Same as :option:`isolate_assignments` control file option.
.. option:: /*verilator&32;lint_off <msg>*/
@ -394,7 +395,7 @@ or "`ifdef`"'s may break other tools.
Specifies the module the comment appears in should not be inlined into
any modules that use this module.
Same as :option:`no_inline` configuration file option.
Same as :option:`no_inline` control file option.
.. option:: /*verilator&32;no_inline_task*/
@ -405,7 +406,7 @@ or "`ifdef`"'s may break other tools.
must be pure; they cannot reference any variables outside the task
itself.
Same as :option:`no_inline` configuration file option.
Same as :option:`no_inline` control file option.
.. option:: /*verilator&32;public*/ (on parameter)
@ -439,7 +440,7 @@ or "`ifdef`"'s may break other tools.
You may want to use DPI exports instead, as it's compatible with other
simulators.
Same as :option:`public` configuration file option.
Same as :option:`public` control file option.
.. option:: /*verilator&32;public*/ (on typedef enum)
@ -462,7 +463,7 @@ or "`ifdef`"'s may break other tools.
function that accesses the variable. This is nicer as it provides an
obvious entry point compatible across simulators.
Same as :option:`public` configuration file option.
Same as :option:`public` control file option.
.. option:: /*verilator&32;public_[|flat|flat_rd|flat_rw]_on [@(<edge_list>)]*/ (as scope)
@ -495,14 +496,14 @@ or "`ifdef`"'s may break other tools.
the name of the signal or path to it may change based upon the module
inlining which takes place.
Same as :option:`public_flat` configuration file option.
Same as :option:`public_flat` control file option.
.. option:: /*verilator&32;public_flat_rd*/ (on variable)
Used after an input, output, register, or wire declaration to indicate
the signal should be declared public_flat (see above), but read-only.
Same as :option:`public_flat_rd` configuration file option.
Same as :option:`public_flat_rd` control file option.
.. option:: /*verilator&32;public_flat_rw @(<edge_list>)*/ (on variable)
@ -512,7 +513,7 @@ or "`ifdef`"'s may break other tools.
given sensitivity edge list. Use of this is implied when using the
:vlopt:`--public-flat-rw` option.
Same as :option:`public_flat_rw` configuration file option.
Same as :option:`public_flat_rw` control file option.
.. option:: /*verilator&32;public_module*/
@ -522,7 +523,7 @@ or "`ifdef`"'s may break other tools.
contains public signals or \`systemc_ directives. Use of this is
implied when using the :vlopt:`--public` option.
Same as :option:`public` configuration file option.
Same as :option:`public` control file option.
.. option:: /*verilator&32;public_off*/
@ -537,7 +538,7 @@ or "`ifdef`"'s may break other tools.
In general, you should avoid using this attribute when unnecessary, as
the performance decreases significantly with increasing usage of sc_bv.
Same as :option:`sc_bv` configuration file option.
Same as :option:`sc_bv` control file option.
.. option:: /*verilator&32;sc_clock*/
@ -555,7 +556,7 @@ or "`ifdef`"'s may break other tools.
$display-like behavior. See the :file:`test_regress/t/t_dpi_display.v`
file for an example.
Same as :option:`sformat` configuration file option.
Same as :option:`sformat` control file option.
.. option:: /*verilator&32;split_var*/
@ -602,7 +603,7 @@ or "`ifdef`"'s may break other tools.
assign bar = tmp[1] + c;
Same as :option:`split_var` configuration file option.
Same as :option:`split_var` control file option.
.. option:: /*verilator&32;tag <text...>*/
@ -617,14 +618,14 @@ or "`ifdef`"'s may break other tools.
:option:`--no-timing`), and :code:`fork`/:code:`join*` blocks are
converted into :code:`begin`/:code:`end` blocks.
Same as :option:`timing_off` configuration file option.
Same as :option:`timing_off` control file option.
.. option:: /*verilator&32;timing_on*/
Re-enable all timing constructs after this metacomment (only applicable
after :option:`timing_off`).
Same as :option:`timing_on` configuration file option.
Same as :option:`timing_on` control file option.
.. option:: /*verilator&32;trace_init_task*/

View File

@ -260,7 +260,7 @@ How do I view waveforms (aka dumps or traces)?
Verilator creates standard VCD (Value Change Dump) and FST files. VCD
files are viewable with the open-source
`GTKWave <http://gtkwave.sourceforge.net/>`_,
`GTKWave <https://gtkwave.sourceforge.net/>`_,
`Surfer <https://surfer-project.org/>`_, Dinotrace (legacy), or any of the
many closed-source viewer offerings; FST is supported only by GTKWave and
Surfer.
@ -335,7 +335,7 @@ How do I prevent my assertions from firing during reset?
Call :code:`Verilated::assertOn(false)` before you first call the model,
then turn it back on after reset. It defaults to true. When false, all
assertions controlled by :vlopt:`--assert` are disabled.
assertions are disabled.
Why do I get "undefined reference to sc_time_stamp()?

View File

@ -112,12 +112,14 @@ In specific debug and other modes, it also creates:
.. list-table::
* - *{prefix}*\ .xml
- XML tree information (from --xml)
* - *{prefix}*\ .sarif
- SARIF diagnostics (from --diagnostics-sarif)
* - *{prefix}*\ .tree.json
- JSON tree information (from --json-only)
* - *{prefix}*\ .tree.meta.json
- JSON tree metadata (from --json-only)
* - *{prefix}*\ .xml
- XML tree information (from --xml)
* - *{prefix}*\ __cdc.txt
- Clock Domain Crossing checks (from --cdc)
* - *{prefix}*\ __stats.txt

View File

@ -159,7 +159,7 @@ Those developing Verilator itself may also want these (see internals.rst):
sudo apt-get install clang clang-format-14 cmake gdb gprof graphviz lcov
sudo apt-get install python3-clang python3-distro yapf3 bear jq
sudo pip3 install sphinx sphinx_rtd_theme sphinxcontrib-spelling breathe ruff
sudo pip3 install sphinx sphinx_rtd_theme sphinxcontrib-spelling breathe gersemi mbake ruff sarif-tools
sudo pip3 install git+https://github.com/antmicro/astsee.git
cpan install Pod::Perldoc
@ -182,7 +182,7 @@ Install GTKWave
^^^^^^^^^^^^^^^
To make use of Verilator FST tracing you will want `GTKwave
<http://gtkwave.sourceforge.net/>`__ installed, however this is not
<https://gtkwave.sourceforge.net/>`__ installed, however this is not
required at Verilator build time.
.. code-block:: shell
@ -194,7 +194,7 @@ Install Z3
^^^^^^^^^^
In order to use constrained randomization the `Z3 Theorem Prover
<https://github.com/z3prover/z3#readme>`__ must be installed, however this is
<https://github.com/z3prover/z3>`__ must be installed, however this is
not required at Verilator build time. There are other compatible SMT solvers,
like CVC5/CVC4, but they are not guaranteed to work. Since different solvers are
faster for different scenarios, the solver to use at run-time can be specified
@ -288,7 +288,7 @@ location include the Verilator version name:
Note after installing (see `Installation`_), you need to add the path to
the ``bin`` directory to your ``PATH``. Or, if you use `modulecmd
<http://modules.sourceforge.net/>`__, you'll want a module file like the
<https://modules.sourceforge.net/>`__, you'll want a module file like the
following:
.. code-block:: shell

View File

@ -6,7 +6,7 @@ Input Languages
***************
This section describes the languages Verilator takes as input. See also
:ref:`Configuration Files`.
:ref:`Verilator Control Files`.
Language Standard Support
@ -90,14 +90,14 @@ wreal.
Synthesis Directive Assertion Support
-------------------------------------
With the :vlopt:`--assert` option, Verilator reads any
Verilator reads any :code:`//synopsys full_case` or :code:`//synopsys
parallel_case` directives. The same applies to any :code:`//ambit
synthesis`, :code:`//cadence` or :code:`//pragma` directives of the same
form.
:code:`//synopsys full_case` or :code:`//synopsys parallel_case`
directives. The same applies to any :code:`//ambit synthesis`,
:code:`//cadence` or :code:`//pragma` directives of the same form.
When these synthesis directives are discovered, Verilator will either
formally prove the directive to be true, or, failing that, will insert the
When these synthesis directives are discovered, unless
:vlopt:`--no-assert-case` option is used, Verilator will either formally
prove the directive to be true, or, failing that, will insert the
appropriate code to detect failing cases at simulation runtime and print an
"Assertion failed" error message.
@ -168,7 +168,7 @@ files. The :option:`/*verilator&32;timing_off*/` and
the encompassed timing controls and forks, regardless of the chosen
:vlopt:`--timing` or :vlopt:`--no-timing` option. This can also be achieved
using the :option:`timing_off` and :option:`timing_off` options in Verilator
configuration files.
Control Files.
.. _Language Limitations:
@ -478,7 +478,8 @@ shortreal
other simulators either do not support float, or convert likewise.
specify specparam
All specify blocks and timing checks are ignored.
All timing checks and specify blocks (except specparam, which is
supported) are ignored.
uwire
Verilator does not perform warning checking on uwires; it treats the
@ -536,4 +537,4 @@ $test$plusargs, $value$plusargs
{VerilatedContext*} ->commandArgs(argc, argv);
to register the command line before calling $test$plusargs or
$value$plusargs.
$value$plusargs. Or use :vlopt:`--binary` or :vlopt:`--main`.

View File

@ -76,12 +76,14 @@ Benchmarking & Optimization
For best performance, run Verilator with the :vlopt:`-O3`
:vlopt:`--x-assign fast <--x-assign>`
:vlopt:`--x-initial fast <--x-initial>`
:vlopt:`--noassert <--assert>` options. The :vlopt:`-O3`
:vlopt:`--no-assert` options. The :vlopt:`-O3`
option will require a longer time to run Verilator, and
:vlopt:`--x-assign fast <--x-assign>`
:vlopt:`--x-initial fast <--x-assign>`
may increase the risk of reset bugs in trade for performance; see the above
documentation for these options.
may increase the risk of reset bugs in trade for performance. The
:vlopt:`--no-assert` will suppress checking assertions, which is faster and
appropriate for known-good models running software, but may hide design
errors. See the above documentation for these options.
If using Verilated multithreaded, consider overriding Verilator's default
thread-to-processor assignment by using ``numactl``; see
@ -203,9 +205,6 @@ With :vlopt:`--coverage` or :vlopt:`--coverage-user`, Verilator will
translate functional coverage points the user has inserted manually in
SystemVerilog code through into the Verilated model.
Currently, all functional coverage points are specified using SystemVerilog
assertion syntax, which must be separately enabled with :vlopt:`--assert`.
For example, the following SystemVerilog statement will add a coverage
point under the coverage name "DefaultClock":
@ -315,7 +314,7 @@ Suppressing Coverage
Using :option:`/*verilator&32;coverage_off*/` and
:option:`/*verilator&32;coverage_on*/` around a block of code will disable
and enable coverage respectively around that block. Or, use the
:option:`coverage_block_off` configuration file option.
:option:`coverage_block_off` control file option.
Verilator automatically disables coverage of lines and branches with a
$stop in them, as it is assumed that $stop branches contain an error check

View File

@ -66,6 +66,40 @@ Once a model is built, the next step is typically for the user to run it,
see :ref:`Simulating`.
.. _Finding and Binding Modules:
Finding and Binding Modules
===========================
Verilator provides several mechanisms to find the source code containing a
module, primitive, interface, or program ("module" in this section) and
bind them to an instantiation. These capabilities are similar to the
"Precompiling in a single-pass" use model described in IEEE 1800-2023
33.5.1, although `config` is not yet supported.
Verilator first reads all files provided on the command line and
:vlopt:`-f` files, and parses all modules within. Each module is assigned
to the most recent library specified with :vlopt:`-work`, thus `-work liba
a.v -work libb b.v` will assign modules in `a.v` to `liba` and modules in
`b.v` to `libb`.
If a module is not defined from a file on the command-line, Verilator
attempts to find a filename constructed from the module name using
:vlopt:`-y` and `+libext`.
Binding begins with the :vlopt:`--top` module, if provided. If not provided
Verilator attempts to figure out the top module itself, and if multiple
tops result a :option:`MULTITOP` warning is issued which may be suppressed
(see details in :option:`MULTITOP`).
Verilator will attempt to bind lower unresolved instances first in the same
library name as the parent's instantiation library, and if not found search
globally across all libraries in the order modules were declared. This
allows otherwise conflicting duplicate module names between libraries to
coexist uniquely within each library name. When IEEE `config use` is
supported, more complicated selections will be able to be specified.
.. _Hierarchical Verilation:
Hierarchical Verilation
@ -94,7 +128,7 @@ There are two ways to mark a module:
* Write :option:`/*verilator&32;hier_block*/` metacomment in HDL code.
* Add a :option:`hier_block` line in the :ref:`Configuration Files`.
* Add a :option:`hier_block` line in the :ref:`Verilator Control Files`.
Then pass the :vlopt:`--hierarchical` option to Verilator.

View File

@ -37,7 +37,7 @@ Warnings may be disabled in multiple ways:
propagate upwards to any parent file (file that included the file with
the lint_off).
#. Disable the warning using :ref:`Configuration Files` with a
#. Disable the warning using :ref:`Verilator Control Files` with a
:option:`lint_off` command. This is useful when a script suppresses
warnings, and the Verilog source should not be changed. This method also
allows matching on the warning text.
@ -68,6 +68,10 @@ source code corresponding to the error, prefixed by the line number and a "
| ". Following this is typically an arrow and ~ pointing at the error on
the source line directly above.
Instead of parsing this text diagnostic output, tools that need to
understand Verilator's warning output should read the SARIF JSON output
created with :vlopt:`--diagnostics-sarif`.
List Of Warnings
================
@ -167,6 +171,28 @@ List Of Warnings
'pragma protect'. Third-party pragmas not defined by IEEE 1800-2023 are
ignored.
This error may be disabled with a lint_off BADSTDPRAGMA metacomment.
Ignoring this warning will cause the pragma to be ignored.
.. option:: BADVLTPRAGMA
An error that a `/*verilator ...*/` metacomment pragma is badly formed
or not understood.
Faulty example:
.. include:: ../../docs/gen/ex_BADVLTPRAGMA_faulty.rst
Results in:
.. include:: ../../docs/gen/ex_BADVLTPRAGMA_msg.rst
This error may be disabled with a lint_off BADVLTPRAGMA metacomment.
Ignoring this warning will cause the pragma to be ignored.
.. option:: BLKANDNBLK
@ -185,23 +211,32 @@ List Of Warnings
public task, or when the blocking and non-blocking assignments have
non-overlapping bits and structure members.
From Verilator 5.038, this warning is only issued when Verilator can't prove that
the assignments are to non-overlapping sub-parts, and the blocking
assignment is in combinational logic (which is the case where simulation
results might differ from other simulators). Review any BLKANDNBLK
cases carefully after this version, and sign them off as
described above, only if know for sure the updates are not to overlapping
parts of the signal.
Generally, this is caused by a register driven by both combo logic and a
flop:
.. code-block:: sv
logic [1:0] foo;
always @(posedge clk) foo[0] <= ...
always_comb foo[1] = ...
logic [3:0] foo;
always @(posedge clk) foo[index] <= ... // With index != 0
always_comb foo[0] = ...
Instead, use a different register for the flop:
.. code-block:: sv
logic [1:0] foo;
always @(posedge clk) foo_flopped[0] <= ...
always_comb foo[0] = foo_flopped[0];
always_comb foo[1] = ...
logic [3:0] foo;
logic [3:1] foo_flopped;
always @(posedge clk) foo_flopped[index] <= ... // With index != 0
always_comb foo[0] = ...
always_comb foo[3:1] = foo_flopped;
Or, this may also avoid the error:
@ -298,8 +333,8 @@ List Of Warnings
Unique case statements that select on an enumerated variable, where all
of the enumerated values are covered by case items, are considered
complete even if the case statement does not cover illegal
non-enumerated values (IEEE 1800-2023 12.5.3). To check that illegal
values are not hit, use :vlopt:`--assert`.
non-enumerated values (IEEE 1800-2023 12.5.3). Verilator checks that
illegal values are not hit, unless :vlopt:`--no-assert-case` was used.
Ignoring this warning will only suppress the lint check; it will
simulate correctly.
@ -337,8 +372,8 @@ List Of Warnings
Warns that it is better style to use casez, and "?" in place of
"x"'s. See
`http://www.sunburst-design.com/papers/CummingsSNUG1999Boston_FullParallelCase_rev1_1.pdf
<http://www.sunburst-design.com/papers/CummingsSNUG1999Boston_FullParallelCase_rev1_1.pdf>`_
`http://www.sunburst-design.com/papers/CummingsSNUG1999Boston_FullParallelCase.pdf
<http://www.sunburst-design.com/papers/CummingsSNUG1999Boston_FullParallelCase.pdf>`_
Ignoring this warning will only suppress the lint check; it will
simulate correctly.
@ -412,8 +447,8 @@ List Of Warnings
is suppressed, Verilator, like synthesis, will convert this to a
non-delayed assignment, which may result in logic races or other
nasties. See
`http://www.sunburst-design.com/papers/CummingsSNUG2000SJ_NBA_rev1_2.pdf
<http://www.sunburst-design.com/papers/CummingsSNUG2000SJ_NBA_rev1_2.pdf>`_
`http://www.sunburst-design.com/papers/CummingsSNUG2000SJ_NBA.pdf
<http://www.sunburst-design.com/papers/CummingsSNUG2000SJ_NBA.pdf>`_
Ignoring this warning may make Verilator simulations differ from other
simulators.
@ -476,7 +511,8 @@ List Of Warnings
.. option:: DEFOVERRIDE
Warns that a macro definition within the code is being overridden by a command line directive:
Warns that a macro definition within the code is being overridden by a
command line directive:
For example, running Verilator with :code:`<+define+\<DUP\>=\<def2\>>` and
@ -1081,8 +1117,6 @@ List Of Warnings
.. option:: LITENDIAN
.. TODO better example
The naming of this warning is in contradiction with the common
interpretation of little endian. It was therefore renamed to
:option:`ASCRANGE`. While :option:`LITENDIAN` remains for
@ -1158,6 +1192,19 @@ List Of Warnings
discarded.
.. option:: MODMISSING
.. TODO better example
Error that a module, typically referenced by a cell, was not found.
This is typically fatal, but may be suppressed in some linting
situations with missing libraries.
Ignoring this error will cause the cell definition to be discarded.
Simulation results will likely be wrong, so typically used only with
lint-only.
.. option:: MULTIDRIVEN
Warns that the specified signal comes from multiple :code:`always`
@ -1214,6 +1261,8 @@ List Of Warnings
modules' signals seem identical, e.g., multiple modules with a "clk"
input.
Ignoring this warning will make multiple tops, as described in (3) above.
.. option:: NEEDTIMINGOPT
@ -1256,6 +1305,9 @@ List Of Warnings
:code:`$psprintf` system function is replaced by its standard equivalent
:code:`$sformatf`.
Ignoring this warning will only suppress the lint check; it will
simulate correctly.
.. option:: NOTIMING
@ -1315,11 +1367,11 @@ List Of Warnings
Faulty example:
.. include:: ../../docs/gen/ex_PKGNODECL_faulty.rst
.. include:: ../../docs/gen/ex_PINMISSING_faulty.rst
Results in:
.. include:: ../../docs/gen/ex_PKGNODECL_msg.rst
.. include:: ../../docs/gen/ex_PINMISSING_msg.rst
Repaired example:
@ -1379,22 +1431,11 @@ List Of Warnings
.. option:: PKGNODECL
An error that a package/class appears to have been referenced that has
not yet been declared. According to IEEE 1800-2023 26.3, all packages
must be declared before being used.
Faulty example:
.. include:: ../../docs/gen/ex_PKGNODECL_faulty.rst
Results in:
.. include:: ../../docs/gen/ex_PKGNODECL_msg.rst
Often the package is declared in its own header file. In this case add
an include of that package header file to the referencing file. (And
make sure you have header guards in the package's header file to prevent
multiple declarations of the package.)
Never issued since version 5.038. Historically an error that a
package/class appears to have been referenced that has not yet been
declared. According to IEEE 1800-2023 26.3, all packages must be
declared before being used. However, several standard libraries
including UVM violate this, and other tools do not warn.
.. option:: PORTSHORT
@ -1444,6 +1485,40 @@ List Of Warnings
The portable way to suppress this warning is to use a define value other
than zero, when it is to be used in a preprocessor expression.
Ignoring this warning will only suppress the lint check; it will
simulate correctly.
.. option:: PROCASSINIT
Warns that the specified signal is given an initial value where it is
declared, and is also driven in an always process. Typically such
initial values should instead be set using a reset signal inside the
process, to match requirements of ASIC synthesis tools. However,
declaration initializers are a valid FPGA design idiom and therefore,
FPGA users may want to disable this warning.
Faulty example:
.. include:: ../../docs/gen/ex_PROCASSINIT_faulty.rst
Results in:
.. include:: ../../docs/gen/ex_PROCASSINIT_msg.rst
One possible fix, adding a reset to the always:
.. include:: ../../docs/gen/ex_PROCASSINIT_fixed.rst
Alternatively, use an initial block for the initialization:
.. code-block:: sv
initial flop_out = 1; // <--- Fixed
Disabled by default as this is a code-style warning; it will simulate
correctly.
.. option:: PROCASSWIRE
@ -1475,7 +1550,7 @@ List Of Warnings
inside the protected region will be partly checked for correctness but is
otherwise ignored.
Suppressing the warning may make Verilator differ from a simulator that
Ignoring the warning may make Verilator differ from a simulator that
accepts the protected code.
@ -1493,6 +1568,9 @@ List Of Warnings
Warns that a real number is being implicitly rounded to an integer, with
possible loss of precision.
Ignoring this warning will only suppress the lint check; it will
simulate correctly.
Faulty example:
.. code-block:: sv
@ -1522,8 +1600,12 @@ List Of Warnings
.. option:: REDEFMACRO
Warns that the code has redefined the same macro with a different value,
for example:
Warns that the code has redefined the same macro with a different value.
Ignoring this warning will only suppress the lint check; it will
simulate correctly.
For example:
.. code-block:: sv
:linenos:
@ -2146,7 +2228,7 @@ List Of Warnings
.. include:: ../../docs/gen/ex_VARHIDDEN_msg.rst
To resolve this, rename the variable to an unique name.
To resolve this, rename the inner or outer variable to an unique name.
.. option:: WAITCONST

View File

@ -1470,7 +1470,7 @@ Preparing to Run Tests
For all tests to pass, you must install the following packages:
- SystemC to compile the SystemC outputs, see http://systemc.org
- SystemC to compile the SystemC outputs, see https://systemc.org
- vcddiff to find differences in VCD outputs. See the readme at
https://github.com/veripool/vcddiff
@ -1569,6 +1569,41 @@ environment can check their branches too by enabling the build workflow:
- Click Enable workflow.
Benchmarking
------------
For benchmarking the effects of changes (simulation speed, memory consumption,
verilation time, etc.), you can use `RTLMeter
<https://github.com/verilator/rtlmeter>`__, a benchmark suite designed for this
purpose. The scripts provided with RTLMeter have many capabilities. For full
details, see the `documentation of RTLMeter
<https://verilator.github.io/rtlmeter>`__ itself.
For a quick check, you an run the following after putting ``verilator`` on your
``PATH``:
.. code:: shell
./rtlmeter run --cases "+standard" --workRoot work-a
./rtlmeter report work-a
To compare against an alternate version, again put that alternate ``verilator``
on your ``PATH`` then run:
.. code:: shell
./rtlmeter run --cases "+standard" --workRoot work-b
./rtlmeter compare work-a work-b
The continuous integration system in GitHub Actions runs this benchmark suite
nightly on the master branch. The performance numbers from these nightly runs
can be viewed via the `RTLMeter results dashboard
<https://verilator.github.io/verilator-rtlmeter-results>`__. Note that these
results are collected on GitHub hosted runners. These are virtual machines
operating in a potentially noisy environment, so time measurements can have
significant variance. Experience shows that a ~20% time difference can be
reliably measured on GitHub hosted runners, and smaller differences are
noticeable over a few days of reruns as trends emerge from the noise.
Fuzzing
-------
@ -1633,7 +1668,7 @@ scaled so it can be more useful with large graphs.
For interactive graph viewing consider `xdot
<https://github.com/jrfonseca/xdot.py>`__ or `ZGRViewer
<http://zvtm.sourceforge.net/zgrviewer.html>`__. If you know of better
<https://zvtm.sourceforge.net/zgrviewer.html>`__. If you know of better
viewers (especially for large graphs) please let us know.
@ -1903,7 +1938,7 @@ find what made a <e#*#*> line in the tree dumps):
::
watch AstNode::s_editCntGbl==####
watch AstNode::s_editCntGbl=####
Then, when the watch fires, to break at every following change to that
node:

41
docs/security.rst Normal file
View File

@ -0,0 +1,41 @@
.. for github, vim: syntax=reStructuredText
Security Policy
===============
If you believe you have found a security issue in any Verilator-owned
repository, create a `GitHub repository security advisory
<https://docs.github.com/en/code-security/security-advisories/working-with-repository-security-advisories/creating-a-repository-security-advisory>`__.
We request that you please not publicly disclose the issue until it has
been addressed by us.
SystemVerilog Security
----------------------
The SystemVerilog language includes `$system`, etc. operating system calls,
and as such executables created by Verilator should be considered insecure.
In contrast, it is a security issue if a Verilator-created data file, such
as a coverage data file, when read with `verilator_coverage`, allows
arbitrary code execution.
Bug bounties
------------
While we encourage reports of suspected security problems, we are an open
source project, and do not run any bug bounty programs.
Preferred Languages
-------------------
We prefer all communications to be in English.
Policy
------
We follow the principle of `Coordinated Vulnerability Disclosure
<https://en.wikipedia.org/wiki/Coordinated_vulnerability_disclosure>`__.
Distribution
------------
SPDX-License-Identifier: CC0-1.0

View File

@ -144,6 +144,7 @@ Gileadi
Giri
Gisselquist
Gladkikh
GmbH
Goessling
Gonnen
Goorah
@ -246,10 +247,12 @@ Lesik
Libenzi
Licker
Liland
LinkDot
Liu
Liwei
Lockhart
Longo
LteS
Luca
Luiza
Lussier
@ -273,6 +276,7 @@ Mednick
Mei
Melo
Menküc
Menon
Michail
Michiels
Microsystems
@ -303,6 +307,7 @@ Nauticus
Newgard
Nigam
Nikana
Niraj
Niranjan
Nitza
Noack
@ -329,6 +334,7 @@ Prabhat
Prabhu
Prateek
Pre
Precompiling
Preprocess
Pretet
Pretl
@ -402,6 +408,7 @@ Stroebel
Strouble
Stucki
Su
Subst
Suguimoto
Sundararajan
Sunderland
@ -437,6 +444,7 @@ UNOPTFLAT
Ubixum
Ueno
Uints
Undefine
Undefines
Unsized
Urbach
@ -533,10 +541,12 @@ basename
bbox
benchmarking
biguint
binToOneHot
bindir
biops
bisonpre
bitOpTree
bitaggregat
bitop
bitstoreal
blackbox
@ -581,7 +591,9 @@ conf
config
const
constexpr
constification
constpool
contify
coredump
coroutine
coroutines
@ -614,7 +626,9 @@ dep
deparametrized
der
dereference
dereferenced
desassign
deserialize
destructor
desynchronization
detections
@ -742,6 +756,8 @@ hierCMakeArgs
hierMkArgs
hierParameters
hierVer
html
https
hx
hyperthreading
hyperthreads
@ -790,6 +806,7 @@ libtcmalloc
libverilated
linkers
linter
linters
linux
liu
livelock
@ -839,6 +856,7 @@ multithread
multithreaded
multithreading
musl
mutex
mutexes
mux
muzafferkal
@ -868,6 +886,7 @@ onehot
ooo
oprofile
ortegon
oversized
oversubscription
parallelized
param
@ -904,6 +923,7 @@ pre
precisions
precompiled
predefines
prefetch
prepareClone
prepend
prepended
@ -965,6 +985,7 @@ runtimes
rw
sVerilator
saif
sarif
sawatzke
sc
scalared
@ -1023,6 +1044,7 @@ swrite
synthesizeable
sys
systemc
taskify
tcmalloc
tenghtt
testbench
@ -1060,6 +1082,7 @@ typename
uint
un
unbased
uncomment
undef
undefineall
undriven

View File

@ -20,28 +20,28 @@
# binary relative to $VERILATOR_ROOT (such as when inside the git sources).
ifeq ($(VERILATOR_ROOT),)
VERILATOR = verilator
VERILATOR_COVERAGE = verilator_coverage
VERILATOR = verilator
VERILATOR_COVERAGE = verilator_coverage
else
export VERILATOR_ROOT
VERILATOR = $(VERILATOR_ROOT)/bin/verilator
VERILATOR_COVERAGE = $(VERILATOR_ROOT)/bin/verilator_coverage
export VERILATOR_ROOT
VERILATOR = $(VERILATOR_ROOT)/bin/verilator
VERILATOR_COVERAGE = $(VERILATOR_ROOT)/bin/verilator_coverage
endif
######################################################################
# Check if CMake is installed and of correct version
ifeq ($(shell which cmake),)
TARGET := nocmake
TARGET := nocmake
else
CMAKE_VERSION := $(shell cmake --version | grep -o '[0-9][.0-9]\+')
CMAKE_MAJOR := $(shell echo $(CMAKE_VERSION) | cut -f1 -d.)
CMAKE_MINOR := $(shell echo $(CMAKE_VERSION) | cut -f2 -d.)
CMAKE_GT_3_8 := $(shell [ $(CMAKE_MAJOR) -gt 3 -o \( $(CMAKE_MAJOR) -eq 3 -a $(CMAKE_MINOR) -ge 8 \) ] && echo true)
ifeq ($(CMAKE_GT_3_8),true)
TARGET := run
else
TARGET := oldcmake
endif
CMAKE_VERSION := $(shell cmake --version | grep -o '[0-9][.0-9]\+')
CMAKE_MAJOR := $(shell echo $(CMAKE_VERSION) | cut -f1 -d.)
CMAKE_MINOR := $(shell echo $(CMAKE_VERSION) | cut -f2 -d.)
CMAKE_GT_3_8 := $(shell [ $(CMAKE_MAJOR) -gt 3 -o \( $(CMAKE_MAJOR) -eq 3 -a $(CMAKE_MINOR) -ge 8 \) ] && echo true)
ifeq ($(CMAKE_GT_3_8),true)
TARGET := run
else
TARGET := oldcmake
endif
endif
default: $(TARGET)

View File

@ -20,46 +20,44 @@
# binary relative to $VERILATOR_ROOT (such as when inside the git sources).
ifeq ($(VERILATOR_ROOT),)
VERILATOR = verilator
VERILATOR_COVERAGE = verilator_coverage
VERILATOR = verilator
VERILATOR_COVERAGE = verilator_coverage
else
export VERILATOR_ROOT
VERILATOR = $(VERILATOR_ROOT)/bin/verilator
VERILATOR_COVERAGE = $(VERILATOR_ROOT)/bin/verilator_coverage
export VERILATOR_ROOT
VERILATOR = $(VERILATOR_ROOT)/bin/verilator
VERILATOR_COVERAGE = $(VERILATOR_ROOT)/bin/verilator_coverage
endif
######################################################################
# Check if CMake is installed and of correct version
ifeq ($(shell which cmake),)
TARGET := nocmake
else
CMAKE_VERSION := $(shell cmake --version | grep -o '[0-9][.0-9]\+')
CMAKE_MAJOR := $(shell echo $(CMAKE_VERSION) | cut -f1 -d.)
CMAKE_MINOR := $(shell echo $(CMAKE_VERSION) | cut -f2 -d.)
CMAKE_GT_3_8 := $(shell [ $(CMAKE_MAJOR) -gt 3 -o \( $(CMAKE_MAJOR) -eq 3 -a $(CMAKE_MINOR) -ge 8 \) ] && echo true)
ifneq ($(CMAKE_GT_3_8),true)
TARGET := oldcmake
TARGET := nocmake
else
CMAKE_VERSION := $(shell cmake --version | grep -o '[0-9][.0-9]\+')
CMAKE_MAJOR := $(shell echo $(CMAKE_VERSION) | cut -f1 -d.)
CMAKE_MINOR := $(shell echo $(CMAKE_VERSION) | cut -f2 -d.)
CMAKE_GT_3_8 := $(shell [ $(CMAKE_MAJOR) -gt 3 -o \( $(CMAKE_MAJOR) -eq 3 -a $(CMAKE_MINOR) -ge 8 \) ] && echo true)
ifneq ($(CMAKE_GT_3_8),true)
TARGET := oldcmake
else
# Check if SC exists via a verilator call (empty if not)
SYSTEMC_EXISTS := $(shell $(VERILATOR) --get-supported SYSTEMC)
# Check if SC exists via a verilator call (empty if not)
SYSTEMC_EXISTS := $(shell $(VERILATOR) --get-supported SYSTEMC)
# Test whether SystemC is installed with CMake support
# This will print a CMake error about processing arguments that can (currently) be ignored.
ifneq (,$(SYSTEMC_EXISTS))
FINDSC := $(shell mkdir -p build && cd build && cmake --find-package -DNAME=SystemCLanguage -DCMAKE_USE_PTHREADS_INIT=ON -DCOMPILER_ID=GNU -DLANGUAGE=CXX -DMODE=EXIST -DThreads_FOUND=ON)
ifneq (,$(findstring SystemCLanguage found,$(FINDSC)))
SYSTEMC_SET := true
endif
endif
# Test whether SystemC is installed with CMake support
# This will print a CMake error about processing arguments that can (currently) be ignored.
ifneq (,$(SYSTEMC_EXISTS))
FINDSC := $(shell mkdir -p build && cd build && cmake --find-package -DNAME=SystemCLanguage -DCMAKE_USE_PTHREADS_INIT=ON -DCOMPILER_ID=GNU -DLANGUAGE=CXX -DMODE=EXIST -DThreads_FOUND=ON)
ifneq (,$(findstring SystemCLanguage found,$(FINDSC)))
SYSTEMC_SET := true
endif
endif
ifeq ($(SYSTEMC_SET), true)
TARGET := run
else
TARGET := nosc
endif
endif
ifeq ($(SYSTEMC_SET), true)
TARGET := run
else
TARGET := nosc
endif
endif
endif
default: $(TARGET)

View File

@ -20,28 +20,28 @@
# binary relative to $VERILATOR_ROOT (such as when inside the git sources).
ifeq ($(VERILATOR_ROOT),)
VERILATOR = verilator
VERILATOR_COVERAGE = verilator_coverage
VERILATOR = verilator
VERILATOR_COVERAGE = verilator_coverage
else
export VERILATOR_ROOT
VERILATOR = $(VERILATOR_ROOT)/bin/verilator
VERILATOR_COVERAGE = $(VERILATOR_ROOT)/bin/verilator_coverage
export VERILATOR_ROOT
VERILATOR = $(VERILATOR_ROOT)/bin/verilator
VERILATOR_COVERAGE = $(VERILATOR_ROOT)/bin/verilator_coverage
endif
######################################################################
# Check if CMake is installed and of correct version
ifeq ($(shell which cmake),)
TARGET := nocmake
TARGET := nocmake
else
CMAKE_VERSION := $(shell cmake --version | grep -o '[0-9][.0-9]\+')
CMAKE_MAJOR := $(shell echo $(CMAKE_VERSION) | cut -f1 -d.)
CMAKE_MINOR := $(shell echo $(CMAKE_VERSION) | cut -f2 -d.)
CMAKE_GT_3_8 := $(shell [ $(CMAKE_MAJOR) -gt 3 -o \( $(CMAKE_MAJOR) -eq 3 -a $(CMAKE_MINOR) -ge 8 \) ] && echo true)
ifeq ($(CMAKE_GT_3_8),true)
TARGET := run
else
TARGET := oldcmake
endif
CMAKE_VERSION := $(shell cmake --version | grep -o '[0-9][.0-9]\+')
CMAKE_MAJOR := $(shell echo $(CMAKE_VERSION) | cut -f1 -d.)
CMAKE_MINOR := $(shell echo $(CMAKE_VERSION) | cut -f2 -d.)
CMAKE_GT_3_8 := $(shell [ $(CMAKE_MAJOR) -gt 3 -o \( $(CMAKE_MAJOR) -eq 3 -a $(CMAKE_MINOR) -ge 8 \) ] && echo true)
ifeq ($(CMAKE_GT_3_8),true)
TARGET := run
else
TARGET := oldcmake
endif
endif
default: $(TARGET)

View File

@ -20,28 +20,28 @@
# binary relative to $VERILATOR_ROOT (such as when inside the git sources).
ifeq ($(VERILATOR_ROOT),)
VERILATOR = verilator
VERILATOR_COVERAGE = verilator_coverage
VERILATOR = verilator
VERILATOR_COVERAGE = verilator_coverage
else
export VERILATOR_ROOT
VERILATOR = $(VERILATOR_ROOT)/bin/verilator
VERILATOR_COVERAGE = $(VERILATOR_ROOT)/bin/verilator_coverage
export VERILATOR_ROOT
VERILATOR = $(VERILATOR_ROOT)/bin/verilator
VERILATOR_COVERAGE = $(VERILATOR_ROOT)/bin/verilator_coverage
endif
######################################################################
# Check if CMake is installed and of correct version
ifeq ($(shell which cmake),)
TARGET := nocmake
TARGET := nocmake
else
CMAKE_VERSION := $(shell cmake --version | grep -o '[0-9][.0-9]\+')
CMAKE_MAJOR := $(shell echo $(CMAKE_VERSION) | cut -f1 -d.)
CMAKE_MINOR := $(shell echo $(CMAKE_VERSION) | cut -f2 -d.)
CMAKE_GT_3_8 := $(shell [ $(CMAKE_MAJOR) -gt 3 -o \( $(CMAKE_MAJOR) -eq 3 -a $(CMAKE_MINOR) -ge 8 \) ] && echo true)
ifeq ($(CMAKE_GT_3_8),true)
TARGET := run
else
TARGET := oldcmake
endif
CMAKE_VERSION := $(shell cmake --version | grep -o '[0-9][.0-9]\+')
CMAKE_MAJOR := $(shell echo $(CMAKE_VERSION) | cut -f1 -d.)
CMAKE_MINOR := $(shell echo $(CMAKE_VERSION) | cut -f2 -d.)
CMAKE_GT_3_8 := $(shell [ $(CMAKE_MAJOR) -gt 3 -o \( $(CMAKE_MAJOR) -eq 3 -a $(CMAKE_MINOR) -ge 8 \) ] && echo true)
ifeq ($(CMAKE_GT_3_8),true)
TARGET := run
else
TARGET := oldcmake
endif
endif
default: $(TARGET)

View File

@ -20,46 +20,44 @@
# binary relative to $VERILATOR_ROOT (such as when inside the git sources).
ifeq ($(VERILATOR_ROOT),)
VERILATOR = verilator
VERILATOR_COVERAGE = verilator_coverage
VERILATOR = verilator
VERILATOR_COVERAGE = verilator_coverage
else
export VERILATOR_ROOT
VERILATOR = $(VERILATOR_ROOT)/bin/verilator
VERILATOR_COVERAGE = $(VERILATOR_ROOT)/bin/verilator_coverage
export VERILATOR_ROOT
VERILATOR = $(VERILATOR_ROOT)/bin/verilator
VERILATOR_COVERAGE = $(VERILATOR_ROOT)/bin/verilator_coverage
endif
######################################################################
# Check if CMake is installed and of correct version
ifeq ($(shell which cmake),)
TARGET := nocmake
else
CMAKE_VERSION := $(shell cmake --version | grep -o '[0-9][.0-9]\+')
CMAKE_MAJOR := $(shell echo $(CMAKE_VERSION) | cut -f1 -d.)
CMAKE_MINOR := $(shell echo $(CMAKE_VERSION) | cut -f2 -d.)
CMAKE_GT_3_8 := $(shell [ $(CMAKE_MAJOR) -gt 3 -o \( $(CMAKE_MAJOR) -eq 3 -a $(CMAKE_MINOR) -ge 8 \) ] && echo true)
ifneq ($(CMAKE_GT_3_8),true)
TARGET := oldcmake
TARGET := nocmake
else
CMAKE_VERSION := $(shell cmake --version | grep -o '[0-9][.0-9]\+')
CMAKE_MAJOR := $(shell echo $(CMAKE_VERSION) | cut -f1 -d.)
CMAKE_MINOR := $(shell echo $(CMAKE_VERSION) | cut -f2 -d.)
CMAKE_GT_3_8 := $(shell [ $(CMAKE_MAJOR) -gt 3 -o \( $(CMAKE_MAJOR) -eq 3 -a $(CMAKE_MINOR) -ge 8 \) ] && echo true)
ifneq ($(CMAKE_GT_3_8),true)
TARGET := oldcmake
else
# Check if SC exists via a verilator call (empty if not)
SYSTEMC_EXISTS := $(shell $(VERILATOR) --get-supported SYSTEMC)
# Check if SC exists via a verilator call (empty if not)
SYSTEMC_EXISTS := $(shell $(VERILATOR) --get-supported SYSTEMC)
# Test whether SystemC is installed with CMake support
# This will print a CMake error about processing arguments that can (currently) be ignored.
ifneq (,$(SYSTEMC_EXISTS))
FINDSC := $(shell mkdir -p build && cd build && cmake --find-package -DNAME=SystemCLanguage -DCMAKE_USE_PTHREADS_INIT=ON -DCOMPILER_ID=GNU -DLANGUAGE=CXX -DMODE=EXIST -DThreads_FOUND=ON)
ifneq (,$(findstring SystemCLanguage found,$(FINDSC)))
SYSTEMC_SET := true
endif
endif
# Test whether SystemC is installed with CMake support
# This will print a CMake error about processing arguments that can (currently) be ignored.
ifneq (,$(SYSTEMC_EXISTS))
FINDSC := $(shell mkdir -p build && cd build && cmake --find-package -DNAME=SystemCLanguage -DCMAKE_USE_PTHREADS_INIT=ON -DCOMPILER_ID=GNU -DLANGUAGE=CXX -DMODE=EXIST -DThreads_FOUND=ON)
ifneq (,$(findstring SystemCLanguage found,$(FINDSC)))
SYSTEMC_SET := true
endif
endif
ifeq ($(SYSTEMC_SET), true)
TARGET := run
else
TARGET := nosc
endif
endif
ifeq ($(SYSTEMC_SET), true)
TARGET := run
else
TARGET := nosc
endif
endif
endif
default: $(TARGET)

View File

@ -15,10 +15,10 @@
# package install, and verilator is in your path. Otherwise find the
# binary relative to $VERILATOR_ROOT (such as when inside the git sources).
ifeq ($(VERILATOR_ROOT),)
VERILATOR = verilator
VERILATOR = verilator
else
export VERILATOR_ROOT
VERILATOR = $(VERILATOR_ROOT)/bin/verilator
export VERILATOR_ROOT
VERILATOR = $(VERILATOR_ROOT)/bin/verilator
endif
DOT = dot
@ -31,17 +31,15 @@ PYTHON_VERSION_MINOR := $(word 2,${PYTHON_VERSION_FULL})
PYTHON_GE_3_5 := $(shell [ ${PYTHON_VERSION_MAJOR} -eq 3 -a ${PYTHON_VERSION_MINOR} -ge 5 ] && echo true)
ifeq (${PYTHON_GE_3_5},true)
default: test
default: test
else
default: python_message
default: python_message
endif
python_message:
@echo "Found Python version ${PYTHON_VERSION}, but require >= 3.5"
test: \
test-vl_file_copy \
test-vl_hier_graph \
test: test-vl_file_copy test-vl_hier_graph
test-vl_file_copy:
@echo "-- vl_file_copy example"

View File

@ -7,12 +7,12 @@
module sub
#(parameter type TYPE_t = logic)
(
input TYPE_t in,
output TYPE_t out
);
(
input TYPE_t in,
output TYPE_t out
);
// Some simple logic
always_comb out = ~in;
// Some simple logic
always_comb out = ~in;
endmodule

View File

@ -58,11 +58,11 @@ class VlHierGraph:
top_module = False
fh.write("];\n")
cells = self.flatten(mod, lambda n: n['type'] == "CELL")
for cell in cells:
def_number = self.addr_to_vertex_number(cell['modp'])
instances = self.flatten(mod, lambda n: n['type'] == "CELL")
for inst in instances:
def_number = self.addr_to_vertex_number(inst['modp'])
fh.write(" n%d->n%d [label=\"%s\"];\n" %
(mod_number, def_number, cell['name']))
(mod_number, def_number, inst['name']))
fh.write("}\n")

View File

@ -13,7 +13,7 @@
# Check for sanity to avoid later confusion
ifneq ($(words $(CURDIR)),1)
$(error Unsupported: GNU Make cannot build in directories containing spaces, build elsewhere: '$(CURDIR)')
$(error Unsupported: GNU Make cannot build in directories containing spaces, build elsewhere: '$(CURDIR)')
endif
######################################################################
@ -26,10 +26,10 @@ endif
# package install, and verilator is in your path. Otherwise find the
# binary relative to $VERILATOR_ROOT (such as when inside the git sources).
ifeq ($(VERILATOR_ROOT),)
VERILATOR = verilator
VERILATOR = verilator
else
export VERILATOR_ROOT
VERILATOR = $(VERILATOR_ROOT)/bin/verilator
export VERILATOR_ROOT
VERILATOR = $(VERILATOR_ROOT)/bin/verilator
endif
default:

View File

@ -7,8 +7,8 @@
// See also https://verilator.org/guide/latest/examples.html"
module top;
initial begin
$display("Hello World!");
$finish;
end
initial begin
$display("Hello World!");
$finish;
end
endmodule

View File

@ -13,7 +13,7 @@
# Check for sanity to avoid later confusion
ifneq ($(words $(CURDIR)),1)
$(error Unsupported: GNU Make cannot build in directories containing spaces, build elsewhere: '$(CURDIR)')
$(error Unsupported: GNU Make cannot build in directories containing spaces, build elsewhere: '$(CURDIR)')
endif
######################################################################
@ -26,10 +26,10 @@ endif
# package install, and verilator is in your path. Otherwise find the
# binary relative to $VERILATOR_ROOT (such as when inside the git sources).
ifeq ($(VERILATOR_ROOT),)
VERILATOR = verilator
VERILATOR = verilator
else
export VERILATOR_ROOT
VERILATOR = $(VERILATOR_ROOT)/bin/verilator
export VERILATOR_ROOT
VERILATOR = $(VERILATOR_ROOT)/bin/verilator
endif
default:

View File

@ -7,8 +7,8 @@
// See also https://verilator.org/guide/latest/examples.html"
module top;
initial begin
$display("Hello World!");
$finish;
end
initial begin
$display("Hello World!");
$finish;
end
endmodule

View File

@ -13,7 +13,7 @@
# Check for sanity to avoid later confusion
ifneq ($(words $(CURDIR)),1)
$(error Unsupported: GNU Make cannot build in directories containing spaces, build elsewhere: '$(CURDIR)')
$(error Unsupported: GNU Make cannot build in directories containing spaces, build elsewhere: '$(CURDIR)')
endif
######################################################################
@ -26,19 +26,19 @@ endif
# package install, and verilator is in your path. Otherwise find the
# binary relative to $VERILATOR_ROOT (such as when inside the git sources).
ifeq ($(VERILATOR_ROOT),)
VERILATOR = verilator
VERILATOR = verilator
else
export VERILATOR_ROOT
VERILATOR = $(VERILATOR_ROOT)/bin/verilator
export VERILATOR_ROOT
VERILATOR = $(VERILATOR_ROOT)/bin/verilator
endif
# Check if SC exists via a verilator call (empty if not)
SYSTEMC_EXISTS := $(shell $(VERILATOR) --get-supported SYSTEMC)
ifneq ($(SYSTEMC_EXISTS),)
default: run
default: run
else
default: nosc
default: nosc
endif
run:

View File

@ -7,8 +7,8 @@
// See also https://verilator.org/guide/latest/examples.html"
module top;
initial begin
$display("Hello World!");
$finish;
end
initial begin
$display("Hello World!");
$finish;
end
endmodule

View File

@ -13,7 +13,7 @@
# Check for sanity to avoid later confusion
ifneq ($(words $(CURDIR)),1)
$(error Unsupported: GNU Make cannot build in directories containing spaces, build elsewhere: '$(CURDIR)')
$(error Unsupported: GNU Make cannot build in directories containing spaces, build elsewhere: '$(CURDIR)')
endif
######################################################################
@ -23,10 +23,10 @@ endif
# package install, and verilator is in your path. Otherwise find the
# binary relative to $VERILATOR_ROOT (such as when inside the git sources).
ifeq ($(VERILATOR_ROOT),)
VERILATOR = verilator
VERILATOR = verilator
else
export VERILATOR_ROOT
VERILATOR = $(VERILATOR_ROOT)/bin/verilator
export VERILATOR_ROOT
VERILATOR = $(VERILATOR_ROOT)/bin/verilator
endif
VERILATOR_FLAGS =
@ -90,7 +90,6 @@ run:
@echo "To see waveforms, open logs/vlt_dump.vcd in a waveform viewer"
@echo
######################################################################
# Other targets

View File

@ -9,22 +9,29 @@
module secret_impl
(
input [31:0] a,
input [31:0] b,
input [31:0] a,
input [31:0] b,
output logic [31:0] x,
input clk);
input clk,
input reset_l);
logic [31:0] accum_q = 0;
logic [31:0] secret_value = 9;
logic [31:0] accum_q;
logic [31:0] secret_value;
initial $display("[%0t] %m: initialized", $time);
initial $display("[%0t] %m: initialized", $time);
always @(posedge clk) begin
always @(posedge clk) begin
if (!reset_l) begin
accum_q <= 0;
secret_value <= 9;
end
else begin
accum_q <= accum_q + a;
if (accum_q > 10)
x <= b;
else
x <= a + b + secret_value;
end
end
end
endmodule

View File

@ -8,29 +8,39 @@
module top (input clk);
integer cyc = 0;
logic [31:0] a = 0;
logic [31:0] b = 0;
logic [31:0] x;
int cyc;
logic reset_l;
logic [31:0] a;
logic [31:0] b;
logic [31:0] x;
verilated_secret secret (.a, .b, .x, .clk);
verilated_secret secret (.a, .b, .x, .clk, .reset_l);
always @(posedge clk) begin
$display("[%0t] cyc=%0d a=%0d b=%0d x=%0d", $time, cyc, a, b, x);
cyc <= cyc + 1;
if (cyc == 0) begin
a <= 5;
b <= 7;
end else if (cyc == 1) begin
a <= 6;
b <= 2;
end else if (cyc == 2) begin
a <= 1;
b <= 9;
end else if (cyc > 3) begin
$display("Done");
$finish;
end
end
always @(posedge clk) begin
$display("[%0t] cyc=%0d a=%0d b=%0d x=%0d", $time, cyc, a, b, x);
cyc <= cyc + 1;
if (cyc == 0) begin
reset_l <= 0;
a <= 0;
b <= 0;
end
else if (cyc == 1) begin
reset_l <= 1;
a <= 5;
b <= 7;
end
else if (cyc == 2) begin
a <= 6;
b <= 2;
end
else if (cyc == 3) begin
a <= 1;
b <= 9;
end
else if (cyc > 4) begin
$display("Done");
$finish;
end
end
endmodule

View File

@ -13,7 +13,7 @@
# Check for sanity to avoid later confusion
ifneq ($(words $(CURDIR)),1)
$(error Unsupported: GNU Make cannot build in directories containing spaces, build elsewhere: '$(CURDIR)')
$(error Unsupported: GNU Make cannot build in directories containing spaces, build elsewhere: '$(CURDIR)')
endif
######################################################################
@ -23,12 +23,12 @@ endif
# package install, and verilator is in your path. Otherwise find the
# binary relative to $VERILATOR_ROOT (such as when inside the git sources).
ifeq ($(VERILATOR_ROOT),)
VERILATOR = verilator
VERILATOR_COVERAGE = verilator_coverage
VERILATOR = verilator
VERILATOR_COVERAGE = verilator_coverage
else
export VERILATOR_ROOT
VERILATOR = $(VERILATOR_ROOT)/bin/verilator
VERILATOR_COVERAGE = $(VERILATOR_ROOT)/bin/verilator_coverage
export VERILATOR_ROOT
VERILATOR = $(VERILATOR_ROOT)/bin/verilator
VERILATOR_COVERAGE = $(VERILATOR_ROOT)/bin/verilator_coverage
endif
# Generate C++ in executable form
@ -89,7 +89,6 @@ run:
@echo "To see waveforms, open vlt_dump.vcd in a waveform viewer"
@echo
######################################################################
# Other targets

View File

@ -32,7 +32,7 @@ CPPFLAGS += -DVL_DEBUG=1
# For testing inside Verilator, "configure --enable-ccwarn" will do this
# automatically; otherwise you may want this unconditionally enabled
ifeq ($(CFG_WITH_CCWARN),yes) # Local... Else don't burden users
USER_CPPFLAGS_WALL += -W -Werror -Wall
USER_CPPFLAGS_WALL += -W -Werror -Wall
endif
# See the benchmarking section of bin/verilator.
@ -51,5 +51,5 @@ OPT_FAST = -Os -fstrict-aliasing
DEPS := $(wildcard *.d)
ifneq ($(DEPS),)
include $(DEPS)
include $(DEPS)
endif

View File

@ -11,32 +11,32 @@ module sub
input reset_l
);
// Example counter/flop
reg [31:0] count_c;
always_ff @(posedge clk) begin
if (!reset_l) begin
/*AUTORESET*/
// Beginning of autoreset for uninitialized flops
count_c <= 32'h0;
// End of automatics
// Example counter/flop
reg [31:0] count_c;
always_ff @(posedge clk) begin
if (!reset_l) begin
/*AUTORESET*/
// Beginning of autoreset for uninitialized flops
count_c <= 32'h0;
// End of automatics
end
else begin
count_c <= count_c + 1;
if (count_c >= 3) begin
// This write is a magic value the Makefile uses to make sure the
// test completes successfully.
$write("*-* All Finished *-*\n");
$finish;
end
else begin
count_c <= count_c + 1;
if (count_c >= 3) begin
// This write is a magic value the Makefile uses to make sure the
// test completes successfully.
$write("*-* All Finished *-*\n");
$finish;
end
end
end
end
end
// An example assertion
always_ff @(posedge clk) begin
AssertionExample : assert (!reset_l || count_c < 100);
end
// An example assertion
always_ff @(posedge clk) begin
AssertionExample : assert (!reset_l || count_c < 100);
end
// And example coverage analysis
cover property (@(posedge clk) count_c == 3);
// And example coverage analysis
cover property (@(posedge clk) count_c == 3);
endmodule

View File

@ -11,36 +11,36 @@
module top
(
// Declare some signals so we can see how I/O works
input clk,
input reset_l,
input clk,
input reset_l,
output wire [1:0] out_small,
output wire [39:0] out_quad,
output wire [69:0] out_wide,
input [1:0] in_small,
input [39:0] in_quad,
input [69:0] in_wide
input [1:0] in_small,
input [39:0] in_quad,
input [69:0] in_wide
);
// Connect up the outputs, using some trivial logic
assign out_small = ~reset_l ? '0 : (in_small + 2'b1);
assign out_quad = ~reset_l ? '0 : (in_quad + 40'b1);
assign out_wide = ~reset_l ? '0 : (in_wide + 70'b1);
// Connect up the outputs, using some trivial logic
assign out_small = ~reset_l ? '0 : (in_small + 2'b1);
assign out_quad = ~reset_l ? '0 : (in_quad + 40'b1);
assign out_wide = ~reset_l ? '0 : (in_wide + 70'b1);
// And an example sub module. The submodule will print stuff.
sub sub (/*AUTOINST*/
// Inputs
.clk (clk),
.reset_l (reset_l));
// And an example sub module. The submodule will print stuff.
sub sub (/*AUTOINST*/
// Inputs
.clk (clk),
.reset_l (reset_l));
// Print some stuff as an example
initial begin
if ($test$plusargs("trace") != 0) begin
$display("[%0t] Tracing to logs/vlt_dump.vcd...\n", $time);
$dumpfile("logs/vlt_dump.vcd");
$dumpvars();
end
$display("[%0t] Model running...\n", $time);
end
// Print some stuff as an example
initial begin
if ($test$plusargs("trace") != 0) begin
$display("[%0t] Tracing to logs/vlt_dump.vcd...\n", $time);
$dumpfile("logs/vlt_dump.vcd");
$dumpvars();
end
$display("[%0t] Model running...\n", $time);
end
endmodule

View File

@ -13,7 +13,7 @@
# Check for sanity to avoid later confusion
ifneq ($(words $(CURDIR)),1)
$(error Unsupported: GNU Make cannot build in directories containing spaces, build elsewhere: '$(CURDIR)')
$(error Unsupported: GNU Make cannot build in directories containing spaces, build elsewhere: '$(CURDIR)')
endif
######################################################################
@ -23,12 +23,12 @@ endif
# package install, and verilator is in your path. Otherwise find the
# binary relative to $VERILATOR_ROOT (such as when inside the git sources).
ifeq ($(VERILATOR_ROOT),)
VERILATOR = verilator
VERILATOR_COVERAGE = verilator_coverage
VERILATOR = verilator
VERILATOR_COVERAGE = verilator_coverage
else
export VERILATOR_ROOT
VERILATOR = $(VERILATOR_ROOT)/bin/verilator
VERILATOR_COVERAGE = $(VERILATOR_ROOT)/bin/verilator_coverage
export VERILATOR_ROOT
VERILATOR = $(VERILATOR_ROOT)/bin/verilator
VERILATOR_COVERAGE = $(VERILATOR_ROOT)/bin/verilator_coverage
endif
VERILATOR_FLAGS =
@ -60,9 +60,9 @@ SYSTEMC_EXISTS := $(shell $(VERILATOR) --get-supported SYSTEMC)
######################################################################
ifneq ($(SYSTEMC_EXISTS),)
default: run
default: run
else
default: nosc
default: nosc
endif
run:
@ -98,7 +98,6 @@ run:
@echo "To see waveforms, open vlt_dump.vcd in a waveform viewer"
@echo
######################################################################
# Other targets

View File

@ -31,7 +31,7 @@ CPPFLAGS += -Wno-deprecated
# For testing inside Verilator, "configure --enable-ccwarn" will do this
# automatically; otherwise you may want this unconditionally enabled
ifeq ($(CFG_WITH_CCWARN),yes) # Local... Else don't burden users
USER_CPPFLAGS_WALL += -W -Werror -Wall
USER_CPPFLAGS_WALL += -W -Werror -Wall
endif
# If you build your own rules from scratch, note you need to include
@ -61,5 +61,5 @@ sim_main.o: sim_main.cpp $(VM_PREFIX).h
DEPS := $(wildcard *.d)
ifneq ($(DEPS),)
include $(DEPS)
include $(DEPS)
endif

View File

@ -12,47 +12,47 @@ module sub
input reset_l
);
// Example counter/flop
reg [31:0] count_f;
always_ff @(posedge fastclk) begin
if (!reset_l) begin
/*AUTORESET*/
// Beginning of autoreset for uninitialized flops
count_f <= 32'h0;
// End of automatics
end
else begin
count_f <= count_f + 1;
end
end
// Example counter/flop
reg [31:0] count_f;
always_ff @(posedge fastclk) begin
if (!reset_l) begin
/*AUTORESET*/
// Beginning of autoreset for uninitialized flops
count_f <= 32'h0;
// End of automatics
end
else begin
count_f <= count_f + 1;
end
end
// Another example flop
reg [31:0] count_c;
always_ff @(posedge clk) begin
if (!reset_l) begin
/*AUTORESET*/
// Beginning of autoreset for uninitialized flops
count_c <= 32'h0;
// End of automatics
// Another example flop
reg [31:0] count_c;
always_ff @(posedge clk) begin
if (!reset_l) begin
/*AUTORESET*/
// Beginning of autoreset for uninitialized flops
count_c <= 32'h0;
// End of automatics
end
else begin
count_c <= count_c + 1;
if (count_c >= 3) begin
$display("[%0t] fastclk is %0d times faster than clk\n", $time, count_f / count_c);
// This write is a magic value the Makefile uses to make sure the
// test completes successfully.
$write("*-* All Finished *-*\n");
$finish;
end
else begin
count_c <= count_c + 1;
if (count_c >= 3) begin
$display("[%0t] fastclk is %0d times faster than clk\n", $time, count_f / count_c);
// This write is a magic value the Makefile uses to make sure the
// test completes successfully.
$write("*-* All Finished *-*\n");
$finish;
end
end
end
end
end
// An example assertion
always_ff @(posedge clk) begin
AssertionExample : assert (!reset_l || count_c < 100);
end
// An example assertion
always_ff @(posedge clk) begin
AssertionExample : assert (!reset_l || count_c < 100);
end
// And example coverage analysis
cover property (@(posedge clk) count_c == 3);
// And example coverage analysis
cover property (@(posedge clk) count_c == 3);
endmodule

View File

@ -23,21 +23,21 @@ module top
input [69:0] in_wide
);
// Connect up the outputs, using some trivial logic
assign out_small = ~reset_l ? '0 : (in_small + 2'b1);
assign out_quad = ~reset_l ? '0 : (in_quad + 40'b1);
assign out_wide = ~reset_l ? '0 : (in_wide + 70'b1);
// Connect up the outputs, using some trivial logic
assign out_small = ~reset_l ? '0 : (in_small + 2'b1);
assign out_quad = ~reset_l ? '0 : (in_quad + 40'b1);
assign out_wide = ~reset_l ? '0 : (in_wide + 70'b1);
// And an example sub module. The submodule will print stuff.
sub sub (/*AUTOINST*/
// Inputs
.clk (clk),
.fastclk (fastclk),
.reset_l (reset_l));
// And an example sub module. The submodule will print stuff.
sub sub (/*AUTOINST*/
// Inputs
.clk (clk),
.fastclk (fastclk),
.reset_l (reset_l));
// Print some stuff as an example
initial begin
$display("[%0t] Model running...\n", $time);
end
// Print some stuff as an example
initial begin
$display("[%0t] Model running...\n", $time);
end
endmodule

View File

@ -406,6 +406,58 @@ IData VL_URANDOM_SEEDED_II(IData seed) VL_MT_SAFE {
Verilated::threadContextp()->randSeed(static_cast<int>(seed));
return VL_RANDOM_I();
}
IData VL_SCOPED_RAND_RESET_I(int obits, uint64_t scopeHash, uint64_t salt) VL_MT_UNSAFE {
if (Verilated::threadContextp()->randReset() == 0) return 0;
IData data = ~0;
if (Verilated::threadContextp()->randReset() != 1) { // if 2, randomize
VlRNG rng{Verilated::threadContextp()->randSeed() ^ scopeHash ^ salt};
data = rng.rand64();
}
data &= VL_MASK_I(obits);
return data;
}
QData VL_SCOPED_RAND_RESET_Q(int obits, uint64_t scopeHash, uint64_t salt) VL_MT_UNSAFE {
if (Verilated::threadContextp()->randReset() == 0) return 0;
QData data = ~0ULL;
if (Verilated::threadContextp()->randReset() != 1) { // if 2, randomize
VlRNG rng{Verilated::threadContextp()->randSeed() ^ scopeHash ^ salt};
data = rng.rand64();
}
data &= VL_MASK_Q(obits);
return data;
}
WDataOutP VL_SCOPED_RAND_RESET_W(int obits, WDataOutP outwp, uint64_t scopeHash,
uint64_t salt) VL_MT_UNSAFE {
if (Verilated::threadContextp()->randReset() != 2) { return VL_RAND_RESET_W(obits, outwp); }
VlRNG rng{Verilated::threadContextp()->randSeed() ^ scopeHash ^ salt};
for (int i = 0; i < VL_WORDS_I(obits) - 1; ++i) outwp[i] = rng.rand64();
outwp[VL_WORDS_I(obits) - 1] = rng.rand64() & VL_MASK_E(obits);
return outwp;
}
IData VL_SCOPED_RAND_RESET_ASSIGN_I(int obits, uint64_t scopeHash, uint64_t salt) VL_MT_UNSAFE {
VlRNG rng{Verilated::threadContextp()->randSeed() ^ scopeHash ^ salt};
const IData data = rng.rand64() & VL_MASK_I(obits);
return data;
}
QData VL_SCOPED_RAND_RESET_ASSIGN_Q(int obits, uint64_t scopeHash, uint64_t salt) VL_MT_UNSAFE {
VlRNG rng{Verilated::threadContextp()->randSeed() ^ scopeHash ^ salt};
const QData data = rng.rand64() & VL_MASK_Q(obits);
return data;
}
WDataOutP VL_SCOPED_RAND_RESET_ASSIGN_W(int obits, WDataOutP outwp, uint64_t scopeHash,
uint64_t salt) VL_MT_UNSAFE {
VlRNG rng{Verilated::threadContextp()->randSeed() ^ scopeHash ^ salt};
for (int i = 0; i < VL_WORDS_I(obits) - 1; ++i) outwp[i] = rng.rand64();
outwp[VL_WORDS_I(obits) - 1] = rng.rand64() & VL_MASK_E(obits);
return outwp;
}
IData VL_RAND_RESET_I(int obits) VL_MT_SAFE {
if (Verilated::threadContextp()->randReset() == 0) return 0;
IData data = ~0;
@ -415,7 +467,6 @@ IData VL_RAND_RESET_I(int obits) VL_MT_SAFE {
data &= VL_MASK_I(obits);
return data;
}
IData VL_RAND_RESET_ASSIGN_I(int obits) VL_MT_SAFE { return VL_RANDOM_I() & VL_MASK_I(obits); }
QData VL_RAND_RESET_Q(int obits) VL_MT_SAFE {
if (Verilated::threadContextp()->randReset() == 0) return 0;
@ -427,18 +478,11 @@ QData VL_RAND_RESET_Q(int obits) VL_MT_SAFE {
return data;
}
QData VL_RAND_RESET_ASSIGN_Q(int obits) VL_MT_SAFE { return VL_RANDOM_Q() & VL_MASK_Q(obits); }
WDataOutP VL_RAND_RESET_W(int obits, WDataOutP outwp) VL_MT_SAFE {
for (int i = 0; i < VL_WORDS_I(obits) - 1; ++i) outwp[i] = VL_RAND_RESET_I(32);
outwp[VL_WORDS_I(obits) - 1] = VL_RAND_RESET_I(32) & VL_MASK_E(obits);
return outwp;
}
WDataOutP VL_RAND_RESET_ASSIGN_W(int obits, WDataOutP outwp) VL_MT_SAFE {
for (int i = 0; i < VL_WORDS_I(obits) - 1; ++i) outwp[i] = VL_RAND_RESET_ASSIGN_I(32);
outwp[VL_WORDS_I(obits) - 1] = VL_RAND_RESET_ASSIGN_I(32) & VL_MASK_E(obits);
return outwp;
}
WDataOutP VL_ZERO_RESET_W(int obits, WDataOutP outwp) VL_MT_SAFE {
// Not inlined to speed up compilation of slowpath code
return VL_ZERO_W(obits, outwp);
@ -577,14 +621,14 @@ WDataOutP VL_POW_WWW(int obits, int, int rbits, WDataOutP owp, const WDataInP lw
const int owords = VL_WORDS_I(obits);
VL_DEBUG_IFDEF(assert(owords <= VL_MULS_MAX_WORDS););
owp[0] = 1;
for (int i = 1; i < VL_WORDS_I(obits); i++) owp[i] = 0;
for (int i = 1; i < VL_WORDS_I(obits); ++i) owp[i] = 0;
// cppcheck-has-bug-suppress variableScope
VlWide<VL_MULS_MAX_WORDS> powstore; // Fixed size, as MSVC++ doesn't allow [words] here
VlWide<VL_MULS_MAX_WORDS> lastpowstore; // Fixed size, as MSVC++ doesn't allow [words] here
VlWide<VL_MULS_MAX_WORDS> lastoutstore; // Fixed size, as MSVC++ doesn't allow [words] here
// cppcheck-has-bug-suppress variableScope
VL_ASSIGN_W(obits, powstore, lwp);
for (int bit = 0; bit < rbits; bit++) {
for (int bit = 0; bit < rbits; ++bit) {
if (bit > 0) { // power = power*power
VL_ASSIGN_W(obits, lastpowstore, powstore);
VL_MUL_W(owords, powstore, lastpowstore, lastpowstore);
@ -1700,6 +1744,48 @@ IData VL_SSCANF_INNX(int, const std::string& ld, const std::string& format, int
return got;
}
// MurmurHash64A
uint64_t VL_MURMUR64_HASH(const char* key) VL_PURE {
const size_t len = strlen(key);
const uint64_t seed = 0;
const uint64_t m = 0xc6a4a7935bd1e995ULL;
const int r = 47;
uint64_t h = seed ^ (len * m);
const uint64_t* data = (const uint64_t*)key;
const uint64_t* end = data + (len / 8);
while (data != end) {
uint64_t k = *data++;
k *= m;
k ^= k >> r;
k *= m;
h ^= k;
h *= m;
}
const unsigned char* data2 = (const unsigned char*)data;
switch (len & 7) {
case 7: h ^= uint64_t(data2[6]) << 48; /* fallthrough */
case 6: h ^= uint64_t(data2[5]) << 40; /* fallthrough */
case 5: h ^= uint64_t(data2[4]) << 32; /* fallthrough */
case 4: h ^= uint64_t(data2[3]) << 24; /* fallthrough */
case 3: h ^= uint64_t(data2[2]) << 16; /* fallthrough */
case 2: h ^= uint64_t(data2[1]) << 8; /* fallthrough */
case 1: h ^= uint64_t(data2[0]); h *= m; /* fallthrough */
};
h ^= h >> r;
h *= m;
h ^= h >> r;
return h;
}
IData VL_FREAD_I(int width, int array_lsb, int array_size, void* memp, IData fpi, IData start,
IData count) VL_MT_SAFE {
// While threadsafe, each thread can only access different file handles
@ -1770,7 +1856,7 @@ std::string VL_STACKTRACE_N() VL_MT_SAFE {
if (!strings) return "Unable to backtrace\n";
std::string result = "Backtrace:\n";
for (int j = 0; j < nptrs; j++) result += std::string{strings[j]} + "\n"s;
for (int j = 0; j < nptrs; ++j) result += std::string{strings[j]} + "\n"s;
free(strings);
return result;
}
@ -2042,7 +2128,7 @@ static const char* formatBinary(int nBits, uint32_t bits) {
assert((nBits >= 1) && (nBits <= 32));
static thread_local char t_buf[64];
for (int i = 0; i < nBits; i++) {
for (int i = 0; i < nBits; ++i) {
const bool isOne = bits & (1 << (nBits - 1 - i));
t_buf[i] = (isOne ? '1' : '0');
}
@ -2477,12 +2563,13 @@ void VL_PRINTTIMESCALE(const char* namep, const char* timeunitp,
VL_PRINTF_MT("Time scale of %s is %s / %s\n", namep, timeunitp,
contextp->timeprecisionString());
}
void VL_TIMEFORMAT_IINI(int units, int precision, const std::string& suffix, int width,
void VL_TIMEFORMAT_IINI(bool hasUnits, int units, bool hasPrecision, int precision, bool hasSuffix,
const std::string& suffix, bool hasWidth, int width,
VerilatedContext* contextp) VL_MT_SAFE {
contextp->impp()->timeFormatUnits(units);
contextp->impp()->timeFormatPrecision(precision);
contextp->impp()->timeFormatSuffix(suffix);
contextp->impp()->timeFormatWidth(width);
if (hasUnits) contextp->impp()->timeFormatUnits(units);
if (hasPrecision) contextp->impp()->timeFormatPrecision(precision);
if (hasSuffix) contextp->impp()->timeFormatSuffix(suffix);
if (hasWidth) contextp->impp()->timeFormatWidth(width);
}
//======================================================================

View File

@ -39,8 +39,8 @@
#endif
// clang-format off
#include "verilatedos.h"
#include "verilated_config.h"
#include "verilatedos.h"
#if VM_SC
# include "verilated_sc.h" // Get SYSTEMC_VERSION and time declarations
#endif
@ -113,6 +113,7 @@ class VerilatedVcdSc;
//=========================================================================
// Basic types
// Type letters
// clang-format off
// P // Packed data of bit type (C/S/I/Q/W)
using CData = uint8_t; ///< Data representing 'bit' of 1-8 packed bits
@ -124,6 +125,8 @@ using WData = EData; ///< Data representing >64 packed bits (used as poin
// F = float; // No typedef needed; Verilator uses float
// D = double; // No typedef needed; Verilator uses double
// N = std::string; // No typedef needed; Verilator uses string
// U = VlUnpacked;
// R = VlQueue;
// clang-format on
using WDataInP = const WData*; ///< 'bit' of >64 packed bits as array input to a function

View File

@ -69,7 +69,7 @@ export CCACHE_SLOPPINESS
# Make checks
ifneq ($(words $(CURDIR)),1)
$(error Unsupported: GNU Make cannot build in directories containing spaces, build elsewhere: '$(CURDIR)')
$(error Unsupported: GNU Make cannot build in directories containing spaces, build elsewhere: '$(CURDIR)')
endif
######################################################################
@ -81,20 +81,20 @@ UNAME_S := $(shell uname -s)
# Add -MMD -MP if you're using a recent version of GCC.
VK_CPPFLAGS_ALWAYS += \
-MMD \
-I$(VERILATOR_ROOT)/include \
-I$(VERILATOR_ROOT)/include/vltstd \
-DVM_COVERAGE=$(VM_COVERAGE) \
-DVM_SC=$(VM_SC) \
-DVM_TIMING=$(VM_TIMING) \
-DVM_TRACE=$(VM_TRACE) \
-DVM_TRACE_FST=$(VM_TRACE_FST) \
-DVM_TRACE_VCD=$(VM_TRACE_VCD) \
-DVM_TRACE_SAIF=$(VM_TRACE_SAIF) \
$(CFG_CXXFLAGS_NO_UNUSED) \
-MMD \
-I$(VERILATOR_ROOT)/include \
-I$(VERILATOR_ROOT)/include/vltstd \
-DVM_COVERAGE=$(VM_COVERAGE) \
-DVM_SC=$(VM_SC) \
-DVM_TIMING=$(VM_TIMING) \
-DVM_TRACE=$(VM_TRACE) \
-DVM_TRACE_FST=$(VM_TRACE_FST) \
-DVM_TRACE_VCD=$(VM_TRACE_VCD) \
-DVM_TRACE_SAIF=$(VM_TRACE_SAIF) \
$(CFG_CXXFLAGS_NO_UNUSED) \
ifeq ($(CFG_WITH_CCWARN),yes) # Local... Else don't burden users
VK_CPPFLAGS_WALL += -Wall $(CFG_CXXFLAGS_WEXTRA) -Werror
VK_CPPFLAGS_WALL += -Wall $(CFG_CXXFLAGS_WEXTRA) -Werror
endif
CPPFLAGS += -I. $(VK_CPPFLAGS_WALL) $(VK_CPPFLAGS_ALWAYS)
@ -103,7 +103,7 @@ VPATH += ..
VPATH += $(VERILATOR_ROOT)/include
VPATH += $(VERILATOR_ROOT)/include/vltstd
LDFLAGS += $(CFG_LDFLAGS_VERILATED)
LDFLAGS += $(CFG_LDFLAGS_VERILATED)
#OPT = -ggdb -DPRINTINITSTR -DDETECTCHANGE
#OPT = -ggdb -DPRINTINITSTR
@ -112,19 +112,19 @@ CPPFLAGS += $(OPT)
# 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
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)
LDFLAGS += $(USER_LDFLAGS)
LDLIBS += $(USER_LDLIBS)
LDFLAGS += $(USER_LDFLAGS)
LDLIBS += $(USER_LDLIBS)
# Add flags from -CFLAGS and -LDFLAGS on Verilator command line
CPPFLAGS += $(VM_USER_CFLAGS)
LDFLAGS += $(VM_USER_LDFLAGS)
LDLIBS += $(VM_USER_LDLIBS)
LDFLAGS += $(VM_USER_LDFLAGS)
LDLIBS += $(VM_USER_LDLIBS)
######################################################################
# Optimization control.
@ -148,7 +148,7 @@ OPT_GLOBAL = -Os
ifeq ($(VM_PROFC),1)
CPPFLAGS += $(CFG_CXXFLAGS_PROFILE)
LDFLAGS += $(CFG_CXXFLAGS_PROFILE)
LDFLAGS += $(CFG_CXXFLAGS_PROFILE)
endif
#######################################################################
@ -156,12 +156,12 @@ endif
ifeq ($(VM_SC),1)
CPPFLAGS += $(SYSTEMC_CXX_FLAGS) $(addprefix -I, $(SYSTEMC_INCLUDE))
LDFLAGS += $(SYSTEMC_CXX_FLAGS) $(addprefix -L, $(SYSTEMC_LIBDIR))
SC_LIBS = -lsystemc
ifneq ($(wildcard $(SYSTEMC_LIBDIR)/*numeric_bit*),)
# SystemC 1.2.1beta
SC_LIBS += -lnumeric_bit -lqt
endif
LDFLAGS += $(SYSTEMC_CXX_FLAGS) $(addprefix -L, $(SYSTEMC_LIBDIR))
SC_LIBS = -lsystemc
ifneq ($(wildcard $(SYSTEMC_LIBDIR)/*numeric_bit*),)
# SystemC 1.2.1beta
SC_LIBS += -lnumeric_bit -lqt
endif
endif
#######################################################################
@ -171,12 +171,11 @@ CPPFLAGS += $(CFG_CXXFLAGS_STD)
LDLIBS += $(CFG_LDLIBS_THREADS)
ifneq ($(VM_TIMING),0)
ifneq ($(VM_TIMING),)
CPPFLAGS += $(CFG_CXXFLAGS_COROUTINES)
endif
ifneq ($(VM_TIMING),)
CPPFLAGS += $(CFG_CXXFLAGS_COROUTINES)
endif
endif
#######################################################################
### Aggregates
@ -258,7 +257,6 @@ endif
$(VM_PREFIX)__ALL.a: $(VK_OBJS) $(VM_HIER_LIBS)
######################################################################
### Compile rules
@ -269,24 +267,24 @@ ifneq ($(VM_DEFAULT_RULES),0)
#
# These rules put OPT_FAST/OPT_SLOW/OPT_GLOBAL before the other flags to
# allow USER_CPPFLAGS to override them
%.o: %.cpp
%.o: %.cpp
$(OBJCACHE) $(CXX) $(OPT_FAST) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
$(VK_OBJS_FAST): %.o: %.cpp $(VK_PCH_H).fast.gch
$(VK_OBJS_FAST): %.o: %.cpp $(VK_PCH_H).fast.gch
$(OBJCACHE) $(CXX) $(OPT_FAST) $(CXXFLAGS) $(CPPFLAGS) $(VK_PCH_I_FAST) -c -o $@ $<
$(VK_OBJS_SLOW): %.o: %.cpp $(VK_PCH_H).slow.gch
$(VK_OBJS_SLOW): %.o: %.cpp $(VK_PCH_H).slow.gch
$(OBJCACHE) $(CXX) $(OPT_SLOW) $(CXXFLAGS) $(CPPFLAGS) $(VK_PCH_I_SLOW) -c -o $@ $<
$(VK_GLOBAL_OBJS): %.o: %.cpp
$(VK_GLOBAL_OBJS): %.o: %.cpp
$(OBJCACHE) $(CXX) $(OPT_GLOBAL) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
# Precompile a header file
# PCH's compiler flags must match exactly the rules' above FAST/SLOW
# arguments used for the .cpp files, or the PCH file won't be used.
%.fast.gch: %
%.fast.gch: %
$(OBJCACHE) $(CXX) $(OPT_FAST) $(CXXFLAGS) $(CPPFLAGS) $(CFG_CXXFLAGS_PCH) $< -o $@
%.slow.gch: %
%.slow.gch: %
$(OBJCACHE) $(CXX) $(OPT_SLOW) $(CXXFLAGS) $(CPPFLAGS) $(CFG_CXXFLAGS_PCH) $< -o $@
endif
@ -313,22 +311,22 @@ ifneq ($(findstring ccache-report,$(MAKECMDGOALS)),)
# Remove previous logfiles and report
$(shell rm -rf $(VK_CCACHE_LOGDIR) $(VK_CCACHE_REPORT))
$(VK_CCACHE_LOGDIR):
$(VK_CCACHE_LOGDIR):
mkdir -p $@
$(VK_OBJS): | $(VK_CCACHE_LOGDIR)
$(VK_OBJS): | $(VK_CCACHE_LOGDIR)
$(VK_OBJS): export CCACHE_LOGFILE=$(VK_CCACHE_LOGDIR)/$@.log
$(VK_OBJS): export CCACHE_LOGFILE=$(VK_CCACHE_LOGDIR)/$@.log
$(VK_CCACHE_REPORT): $(VK_OBJS)
$(VK_CCACHE_REPORT): $(VK_OBJS)
$(VERILATOR_CCACHE_REPORT) -o $@ $(VK_CCACHE_LOGDIR)
.PHONY: ccache-report
ccache-report: $(VK_CCACHE_REPORT)
.PHONY: ccache-report
ccache-report: $(VK_CCACHE_REPORT)
@cat $<
# ccache-report runs last
ccache-report: $(VK_OTHER_GOALS)
ccache-report: $(VK_OTHER_GOALS)
endif
######################################################################
@ -358,5 +356,5 @@ debug-make::
DEPS := $(wildcard *.d)
ifneq ($(DEPS),)
include $(DEPS)
include $(DEPS)
endif

View File

@ -312,7 +312,7 @@ public:
const char* fnstartp = m_insertFilenamep;
while (const char* foundp = std::strchr(fnstartp, '/')) fnstartp = foundp + 1;
const char* fnendp = fnstartp;
for (; *fnendp && *fnendp != '.'; fnendp++) {}
for (; *fnendp && *fnendp != '.'; ++fnendp) {}
const size_t page_len = fnendp - fnstartp;
const std::string page_default = "sp_user/" + std::string{fnstartp, page_len};
ckeyps[2] = "page";
@ -390,6 +390,10 @@ public:
hier = val;
} else {
// Print it
if (key == "page") {
const std::string type = val.substr(2, val.find('/') - 2);
name += keyValueFormatter(VL_CIK_TYPE, type);
}
name += keyValueFormatter(key, val);
}
}

View File

@ -140,7 +140,6 @@ void VerilatedFst::declDTypeEnum(int dtypenum, const char* name, uint32_t elemen
// TODO: should return std::optional<fstScopeType>, but I can't have C++17
static std::pair<bool, fstScopeType> toFstScopeType(VerilatedTracePrefixType type) {
switch (type) {
case VerilatedTracePrefixType::ROOTIO_MODULE: return {true, FST_ST_VCD_MODULE};
case VerilatedTracePrefixType::SCOPE_MODULE: return {true, FST_ST_VCD_MODULE};
case VerilatedTracePrefixType::SCOPE_INTERFACE: return {true, FST_ST_VCD_INTERFACE};
case VerilatedTracePrefixType::STRUCT_PACKED:
@ -152,19 +151,23 @@ static std::pair<bool, fstScopeType> toFstScopeType(VerilatedTracePrefixType typ
void VerilatedFst::pushPrefix(const std::string& name, VerilatedTracePrefixType type) {
assert(!m_prefixStack.empty()); // Constructor makes an empty entry
std::string pname = name;
// An empty name means this is the root of a model created with name()=="". The
// tools get upset if we try to pass this as empty, so we put the signals under a
// new scope, but the signals further down will be peers, not children (as usual
// for name()!="")
// Terminate earlier $root?
if (m_prefixStack.back().second == VerilatedTracePrefixType::ROOTIO_MODULE) popPrefix();
if (pname.empty()) { // Start new temporary root
pname = "$rootio"; // VCD names are not backslash escaped
m_prefixStack.emplace_back("", VerilatedTracePrefixType::ROOTIO_WRAPPER);
type = VerilatedTracePrefixType::ROOTIO_MODULE;
// An empty name means this is the root of a model created with
// name()=="". The tools get upset if we try to pass this as empty, so
// we put the signals under a new $rootio scope, but the signals
// further down will be peers, not children (as usual for name()!="").
const std::string prevPrefix = m_prefixStack.back().first;
if (name == "$rootio" && !prevPrefix.empty()) {
// Upper has name, we can suppress inserting $rootio, but still push so popPrefix works
m_prefixStack.emplace_back(prevPrefix, VerilatedTracePrefixType::ROOTIO_WRAPPER);
return;
} else if (name.empty()) {
m_prefixStack.emplace_back(prevPrefix, VerilatedTracePrefixType::ROOTIO_WRAPPER);
return;
}
const std::string newPrefix = m_prefixStack.back().first + pname;
// This code assumes a signal at a given prefix level is declared before
// any pushPrefix are done at that same level.
const std::string newPrefix = prevPrefix + name;
const auto pair = toFstScopeType(type);
const bool properScope = pair.first;
const fstScopeType scopeType = pair.second;

View File

@ -101,6 +101,24 @@ inline IData VL_URANDOM_RANGE_I(IData hi, IData lo) {
}
}
/// Random reset a signal of given width (init time only, var-specific PRNG)
extern IData VL_SCOPED_RAND_RESET_I(int obits, uint64_t scopeHash, uint64_t salt) VL_MT_UNSAFE;
/// Random reset a signal of given width (init time only, var-specific PRNG)
extern QData VL_SCOPED_RAND_RESET_Q(int obits, uint64_t scopeHash, uint64_t salt) VL_MT_UNSAFE;
/// Random reset a signal of given width (init time only, var-specific PRNG)
extern WDataOutP VL_SCOPED_RAND_RESET_W(int obits, WDataOutP outwp, uint64_t scopeHash,
uint64_t salt) VL_MT_UNSAFE;
/// Random reset a signal of given width (assign time only)
extern IData VL_SCOPED_RAND_RESET_ASSIGN_I(int obits, uint64_t scopeHash,
uint64_t salt) VL_MT_UNSAFE;
/// Random reset a signal of given width (assign time only)
extern QData VL_SCOPED_RAND_RESET_ASSIGN_Q(int obits, uint64_t scopeHash,
uint64_t salt) VL_MT_UNSAFE;
/// Random reset a signal of given width (assign time only)
extern WDataOutP VL_SCOPED_RAND_RESET_ASSIGN_W(int obits, WDataOutP outwp, uint64_t scopeHash,
uint64_t salt) VL_MT_UNSAFE;
/// 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 (init time only)
@ -108,13 +126,6 @@ extern QData VL_RAND_RESET_Q(int obits) VL_MT_SAFE;
/// Random reset a signal of given width (init time only)
extern WDataOutP VL_RAND_RESET_W(int obits, WDataOutP outwp) VL_MT_SAFE;
/// Random reset a signal of given width (assign time only)
extern IData VL_RAND_RESET_ASSIGN_I(int obits) VL_MT_SAFE;
/// Random reset a signal of given width (assign time only)
extern QData VL_RAND_RESET_ASSIGN_Q(int obits) VL_MT_SAFE;
/// Random reset a signal of given width (assign time only)
extern WDataOutP VL_RAND_RESET_ASSIGN_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;
@ -1594,26 +1605,28 @@ static inline WDataOutP VL_STREAML_WWI(int lbits, WDataOutP owp, WDataInP const
return owp;
}
static inline IData VL_PACK_II(int obits, int lbits, const VlQueue<CData>& q) {
static inline IData VL_PACK_I_RI(int obits, int lbits, const VlQueue<CData>& q) {
IData ret = 0;
for (size_t i = 0; i < q.size(); ++i) ret |= static_cast<IData>(q.at(i)) << (i * lbits);
for (size_t i = 0; i < q.size(); ++i)
ret |= static_cast<IData>(q.at(q.size() - 1 - i)) << (i * lbits);
return ret;
}
static inline IData VL_PACK_II(int obits, int lbits, const VlQueue<SData>& q) {
static inline IData VL_PACK_I_RI(int obits, int lbits, const VlQueue<SData>& q) {
IData ret = 0;
for (size_t i = 0; i < q.size(); ++i) ret |= static_cast<IData>(q.at(i)) << (i * lbits);
for (size_t i = 0; i < q.size(); ++i)
ret |= static_cast<IData>(q.at(q.size() - 1 - i)) << (i * lbits);
return ret;
}
static inline IData VL_PACK_II(int obits, int lbits, const VlQueue<IData>& q) {
static inline IData VL_PACK_I_RI(int obits, int lbits, const VlQueue<IData>& q) {
IData ret = 0;
for (size_t i = 0; i < q.size(); ++i) ret |= q.at(i) << (i * lbits);
for (size_t i = 0; i < q.size(); ++i) ret |= q.at(q.size() - 1 - i) << (i * lbits);
return ret;
}
template <std::size_t N_Depth>
static inline IData VL_PACK_II(int obits, int lbits, const VlUnpacked<CData, N_Depth>& q) {
static inline IData VL_PACK_I_UI(int obits, int lbits, const VlUnpacked<CData, N_Depth>& q) {
IData ret = 0;
for (size_t i = 0; i < N_Depth; ++i)
ret |= static_cast<IData>(q[N_Depth - 1 - i]) << (i * lbits);
@ -1621,7 +1634,7 @@ static inline IData VL_PACK_II(int obits, int lbits, const VlUnpacked<CData, N_D
}
template <std::size_t N_Depth>
static inline IData VL_PACK_II(int obits, int lbits, const VlUnpacked<SData, N_Depth>& q) {
static inline IData VL_PACK_I_UI(int obits, int lbits, const VlUnpacked<SData, N_Depth>& q) {
IData ret = 0;
for (size_t i = 0; i < N_Depth; ++i)
ret |= static_cast<IData>(q[N_Depth - 1 - i]) << (i * lbits);
@ -1629,32 +1642,35 @@ static inline IData VL_PACK_II(int obits, int lbits, const VlUnpacked<SData, N_D
}
template <std::size_t N_Depth>
static inline IData VL_PACK_II(int obits, int lbits, const VlUnpacked<IData, N_Depth>& q) {
static inline IData VL_PACK_I_UI(int obits, int lbits, const VlUnpacked<IData, N_Depth>& q) {
IData ret = 0;
for (size_t i = 0; i < N_Depth; ++i) ret |= q[N_Depth - 1 - i] << (i * lbits);
return ret;
}
static inline QData VL_PACK_QI(int obits, int lbits, const VlQueue<CData>& q) {
static inline QData VL_PACK_Q_RI(int obits, int lbits, const VlQueue<CData>& q) {
QData ret = 0;
for (size_t i = 0; i < q.size(); ++i) ret |= static_cast<QData>(q.at(i)) << (i * lbits);
for (size_t i = 0; i < q.size(); ++i)
ret |= static_cast<QData>(q.at(q.size() - 1 - i)) << (i * lbits);
return ret;
}
static inline QData VL_PACK_QI(int obits, int lbits, const VlQueue<SData>& q) {
static inline QData VL_PACK_Q_RI(int obits, int lbits, const VlQueue<SData>& q) {
QData ret = 0;
for (size_t i = 0; i < q.size(); ++i) ret |= static_cast<QData>(q.at(i)) << (i * lbits);
for (size_t i = 0; i < q.size(); ++i)
ret |= static_cast<QData>(q.at(q.size() - 1 - i)) << (i * lbits);
return ret;
}
static inline QData VL_PACK_QI(int obits, int lbits, const VlQueue<IData>& q) {
static inline QData VL_PACK_Q_RI(int obits, int lbits, const VlQueue<IData>& q) {
QData ret = 0;
for (size_t i = 0; i < q.size(); ++i) ret |= static_cast<QData>(q.at(i)) << (i * lbits);
for (size_t i = 0; i < q.size(); ++i)
ret |= static_cast<QData>(q.at(q.size() - 1 - i)) << (i * lbits);
return ret;
}
template <std::size_t N_Depth>
static inline QData VL_PACK_QI(int obits, int lbits, const VlUnpacked<CData, N_Depth>& q) {
static inline QData VL_PACK_Q_UI(int obits, int lbits, const VlUnpacked<CData, N_Depth>& q) {
QData ret = 0;
for (size_t i = 0; i < N_Depth; ++i)
ret |= static_cast<QData>(q[N_Depth - 1 - i]) << (i * lbits);
@ -1662,7 +1678,7 @@ static inline QData VL_PACK_QI(int obits, int lbits, const VlUnpacked<CData, N_D
}
template <std::size_t N_Depth>
static inline QData VL_PACK_QI(int obits, int lbits, const VlUnpacked<SData, N_Depth>& q) {
static inline QData VL_PACK_Q_UI(int obits, int lbits, const VlUnpacked<SData, N_Depth>& q) {
QData ret = 0;
for (size_t i = 0; i < N_Depth; ++i)
ret |= static_cast<QData>(q[N_Depth - 1 - i]) << (i * lbits);
@ -1670,50 +1686,53 @@ static inline QData VL_PACK_QI(int obits, int lbits, const VlUnpacked<SData, N_D
}
template <std::size_t N_Depth>
static inline QData VL_PACK_QI(int obits, int lbits, const VlUnpacked<IData, N_Depth>& q) {
static inline QData VL_PACK_Q_UI(int obits, int lbits, const VlUnpacked<IData, N_Depth>& q) {
QData ret = 0;
for (size_t i = 0; i < N_Depth; ++i)
ret |= static_cast<QData>(q[N_Depth - 1 - i]) << (i * lbits);
return ret;
}
static inline QData VL_PACK_QQ(int obits, int lbits, const VlQueue<QData>& q) {
static inline QData VL_PACK_Q_RQ(int obits, int lbits, const VlQueue<QData>& q) {
QData ret = 0;
for (size_t i = 0; i < q.size(); ++i) ret |= q.at(i) << (i * lbits);
for (size_t i = 0; i < q.size(); ++i) ret |= q.at(q.size() - 1 - i) << (i * lbits);
return ret;
}
template <std::size_t N_Depth>
static inline QData VL_PACK_QQ(int obits, int lbits, const VlUnpacked<QData, N_Depth>& q) {
static inline QData VL_PACK_Q_UQ(int obits, int lbits, const VlUnpacked<QData, N_Depth>& q) {
QData ret = 0;
for (size_t i = 0; i < N_Depth; ++i) ret |= q[N_Depth - 1 - i] << (i * lbits);
return ret;
}
static inline WDataOutP VL_PACK_WI(int obits, int lbits, WDataOutP owp, const VlQueue<CData>& q) {
static inline WDataOutP VL_PACK_W_RI(int obits, int lbits, WDataOutP owp,
const VlQueue<CData>& q) {
VL_MEMSET_ZERO_W(owp + 1, VL_WORDS_I(obits) - 1);
for (size_t i = 0; i < q.size(); ++i)
_vl_insert_WI(owp, q.at(i), i * lbits + lbits - 1, i * lbits);
_vl_insert_WI(owp, q.at(q.size() - i - 1), i * lbits + lbits - 1, i * lbits);
return owp;
}
static inline WDataOutP VL_PACK_WI(int obits, int lbits, WDataOutP owp, const VlQueue<SData>& q) {
static inline WDataOutP VL_PACK_W_RI(int obits, int lbits, WDataOutP owp,
const VlQueue<SData>& q) {
VL_MEMSET_ZERO_W(owp + 1, VL_WORDS_I(obits) - 1);
for (size_t i = 0; i < q.size(); ++i)
_vl_insert_WI(owp, q.at(i), i * lbits + lbits - 1, i * lbits);
_vl_insert_WI(owp, q.at(q.size() - i - 1), i * lbits + lbits - 1, i * lbits);
return owp;
}
static inline WDataOutP VL_PACK_WI(int obits, int lbits, WDataOutP owp, const VlQueue<IData>& q) {
static inline WDataOutP VL_PACK_W_RI(int obits, int lbits, WDataOutP owp,
const VlQueue<IData>& q) {
VL_MEMSET_ZERO_W(owp + 1, VL_WORDS_I(obits) - 1);
for (size_t i = 0; i < q.size(); ++i)
_vl_insert_WI(owp, q.at(i), i * lbits + lbits - 1, i * lbits);
_vl_insert_WI(owp, q.at(q.size() - 1 - i), i * lbits + lbits - 1, i * lbits);
return owp;
}
template <std::size_t N_Depth>
static inline WDataOutP VL_PACK_WI(int obits, int lbits, WDataOutP owp,
const VlUnpacked<CData, N_Depth>& q) {
static inline WDataOutP VL_PACK_W_UI(int obits, int lbits, WDataOutP owp,
const VlUnpacked<CData, N_Depth>& q) {
VL_MEMSET_ZERO_W(owp + 1, VL_WORDS_I(obits) - 1);
for (size_t i = 0; i < N_Depth; ++i)
_vl_insert_WI(owp, q[N_Depth - 1 - i], i * lbits + lbits - 1, i * lbits);
@ -1721,8 +1740,8 @@ static inline WDataOutP VL_PACK_WI(int obits, int lbits, WDataOutP owp,
}
template <std::size_t N_Depth>
static inline WDataOutP VL_PACK_WI(int obits, int lbits, WDataOutP owp,
const VlUnpacked<SData, N_Depth>& q) {
static inline WDataOutP VL_PACK_W_UI(int obits, int lbits, WDataOutP owp,
const VlUnpacked<SData, N_Depth>& q) {
VL_MEMSET_ZERO_W(owp + 1, VL_WORDS_I(obits) - 1);
for (size_t i = 0; i < N_Depth; ++i)
_vl_insert_WI(owp, q[N_Depth - 1 - i], i * lbits + lbits - 1, i * lbits);
@ -1730,24 +1749,25 @@ static inline WDataOutP VL_PACK_WI(int obits, int lbits, WDataOutP owp,
}
template <std::size_t N_Depth>
static inline WDataOutP VL_PACK_WI(int obits, int lbits, WDataOutP owp,
const VlUnpacked<IData, N_Depth>& q) {
static inline WDataOutP VL_PACK_W_UI(int obits, int lbits, WDataOutP owp,
const VlUnpacked<IData, N_Depth>& q) {
VL_MEMSET_ZERO_W(owp + 1, VL_WORDS_I(obits) - 1);
for (size_t i = 0; i < N_Depth; ++i)
_vl_insert_WI(owp, q[N_Depth - 1 - i], i * lbits + lbits - 1, i * lbits);
return owp;
}
static inline WDataOutP VL_PACK_WQ(int obits, int lbits, WDataOutP owp, const VlQueue<QData>& q) {
static inline WDataOutP VL_PACK_W_RQ(int obits, int lbits, WDataOutP owp,
const VlQueue<QData>& q) {
VL_MEMSET_ZERO_W(owp + 1, VL_WORDS_I(obits) - 1);
for (size_t i = 0; i < q.size(); ++i)
_vl_insert_WQ(owp, q.at(i), i * lbits + lbits - 1, i * lbits);
_vl_insert_WQ(owp, q.at(q.size() - 1 - i), i * lbits + lbits - 1, i * lbits);
return owp;
}
template <std::size_t N_Depth>
static inline WDataOutP VL_PACK_WQ(int obits, int lbits, WDataOutP owp,
const VlUnpacked<QData, N_Depth>& q) {
static inline WDataOutP VL_PACK_W_UQ(int obits, int lbits, WDataOutP owp,
const VlUnpacked<QData, N_Depth>& q) {
VL_MEMSET_ZERO_W(owp + 1, VL_WORDS_I(obits) - 1);
for (size_t i = 0; i < N_Depth; ++i)
_vl_insert_WQ(owp, q[N_Depth - 1 - i], i * lbits + lbits - 1, i * lbits);
@ -1755,17 +1775,17 @@ static inline WDataOutP VL_PACK_WQ(int obits, int lbits, WDataOutP owp,
}
template <std::size_t N_Words>
static inline WDataOutP VL_PACK_WW(int obits, int lbits, WDataOutP owp,
const VlQueue<VlWide<N_Words>>& q) {
static inline WDataOutP VL_PACK_W_RW(int obits, int lbits, WDataOutP owp,
const VlQueue<VlWide<N_Words>>& q) {
VL_MEMSET_ZERO_W(owp + 1, VL_WORDS_I(obits) - 1);
for (size_t i = 0; i < q.size(); ++i)
_vl_insert_WW(owp, q.at(i), i * lbits + lbits - 1, i * lbits);
_vl_insert_WW(owp, q.at(q.size() - 1 - i), i * lbits + lbits - 1, i * lbits);
return owp;
}
template <std::size_t N_Depth, std::size_t N_Words>
static inline WDataOutP VL_PACK_WW(int obits, int lbits, WDataOutP owp,
const VlUnpacked<VlWide<N_Words>, N_Depth>& q) {
static inline WDataOutP VL_PACK_W_UW(int obits, int lbits, WDataOutP owp,
const VlUnpacked<VlWide<N_Words>, N_Depth>& q) {
VL_MEMSET_ZERO_W(owp + 1, VL_WORDS_I(obits) - 1);
for (size_t i = 0; i < N_Depth; ++i)
_vl_insert_WW(owp, q[N_Depth - 1 - i], i * lbits + lbits - 1, i * lbits);
@ -2211,56 +2231,56 @@ static inline WDataOutP VL_SEL_WWII(int obits, int lbits, WDataOutP owp, WDataIn
//======================================================================
// Expressions needing insert/select
static inline void VL_UNPACK_II(int lbits, int rbits, VlQueue<CData>& q, IData from) {
static inline void VL_UNPACK_RI_I(int lbits, int rbits, VlQueue<CData>& q, IData from) {
const size_t size = (rbits + lbits - 1) / lbits;
q.renew(size);
const IData mask = VL_MASK_I(lbits);
for (size_t i = 0; i < size; ++i) q.atWrite(i) = (from >> (i * lbits)) & mask;
for (size_t i = 0; i < size; ++i) q.atWrite(q.size() - 1 - i) = (from >> (i * lbits)) & mask;
}
static inline void VL_UNPACK_II(int lbits, int rbits, VlQueue<SData>& q, IData from) {
static inline void VL_UNPACK_RI_I(int lbits, int rbits, VlQueue<SData>& q, IData from) {
const size_t size = (rbits + lbits - 1) / lbits;
q.renew(size);
const IData mask = VL_MASK_I(lbits);
for (size_t i = 0; i < size; ++i) q.atWrite(i) = (from >> (i * lbits)) & mask;
for (size_t i = 0; i < size; ++i) q.atWrite(q.size() - 1 - i) = (from >> (i * lbits)) & mask;
}
static inline void VL_UNPACK_II(int lbits, int rbits, VlQueue<IData>& q, IData from) {
static inline void VL_UNPACK_RI_I(int lbits, int rbits, VlQueue<IData>& q, IData from) {
const size_t size = (rbits + lbits - 1) / lbits;
q.renew(size);
const IData mask = VL_MASK_I(lbits);
for (size_t i = 0; i < size; ++i) q.atWrite(i) = (from >> (i * lbits)) & mask;
for (size_t i = 0; i < size; ++i) q.atWrite(q.size() - 1 - i) = (from >> (i * lbits)) & mask;
}
static inline void VL_UNPACK_IQ(int lbits, int rbits, VlQueue<CData>& q, QData from) {
static inline void VL_UNPACK_RI_Q(int lbits, int rbits, VlQueue<CData>& q, QData from) {
const size_t size = (rbits + lbits - 1) / lbits;
q.renew(size);
const IData mask = VL_MASK_I(lbits);
for (size_t i = 0; i < size; ++i) q.atWrite(i) = (from >> (i * lbits)) & mask;
for (size_t i = 0; i < size; ++i) q.atWrite(q.size() - 1 - i) = (from >> (i * lbits)) & mask;
}
static inline void VL_UNPACK_IQ(int lbits, int rbits, VlQueue<SData>& q, QData from) {
static inline void VL_UNPACK_RI_Q(int lbits, int rbits, VlQueue<SData>& q, QData from) {
const size_t size = (rbits + lbits - 1) / lbits;
q.renew(size);
const IData mask = VL_MASK_I(lbits);
for (size_t i = 0; i < size; ++i) q.atWrite(i) = (from >> (i * lbits)) & mask;
for (size_t i = 0; i < size; ++i) q.atWrite(q.size() - 1 - i) = (from >> (i * lbits)) & mask;
}
static inline void VL_UNPACK_IQ(int lbits, int rbits, VlQueue<IData>& q, QData from) {
static inline void VL_UNPACK_RI_Q(int lbits, int rbits, VlQueue<IData>& q, QData from) {
const size_t size = (rbits + lbits - 1) / lbits;
q.renew(size);
const IData mask = VL_MASK_I(lbits);
for (size_t i = 0; i < size; ++i) q.atWrite(i) = (from >> (i * lbits)) & mask;
for (size_t i = 0; i < size; ++i) q.atWrite(q.size() - 1 - i) = (from >> (i * lbits)) & mask;
}
static inline void VL_UNPACK_QQ(int lbits, int rbits, VlQueue<QData>& q, QData from) {
static inline void VL_UNPACK_RQ_Q(int lbits, int rbits, VlQueue<QData>& q, QData from) {
const size_t size = (rbits + lbits - 1) / lbits;
q.renew(size);
const QData mask = VL_MASK_Q(lbits);
for (size_t i = 0; i < size; ++i) q.atWrite(i) = (from >> (i * lbits)) & mask;
for (size_t i = 0; i < size; ++i) q.atWrite(q.size() - 1 - i) = (from >> (i * lbits)) & mask;
}
static inline void VL_UNPACK_IW(int lbits, int rbits, VlQueue<CData>& q, WDataInP rwp) {
static inline void VL_UNPACK_RI_W(int lbits, int rbits, VlQueue<CData>& q, WDataInP rwp) {
const int size = (rbits + lbits - 1) / lbits;
q.renew(size);
const IData mask = VL_MASK_I(lbits);
@ -2269,7 +2289,7 @@ static inline void VL_UNPACK_IW(int lbits, int rbits, VlQueue<CData>& q, WDataIn
}
}
static inline void VL_UNPACK_IW(int lbits, int rbits, VlQueue<SData>& q, WDataInP rwp) {
static inline void VL_UNPACK_RI_W(int lbits, int rbits, VlQueue<SData>& q, WDataInP rwp) {
const int size = (rbits + lbits - 1) / lbits;
q.renew(size);
const IData mask = VL_MASK_I(lbits);
@ -2278,7 +2298,7 @@ static inline void VL_UNPACK_IW(int lbits, int rbits, VlQueue<SData>& q, WDataIn
}
}
static inline void VL_UNPACK_IW(int lbits, int rbits, VlQueue<IData>& q, WDataInP rwp) {
static inline void VL_UNPACK_RI_W(int lbits, int rbits, VlQueue<IData>& q, WDataInP rwp) {
const int size = (rbits + lbits - 1) / lbits;
q.renew(size);
const IData mask = VL_MASK_I(lbits);
@ -2287,7 +2307,7 @@ static inline void VL_UNPACK_IW(int lbits, int rbits, VlQueue<IData>& q, WDataIn
}
}
static inline void VL_UNPACK_QW(int lbits, int rbits, VlQueue<QData>& q, WDataInP rwp) {
static inline void VL_UNPACK_RQ_W(int lbits, int rbits, VlQueue<QData>& q, WDataInP rwp) {
const int size = (rbits + lbits - 1) / lbits;
q.renew(size);
const QData mask = VL_MASK_Q(lbits);
@ -2297,7 +2317,8 @@ static inline void VL_UNPACK_QW(int lbits, int rbits, VlQueue<QData>& q, WDataIn
}
template <std::size_t N_Words>
static inline void VL_UNPACK_WW(int lbits, int rbits, VlQueue<VlWide<N_Words>>& q, WDataInP rwp) {
static inline void VL_UNPACK_RW_W(int lbits, int rbits, VlQueue<VlWide<N_Words>>& q,
WDataInP rwp) {
const int size = (rbits + lbits - 1) / lbits;
q.renew(size);
for (size_t i = 0; i < size; ++i) {
@ -2306,82 +2327,89 @@ static inline void VL_UNPACK_WW(int lbits, int rbits, VlQueue<VlWide<N_Words>>&
}
template <std::size_t N_Depth>
static inline void VL_UNPACK_II(int lbits, int rbits, VlUnpacked<CData, N_Depth>& q, IData from) {
static inline void VL_UNPACK_UI_I(int lbits, int rbits, VlUnpacked<CData, N_Depth>& q,
IData from) {
const IData mask = VL_MASK_I(lbits);
for (size_t i = 0; i < N_Depth; ++i) q[i] = (from >> ((N_Depth - 1 - i) * lbits)) & mask;
}
template <std::size_t N_Depth>
static inline void VL_UNPACK_II(int lbits, int rbits, VlUnpacked<SData, N_Depth>& q, IData from) {
static inline void VL_UNPACK_UI_I(int lbits, int rbits, VlUnpacked<SData, N_Depth>& q,
IData from) {
const IData mask = VL_MASK_I(lbits);
for (size_t i = 0; i < N_Depth; ++i) q[i] = (from >> ((N_Depth - 1 - i) * lbits)) & mask;
}
template <std::size_t N_Depth>
static inline void VL_UNPACK_II(int lbits, int rbits, VlUnpacked<IData, N_Depth>& q, IData from) {
static inline void VL_UNPACK_UI_I(int lbits, int rbits, VlUnpacked<IData, N_Depth>& q,
IData from) {
const IData mask = VL_MASK_I(lbits);
for (size_t i = 0; i < N_Depth; ++i) q[i] = (from >> ((N_Depth - 1 - i) * lbits)) & mask;
}
template <std::size_t N_Depth>
static inline void VL_UNPACK_IQ(int lbits, int rbits, VlUnpacked<CData, N_Depth>& q, QData from) {
static inline void VL_UNPACK_UI_Q(int lbits, int rbits, VlUnpacked<CData, N_Depth>& q,
QData from) {
const IData mask = VL_MASK_I(lbits);
for (size_t i = 0; i < N_Depth; ++i) q[i] = (from >> ((N_Depth - 1 - i) * lbits)) & mask;
}
template <std::size_t N_Depth>
static inline void VL_UNPACK_IQ(int lbits, int rbits, VlUnpacked<SData, N_Depth>& q, QData from) {
static inline void VL_UNPACK_UI_Q(int lbits, int rbits, VlUnpacked<SData, N_Depth>& q,
QData from) {
const IData mask = VL_MASK_I(lbits);
for (size_t i = 0; i < N_Depth; ++i) q[i] = (from >> ((N_Depth - 1 - i) * lbits)) & mask;
}
template <std::size_t N_Depth>
static inline void VL_UNPACK_IQ(int lbits, int rbits, VlUnpacked<IData, N_Depth>& q, QData from) {
static inline void VL_UNPACK_UI_Q(int lbits, int rbits, VlUnpacked<IData, N_Depth>& q,
QData from) {
const IData mask = VL_MASK_I(lbits);
for (size_t i = 0; i < N_Depth; ++i) q[i] = (from >> ((N_Depth - 1 - i) * lbits)) & mask;
}
template <std::size_t N_Depth>
static inline void VL_UNPACK_QQ(int lbits, int rbits, VlUnpacked<QData, N_Depth>& q, QData from) {
static inline void VL_UNPACK_UQ_Q(int lbits, int rbits, VlUnpacked<QData, N_Depth>& q,
QData from) {
const QData mask = VL_MASK_Q(lbits);
for (size_t i = 0; i < N_Depth; ++i) q[i] = (from >> ((N_Depth - 1 - i) * lbits)) & mask;
}
template <std::size_t N_Depth>
static inline void VL_UNPACK_IW(int lbits, int rbits, VlUnpacked<CData, N_Depth>& q,
WDataInP rwp) {
static inline void VL_UNPACK_UI_W(int lbits, int rbits, VlUnpacked<CData, N_Depth>& q,
WDataInP rwp) {
const IData mask = VL_MASK_I(lbits);
for (size_t i = 0; i < N_Depth; ++i)
q[i] = VL_SEL_IWII(rbits, rwp, (N_Depth - 1 - i) * lbits, lbits) & mask;
}
template <std::size_t N_Depth>
static inline void VL_UNPACK_IW(int lbits, int rbits, VlUnpacked<SData, N_Depth>& q,
WDataInP rwp) {
static inline void VL_UNPACK_UI_W(int lbits, int rbits, VlUnpacked<SData, N_Depth>& q,
WDataInP rwp) {
const IData mask = VL_MASK_I(lbits);
for (size_t i = 0; i < N_Depth; ++i)
q[i] = VL_SEL_IWII(rbits, rwp, (N_Depth - 1 - i) * lbits, lbits) & mask;
}
template <std::size_t N_Depth>
static inline void VL_UNPACK_IW(int lbits, int rbits, VlUnpacked<IData, N_Depth>& q,
WDataInP rwp) {
static inline void VL_UNPACK_UI_W(int lbits, int rbits, VlUnpacked<IData, N_Depth>& q,
WDataInP rwp) {
const IData mask = VL_MASK_I(lbits);
for (size_t i = 0; i < N_Depth; ++i)
q[i] = VL_SEL_IWII(rbits, rwp, (N_Depth - 1 - i) * lbits, lbits) & mask;
}
template <std::size_t N_Depth>
static inline void VL_UNPACK_QW(int lbits, int rbits, VlUnpacked<QData, N_Depth>& q,
WDataInP rwp) {
static inline void VL_UNPACK_UQ_W(int lbits, int rbits, VlUnpacked<QData, N_Depth>& q,
WDataInP rwp) {
const QData mask = VL_MASK_Q(lbits);
for (size_t i = 0; i < N_Depth; ++i)
q[i] = VL_SEL_QWII(rbits, rwp, (N_Depth - 1 - i) * lbits, lbits) & mask;
}
template <std::size_t N_Depth, std::size_t N_Words>
static inline void VL_UNPACK_WW(int lbits, int rbits, VlUnpacked<VlWide<N_Words>, N_Depth>& q,
WDataInP rwp) {
static inline void VL_UNPACK_UW_W(int lbits, int rbits, VlUnpacked<VlWide<N_Words>, N_Depth>& q,
WDataInP rwp) {
for (size_t i = 0; i < N_Depth; ++i)
VL_SEL_WWII(lbits, rbits, q[i], rwp, (N_Depth - 1 - i) * lbits, lbits);
}
@ -2772,7 +2800,8 @@ extern IData VL_SSCANF_INNX(int lbits, const std::string& ld, const std::string&
extern void VL_SFORMAT_NX(int obits_ignored, std::string& output, const std::string& format,
int argc, ...) VL_MT_SAFE;
extern std::string VL_SFORMATF_N_NX(const std::string& format, int argc, ...) VL_MT_SAFE;
extern void VL_TIMEFORMAT_IINI(int units, int precision, const std::string& suffix, int width,
extern void VL_TIMEFORMAT_IINI(bool hasUnits, int units, bool hasPrecision, int precision,
bool hasSuffix, const std::string& suffix, bool hasWidth, int width,
VerilatedContext* contextp) VL_MT_SAFE;
extern IData VL_VALUEPLUSARGS_INW(int rbits, const std::string& ld, WDataOutP rwp) VL_MT_SAFE;
inline IData VL_VALUEPLUSARGS_INI(int rbits, const std::string& ld, CData& rdr) VL_MT_SAFE {
@ -2807,6 +2836,8 @@ inline IData VL_VALUEPLUSARGS_INQ(int rbits, const std::string& ld, double& rdr)
}
extern IData VL_VALUEPLUSARGS_INN(int, const std::string& ld, std::string& rdr) VL_MT_SAFE;
uint64_t VL_MURMUR64_HASH(const char* key) VL_PURE;
//======================================================================
#endif // Guard

View File

@ -116,7 +116,7 @@ IData VL_DIST_ERLANG(IData& seedr, IData uk, IData umean) VL_MT_SAFE {
return 0;
}
double x = 1.0;
for (int32_t i = 1; i <= k; i++) x = x * _vl_dbase_uniform(seedr, 0, 1);
for (int32_t i = 1; i <= k; ++i) x = x * _vl_dbase_uniform(seedr, 0, 1);
const double a = static_cast<double>(mean);
const double b = static_cast<double>(k);
double r = -a * log(x) / b;

View File

@ -112,7 +112,7 @@ public:
if (m_pidStatus) {
std::stringstream msg;
msg << "Subprocess command `" << m_cmd[0];
for (const char* const* arg = m_cmd + 1; *arg; arg++) msg << ' ' << *arg;
for (const char* const* arg = m_cmd + 1; *arg; ++arg) msg << ' ' << *arg;
msg << "' failed: ";
if (WIFSIGNALED(m_pidStatus))
msg << strsignal(WTERMSIG(m_pidStatus))
@ -221,7 +221,7 @@ static Process& getSolver() {
static std::vector<const char*> s_argv;
static std::string s_program = Verilated::threadContextp()->solverProgram();
s_argv.emplace_back(&s_program[0]);
for (char* arg = &s_program[0]; *arg; arg++) {
for (char* arg = &s_program[0]; *arg; ++arg) {
if (*arg == ' ') {
*arg = '\0';
s_argv.emplace_back(arg + 1);
@ -242,7 +242,7 @@ static Process& getSolver() {
msg << "Unable to communicate with SAT solver, please check its installation or specify a "
"different one in VERILATOR_SOLVER environment variable.\n";
msg << " ... Tried: $";
for (const char* const* arg = cmd; *arg; arg++) msg << ' ' << *arg;
for (const char* const* arg = cmd; *arg; ++arg) msg << ' ' << *arg;
msg << '\n';
const std::string str = msg.str();
VL_WARN_MT("", 0, "randomize", str.c_str());
@ -294,7 +294,7 @@ void VlRandomVar::emitType(std::ostream& s) const { s << "(_ BitVec " << width()
int VlRandomVar::totalWidth() const { return m_width; }
static bool parseSMTNum(int obits, WDataOutP owp, const std::string& val) {
int i;
for (i = 0; val[i] && val[i] != '#'; i++) {}
for (i = 0; val[i] && val[i] != '#'; ++i) {}
if (val[i++] != '#') return false;
switch (val[i++]) {
case 'b': _vl_vsss_based(owp, obits, 1, &val[i], 0, val.size() - i); break;
@ -345,7 +345,7 @@ void VlRandomizer::randomConstraint(std::ostream& os, VlRNG& rngr, int bits) {
os << "(= #b";
for (int i = bits - 1; i >= 0; i--) os << (VL_BITISSET_I(hash, i) ? '1' : '0');
if (bits > 1) os << " (concat";
for (int i = 0; i < bits; i++) {
for (int i = 0; i < bits; ++i) {
IData varBitsLeft = varBits;
IData varBitsWant = (varBits + 1) / 2;
if (varBits > 2) os << " (bvxor";
@ -393,7 +393,7 @@ bool VlRandomizer::next(VlRNG& rngr) {
f << "(reset)\n";
return false;
}
for (int i = 0; i < _VL_SOLVER_HASH_LEN_TOTAL && sat; i++) {
for (int i = 0; i < _VL_SOLVER_HASH_LEN_TOTAL && sat; ++i) {
f << "(assert ";
randomConstraint(f, rngr, _VL_SOLVER_HASH_LEN);
f << ")\n";

View File

@ -45,11 +45,11 @@ public:
ArrayInfo(const std::string& name, void* datap, int index, const std::vector<IData>& indices,
const std::vector<size_t>& idxWidths)
: m_name(name)
, m_datap(datap)
, m_index(index)
, m_indices(indices)
, m_idxWidths(idxWidths) {}
: m_name{name}
, m_datap{datap}
, m_index{index}
, m_indices{indices}
, m_idxWidths{idxWidths} {}
};
using ArrayInfoMap = std::map<std::string, std::shared_ptr<const ArrayInfo>>;
@ -143,7 +143,7 @@ public:
}
void emitGetValue(std::ostream& s) const override {
const int elementCounts = countMatchingElements(*m_arrVarsRefp, name());
for (int i = 0; i < elementCounts; i++) {
for (int i = 0; i < elementCounts; ++i) {
const std::string indexed_name = name() + std::to_string(i);
const auto it = m_arrVarsRefp->find(indexed_name);
if (it != m_arrVarsRefp->end()) {
@ -382,8 +382,9 @@ public:
// Register associative array of non-struct types
template <typename T_Key, typename T_Value>
void write_var(VlAssocArray<T_Key, T_Value>& var, int width, const char* name, int dimension,
std::uint32_t randmodeIdx = std::numeric_limits<std::uint32_t>::max()) {
typename std::enable_if<!VlContainsCustomStruct<T_Value>::value, void>::type
write_var(VlAssocArray<T_Key, T_Value>& var, int width, const char* name, int dimension,
std::uint32_t randmodeIdx = std::numeric_limits<std::uint32_t>::max()) {
if (m_vars.find(name) != m_vars.end()) return;
m_vars[name]
= std::make_shared<const VlRandomArrayVarTemplate<VlAssocArray<T_Key, T_Value>>>(
@ -394,8 +395,13 @@ public:
}
}
// TODO: Register associative array of structs
// Register associative array of structs
template <typename T_Key, typename T_Value>
typename std::enable_if<VlContainsCustomStruct<T_Value>::value, void>::type
write_var(VlAssocArray<T_Key, T_Value>& var, int width, const char* name, int dimension,
std::uint32_t randmodeIdx = std::numeric_limits<std::uint32_t>::max()) {
if (dimension > 0) record_struct_arr(var, name, dimension, {}, {});
}
// ----------------------------------------
// --- Record Arrays: flat and struct ---
// ----------------------------------------
@ -403,7 +409,7 @@ public:
// Record a flat (non-class) element into the array variable table
template <typename T>
typename std::enable_if<!std::is_class<T>::value, void>::type
record_arr_table(T& var, const std::string name, int dimension, std::vector<IData> indices,
record_arr_table(T& var, const std::string& name, int dimension, std::vector<IData> indices,
std::vector<size_t> idxWidths) {
const std::string key = generateKey(name, m_index);
m_arr_vars[key] = std::make_shared<ArrayInfo>(name, &var, m_index, indices, idxWidths);
@ -412,7 +418,7 @@ public:
// Recursively record all elements in an unpacked array
template <typename T, std::size_t N_Depth>
void record_arr_table(VlUnpacked<T, N_Depth>& var, const std::string name, int dimension,
void record_arr_table(VlUnpacked<T, N_Depth>& var, const std::string& name, int dimension,
std::vector<IData> indices, std::vector<size_t> idxWidths) {
if ((dimension > 0) && (N_Depth != 0)) {
idxWidths.push_back(32);
@ -428,7 +434,7 @@ public:
// Recursively record all elements in a queue
template <typename T>
void record_arr_table(VlQueue<T>& var, const std::string name, int dimension,
void record_arr_table(VlQueue<T>& var, const std::string& name, int dimension,
std::vector<IData> indices, std::vector<size_t> idxWidths) {
if ((dimension > 0) && (var.size() != 0)) {
idxWidths.push_back(32);
@ -443,8 +449,9 @@ public:
// Recursively record all elements in an associative array
template <typename T_Key, typename T_Value>
void record_arr_table(VlAssocArray<T_Key, T_Value>& var, const std::string name, int dimension,
std::vector<IData> indices, std::vector<size_t> idxWidths) {
void record_arr_table(VlAssocArray<T_Key, T_Value>& var, const std::string& name,
int dimension, std::vector<IData> indices,
std::vector<size_t> idxWidths) {
if ((dimension > 0) && (var.size() != 0)) {
for (auto it = var.begin(); it != var.end(); ++it) {
const T_Key& key = it->first;
@ -472,22 +479,25 @@ public:
// Register a single structArray element via write_var
template <typename T>
typename std::enable_if<VlContainsCustomStruct<T>::value, void>::type
record_struct_arr(T& var, const std::string name, int dimension, std::vector<IData> indices,
record_struct_arr(T& var, const std::string& name, int dimension, std::vector<IData> indices,
std::vector<size_t> idxWidths) {
std::ostringstream oss;
for (size_t i = 0; i < indices.size(); ++i) {
oss << std::hex << static_cast<int>(indices[i]);
oss << std::hex << std::setw(int(idxWidths[i] / 4)) << std::setfill('0')
<< static_cast<int>(indices[i]);
if (i < indices.size() - 1) oss << ".";
}
write_var(var, 1ULL, (name + "." + oss.str()).c_str(), 1ULL);
write_var(var, 1ULL,
oss.str().length() > 0 ? (name + "." + oss.str()).c_str() : name.c_str(), 1ULL);
}
// Recursively process VlUnpacked of structs
template <typename T, std::size_t N_Depth>
void record_struct_arr(VlUnpacked<T, N_Depth>& var, const std::string name, int dimension,
void record_struct_arr(VlUnpacked<T, N_Depth>& var, const std::string& name, int dimension,
std::vector<IData> indices, std::vector<size_t> idxWidths) {
if (dimension > 0 && N_Depth != 0) {
idxWidths.push_back(32);
constexpr size_t idx_width = 1 << VL_CLOG2_CE_Q(VL_CLOG2_CE_Q(N_Depth) + 1);
idxWidths.push_back(idx_width);
for (size_t i = 0; i < N_Depth; ++i) {
indices.push_back(i);
record_struct_arr(var.operator[](i), name, dimension - 1, indices, idxWidths);
@ -498,7 +508,7 @@ public:
// Recursively process VlQueue of structs
template <typename T>
void record_struct_arr(VlQueue<T>& var, const std::string name, int dimension,
void record_struct_arr(VlQueue<T>& var, const std::string& name, int dimension,
std::vector<IData> indices, std::vector<size_t> idxWidths) {
if ((dimension > 0) && (var.size() != 0)) {
idxWidths.push_back(32);
@ -510,16 +520,39 @@ public:
}
}
// TODO: Add support for associative arrays of structs
// Recursively process associative arrays of structs
template <typename T_Key, typename T_Value>
void record_struct_arr(VlAssocArray<T_Key, T_Value>& var, const std::string& name,
int dimension, const std::vector<IData>& indices,
const std::vector<size_t>& idxWidths) {
if ((dimension > 0) && (!var.empty())) {
for (auto it = var.begin(); it != var.end(); ++it) {
const T_Key& key = it->first;
const T_Value& value = it->second;
std::string indexed_name;
std::vector<size_t> integral_index;
size_t idx_width = 0;
process_key(key, indexed_name, integral_index, name, idx_width);
std::ostringstream oss;
for (int i = 0; i < integral_index.size(); ++i)
oss << std::hex << static_cast<int>(integral_index[i]);
std::string result = oss.str();
result.insert(result.begin(), int(idx_width / 4) - result.size(), '0');
record_struct_arr(var.at(key), name + "." + result, dimension - 1, indices,
idxWidths);
}
}
}
// --------------------------
// --- Helper functions ---
// --------------------------
// Helper: Register all members of a user-defined struct
template <typename T, std::size_t... I>
void modifyMembers(T& obj, std::index_sequence<I...>, std::string baseName) {
void modifyMembers(T& obj, std::index_sequence<I...>, const std::string& baseName) {
// Use the indices to access each member via std::get
(void)std::initializer_list<int>{
(write_var(std::get<I>(obj.getMembers(obj)), obj.memberWidth()[I],

View File

@ -110,7 +110,7 @@ public:
"The emitted value must be of integral type");
const uint64_t dt = time - m_lastTime;
for (size_t i = 0; i < std::min(m_width, bits); i++) {
for (size_t i = 0; i < std::min(m_width, bits); ++i) {
m_bits[i].aggregateVal(dt, (newval >> i) & 1);
}
updateLastTime(time);
@ -475,18 +475,25 @@ void VerilatedSaif::printIndent() {
}
void VerilatedSaif::pushPrefix(const std::string& name, VerilatedTracePrefixType type) {
std::string pname = name;
if (m_prefixStack.back().second == VerilatedTracePrefixType::ROOTIO_MODULE) popPrefix();
if (pname.empty()) {
pname = "$rootio";
type = VerilatedTracePrefixType::ROOTIO_MODULE;
assert(!m_prefixStack.empty()); // Constructor makes an empty entry
// An empty name means this is the root of a model created with
// name()=="". The tools get upset if we try to pass this as empty, so
// we put the signals under a new $rootio scope, but the signals
// further down will be peers, not children (as usual for name()!="").
const std::string prevPrefix = m_prefixStack.back().first;
if (name == "$rootio" && !prevPrefix.empty()) {
// Upper has name, we can suppress inserting $rootio, but still push so popPrefix works
m_prefixStack.emplace_back(prevPrefix, VerilatedTracePrefixType::ROOTIO_WRAPPER);
return;
} else if (name.empty()) {
m_prefixStack.emplace_back(prevPrefix, VerilatedTracePrefixType::ROOTIO_WRAPPER);
return;
}
if (type != VerilatedTracePrefixType::ARRAY_UNPACKED
&& type != VerilatedTracePrefixType::ARRAY_PACKED) {
std::string scopePath = m_prefixStack.back().first + pname;
std::string scopePath = prevPrefix + name;
std::string scopeName = lastWord(scopePath);
auto newScope = std::make_unique<VerilatedSaifActivityScope>(
@ -502,23 +509,22 @@ void VerilatedSaif::pushPrefix(const std::string& name, VerilatedTracePrefixType
m_currentScope = newScopePtr;
}
std::string newPrefix = m_prefixStack.back().first + pname;
if (type != VerilatedTracePrefixType::ARRAY_UNPACKED
&& type != VerilatedTracePrefixType::ARRAY_PACKED) {
newPrefix += ' ';
}
m_prefixStack.emplace_back(newPrefix, type);
const std::string newPrefix = prevPrefix + name;
bool properScope = (type != VerilatedTracePrefixType::ARRAY_UNPACKED
&& type != VerilatedTracePrefixType::ARRAY_PACKED
&& type != VerilatedTracePrefixType::ROOTIO_WRAPPER);
m_prefixStack.emplace_back(newPrefix + (properScope ? " " : ""), type);
}
void VerilatedSaif::popPrefix() {
if (m_prefixStack.back().second != VerilatedTracePrefixType::ARRAY_UNPACKED
&& m_prefixStack.back().second != VerilatedTracePrefixType::ARRAY_PACKED
&& m_currentScope != nullptr) {
&& m_prefixStack.back().second != VerilatedTracePrefixType::ROOTIO_WRAPPER
&& m_currentScope) {
m_currentScope = m_currentScope->parentScope();
}
m_prefixStack.pop_back();
assert(!m_prefixStack.empty()); // Always one left, the constructor's initial one
}
void VerilatedSaif::declare(const uint32_t code, uint32_t fidx, const char* name,

View File

@ -294,7 +294,7 @@ inline VerilatedDeserialize& operator>>(VerilatedDeserialize& os, std::string& r
uint32_t len = 0;
os >> len;
rhs.resize(len);
// C cast is required below
// NOLINTNEXTLINE(google-readability-casting)
return os.read((void*)(rhs.data()), len);
}
VerilatedSerialize& operator<<(VerilatedSerialize& os, VerilatedContext* rhsp);

View File

@ -31,6 +31,10 @@
#include <memory>
#include <string>
#ifdef __FreeBSD__
#include <pthread_np.h>
#endif
//=============================================================================
// Globals
@ -131,7 +135,7 @@ bool VlThreadPool::isNumactlRunning() {
}
std::string VlThreadPool::numaAssign() {
#if defined(__linux) || defined(CPU_ZERO) // Linux-like; assume we have pthreads etc
#if defined(__linux) || defined(CPU_ZERO) || defined(VL_CPPCHECK) // Linux-like pthreads
// If not under numactl, make a reasonable processor affinity selection
if (isNumactlRunning()) return "running under numactl"; // User presumably set affinity
const int num_threads = static_cast<int>(m_workers.size());
@ -153,24 +157,25 @@ std::string VlThreadPool::numaAssign() {
std::map<int, int> processor_core;
std::multimap<int, int> core_processors;
std::set<int> cores;
int processor = -1;
int core = -1;
while (!is.eof()) {
std::string line;
std::getline(is, line);
static std::string::size_type pos = line.find(":");
int number = -1;
if (pos != std::string::npos) number = atoi(line.c_str() + pos + 1);
if (line.compare(0, std::strlen("processor"), "processor") == 0) {
processor = number;
core = -1;
} else if (line.compare(0, std::strlen("core id"), "core id") == 0) {
core = number;
// std::cout << "p" << processor << " socket " << socket << " c" << core << std::endl;
cores.emplace(core);
processor_core[processor] = core;
core_processors.emplace(core, processor);
unassigned_processors.push_back(processor);
{
int processor = -1;
while (!is.eof()) {
std::string line;
std::getline(is, line);
static std::string::size_type pos = line.find(":");
int number = -1;
if (pos != std::string::npos) number = atoi(line.c_str() + pos + 1);
if (line.compare(0, std::strlen("processor"), "processor") == 0) {
processor = number;
} else if (line.compare(0, std::strlen("core id"), "core id") == 0) {
const int core = number;
// std::cout << "p" << processor << " socket " << socket << " c" << core <<
// std::endl;
cores.emplace(core);
processor_core[processor] = core;
core_processors.emplace(core, processor);
unassigned_processors.push_back(processor);
}
}
}

View File

@ -241,6 +241,7 @@ public:
private:
VL_UNCOPYABLE(VlThreadPool);
// cppcheck-suppress unusedPrivateFunction
static bool isNumactlRunning();
std::string numaAssign();
};

View File

@ -53,8 +53,7 @@ enum class VerilatedTracePrefixType : uint8_t {
// Note: Entries must match VTracePrefixType (by name, not necessarily by value)
ARRAY_PACKED,
ARRAY_UNPACKED,
ROOTIO_MODULE, // $rootio, used when name()=="", other modules become peers
ROOTIO_WRAPPER, // "Above" ROOTIO_MODULE
ROOTIO_WRAPPER, // $rootio suppressed due to name()!=""
SCOPE_MODULE,
SCOPE_INTERFACE,
STRUCT_PACKED,

View File

@ -47,7 +47,7 @@ static double timescaleToDouble(const char* unitp) VL_PURE {
// On error so we allow just "ns" to return 1e-9.
if (value == 0.0 && endp == unitp) value = 1;
unitp = endp;
for (; *unitp && std::isspace(*unitp); unitp++) {}
for (; *unitp && std::isspace(*unitp); ++unitp) {}
switch (*unitp) {
case 's': value *= 1e0; break;
case 'm': value *= 1e-3; break;

View File

@ -969,6 +969,7 @@ public:
// Size of array. Verilog: function int size(), or int num()
int size() const { return m_map.size(); }
bool empty() const { return m_map.empty(); }
// Clear array. Verilog: function void delete([input index])
void clear() { m_map.clear(); }
void erase(const T_Key& index) { m_map.erase(index); }
@ -1265,7 +1266,7 @@ std::string VL_TO_STRING(const VlAssocArray<T_Key, T_Value>& obj) {
}
template <typename T_Key, typename T_Value>
struct VlContainsCustomStruct<VlAssocArray<T_Key, T_Value>> : VlContainsCustomStruct<T_Key> {};
struct VlContainsCustomStruct<VlAssocArray<T_Key, T_Value>> : VlContainsCustomStruct<T_Value> {};
template <typename T_Key, typename T_Value>
void VL_READMEM_N(bool hex, int bits, const std::string& filename,
@ -1331,6 +1332,11 @@ public:
const WData* data() const { return &m_storage[0]; }
constexpr std::size_t size() const { return N_Depth; }
void fill(const T_Value& value) {
std::fill(std::begin(m_storage), std::end(m_storage), value);
}
// To fit C++14
template <std::size_t N_CurrentDimension = 0, typename U = T_Value>
int find_length(int dimension, std::false_type) const {
@ -1597,8 +1603,8 @@ std::string VL_TO_STRING(const VlUnpacked<T_Value, N_Depth>& obj) {
return obj.to_string();
}
template <typename T, int N>
struct VlContainsCustomStruct<VlUnpacked<T, N>> : VlContainsCustomStruct<T> {};
template <typename T_Value, std::size_t N_Depth>
struct VlContainsCustomStruct<VlUnpacked<T_Value, N_Depth>> : VlContainsCustomStruct<T_Value> {};
//===================================================================
// Helper to apply the given indices to a target expression

View File

@ -193,7 +193,7 @@ void VerilatedVcd::emitTimeChange(uint64_t timeui) {
// timestamp backup and overwrite it.
// This is faster then checking on every signal change if time needs to
// be emitted. Note buffer flushes may still emit a rare duplicate.
if (m_wrTimeEndp == m_writep) m_writep = m_wrTimeBeginp;
if (m_wrTimeBeginp && m_wrTimeEndp == m_writep) m_writep = m_wrTimeBeginp;
m_wrTimeBeginp = m_writep;
{
printStr("#");
@ -323,43 +323,46 @@ void VerilatedVcd::printIndent(int level_change) {
void VerilatedVcd::pushPrefix(const std::string& name, VerilatedTracePrefixType type) {
assert(!m_prefixStack.empty()); // Constructor makes an empty entry
std::string pname = name;
// An empty name means this is the root of a model created with name()=="". The
// tools get upset if we try to pass this as empty, so we put the signals under a
// new scope, but the signals further down will be peers, not children (as usual
// for name()!="")
// Terminate earlier $root?
if (m_prefixStack.back().second == VerilatedTracePrefixType::ROOTIO_MODULE) popPrefix();
if (pname.empty()) { // Start new temporary root
pname = "$rootio"; // VCD names are not backslash escaped
m_prefixStack.emplace_back("", VerilatedTracePrefixType::ROOTIO_WRAPPER);
type = VerilatedTracePrefixType::ROOTIO_MODULE;
// An empty name means this is the root of a model created with
// name()=="". The tools get upset if we try to pass this as empty, so
// we put the signals under a new $rootio scope, but the signals
// further down will be peers, not children (as usual for name()!="").
const std::string prevPrefix = m_prefixStack.back().first;
if (name == "$rootio" && !prevPrefix.empty()) {
// Upper has name, we can suppress inserting $rootio, but still push so popPrefix works
m_prefixStack.emplace_back(prevPrefix, VerilatedTracePrefixType::ROOTIO_WRAPPER);
return;
} else if (name.empty()) {
m_prefixStack.emplace_back(prevPrefix, VerilatedTracePrefixType::ROOTIO_WRAPPER);
return;
}
std::string newPrefix = m_prefixStack.back().first + pname;
const std::string newPrefix = prevPrefix + name;
bool properScope = false;
switch (type) {
case VerilatedTracePrefixType::ROOTIO_MODULE:
case VerilatedTracePrefixType::SCOPE_MODULE:
case VerilatedTracePrefixType::SCOPE_INTERFACE:
case VerilatedTracePrefixType::STRUCT_PACKED:
case VerilatedTracePrefixType::STRUCT_UNPACKED:
case VerilatedTracePrefixType::UNION_PACKED: {
properScope = true;
break;
}
default: break;
}
if (properScope) {
printIndent(1);
printStr("$scope module ");
const std::string n = lastWord(newPrefix);
printStr(n.c_str());
printStr(" $end\n");
newPrefix += ' ';
break;
}
default: break;
}
m_prefixStack.emplace_back(newPrefix, type);
m_prefixStack.emplace_back(newPrefix + (properScope ? " " : ""), type);
}
void VerilatedVcd::popPrefix() {
assert(!m_prefixStack.empty());
switch (m_prefixStack.back().second) {
case VerilatedTracePrefixType::ROOTIO_MODULE:
case VerilatedTracePrefixType::SCOPE_MODULE:
case VerilatedTracePrefixType::SCOPE_INTERFACE:
case VerilatedTracePrefixType::STRUCT_PACKED:

View File

@ -205,7 +205,7 @@ public:
uint32_t size() const override {
const int maxDimNum = maxDim(isIndexedDimUnpacked());
int size = 1;
for (int dim = indexedDim() + 1; dim <= maxDimNum; dim++)
for (int dim = indexedDim() + 1; dim <= maxDimNum; ++dim)
size *= varp()->range(dim)->elements();
return size;
}
@ -503,7 +503,7 @@ public:
explicit VerilatedVpioRegIter(const VerilatedVpioVar* vop)
: m_var{new VerilatedVpioVar(vop)}
, m_maxDim{vop->varp()->udims() - 1} {
for (auto it = vop->indexedDim() + 1; it <= m_maxDim; it++)
for (auto it = vop->indexedDim() + 1; it <= m_maxDim; ++it)
m_ranges.push_back(*vop->varp()->range(it));
for (auto it : m_ranges) m_nextIndex.push_back(it.right());
}
@ -2219,7 +2219,7 @@ vpiHandle vpi_iterate(PLI_INT32 type, vpiHandle object) {
std::vector<VerilatedRange> ranges;
const int maxDim = vop->maxDim(vop->isIndexedDimUnpacked());
for (int dim = vop->indexedDim() + 1; dim <= maxDim; dim++)
for (int dim = vop->indexedDim() + 1; dim <= maxDim; ++dim)
ranges.emplace_back(*vop->varp()->range(dim));
// allow one more range layer (regbit)
@ -2537,6 +2537,7 @@ void vl_vpi_put_word_gen(const VerilatedVpioVar* vop, T word, size_t bitCount, s
= (info.m_datap[info.m_wordOffset + 1] & ~info.m_maskHi)
| ((word >> (wordBits - info.m_bitOffset)) & info.m_maskHi);
}
// cppcheck-has-bug-suppress unreadVariable
info.m_datap[info.m_wordOffset] = (info.m_datap[info.m_wordOffset] & ~info.m_maskLo)
| ((word << info.m_bitOffset) & info.m_maskLo);
}
@ -2945,7 +2946,7 @@ void vl_get_value_array_integrals(unsigned index, const unsigned num, const unsi
const unsigned packedSize, const bool leftIsLow, const T* src,
K* dst) {
static_assert(sizeof(K) >= sizeof(T), "size of type K is less than size of type T");
for (int i = 0; i < num; i++) {
for (int i = 0; i < num; ++i) {
dst[i] = src[index];
index = leftIsLow ? index == (size - 1) ? 0 : index + 1
: index == 0 ? size - 1
@ -2964,7 +2965,7 @@ void vl_put_value_array_integrals(unsigned index, const unsigned num, const unsi
const T mask = element_size_bytes == sizeof(T)
? static_cast<T>(-1)
: ~(static_cast<T>(-1) << (element_size_bytes * 8));
for (unsigned i = 0; i < num; i++) {
for (unsigned i = 0; i < num; ++i) {
dst[index] = src[i] & static_cast<T>(mask);
index = leftIsLow ? index == (size - 1) ? 0 : index + 1
: index == 0 ? size - 1
@ -2978,10 +2979,9 @@ void vl_get_value_array_vectors(unsigned index, const unsigned num, const unsign
p_vpi_vecval dst) {
static_assert(std::is_unsigned<T>::value,
"type T is not unsigned"); // ensure logical right shift
const unsigned element_size_bytes = VL_BYTES_I(packedSize);
const unsigned element_size_words = VL_WORDS_I(packedSize);
if (sizeof(T) == sizeof(QData)) {
for (unsigned i = 0; i < num; i++) {
for (unsigned i = 0; i < num; ++i) {
dst[i * 2].aval = static_cast<QData>(src[index]);
dst[i * 2].bval = 0;
dst[(i * 2) + 1].aval = static_cast<QData>(src[index]) >> 32;
@ -2991,10 +2991,10 @@ void vl_get_value_array_vectors(unsigned index, const unsigned num, const unsign
: index - 1;
}
} else {
for (unsigned i = 0; i < num; i++) {
for (unsigned i = 0; i < num; ++i) {
const size_t dst_index = i * element_size_words;
const size_t src_index = index * element_size_words;
for (unsigned j = 0; j < element_size_words; j++) {
for (unsigned j = 0; j < element_size_words; ++j) {
dst[dst_index + j].aval = src[src_index + j];
dst[dst_index + j].bval = 0;
}
@ -3017,7 +3017,7 @@ void vl_put_value_array_vectors(unsigned index, const unsigned num, const unsign
const QData mask = element_size_bytes == sizeof(T)
? static_cast<QData>(-1)
: ~(static_cast<QData>(-1) << (element_size_bytes * 8));
for (unsigned i = 0; i < num; i++) {
for (unsigned i = 0; i < num; ++i) {
dst[index] = src[i * 2].aval;
dst[index]
|= (static_cast<QData>(src[(i * 2) + 1].aval) << (sizeof(PLI_UINT32) * 8)) & mask;
@ -3026,9 +3026,9 @@ void vl_put_value_array_vectors(unsigned index, const unsigned num, const unsign
: index - 1;
}
} else {
for (unsigned i = 0; i < num; i++) {
for (unsigned i = 0; i < num; ++i) {
unsigned bytes_stored = 0;
for (unsigned j = 0; j < element_size_words; j++) {
for (unsigned j = 0; j < element_size_words; ++j) {
if (bytes_stored >= element_size_bytes) break;
const T mask
= (element_size_bytes - bytes_stored) >= sizeof(PLI_UINT32)
@ -3057,9 +3057,9 @@ void vl_get_value_array_rawvals(unsigned index, unsigned num, const unsigned siz
while (num-- > 0) {
const size_t src_offset = index * element_size_repr;
unsigned bytes_copied = 0;
for (unsigned j = 0; j < element_size_repr; j++) {
for (unsigned j = 0; j < element_size_repr; ++j) {
const T& src_data = src[src_offset + j];
for (unsigned k = 0; k < sizeof(T); k++) {
for (unsigned k = 0; k < sizeof(T); ++k) {
if (bytes_copied++ == element_size_bytes) break;
dst[dst_index++] = src_data >> (k * 8);
}
@ -3080,13 +3080,13 @@ void vl_put_value_array_rawvals(unsigned index, const unsigned num, const unsign
const bool fourState, const PLI_UBYTE8* src, T* dst) {
const unsigned element_size_bytes VL_BYTES_I(packedSize);
const unsigned element_size_repr = (element_size_bytes + sizeof(T) - 1) / sizeof(T);
for (unsigned i = 0; i < num; i++) {
for (unsigned i = 0; i < num; ++i) {
unsigned bytes_copied = 0;
const size_t dst_offset = index * element_size_repr;
const size_t src_offset = i * element_size_bytes;
for (unsigned j = 0; j < element_size_repr; j++) {
for (unsigned j = 0; j < element_size_repr; ++j) {
T& dst_data = dst[dst_offset + j];
for (unsigned k = 0; k < sizeof(T); k++) {
for (unsigned k = 0; k < sizeof(T); ++k) {
if (bytes_copied == element_size_bytes) break;
const unsigned src_index
= fourState ? (src_offset * 2) + bytes_copied : (src_offset) + bytes_copied;

View File

@ -367,28 +367,28 @@ XXTERN int svIsDisabledState( void );
*/
XXTERN void svAckDisabledState( void );
/* Mantis 5713/D9
/*
* Retrieve the current simulation time, scaled to the time unit of the scope.
* If scope is NULL, then time is scaled to the simulation time unit.
* It is an error to call svGetTime() with an invalid svScope.
* This function returns -1 for all error cases, 0 upon success.
*/
* If scope is NULL, then time is scaled to the simulation time unit.
* It is an error to call svGetTime() with an invalid svScope.
* This function returns -1 for all error cases, 0 upon success.
*/
XXTERN int svGetTime(const svScope scope, svTimeVal* time);
/*
* Retrieve the time unit for scope.
* If scope is NULL, then simulation time unit is retrieved.
* It is an error to call svGetTimeUnit() with an invalid svScope.
* This function returns -1 for all error cases, 0 upon success.
*/
* It is an error to call svGetTimeUnit() with an invalid svScope.
* This function returns -1 for all error cases, 0 upon success.
*/
XXTERN int svGetTimeUnit(const svScope scope, int32_t* time_unit);
/*
* Retrieve the time precision for scope.
* If scope is NULL, then simulation time unit is retrieved.
* It is an error to call svGetTimePrecision() with an invalid svScope.
* This function returns -1 for all error cases, 0 upon success.
*/
* It is an error to call svGetTimePrecision() with an invalid svScope.
* This function returns -1 for all error cases, 0 upon success.
*/
XXTERN int svGetTimePrecision(const svScope scope, int32_t* time_precision);

View File

@ -90,7 +90,7 @@ def process():
print()
print("You may now want to clean up spelling, and commit:")
print(" (cd docs ; make spelling | grep -vi 'writing output')")
print(" (make spelling | grep -vi 'writing output')")
print(" git ci -am 'Commentary: Changes update'")
print()

View File

@ -61,7 +61,7 @@ set(HEADERS
V3Clock.h
V3Combine.h
V3Common.h
V3Config.h
V3Control.h
V3Const.h
V3Coverage.h
V3CoverageJoin.h
@ -77,6 +77,7 @@ set(HEADERS
V3DfgPatternStats.h
V3DfgPeephole.h
V3DfgVertices.h
V3DiagSarif.h
V3DupFinder.h
V3EmitC.h
V3EmitCBase.h
@ -95,8 +96,8 @@ set(HEADERS
V3FileLine.h
V3Force.h
V3Fork.h
V3FunctionTraits.h
V3FuncOpt.h
V3FunctionTraits.h
V3Gate.h
V3Global.h
V3Graph.h
@ -133,15 +134,14 @@ set(HEADERS
V3OptionParser.h
V3Options.h
V3Order.h
V3OrderInternal.h
V3OrderGraph.h
V3OrderInternal.h
V3OrderMoveGraph.h
V3Os.h
V3PairingHeap.h
V3Param.h
V3Parse.h
V3ParseImp.h
V3ParseSym.h
V3PchAstMT.h
V3PchAstNoMT.h
V3PreExpr.h
@ -216,7 +216,7 @@ set(COMMON_SOURCES
V3Clock.cpp
V3Combine.cpp
V3Common.cpp
V3Config.cpp
V3Control.cpp
V3Const__gen.cpp
V3Coverage.cpp
V3CoverageJoin.cpp
@ -234,8 +234,8 @@ set(COMMON_SOURCES
V3DfgPasses.cpp
V3DfgPeephole.cpp
V3DfgRegularize.cpp
V3DiagSarif.cpp
V3DupFinder.cpp
V3Timing.cpp
V3EmitCBase.cpp
V3EmitCConstPool.cpp
V3EmitCFunc.cpp
@ -297,6 +297,10 @@ set(COMMON_SOURCES
V3OrderSerial.cpp
V3Os.cpp
V3Param.cpp
V3ParseGrammar.cpp
V3ParseImp.cpp
V3ParseLex.cpp
V3PreProc.cpp
V3PreShell.cpp
V3Premit.cpp
V3ProtectLib.cpp
@ -320,13 +324,14 @@ set(COMMON_SOURCES
V3StatsReport.cpp
V3String.cpp
V3Subst.cpp
V3TSP.cpp
V3Table.cpp
V3Task.cpp
V3ThreadPool.cpp
V3Timing.cpp
V3Trace.cpp
V3TraceDecl.cpp
V3Tristate.cpp
V3TSP.cpp
V3Udp.cpp
V3Undriven.cpp
V3Unknown.cpp
@ -336,10 +341,6 @@ set(COMMON_SOURCES
V3Width.cpp
V3WidthCommit.cpp
V3WidthSel.cpp
V3ParseImp.cpp
V3ParseGrammar.cpp
V3ParseLex.cpp
V3PreProc.cpp
)
set(COVERAGE_SOURCES VlcMain.cpp)

View File

@ -30,7 +30,7 @@ debug: dbg
optimize: opt
ifneq ($(words $(CURDIR)),1)
$(error Unsupported: GNU Make cannot build in directories containing spaces, build elsewhere: '$(CURDIR)')
$(error Unsupported: GNU Make cannot build in directories containing spaces, build elsewhere: '$(CURDIR)')
endif
UNDER_GIT = $(wildcard ${srcdir}/../.git/logs/HEAD)
@ -50,9 +50,9 @@ else
endif
ifneq ($(BEAR),)
BEAR_OBJ_OPT := $(BEAR) --append --output obj_dbg/compile_commands.json --
BEAR_OBJ_OPT := $(BEAR) --append --output obj_dbg/compile_commands.json --
else
BEAR_OBJ_OPT :=
BEAR_OBJ_OPT :=
endif
#*********************************************************************
@ -70,11 +70,11 @@ obj_dbg:
opt: ../bin/verilator_bin$(EXEEXT)
ifeq ($(VERILATOR_NO_OPT_BUILD),1) # Faster laptop development... One build
../bin/verilator_bin$(EXEEXT): ../bin/verilator_bin_dbg$(EXEEXT)
../bin/verilator_bin$(EXEEXT): ../bin/verilator_bin_dbg$(EXEEXT)
-cp -p $< $@.tmp
-mv -f $@.tmp $@
else
../bin/verilator_bin$(EXEEXT): obj_opt ../bin prefiles
../bin/verilator_bin$(EXEEXT): obj_opt ../bin prefiles
$(MAKE) -C obj_opt -j 1 TGT=../$@ -f ../Makefile_obj serial
$(MAKE) -C obj_opt TGT=../$@ -f ../Makefile_obj
endif
@ -89,9 +89,9 @@ dbg: ../bin/verilator_bin_dbg$(EXEEXT) ../bin/verilator_coverage_bin_dbg$(EXEEXT
$(MAKE) -C obj_dbg TGT=../$@ VL_DEBUG=1 VL_VLCOV=1 -f ../Makefile_obj
ifneq ($(VERILATOR_NO_OPT_BUILD),1) # Faster laptop development... don't rebuild each commit
ifneq ($(UNDER_GIT),) # If local git tree... else don't burden users
GIT_CHANGE_DEP = ${srcdir}/../.git/logs/HEAD
endif
ifneq ($(UNDER_GIT),) # If local git tree... else don't burden users
GIT_CHANGE_DEP = ${srcdir}/../.git/logs/HEAD
endif
endif
prefiles::

View File

@ -21,13 +21,13 @@
# from a level lower, so we need to move up if it's relative, not if absolute.
config_srcdir = @srcdir@
ifeq ($(config_srcdir),.)
srcdir = ..
srcdir = ..
else # Run an experiment
ifeq ($(wildcard $(config_srcdir)/../Makefile_obj.in),)
srcdir = $(config_srcdir)
else
srcdir = $(config_srcdir)/..
endif
ifeq ($(wildcard $(config_srcdir)/../Makefile_obj.in),)
srcdir = $(config_srcdir)
else
srcdir = $(config_srcdir)/..
endif
endif
incdir = $(srcdir)/../include
@ -81,14 +81,14 @@ TGT = ../../verilator_bin$(EXEEXT)
#################
ifeq ($(VL_NOOPT),1)
CPPFLAGS += -O0
CPPFLAGS += -O0
else ifeq ($(VL_DEBUG),)
# Optimize
CPPFLAGS += -O3
# Optimize
CPPFLAGS += -O3
else
# Debug
CPPFLAGS += @CFG_CXXFLAGS_DEBUG@ -DVL_DEBUG -D_GLIBCXX_DEBUG
LDFLAGS += @CFG_LDFLAGS_DEBUG@
# Debug
CPPFLAGS += @CFG_CXXFLAGS_DEBUG@ -DVL_DEBUG -D_GLIBCXX_DEBUG
LDFLAGS += @CFG_LDFLAGS_DEBUG@
endif
#################
@ -104,35 +104,35 @@ CPPFLAGS += -I. -I$(bldsrc) -I$(srcdir) -I$(incdir) -I../../include
#CPPFLAGS += -DVL_LEAK_CHECKS # If running valgrind or other hunting tool
CPPFLAGS += -MP # Only works on recent GCC versions
ifeq ($(CFG_WITH_CCWARN),yes) # Local... Else don't burden users
CPPFLAGS += -W -Wall $(CFG_CXXFLAGS_WEXTRA) $(CFG_CXXFLAGS_SRC) -Werror
#CPPFLAGS += -pedantic-errors
CPPFLAGS += -W -Wall $(CFG_CXXFLAGS_WEXTRA) $(CFG_CXXFLAGS_SRC) -Werror
#CPPFLAGS += -pedantic-errors
else
CPPFLAGS += $(CFG_CXXFLAGS_SRC)
CPPFLAGS += $(CFG_CXXFLAGS_SRC)
endif
LDFLAGS += $(CFG_LDFLAGS_SRC)
CPPFLAGSWALL = $(CPPFLAGS)
CPPFLAGSWALL = $(CPPFLAGS)
CPPFLAGSPARSER = $(CPPFLAGS) $(CFG_CXXFLAGS_PARSER)
# Allow RPM builds to specify hardcoded data directories
# To do this:
ifeq ($(CFG_WITH_DEFENV),yes)
CPPFLAGS += -DDEFENV_SYSTEMC=\"$(SYSTEMC)\"
CPPFLAGS += -DDEFENV_SYSTEMC_ARCH=\"$(SYSTEMC_ARCH)\"
CPPFLAGS += -DDEFENV_SYSTEMC_INCLUDE=\"$(SYSTEMC_INCLUDE)\"
CPPFLAGS += -DDEFENV_SYSTEMC_LIBDIR=\"$(SYSTEMC_LIBDIR)\"
ifeq ($(VERILATOR_ROOT),) # Use what we're given, or intuit
CPPFLAGS += -DDEFENV_VERILATOR_ROOT=\"$(pkgdatadir)\"
else
CPPFLAGS += -DDEFENV_VERILATOR_ROOT=\"$(VERILATOR_ROOT)\"
endif
ifneq ($(CFG_WITH_SOLVER),no)
CPPFLAGS += -DDEFENV_VERILATOR_SOLVER='"$(CFG_WITH_SOLVER)"'
else
ifneq ($(VERILATOR_SOLVER),)
CPPFLAGS += -DDEFENV_VERILATOR_SOLVER='"$(VERILATOR_SOLVER)"'
CPPFLAGS += -DDEFENV_SYSTEMC=\"$(SYSTEMC)\"
CPPFLAGS += -DDEFENV_SYSTEMC_ARCH=\"$(SYSTEMC_ARCH)\"
CPPFLAGS += -DDEFENV_SYSTEMC_INCLUDE=\"$(SYSTEMC_INCLUDE)\"
CPPFLAGS += -DDEFENV_SYSTEMC_LIBDIR=\"$(SYSTEMC_LIBDIR)\"
ifeq ($(VERILATOR_ROOT),) # Use what we're given, or intuit
CPPFLAGS += -DDEFENV_VERILATOR_ROOT=\"$(pkgdatadir)\"
else
CPPFLAGS += -DDEFENV_VERILATOR_ROOT=\"$(VERILATOR_ROOT)\"
endif
ifneq ($(CFG_WITH_SOLVER),no)
CPPFLAGS += -DDEFENV_VERILATOR_SOLVER='"$(CFG_WITH_SOLVER)"'
else
ifneq ($(VERILATOR_SOLVER),)
CPPFLAGS += -DDEFENV_VERILATOR_SOLVER='"$(VERILATOR_SOLVER)"'
endif
endif
endif
endif
HEADERS = $(wildcard V*.h v*.h)
@ -171,174 +171,175 @@ maintainer-copy::
#### Top executable
RAW_OBJS = \
V3Const__gen.o \
V3Error.o \
V3FileLine.o \
V3Graph.o \
V3GraphAcyc.o \
V3GraphAlg.o \
V3GraphPathChecker.o \
V3GraphTest.o \
V3Hash.o \
V3OptionParser.o \
V3Os.o \
V3ParseGrammar.o \
V3ParseImp.o \
V3ParseLex.o \
V3PreProc.o \
V3PreShell.o \
V3String.o \
V3ThreadPool.o \
V3Waiver.o \
Verilator.o \
V3Const__gen.o \
V3Error.o \
V3FileLine.o \
V3Graph.o \
V3GraphAcyc.o \
V3GraphAlg.o \
V3GraphPathChecker.o \
V3GraphTest.o \
V3Hash.o \
V3OptionParser.o \
V3Os.o \
V3ParseGrammar.o \
V3ParseImp.o \
V3ParseLex.o \
V3PreProc.o \
V3PreShell.o \
V3String.o \
V3ThreadPool.o \
V3Waiver.o \
Verilator.o \
RAW_OBJS_PCH_ASTMT = \
V3Ast.o \
V3AstNodes.o \
V3Broken.o \
V3Config.o \
V3EmitCBase.o \
V3EmitCConstPool.o \
V3EmitCFunc.o \
V3EmitCHeaders.o \
V3EmitCImp.o \
V3EmitCInlines.o \
V3EmitCPch.o \
V3EmitV.o \
V3File.o \
V3FuncOpt.o \
V3Global.o \
V3Hasher.o \
V3Number.o \
V3Options.o \
V3Stats.o \
V3StatsReport.o \
V3VariableOrder.o \
V3Ast.o \
V3AstNodes.o \
V3Broken.o \
V3Control.o \
V3EmitCBase.o \
V3EmitCConstPool.o \
V3EmitCFunc.o \
V3EmitCHeaders.o \
V3EmitCImp.o \
V3EmitCInlines.o \
V3EmitCPch.o \
V3EmitV.o \
V3File.o \
V3FuncOpt.o \
V3Global.o \
V3Hasher.o \
V3Number.o \
V3Options.o \
V3Stats.o \
V3StatsReport.o \
V3VariableOrder.o \
RAW_OBJS_PCH_ASTNOMT = \
V3Active.o \
V3ActiveTop.o \
V3Assert.o \
V3AssertPre.o \
V3Begin.o \
V3Branch.o \
V3CCtors.o \
V3CUse.o \
V3Case.o \
V3Cast.o \
V3Class.o \
V3Clean.o \
V3Clock.o \
V3Combine.o \
V3Common.o \
V3Coverage.o \
V3CoverageJoin.o \
V3Dead.o \
V3Delayed.o \
V3Depth.o \
V3DepthBlock.o \
V3Descope.o \
V3Dfg.o \
V3DfgAstToDfg.o \
V3DfgCache.o \
V3DfgDecomposition.o \
V3DfgDfgToAst.o \
V3DfgOptimizer.o \
V3DfgPasses.o \
V3DfgPeephole.o \
V3DfgRegularize.o \
V3DupFinder.o \
V3EmitCMain.o \
V3EmitCMake.o \
V3EmitCModel.o \
V3EmitCSyms.o \
V3EmitMk.o \
V3EmitMkJson.o \
V3EmitXml.o \
V3ExecGraph.o \
V3Expand.o \
V3Force.o \
V3Fork.o \
V3Gate.o \
V3HierBlock.o \
V3Inline.o \
V3Inst.o \
V3InstrCount.o \
V3Interface.o \
V3Life.o \
V3LifePost.o \
V3LinkCells.o \
V3LinkDot.o \
V3LinkInc.o \
V3LinkJump.o \
V3LinkLValue.o \
V3LinkLevel.o \
V3LinkParse.o \
V3LinkResolve.o \
V3Localize.o \
V3MergeCond.o \
V3Name.o \
V3Order.o \
V3OrderGraphBuilder.o \
V3OrderMoveGraph.o \
V3OrderParallel.o \
V3OrderProcessDomains.o \
V3OrderSerial.o \
V3Param.o \
V3Premit.o \
V3ProtectLib.o \
V3Randomize.o \
V3Reloop.o \
V3Sampled.o \
V3Sched.o \
V3SchedAcyclic.o \
V3SchedPartition.o \
V3SchedReplicate.o \
V3SchedTiming.o \
V3SchedVirtIface.o \
V3Scope.o \
V3Scoreboard.o \
V3Slice.o \
V3Split.o \
V3SplitAs.o \
V3SplitVar.o \
V3StackCount.o \
V3Subst.o \
V3TSP.o \
V3Table.o \
V3Task.o \
V3Timing.o \
V3Trace.o \
V3TraceDecl.o \
V3Tristate.o \
V3Udp.o \
V3Undriven.o \
V3Unknown.o \
V3Unroll.o \
V3Width.o \
V3WidthCommit.o \
V3WidthSel.o \
V3Active.o \
V3ActiveTop.o \
V3Assert.o \
V3AssertPre.o \
V3Begin.o \
V3Branch.o \
V3CCtors.o \
V3CUse.o \
V3Case.o \
V3Cast.o \
V3Class.o \
V3Clean.o \
V3Clock.o \
V3Combine.o \
V3Common.o \
V3Coverage.o \
V3CoverageJoin.o \
V3Dead.o \
V3Delayed.o \
V3Depth.o \
V3DepthBlock.o \
V3Descope.o \
V3Dfg.o \
V3DfgAstToDfg.o \
V3DfgCache.o \
V3DfgDecomposition.o \
V3DfgDfgToAst.o \
V3DfgOptimizer.o \
V3DfgPasses.o \
V3DfgPeephole.o \
V3DfgRegularize.o \
V3DiagSarif.o \
V3DupFinder.o \
V3EmitCMain.o \
V3EmitCMake.o \
V3EmitCModel.o \
V3EmitCSyms.o \
V3EmitMk.o \
V3EmitMkJson.o \
V3EmitXml.o \
V3ExecGraph.o \
V3Expand.o \
V3Force.o \
V3Fork.o \
V3Gate.o \
V3HierBlock.o \
V3Inline.o \
V3Inst.o \
V3InstrCount.o \
V3Interface.o \
V3Life.o \
V3LifePost.o \
V3LinkCells.o \
V3LinkDot.o \
V3LinkInc.o \
V3LinkJump.o \
V3LinkLValue.o \
V3LinkLevel.o \
V3LinkParse.o \
V3LinkResolve.o \
V3Localize.o \
V3MergeCond.o \
V3Name.o \
V3Order.o \
V3OrderGraphBuilder.o \
V3OrderMoveGraph.o \
V3OrderParallel.o \
V3OrderProcessDomains.o \
V3OrderSerial.o \
V3Param.o \
V3Premit.o \
V3ProtectLib.o \
V3Randomize.o \
V3Reloop.o \
V3Sampled.o \
V3Sched.o \
V3SchedAcyclic.o \
V3SchedPartition.o \
V3SchedReplicate.o \
V3SchedTiming.o \
V3SchedVirtIface.o \
V3Scope.o \
V3Scoreboard.o \
V3Slice.o \
V3Split.o \
V3SplitAs.o \
V3SplitVar.o \
V3StackCount.o \
V3Subst.o \
V3TSP.o \
V3Table.o \
V3Task.o \
V3Timing.o \
V3Trace.o \
V3TraceDecl.o \
V3Tristate.o \
V3Udp.o \
V3Undriven.o \
V3Unknown.o \
V3Unroll.o \
V3Width.o \
V3WidthCommit.o \
V3WidthSel.o \
# verilator_coverage
VLCOV_OBJS = \
VlcMain.o \
VlcMain.o \
NON_STANDALONE_HEADERS = \
V3AstInlines.h \
V3AstNodeDType.h \
V3AstNodeExpr.h \
V3AstNodeOther.h \
V3DfgVertices.h \
V3ThreadPool.h \
V3WidthRemove.h \
V3AstInlines.h \
V3AstNodeDType.h \
V3AstNodeExpr.h \
V3AstNodeOther.h \
V3DfgVertices.h \
V3ThreadPool.h \
V3WidthRemove.h \
AST_DEFS := \
V3AstNodeDType.h \
V3AstNodeExpr.h \
V3AstNodeOther.h \
V3AstNodeDType.h \
V3AstNodeExpr.h \
V3AstNodeOther.h \
DFG_DEFS := \
V3DfgVertices.h
V3DfgVertices.h
#### astgen common flags
@ -349,11 +350,11 @@ ASTGENFLAGS += $(foreach f,$(DFG_DEFS),--dfgdef $f)
#### Linking
ifeq ($(VL_VLCOV),)
PREDEP_H = V3Ast__gen_forward_class_decls.h
OBJS += $(RAW_OBJS) $(RAW_OBJS_PCH_ASTMT) $(RAW_OBJS_PCH_ASTNOMT)
PREDEP_H = V3Ast__gen_forward_class_decls.h
OBJS += $(RAW_OBJS) $(RAW_OBJS_PCH_ASTMT) $(RAW_OBJS_PCH_ASTNOMT)
else
PREDEP_H =
OBJS += $(VLCOV_OBJS)
PREDEP_H =
OBJS += $(VLCOV_OBJS)
endif
$(TGT): $(PREDEP_H) $(OBJS)
@ -453,5 +454,5 @@ header_cc: $(addsuffix __header_cc.o, $(basename $(HEADER_CC_H)))
DEPS := $(wildcard *.d)
ifneq ($(DEPS),)
include $(DEPS)
include $(DEPS)
endif

View File

@ -647,7 +647,7 @@ public:
// Active class functions
void V3Active::activeAll(AstNetlist* nodep) {
UINFO(2, __FUNCTION__ << ": " << endl);
UINFO(2, __FUNCTION__ << ":");
{ ActiveVisitor{nodep}; } // Destruct before checking
V3Global::dumpCheckGlobalTree("active", 0, dumpTreeEitherLevel() >= 3);
}

View File

@ -61,11 +61,11 @@ class ActiveTopVisitor final : public VNVisitor {
void visit(AstNodeModule* nodep) override {
// Create required actives and add to module
// We can start ordering at a module, or a scope
UINFO(4, " MOD " << nodep << endl);
UINFO(4, " MOD " << nodep);
iterateChildren(nodep);
}
void visit(AstActive* nodep) override {
UINFO(4, " ACTIVE " << nodep << endl);
UINFO(4, " ACTIVE " << nodep);
// Remove duplicate clocks and such; sensesp() may change!
V3Const::constifyExpensiveEdit(nodep);
AstSenTree* sensesp = nodep->sensesp();
@ -95,10 +95,10 @@ class ActiveTopVisitor final : public VNVisitor {
// Move the SENTREE for each active up to the global level.
// This way we'll easily see what clock domains are identical
AstSenTree* const wantp = m_finder.getSenTree(sensesp);
UINFO(4, " lookdone\n");
UINFO(4, " lookdone");
if (wantp != sensesp) {
// Move the active's contents to the other active
UINFO(4, " merge active " << sensesp << " into " << wantp << endl);
UINFO(4, " merge active " << sensesp << " into " << wantp);
if (nodep->sensesStorep()) {
UASSERT_OBJ(sensesp == nodep->sensesStorep(), nodep,
"sensesStore should have been deleted earlier if different");
@ -155,7 +155,7 @@ public:
// Active class functions
void V3ActiveTop::activeTopAll(AstNetlist* nodep) {
UINFO(2, __FUNCTION__ << ": " << endl);
UINFO(2, __FUNCTION__ << ":");
{ ActiveTopVisitor{nodep}; } // Destruct before checking
V3Global::dumpCheckGlobalTree("activetop", 0, dumpTreeEitherLevel() >= 3);
}

View File

@ -53,10 +53,11 @@ class AssertVisitor final : public VNVisitor {
// METHODS
static AstNodeExpr* assertOnCond(FileLine* fl, VAssertType type,
VAssertDirectiveType directiveType) {
// cppcheck-suppress missingReturn
switch (directiveType) {
case VAssertDirectiveType::INTRINSIC: return new AstConst{fl, AstConst::BitTrue{}};
case VAssertDirectiveType::VIOLATION_CASE: {
if (v3Global.opt.assertCaseOn()) {
if (v3Global.opt.assertCase()) {
return new AstCExpr{fl, "vlSymsp->_vm_contextp__->assertOn()", 1};
}
// If assertions are off, have constant propagation rip them out later
@ -635,7 +636,7 @@ class AssertVisitor final : public VNVisitor {
FileLine* const fl = nodep->fileline();
switch (nodep->ctlType()) {
case VAssertCtlType::ON:
UINFO(9, "Generating assertctl for a module: " << m_modp << endl);
UINFO(9, "Generating assertctl for a module: " << m_modp);
nodep->replaceWith(new AstCExpr{
fl,
"vlSymsp->_vm_contextp__->assertOnSet("s + std::to_string(nodep->ctlAssertTypes())
@ -644,7 +645,7 @@ class AssertVisitor final : public VNVisitor {
break;
case VAssertCtlType::OFF:
case VAssertCtlType::KILL: {
UINFO(9, "Generating assertctl for a module: " << m_modp << endl);
UINFO(9, "Generating assertctl for a module: " << m_modp);
nodep->replaceWith(new AstCExpr{fl,
"vlSymsp->_vm_contextp__->assertOnClear("s
+ std::to_string(nodep->ctlAssertTypes()) + " ,"s
@ -725,7 +726,7 @@ public:
// Top Assert class
void V3Assert::assertAll(AstNetlist* nodep) {
UINFO(2, __FUNCTION__ << ": " << endl);
UINFO(2, __FUNCTION__ << ":");
{ AssertVisitor{nodep}; } // Destruct before checking
V3Global::dumpCheckGlobalTree("assert", 0, dumpTreeEitherLevel() >= 3);
}

View File

@ -156,7 +156,7 @@ private:
void visit(AstClocking* const nodep) override {
VL_RESTORER(m_clockingp);
m_clockingp = nodep;
UINFO(8, " CLOCKING" << nodep << endl);
UINFO(8, " CLOCKING" << nodep);
iterateChildren(nodep);
if (nodep->eventp()) nodep->addNextHere(nodep->eventp()->unlinkFrBack());
VL_DO_DANGLING(pushDeletep(nodep->unlinkFrBack()), nodep);
@ -359,9 +359,9 @@ private:
}
}
void visit(AstNodeVarRef* nodep) override {
UINFO(8, " -varref: " << nodep << endl);
UINFO(8, " -varref-var-back: " << nodep->varp()->backp() << endl);
UINFO(8, " -varref-var-user1: " << nodep->varp()->user1p() << endl);
UINFO(8, " -varref: " << nodep);
UINFO(8, " -varref-var-back: " << nodep->varp()->backp());
UINFO(8, " -varref-var-user1: " << nodep->varp()->user1p());
if (AstClockingItem* const itemp = VN_CAST(
nodep->varp()->user1p() ? nodep->varp()->user1p() : nodep->varp()->firstAbovep(),
ClockingItem)) {
@ -369,12 +369,12 @@ private:
// ensure linking still works, this has to be done only once
if (AstVarXRef* xrefp = VN_CAST(nodep, VarXRef)) {
UINFO(8, " -clockvarxref-in: " << xrefp << endl);
UINFO(8, " -clockvarxref-in: " << xrefp);
string dotted = xrefp->dotted();
const size_t dotPos = dotted.rfind('.');
dotted.erase(dotPos, string::npos);
xrefp->dotted(dotted);
UINFO(8, " -clockvarxref-out: " << xrefp << endl);
UINFO(8, " -clockvarxref-out: " << xrefp);
m_xrefsp.emplace_back(xrefp);
}
@ -460,7 +460,7 @@ private:
if (exprp->width() > 1) exprp = new AstSel{fl, exprp, 0, 1};
AstSenTree* sentreep = nodep->sentreep();
if (sentreep) sentreep->unlinkFrBack();
AstNodeExpr* const past = new AstPast{fl, exprp, nullptr};
AstNodeExpr* const past = new AstPast{fl, exprp};
past->dtypeFrom(exprp);
exprp = new AstAnd{fl, past, new AstNot{fl, exprp->cloneTreePure(false)}};
exprp->dtypeSetBit();
@ -481,7 +481,7 @@ private:
if (exprp->width() > 1) exprp = new AstSel{fl, exprp, 0, 1};
AstSenTree* sentreep = nodep->sentreep();
if (sentreep) sentreep->unlinkFrBack();
AstNodeExpr* const past = new AstPast{fl, exprp, nullptr};
AstNodeExpr* const past = new AstPast{fl, exprp};
past->dtypeFrom(exprp);
exprp = new AstAnd{fl, new AstNot{fl, past}, exprp->cloneTreePure(false)};
exprp->dtypeSetBit();
@ -496,7 +496,7 @@ private:
AstNodeExpr* exprp = nodep->exprp()->unlinkFrBack();
AstSenTree* sentreep = nodep->sentreep();
if (sentreep) sentreep->unlinkFrBack();
AstNodeExpr* const past = new AstPast{fl, exprp, nullptr};
AstNodeExpr* const past = new AstPast{fl, exprp};
past->dtypeFrom(exprp);
exprp = new AstEq{fl, past, exprp->cloneTreePure(false)};
exprp->dtypeSetBit();
@ -514,7 +514,7 @@ private:
if (m_disablep) lhsp = new AstAnd{fl, new AstNot{fl, m_disablep}, lhsp};
AstNodeExpr* const past = new AstPast{fl, lhsp, nullptr};
AstNodeExpr* const past = new AstPast{fl, lhsp};
past->dtypeFrom(lhsp);
AstNodeExpr* const exprp = new AstOr{fl, new AstNot{fl, past}, rhsp};
exprp->dtypeSetBit();
@ -613,7 +613,7 @@ public:
// Top Assert class
void V3AssertPre::assertPreAll(AstNetlist* nodep) {
UINFO(2, __FUNCTION__ << ": " << endl);
UINFO(2, __FUNCTION__ << ":");
{ AssertPreVisitor{nodep}; } // Destruct before checking
V3Global::dumpCheckGlobalTree("assertpre", 0, dumpTreeEitherLevel() >= 3);
}

View File

@ -193,6 +193,11 @@ string AstNode::prettyName(const string& namein) VL_PURE {
pos += 7;
continue;
}
if (0 == std::strncmp(pos, "__LIB__", 7)) {
pretty = ""; // Trim library name before module name
pos += 7;
continue;
}
if (0 == std::strncmp(pos, "__PVT__", 7)) {
pretty += "";
pos += 7;
@ -324,7 +329,7 @@ void AstNode::debugTreeChange(const AstNode* nodep, const char* prefix, int line
// // Commenting out the section below may crash, as the tree state
// // between edits is not always consistent for printing
// cout<<"-treeChange: V3Ast.cpp:"<<lineno<<" Tree Change for "<<prefix<<endl;
// v3Global.rootp()->dumpTree("- treeChange: ");
// if (debug()) v3Global.rootp()->dumpTree("- treeChange: ");
// if (next||1) nodep->dumpTreeAndNext(cout, prefix);
// else nodep->dumpTree(prefix);
// nodep->checkTree();
@ -521,6 +526,10 @@ void AstNode::replaceWith(AstNode* newp) {
this->unlinkFrBack(&repHandle);
repHandle.relink(newp);
}
void AstNode::replaceWithKeepDType(AstNode* newp) {
newp->dtypeFrom(this);
replaceWith(newp);
}
void VNRelinker::dump(std::ostream& str) const {
str << " BK=" << reinterpret_cast<uint32_t*>(m_backp);
@ -667,7 +676,7 @@ AstNode* AstNode::unlinkFrBack(VNRelinker* linkerp) {
void AstNode::relink(VNRelinker* linkerp) {
if (debug() > 8) {
UINFO(0, " EDIT: relink: ");
UINFO_PREFIX(" EDIT: relink: ");
dumpPtrs();
}
AstNode* const newp = this;
@ -1340,7 +1349,7 @@ void AstNode::dumpTreeFile(const string& filename, bool doDump) {
// Not const function as calls checkTree
if (doDump) {
{ // Write log & close
UINFO(2, "Dumping " << filename << endl);
UINFO(2, "Dumping " << filename);
const std::unique_ptr<std::ofstream> logsp{V3File::new_ofstream(filename)};
if (logsp->fail()) v3fatal("Can't write file: " << filename);
*logsp << "Verilator Tree Dump (format 0x3900) from <e" << std::dec << editCountLast();
@ -1385,7 +1394,7 @@ void AstNode::dumpTreeDot(std::ostream& os) const {
void AstNode::dumpTreeJsonFile(const string& filename, bool doDump) {
if (!doDump) return;
UINFO(2, "Dumping " << filename << endl);
UINFO(2, "Dumping " << filename);
const std::unique_ptr<std::ofstream> treejsonp{V3File::new_ofstream(filename)};
if (treejsonp->fail()) v3fatal("Can't write file: " << filename);
dumpTreeJson(*treejsonp);
@ -1394,7 +1403,7 @@ void AstNode::dumpTreeJsonFile(const string& filename, bool doDump) {
void AstNode::dumpJsonMetaFileGdb(const char* filename) { dumpJsonMetaFile(filename); }
void AstNode::dumpJsonMetaFile(const string& filename) {
UINFO(2, "Dumping " << filename << endl);
UINFO(2, "Dumping " << filename);
const std::unique_ptr<std::ofstream> treejsonp{V3File::new_ofstream(filename)};
if (treejsonp->fail()) v3fatalStatic("Can't write file: " << filename);
*treejsonp << '{';
@ -1408,7 +1417,7 @@ void AstNode::dumpJsonMetaFile(const string& filename) {
void AstNode::dumpTreeDotFile(const string& filename, bool doDump) {
if (doDump) {
UINFO(2, "Dumping " << filename << endl);
UINFO(2, "Dumping " << filename);
const std::unique_ptr<std::ofstream> treedotp{V3File::new_ofstream(filename)};
if (treedotp->fail()) v3fatal("Can't write file: " << filename);
*treedotp << "digraph vTree{\n";
@ -1449,7 +1458,7 @@ void AstNode::v3errorEnd(std::ostringstream& str) const VL_RELEASE(V3Error::s().
const string instanceStrExtra
= m_fileline->warnIsOff(V3Error::s().errorCode()) ? "" : instanceStr();
if (!m_fileline) {
V3Error::v3errorEnd(str, instanceStrExtra);
V3Error::v3errorEnd(str, instanceStrExtra, nullptr);
} else {
std::ostringstream nsstr;
nsstr << str.str();
@ -1457,7 +1466,7 @@ void AstNode::v3errorEnd(std::ostringstream& str) const VL_RELEASE(V3Error::s().
nsstr << '\n';
nsstr << "-node: ";
const_cast<AstNode*>(this)->dump(nsstr);
nsstr << endl;
nsstr << '\n';
}
m_fileline->v3errorEnd(nsstr, instanceStrExtra);
}
@ -1579,7 +1588,7 @@ static VCastable computeCastableImp(const AstNodeDType* toDtp, const AstNodeDTyp
return VCastable::COMPATIBLE;
} else if (toNumericable) {
if (fromNumericable) return VCastable::COMPATIBLE;
} else if (VN_IS(toDtp, EnumDType)) {
} else if (VN_IS(toBaseDtp, EnumDType)) {
if (VN_IS(fromBaseDtp, EnumDType) && toDtp->sameTree(fromDtp))
return VCastable::ENUM_IMPLICIT;
if (fromNumericable) return VCastable::ENUM_EXPLICIT;
@ -1604,9 +1613,9 @@ static VCastable computeCastableImp(const AstNodeDType* toDtp, const AstNodeDTyp
VCastable AstNode::computeCastable(const AstNodeDType* toDtp, const AstNodeDType* fromDtp,
const AstNode* fromConstp) {
const auto castable = computeCastableImp(toDtp, fromDtp, fromConstp);
UINFO(9, " castable=" << castable << " for " << toDtp << endl);
UINFO(9, " =?= " << fromDtp << endl);
if (fromConstp) UINFO(9, " const= " << fromConstp << endl);
UINFO(9, " castable=" << castable << " for " << toDtp);
UINFO(9, " =?= " << fromDtp);
if (fromConstp) UINFO(9, " const= " << fromConstp);
return castable;
}

View File

@ -92,7 +92,7 @@ class VFlagChildDType {}; // Used by parser.y to select constructor that sets c
#endif
// (V)erilator (N)ode deleted: Pointer to deleted AstNode (for assertions only)
#define VN_DELETED(nodep) VL_UNLIKELY((uint64_t)(nodep) == 0x1)
#define VN_DELETED(nodep) VL_UNLIKELY(reinterpret_cast<uint64_t>(nodep) == 0x1)
//######################################################################
@ -287,6 +287,33 @@ public:
// ######################################################################
class VFwdType final {
public:
enum en : uint8_t { NONE, ENUM, STRUCT, UNION, CLASS, INTERFACE_CLASS };
enum en m_e;
const char* ascii() const {
static const char* const names[]
= {"none", "enum", "struct", "union", "class", "interface class"};
return names[m_e];
}
VFwdType()
: m_e{NONE} {}
// cppcheck-suppress noExplicitConstructor
constexpr VFwdType(en _e)
: m_e{_e} {}
explicit VFwdType(int _e)
: m_e(static_cast<en>(_e)) {} // Need () or GCC 4.8 false warning
constexpr operator en() const { return m_e; }
};
constexpr bool operator==(const VFwdType& lhs, const VFwdType& rhs) { return lhs.m_e == rhs.m_e; }
constexpr bool operator==(const VFwdType& lhs, VFwdType::en rhs) { return lhs.m_e == rhs; }
constexpr bool operator==(VFwdType::en lhs, const VFwdType& rhs) { return lhs == rhs.m_e; }
inline std::ostream& operator<<(std::ostream& os, const VFwdType& rhs) {
return os << rhs.ascii();
}
// ######################################################################
class VSigning final {
public:
enum en : uint8_t {
@ -336,6 +363,7 @@ public:
NO_INLINE_TASK,
PUBLIC_MODULE,
PUBLIC_TASK,
TIMEUNIT_SET,
UNROLL_DISABLE,
UNROLL_FULL,
FULL_CASE,
@ -458,6 +486,7 @@ public:
ILLEGAL,
//
DIM_BITS, // V3Const converts to constant
DIM_BITS_OR_NUMBER, // V3Const converts to constant
DIM_DIMENSIONS, // V3Width converts to constant
DIM_HIGH, // V3Width processes
DIM_INCREMENT, // V3Width processes
@ -500,7 +529,8 @@ public:
// clang-format off
static const char* const names[] = {
"%E-AT",
"DIM_BITS", "DIM_DIMENSIONS", "DIM_HIGH", "DIM_INCREMENT", "DIM_LEFT",
"DIM_BITS", "DIM_BITS_OR_NUMBER", "DIM_DIMENSIONS",
"DIM_HIGH", "DIM_INCREMENT", "DIM_LEFT",
"DIM_LOW", "DIM_RIGHT", "DIM_SIZE", "DIM_UNPK_DIMENSIONS",
"DT_PUBLIC",
"ENUM_FIRST", "ENUM_LAST", "ENUM_NUM",
@ -893,6 +923,7 @@ public:
UNKNOWN,
GPARAM,
LPARAM,
SPECPARAM,
GENVAR,
VAR, // Reg, integer, logic, etc
SUPPLY0,
@ -921,9 +952,10 @@ public:
constexpr operator en() const { return m_e; }
const char* ascii() const {
static const char* const names[]
= {"?", "GPARAM", "LPARAM", "GENVAR", "VAR", "SUPPLY0", "SUPPLY1",
"WIRE", "WREAL", "TRIAND", "TRIOR", "TRIWIRE", "TRI0", "TRI1",
"PORT", "BLOCKTEMP", "MODULETEMP", "STMTTEMP", "XTEMP", "IFACEREF", "MEMBER"};
= {"?", "GPARAM", "LPARAM", "SPECPARAM", "GENVAR", "VAR",
"SUPPLY0", "SUPPLY1", "WIRE", "WREAL", "TRIAND", "TRIOR",
"TRIWIRE", "TRI0", "TRI1", "PORT", "BLOCKTEMP", "MODULETEMP",
"STMTTEMP", "XTEMP", "IFACEREF", "MEMBER"};
return names[m_e];
}
bool isParam() const { return m_e == GPARAM || m_e == LPARAM; }
@ -953,8 +985,8 @@ public:
return (m_e == BLOCKTEMP || m_e == MODULETEMP || m_e == STMTTEMP || m_e == XTEMP);
}
bool isVPIAccessible() const {
return (m_e == VAR || m_e == GPARAM || m_e == LPARAM || m_e == PORT || m_e == WIRE
|| m_e == TRI0 || m_e == TRI1);
return (m_e == VAR || m_e == GPARAM || m_e == LPARAM || m_e == SPECPARAM || m_e == PORT
|| m_e == WIRE || m_e == TRI0 || m_e == TRI1);
}
const char* traceSigKind() const {
@ -963,6 +995,7 @@ public:
/* UNKNOWN: */ "", // Should not be traced
/* GPARAM: */ "PARAMETER",
/* LPARAM: */ "PARAMETER",
/* SPECPARAM: */ "PARAMETER",
/* GENVAR: */ "PARAMETER",
/* VAR: */ "VAR",
/* SUPPLY0: */ "SUPPLY0",
@ -1382,7 +1415,7 @@ public:
// cppcheck-suppress noExplicitConstructor
constexpr VStrength(en strengthLevel)
: m_e(strengthLevel) {}
: m_e{strengthLevel} {}
explicit VStrength(int _e)
: m_e(static_cast<en>(_e)) {} // Need () or GCC 4.8 false warning
constexpr operator en() const { return m_e; }
@ -1704,7 +1737,7 @@ public:
};
enum en m_e;
const char* ascii() const {
static const char* const names[] = {"NONE", "RAND", "RANDC", "RAND-INLINE"};
static const char* const names[] = {"NONE", "RAND", "RANDC", "RAND_INLINE"};
return names[m_e];
}
VRandAttr()
@ -2125,6 +2158,9 @@ protected:
// Use instead isSame(), this is for each Ast* class, and assumes node is of same type
virtual bool sameNode(const AstNode*) const { return true; }
// Generated by 'astgen'. If do an oldp->replaceNode(newp), would cause a broken()
virtual bool wouldBreakGen(const AstNode* const oldp,
const AstNode* const newp) const = 0; // Generated by 'astgen'
public:
// ACCESSORS
@ -2415,6 +2451,7 @@ public:
void addNextHere(AstNode* newp); // Insert newp at this->nextp
void addHereThisAsNext(AstNode* newp); // Adds at old place of this, this becomes next
void replaceWith(AstNode* newp); // Replace current node in tree with new node
void replaceWithKeepDType(AstNode* newp); // Replace current node in tree, keep old dtype
// Unlink this from whoever points to it.
AstNode* unlinkFrBack(VNRelinker* linkerp = nullptr);
// Unlink this from whoever points to it, keep entire next list with unlinked node
@ -2523,6 +2560,8 @@ public:
virtual const char* broken() const { return nullptr; }
// Generated by 'astgen'. Calls 'broken()', which can be used to add extra checks
virtual const char* brokenGen() const = 0; // Generated by 'astgen'
// If do a this->replaceNode(newp), would cause a broken()
bool wouldBreak(const AstNode* const newp) const { return backp()->wouldBreakGen(this, newp); }
// INVOKERS
virtual void accept(VNVisitorConst& v) = 0;

View File

@ -34,7 +34,7 @@ int AstNode::widthInstrs() const {
return (!dtypep() ? 1 : (dtypep()->isWide() ? dtypep()->widthWords() : 1));
}
bool AstNode::isDouble() const VL_MT_STABLE {
return dtypep() && VN_IS(dtypep(), BasicDType) && VN_AS(dtypep(), BasicDType)->isDouble();
return dtypep() && dtypep()->basicp() && dtypep()->basicp()->isDouble();
}
bool AstNode::isString() const VL_MT_STABLE {
return dtypep() && dtypep()->basicp() && dtypep()->basicp()->isString();

View File

@ -123,6 +123,8 @@ public:
bool similarDType(const AstNodeDType* samep) const;
// Iff has a non-null subDTypep(), as generic node function
virtual AstNodeDType* subDTypep() const VL_MT_STABLE { return nullptr; }
virtual AstNodeDType* subDType2p() const VL_MT_STABLE { return nullptr; }
virtual bool isAggregateType() const { return false; }
virtual bool isFourstate() const;
// Ideally an IEEE $typename
virtual string prettyDTypeName(bool) const { return prettyTypeName(); }
@ -156,7 +158,7 @@ public:
bool widthSized() const VL_MT_SAFE { return !m_widthMin || m_widthMin == m_width; }
bool generic() const VL_MT_SAFE { return m_generic; }
void generic(bool flag) { m_generic = flag; }
std::pair<uint32_t, uint32_t> dimensions(bool includeBasic);
std::pair<uint32_t, uint32_t> dimensions(bool includeBasic) const;
uint32_t arrayUnpackedElements() const; // 1, or total multiplication of all dimensions
static int uniqueNumInc() { return ++s_uniqueNum; }
const char* charIQWN() const {
@ -243,12 +245,12 @@ protected:
numeric(VSigning::fromBool(numericUnpack.isSigned()));
}
AstNodeUOrStructDType(const AstNodeUOrStructDType& other)
: AstNodeDType(other)
, m_name(other.m_name)
, m_uniqueNum(uniqueNumInc())
, m_packed(other.m_packed)
, m_isFourstate(other.m_isFourstate)
, m_constrainedRand(false) {}
: AstNodeDType{other}
, m_name{other.m_name}
, m_uniqueNum{uniqueNumInc()}
, m_packed{other.m_packed}
, m_isFourstate{other.m_isFourstate}
, m_constrainedRand{false} {}
public:
ASTGEN_MEMBERS_AstNodeUOrStructDType;
@ -362,6 +364,10 @@ public:
AstNodeDType* subDTypep() const override VL_MT_STABLE {
return m_refDTypep ? m_refDTypep : childDTypep();
}
AstNodeDType* subDType2p() const override VL_MT_STABLE {
return m_keyDTypep ? m_keyDTypep : keyChildDTypep();
}
bool isAggregateType() const override { return true; }
void refDTypep(AstNodeDType* nodep) { m_refDTypep = nodep; }
AstNodeDType* virtRefDTypep() const override { return m_refDTypep; }
void virtRefDTypep(AstNodeDType* nodep) override { refDTypep(nodep); }
@ -427,6 +433,8 @@ public:
string prettyDTypeName(bool full) const override;
const char* broken() const override {
BROKEN_RTN(dtypep() != this);
BROKEN_RTN(v3Global.widthMinUsage() == VWidthMinUsage::VERILOG_WIDTH
&& widthMin() > width());
return nullptr;
}
void setSignedState(const VSigning& signst) {
@ -664,25 +672,20 @@ class AstDefImplicitDType final : public AstNodeDType {
// After link, these become typedefs
// @astgen op1 := childDTypep : Optional[AstNodeDType]
string m_name;
void* m_containerp; // In what scope is the name unique, so we can know what are duplicate
// definitions (arbitrary value)
const int m_uniqueNum;
public:
AstDefImplicitDType(FileLine* fl, const string& name, void* containerp, VFlagChildDType,
AstNodeDType* dtp)
AstDefImplicitDType(FileLine* fl, const string& name, VFlagChildDType, AstNodeDType* dtp)
: ASTGEN_SUPER_DefImplicitDType(fl)
, m_name{name}
, m_containerp{containerp}
, m_uniqueNum{uniqueNumInc()} {
childDTypep(dtp); // Only for parser
dtypep(nullptr); // V3Width will resolve
}
AstDefImplicitDType(const AstDefImplicitDType& other)
: AstNodeDType(other)
, m_name(other.m_name)
, m_containerp(other.m_containerp)
, m_uniqueNum(uniqueNumInc()) {}
, m_name{other.m_name}
, m_uniqueNum{uniqueNumInc()} {}
ASTGEN_MEMBERS_AstDefImplicitDType;
int uniqueNum() const { return m_uniqueNum; }
bool sameNode(const AstNode* samep) const override {
@ -694,7 +697,6 @@ public:
AstNodeDType* subDTypep() const override VL_MT_STABLE {
return dtypep() ? dtypep() : childDTypep();
}
void* containerp() const { return m_containerp; }
// METHODS
// op1 = Range of variable
AstNodeDType* dtypeSkipRefp() const { return dtypep()->skipRefp(); }
@ -742,6 +744,7 @@ public:
AstNodeDType* subDTypep() const override VL_MT_STABLE {
return m_refDTypep ? m_refDTypep : childDTypep();
}
bool isAggregateType() const override { return true; }
void refDTypep(AstNodeDType* nodep) { m_refDTypep = nodep; }
AstNodeDType* virtRefDTypep() const override { return m_refDTypep; }
void virtRefDTypep(AstNodeDType* nodep) override { refDTypep(nodep); }
@ -797,9 +800,9 @@ public:
widthFromSub(subDTypep());
}
AstEnumDType(const AstEnumDType& other)
: AstNodeDType(other)
, m_name(other.m_name)
, m_uniqueNum(uniqueNumInc()) {}
: AstNodeDType{other}
, m_name{other.m_name}
, m_uniqueNum{uniqueNumInc()} {}
ASTGEN_MEMBERS_AstEnumDType;
const char* broken() const override;
@ -922,7 +925,7 @@ public:
AstNode* valuep)
: ASTGEN_SUPER_MemberDType(fl)
, m_name{name}
, m_constrainedRand(false) {
, m_constrainedRand{false} {
childDTypep(dtp); // Only for parser
this->valuep(valuep);
dtypep(nullptr); // V3Width will resolve
@ -931,7 +934,7 @@ public:
AstMemberDType(FileLine* fl, const string& name, AstNodeDType* dtp)
: ASTGEN_SUPER_MemberDType(fl)
, m_name{name}
, m_constrainedRand(false) {
, m_constrainedRand{false} {
UASSERT(dtp, "AstMember created with no dtype");
refDTypep(dtp);
dtypep(this);
@ -1006,12 +1009,14 @@ class AstParamTypeDType final : public AstNodeDType {
// A parameter type statement; much like a var or typedef
// @astgen op1 := childDTypep : Optional[AstNodeDType]
const VVarType m_varType; // Type of variable (for localparam vs. param)
const VFwdType m_fwdType; // Forward type for lint check
string m_name; // Name of variable
public:
AstParamTypeDType(FileLine* fl, VVarType type, const string& name, VFlagChildDType,
AstNodeDType* dtp)
AstParamTypeDType(FileLine* fl, VVarType type, VFwdType fwdType, const string& name,
VFlagChildDType, AstNodeDType* dtp)
: ASTGEN_SUPER_ParamTypeDType(fl)
, m_varType{type}
, m_fwdType{fwdType}
, m_name{name} {
childDTypep(dtp); // Only for parser
dtypep(nullptr); // V3Width will resolve
@ -1036,6 +1041,7 @@ public:
bool hasDType() const override VL_MT_SAFE { return true; }
void name(const string& flag) override { m_name = flag; }
VVarType varType() const { return m_varType; } // * = Type of variable
VFwdType fwdType() const { return m_fwdType; }
bool isParam() const { return true; }
bool isGParam() const { return (varType() == VVarType::GPARAM); }
bool isCompound() const override {
@ -1047,9 +1053,11 @@ class AstParseTypeDType final : public AstNodeDType {
// Parents: VAR
// During parsing, this indicates the type of a parameter is a "parameter type"
// e.g. the data type is a container of any data type
const VFwdType m_fwdType; // Forward type for lint check
public:
explicit AstParseTypeDType(FileLine* fl)
: ASTGEN_SUPER_ParseTypeDType(fl) {}
explicit AstParseTypeDType(FileLine* fl, VFwdType fwdType = VFwdType::NONE)
: ASTGEN_SUPER_ParseTypeDType(fl)
, m_fwdType{fwdType} {}
ASTGEN_MEMBERS_AstParseTypeDType;
AstNodeDType* dtypep() const VL_MT_STABLE { return nullptr; }
// METHODS
@ -1061,6 +1069,7 @@ public:
v3fatalSrc("call isCompound on subdata type, not reference");
return false;
}
VFwdType fwdType() const { return m_fwdType; }
};
class AstQueueDType final : public AstNodeDType {
// Queue array data type, ie "[ $ ]"
@ -1102,6 +1111,7 @@ public:
AstNodeDType* subDTypep() const override VL_MT_STABLE {
return m_refDTypep ? m_refDTypep : childDTypep();
}
bool isAggregateType() const override { return true; }
void refDTypep(AstNodeDType* nodep) { m_refDTypep = nodep; }
inline int boundConst() const VL_MT_STABLE;
AstNodeDType* virtRefDTypep() const override { return m_refDTypep; }
@ -1178,6 +1188,33 @@ public:
return false;
}
};
class AstRequireDType final : public AstNodeDType {
// @astgen op1 := lhsp : Optional[AstNode<AstNodeExpr|AstNodeDType>]
//
// Require a generic node type (typically AstParseRef become a type.
public:
AstRequireDType(FileLine* fl, AstNode* lhsp)
: ASTGEN_SUPER_RequireDType(fl) {
this->lhsp(lhsp);
}
ASTGEN_MEMBERS_AstRequireDType;
// METHODS
bool similarDTypeNode(const AstNodeDType* samep) const override {
const AstRequireDType* const asamep = VN_DBG_AS(samep, RequireDType);
return subDTypep()->similarDType(asamep->subDTypep());
}
AstBasicDType* basicp() const override VL_MT_STABLE { return nullptr; }
AstNodeDType* subDTypep() const override VL_MT_STABLE {
// Used for recursive definition checking
if (AstNodeDType* const dtp = VN_CAST(lhsp(), NodeDType))
return dtp;
else
return nullptr;
}
int widthAlignBytes() const override { V3ERROR_NA_RETURN(1); }
int widthTotalBytes() const override { V3ERROR_NA_RETURN(1); }
bool isCompound() const override { V3ERROR_NA_RETURN(false); }
};
class AstSampleQueueDType final : public AstNodeDType {
// @astgen op1 := childDTypep : Optional[AstNodeDType] // moved to refDTypep() in V3Width
//
@ -1371,6 +1408,7 @@ public:
const AstUnpackArrayDType* const sp = VN_DBG_AS(samep, UnpackArrayDType);
return m_isCompound == sp->m_isCompound;
}
bool isAggregateType() const override { return true; }
// Outer dimension comes first. The first element is this node.
std::vector<AstUnpackArrayDType*> unpackDimensions();
void isCompound(bool flag) { m_isCompound = flag; }
@ -1396,7 +1434,7 @@ public:
// isSoft implies packed
AstUnionDType(FileLine* fl, bool isSoft, VSigning numericUnpack)
: ASTGEN_SUPER_UnionDType(fl, numericUnpack)
, m_isSoft(isSoft) {
, m_isSoft{isSoft} {
packed(packed() | m_isSoft);
}
ASTGEN_MEMBERS_AstUnionDType;

Some files were not shown because too many files have changed in this diff Show More