2022-12-21 01:42:27 +01:00
|
|
|
#*****************************************************************************
|
|
|
|
|
#
|
|
|
|
|
# DESCRIPTION: Script for build tool cmake on both unix and windows
|
|
|
|
|
#
|
|
|
|
|
#*****************************************************************************
|
|
|
|
|
#
|
2026-01-27 02:24:34 +01:00
|
|
|
# This program is free software; you can redistribute it and/or modify it
|
|
|
|
|
# under the terms of either the GNU Lesser General Public License Version 3
|
|
|
|
|
# or the Perl Artistic License Version 2.0.
|
|
|
|
|
# SPDX-FileCopyrightText: 2025-2026 Wilson Snyder
|
2022-12-21 01:42:27 +01:00
|
|
|
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
|
|
|
|
#
|
|
|
|
|
#****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Utilities
|
2024-09-25 02:43:19 +02:00
|
|
|
macro(addBuildType sourceConfig newConfig)
|
2022-12-21 01:42:27 +01:00
|
|
|
get_cmake_property(variableNames VARIABLES)
|
2024-09-25 02:43:19 +02:00
|
|
|
foreach(variableName ${variableNames})
|
|
|
|
|
if(variableName MATCHES "^CMAKE_.*_${sourceConfig}(|_.*)$")
|
|
|
|
|
string(
|
|
|
|
|
REPLACE
|
|
|
|
|
_${sourceConfig}
|
|
|
|
|
_${newConfig}
|
|
|
|
|
newVariableName
|
|
|
|
|
${variableName}
|
|
|
|
|
)
|
2022-12-21 01:42:27 +01:00
|
|
|
set(${newVariableName} ${${variableName}})
|
|
|
|
|
mark_as_advanced(${newVariableName})
|
2024-09-25 02:43:19 +02:00
|
|
|
message(
|
|
|
|
|
DEBUG
|
|
|
|
|
" Propagating ${variableName} to ${newVariableName} = ${${newVariableName}}"
|
|
|
|
|
)
|
2022-12-21 01:42:27 +01:00
|
|
|
endif()
|
|
|
|
|
endforeach()
|
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Sources and headers for the verilator binary
|
|
|
|
|
|
|
|
|
|
set(HEADERS
|
2023-01-05 11:00:54 +01:00
|
|
|
V3Active.h
|
|
|
|
|
V3ActiveTop.h
|
|
|
|
|
V3Assert.h
|
|
|
|
|
V3AssertPre.h
|
2025-11-06 14:42:27 +01:00
|
|
|
V3AssertProp.h
|
2023-01-05 11:00:54 +01:00
|
|
|
V3Ast.h
|
2025-09-27 14:19:57 +02:00
|
|
|
V3AstAttr.h
|
2023-01-05 11:00:54 +01:00
|
|
|
V3AstInlines.h
|
|
|
|
|
V3AstNodeDType.h
|
|
|
|
|
V3AstNodeExpr.h
|
|
|
|
|
V3AstNodeOther.h
|
2025-08-16 10:46:18 +02:00
|
|
|
V3AstNodeStmt.h
|
2023-01-05 11:00:54 +01:00
|
|
|
V3AstUserAllocator.h
|
|
|
|
|
V3Begin.h
|
|
|
|
|
V3Branch.h
|
|
|
|
|
V3Broken.h
|
2023-10-18 12:07:05 +02:00
|
|
|
V3CCtors.h
|
|
|
|
|
V3CUse.h
|
2023-01-05 11:00:54 +01:00
|
|
|
V3Case.h
|
|
|
|
|
V3Cast.h
|
Optimize complex combinational logic in DFG (#6298)
This patch adds DfgLogic, which is a vertex that represents a whole,
arbitrarily complex combinational AstAlways or AstAssignW in the
DfgGraph.
Implementing this requires computing the variables live at entry to the
AstAlways (variables read by the block), so there is a new
ControlFlowGraph data structure and a classical data-flow analysis based
live variable analysis to do that at the variable level (as opposed to
bit/element level).
The actual CFG construction and live variable analysis is best effort,
and might fail for currently unhandled constructs or data types. This
can be extended later.
V3DfgAstToDfg is changed to convert the Ast into an initial DfgGraph
containing only DfgLogic, DfgVertexSplice and DfgVertexVar vertices.
The DfgLogic are then subsequently synthesized into primitive operations
by the new V3DfgSynthesize pass, which is a combination of the old
V3DfgAstToDfg conversion and new code to handle AstAlways blocks with
complex flow control.
V3DfgSynthesize by default will synthesize roughly the same constructs
as V3DfgAstToDfg used to handle before, plus any logic that is part of a
combinational cycle within the DfgGraph. This enables breaking up these
cycles, for which there are extensions to V3DfgBreakCycles in this patch
as well. V3DfgSynthesize will then delete all non synthesized or non
synthesizable DfgLogic vertices and the rest of the Dfg pipeline is
identical, with minor changes to adjust for the changed representation.
Because with this change we can now eliminate many more UNOPTFLAT, DFG
has been disabled in all the tests that specifically target testing the
scheduling and reporting of circular combinational logic.
2025-08-19 16:06:38 +02:00
|
|
|
V3Cfg.h
|
2023-01-05 11:00:54 +01:00
|
|
|
V3Class.h
|
|
|
|
|
V3Clean.h
|
|
|
|
|
V3Clock.h
|
|
|
|
|
V3Combine.h
|
|
|
|
|
V3Common.h
|
|
|
|
|
V3Const.h
|
2026-03-01 17:59:29 +01:00
|
|
|
V3Container.h
|
|
|
|
|
V3Control.h
|
2023-01-05 11:00:54 +01:00
|
|
|
V3Coverage.h
|
|
|
|
|
V3CoverageJoin.h
|
|
|
|
|
V3Dead.h
|
|
|
|
|
V3Delayed.h
|
|
|
|
|
V3Depth.h
|
|
|
|
|
V3DepthBlock.h
|
|
|
|
|
V3Descope.h
|
|
|
|
|
V3Dfg.h
|
2024-03-06 19:01:52 +01:00
|
|
|
V3DfgCache.h
|
2025-07-26 21:37:01 +02:00
|
|
|
V3DfgContext.h
|
2025-09-07 21:38:50 +02:00
|
|
|
V3DfgDataType.h
|
2023-01-05 11:00:54 +01:00
|
|
|
V3DfgOptimizer.h
|
|
|
|
|
V3DfgPasses.h
|
2024-03-01 13:51:23 +01:00
|
|
|
V3DfgPatternStats.h
|
2025-07-26 21:37:01 +02:00
|
|
|
V3DfgPeepholePatterns.h
|
2023-01-05 11:00:54 +01:00
|
|
|
V3DfgVertices.h
|
2025-05-17 21:46:15 +02:00
|
|
|
V3DiagSarif.h
|
2023-01-05 11:00:54 +01:00
|
|
|
V3DupFinder.h
|
|
|
|
|
V3EmitC.h
|
|
|
|
|
V3EmitCBase.h
|
|
|
|
|
V3EmitCConstInit.h
|
|
|
|
|
V3EmitCFunc.h
|
|
|
|
|
V3EmitCMain.h
|
|
|
|
|
V3EmitMk.h
|
2025-03-12 00:57:21 +01:00
|
|
|
V3EmitMkJson.h
|
2023-01-05 11:00:54 +01:00
|
|
|
V3EmitV.h
|
|
|
|
|
V3Error.h
|
2024-03-10 16:58:58 +01:00
|
|
|
V3ExecGraph.h
|
2023-01-05 11:00:54 +01:00
|
|
|
V3Expand.h
|
|
|
|
|
V3File.h
|
|
|
|
|
V3FileLine.h
|
|
|
|
|
V3Force.h
|
2023-06-14 20:44:53 +02:00
|
|
|
V3Fork.h
|
2024-11-10 16:51:59 +01:00
|
|
|
V3FuncOpt.h
|
2025-05-17 21:46:15 +02:00
|
|
|
V3FunctionTraits.h
|
2023-01-05 11:00:54 +01:00
|
|
|
V3Gate.h
|
|
|
|
|
V3Global.h
|
|
|
|
|
V3Graph.h
|
|
|
|
|
V3GraphAlg.h
|
|
|
|
|
V3GraphPathChecker.h
|
|
|
|
|
V3GraphStream.h
|
|
|
|
|
V3Hash.h
|
|
|
|
|
V3Hasher.h
|
|
|
|
|
V3HierBlock.h
|
|
|
|
|
V3Inline.h
|
2025-12-21 19:14:50 +01:00
|
|
|
V3InlineCFuncs.h
|
2023-01-05 11:00:54 +01:00
|
|
|
V3Inst.h
|
|
|
|
|
V3InstrCount.h
|
2023-10-04 01:55:25 +02:00
|
|
|
V3Interface.h
|
2023-01-05 11:00:54 +01:00
|
|
|
V3LangCode.h
|
|
|
|
|
V3LanguageWords.h
|
|
|
|
|
V3Life.h
|
|
|
|
|
V3LifePost.h
|
2026-02-28 23:20:09 +01:00
|
|
|
V3LiftExpr.h
|
2023-01-05 11:00:54 +01:00
|
|
|
V3LinkCells.h
|
|
|
|
|
V3LinkDot.h
|
2025-12-06 15:42:59 +01:00
|
|
|
V3LinkDotIfaceCapture.h
|
2023-01-05 11:00:54 +01:00
|
|
|
V3LinkInc.h
|
|
|
|
|
V3LinkJump.h
|
|
|
|
|
V3LinkLValue.h
|
2023-10-18 12:07:05 +02:00
|
|
|
V3LinkLevel.h
|
2023-01-05 11:00:54 +01:00
|
|
|
V3LinkParse.h
|
|
|
|
|
V3LinkResolve.h
|
|
|
|
|
V3List.h
|
|
|
|
|
V3Localize.h
|
2023-10-18 12:37:38 +02:00
|
|
|
V3MemberMap.h
|
2023-01-05 11:00:54 +01:00
|
|
|
V3MergeCond.h
|
2023-10-18 12:37:38 +02:00
|
|
|
V3Mutex.h
|
|
|
|
|
V3Name.h
|
2023-01-05 11:00:54 +01:00
|
|
|
V3Name.h
|
|
|
|
|
V3Number.h
|
|
|
|
|
V3OptionParser.h
|
|
|
|
|
V3Options.h
|
|
|
|
|
V3Order.h
|
|
|
|
|
V3OrderGraph.h
|
2025-05-17 21:46:15 +02:00
|
|
|
V3OrderInternal.h
|
2024-03-17 14:15:39 +01:00
|
|
|
V3OrderMoveGraph.h
|
2023-01-05 11:00:54 +01:00
|
|
|
V3Os.h
|
|
|
|
|
V3PairingHeap.h
|
|
|
|
|
V3Param.h
|
|
|
|
|
V3Parse.h
|
|
|
|
|
V3ParseImp.h
|
2023-10-18 12:07:05 +02:00
|
|
|
V3PchAstMT.h
|
|
|
|
|
V3PchAstNoMT.h
|
2024-03-02 15:06:22 +01:00
|
|
|
V3PreExpr.h
|
2023-01-05 11:00:54 +01:00
|
|
|
V3PreLex.h
|
|
|
|
|
V3PreProc.h
|
|
|
|
|
V3PreShell.h
|
2023-10-18 12:07:05 +02:00
|
|
|
V3Premit.h
|
2023-01-05 11:00:54 +01:00
|
|
|
V3ProtectLib.h
|
2025-11-30 15:04:42 +01:00
|
|
|
V3RandSequence.h
|
2023-01-05 11:00:54 +01:00
|
|
|
V3Randomize.h
|
|
|
|
|
V3Reloop.h
|
2026-02-01 06:09:40 +01:00
|
|
|
V3Reorder.h
|
2023-10-18 12:37:38 +02:00
|
|
|
V3Rtti.h
|
2024-07-10 00:31:58 +02:00
|
|
|
V3Sampled.h
|
2023-01-05 11:00:54 +01:00
|
|
|
V3Sched.h
|
|
|
|
|
V3Scope.h
|
|
|
|
|
V3Scoreboard.h
|
|
|
|
|
V3SenExprBuilder.h
|
|
|
|
|
V3SenTree.h
|
|
|
|
|
V3Simulate.h
|
|
|
|
|
V3Slice.h
|
|
|
|
|
V3Split.h
|
|
|
|
|
V3SplitAs.h
|
|
|
|
|
V3SplitVar.h
|
2024-01-06 22:14:58 +01:00
|
|
|
V3StackCount.h
|
2023-01-05 11:00:54 +01:00
|
|
|
V3Stats.h
|
|
|
|
|
V3StdFuture.h
|
|
|
|
|
V3String.h
|
|
|
|
|
V3Subst.h
|
|
|
|
|
V3SymTable.h
|
2023-10-18 12:07:05 +02:00
|
|
|
V3TSP.h
|
2023-01-05 11:00:54 +01:00
|
|
|
V3Table.h
|
|
|
|
|
V3Task.h
|
2023-01-27 16:43:50 +01:00
|
|
|
V3ThreadPool.h
|
2023-01-05 11:00:54 +01:00
|
|
|
V3Timing.h
|
|
|
|
|
V3Trace.h
|
|
|
|
|
V3TraceDecl.h
|
|
|
|
|
V3Tristate.h
|
2025-04-16 12:32:18 +02:00
|
|
|
V3Udp.h
|
2023-01-05 11:00:54 +01:00
|
|
|
V3Undriven.h
|
2026-01-01 16:20:21 +01:00
|
|
|
V3UndrivenCapture.h
|
2023-01-05 11:00:54 +01:00
|
|
|
V3UniqueNames.h
|
|
|
|
|
V3Unknown.h
|
|
|
|
|
V3Unroll.h
|
|
|
|
|
V3VariableOrder.h
|
|
|
|
|
V3Waiver.h
|
|
|
|
|
V3Width.h
|
|
|
|
|
V3WidthCommit.h
|
2023-10-07 05:18:26 +02:00
|
|
|
V3WidthRemove.h
|
2023-01-05 11:00:54 +01:00
|
|
|
VlcBucket.h
|
|
|
|
|
VlcOptions.h
|
|
|
|
|
VlcPoint.h
|
|
|
|
|
VlcSource.h
|
|
|
|
|
VlcTest.h
|
|
|
|
|
VlcTop.h
|
2022-12-21 01:42:27 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
set(COMMON_SOURCES
|
2023-01-05 11:00:54 +01:00
|
|
|
Verilator.cpp
|
|
|
|
|
V3Active.cpp
|
|
|
|
|
V3ActiveTop.cpp
|
|
|
|
|
V3Assert.cpp
|
|
|
|
|
V3AssertPre.cpp
|
2025-11-06 14:42:27 +01:00
|
|
|
V3AssertProp.cpp
|
2023-01-05 11:00:54 +01:00
|
|
|
V3Ast.cpp
|
|
|
|
|
V3AstNodes.cpp
|
|
|
|
|
V3Begin.cpp
|
|
|
|
|
V3Branch.cpp
|
|
|
|
|
V3Broken.cpp
|
2022-12-21 01:42:27 +01:00
|
|
|
V3CCtors.cpp
|
2023-01-02 12:25:50 +01:00
|
|
|
V3CUse.cpp
|
2023-01-05 11:00:54 +01:00
|
|
|
V3Case.cpp
|
|
|
|
|
V3Cast.cpp
|
Optimize complex combinational logic in DFG (#6298)
This patch adds DfgLogic, which is a vertex that represents a whole,
arbitrarily complex combinational AstAlways or AstAssignW in the
DfgGraph.
Implementing this requires computing the variables live at entry to the
AstAlways (variables read by the block), so there is a new
ControlFlowGraph data structure and a classical data-flow analysis based
live variable analysis to do that at the variable level (as opposed to
bit/element level).
The actual CFG construction and live variable analysis is best effort,
and might fail for currently unhandled constructs or data types. This
can be extended later.
V3DfgAstToDfg is changed to convert the Ast into an initial DfgGraph
containing only DfgLogic, DfgVertexSplice and DfgVertexVar vertices.
The DfgLogic are then subsequently synthesized into primitive operations
by the new V3DfgSynthesize pass, which is a combination of the old
V3DfgAstToDfg conversion and new code to handle AstAlways blocks with
complex flow control.
V3DfgSynthesize by default will synthesize roughly the same constructs
as V3DfgAstToDfg used to handle before, plus any logic that is part of a
combinational cycle within the DfgGraph. This enables breaking up these
cycles, for which there are extensions to V3DfgBreakCycles in this patch
as well. V3DfgSynthesize will then delete all non synthesized or non
synthesizable DfgLogic vertices and the rest of the Dfg pipeline is
identical, with minor changes to adjust for the changed representation.
Because with this change we can now eliminate many more UNOPTFLAT, DFG
has been disabled in all the tests that specifically target testing the
scheduling and reporting of circular combinational logic.
2025-08-19 16:06:38 +02:00
|
|
|
V3Cfg.cpp
|
|
|
|
|
V3CfgBuilder.cpp
|
|
|
|
|
V3CfgLiveVariables.cpp
|
2023-01-05 11:00:54 +01:00
|
|
|
V3Class.cpp
|
|
|
|
|
V3Clean.cpp
|
|
|
|
|
V3Clock.cpp
|
|
|
|
|
V3Combine.cpp
|
|
|
|
|
V3Common.cpp
|
2025-06-28 02:38:01 +02:00
|
|
|
V3Control.cpp
|
2023-01-05 11:00:54 +01:00
|
|
|
V3Const__gen.cpp
|
|
|
|
|
V3Coverage.cpp
|
|
|
|
|
V3CoverageJoin.cpp
|
|
|
|
|
V3Dead.cpp
|
|
|
|
|
V3Delayed.cpp
|
|
|
|
|
V3Depth.cpp
|
|
|
|
|
V3DepthBlock.cpp
|
|
|
|
|
V3Descope.cpp
|
|
|
|
|
V3Dfg.cpp
|
|
|
|
|
V3DfgAstToDfg.cpp
|
2025-07-10 19:46:45 +02:00
|
|
|
V3DfgBreakCycles.cpp
|
2024-03-06 19:01:52 +01:00
|
|
|
V3DfgCache.cpp
|
2025-08-05 14:03:30 +02:00
|
|
|
V3DfgColorSCCs.cpp
|
2025-09-03 18:34:55 +02:00
|
|
|
V3DfgCse.cpp
|
2025-09-07 21:38:50 +02:00
|
|
|
V3DfgDataType.cpp
|
2023-01-05 11:00:54 +01:00
|
|
|
V3DfgDecomposition.cpp
|
|
|
|
|
V3DfgDfgToAst.cpp
|
|
|
|
|
V3DfgOptimizer.cpp
|
|
|
|
|
V3DfgPasses.cpp
|
|
|
|
|
V3DfgPeephole.cpp
|
2026-02-07 19:06:12 +01:00
|
|
|
V3DfgPushDownSels.cpp
|
2024-03-02 20:49:29 +01:00
|
|
|
V3DfgRegularize.cpp
|
Optimize complex combinational logic in DFG (#6298)
This patch adds DfgLogic, which is a vertex that represents a whole,
arbitrarily complex combinational AstAlways or AstAssignW in the
DfgGraph.
Implementing this requires computing the variables live at entry to the
AstAlways (variables read by the block), so there is a new
ControlFlowGraph data structure and a classical data-flow analysis based
live variable analysis to do that at the variable level (as opposed to
bit/element level).
The actual CFG construction and live variable analysis is best effort,
and might fail for currently unhandled constructs or data types. This
can be extended later.
V3DfgAstToDfg is changed to convert the Ast into an initial DfgGraph
containing only DfgLogic, DfgVertexSplice and DfgVertexVar vertices.
The DfgLogic are then subsequently synthesized into primitive operations
by the new V3DfgSynthesize pass, which is a combination of the old
V3DfgAstToDfg conversion and new code to handle AstAlways blocks with
complex flow control.
V3DfgSynthesize by default will synthesize roughly the same constructs
as V3DfgAstToDfg used to handle before, plus any logic that is part of a
combinational cycle within the DfgGraph. This enables breaking up these
cycles, for which there are extensions to V3DfgBreakCycles in this patch
as well. V3DfgSynthesize will then delete all non synthesized or non
synthesizable DfgLogic vertices and the rest of the Dfg pipeline is
identical, with minor changes to adjust for the changed representation.
Because with this change we can now eliminate many more UNOPTFLAT, DFG
has been disabled in all the tests that specifically target testing the
scheduling and reporting of circular combinational logic.
2025-08-19 16:06:38 +02:00
|
|
|
V3DfgSynthesize.cpp
|
2025-05-17 21:46:15 +02:00
|
|
|
V3DiagSarif.cpp
|
2023-01-05 11:00:54 +01:00
|
|
|
V3DupFinder.cpp
|
|
|
|
|
V3EmitCBase.cpp
|
|
|
|
|
V3EmitCConstPool.cpp
|
|
|
|
|
V3EmitCFunc.cpp
|
|
|
|
|
V3EmitCHeaders.cpp
|
|
|
|
|
V3EmitCImp.cpp
|
|
|
|
|
V3EmitCInlines.cpp
|
|
|
|
|
V3EmitCMain.cpp
|
|
|
|
|
V3EmitCModel.cpp
|
2023-10-18 14:08:15 +02:00
|
|
|
V3EmitCPch.cpp
|
2023-01-05 11:00:54 +01:00
|
|
|
V3EmitCSyms.cpp
|
|
|
|
|
V3EmitMk.cpp
|
2025-03-12 00:57:21 +01:00
|
|
|
V3EmitMkJson.cpp
|
2023-01-05 11:00:54 +01:00
|
|
|
V3EmitV.cpp
|
|
|
|
|
V3Error.cpp
|
2024-03-10 16:58:58 +01:00
|
|
|
V3ExecGraph.cpp
|
2023-01-05 11:00:54 +01:00
|
|
|
V3Expand.cpp
|
|
|
|
|
V3File.cpp
|
|
|
|
|
V3FileLine.cpp
|
|
|
|
|
V3Force.cpp
|
2023-06-14 20:44:53 +02:00
|
|
|
V3Fork.cpp
|
2024-11-10 16:51:59 +01:00
|
|
|
V3FuncOpt.cpp
|
2023-01-05 11:00:54 +01:00
|
|
|
V3Gate.cpp
|
|
|
|
|
V3Global.cpp
|
|
|
|
|
V3Graph.cpp
|
|
|
|
|
V3GraphAcyc.cpp
|
|
|
|
|
V3GraphAlg.cpp
|
|
|
|
|
V3GraphPathChecker.cpp
|
|
|
|
|
V3GraphTest.cpp
|
|
|
|
|
V3Hash.cpp
|
|
|
|
|
V3Hasher.cpp
|
|
|
|
|
V3HierBlock.cpp
|
|
|
|
|
V3Inline.cpp
|
2025-12-21 19:14:50 +01:00
|
|
|
V3InlineCFuncs.cpp
|
2023-01-05 11:00:54 +01:00
|
|
|
V3Inst.cpp
|
|
|
|
|
V3InstrCount.cpp
|
2023-10-04 01:55:25 +02:00
|
|
|
V3Interface.cpp
|
2025-12-16 17:21:46 +01:00
|
|
|
V3LibMap.cpp
|
2023-01-05 11:00:54 +01:00
|
|
|
V3Life.cpp
|
|
|
|
|
V3LifePost.cpp
|
2026-02-28 23:20:09 +01:00
|
|
|
V3LiftExpr.cpp
|
2023-01-05 11:00:54 +01:00
|
|
|
V3LinkCells.cpp
|
|
|
|
|
V3LinkDot.cpp
|
2025-12-06 15:42:59 +01:00
|
|
|
V3LinkDotIfaceCapture.cpp
|
2023-01-05 11:00:54 +01:00
|
|
|
V3LinkInc.cpp
|
|
|
|
|
V3LinkJump.cpp
|
|
|
|
|
V3LinkLValue.cpp
|
2024-01-06 22:14:58 +01:00
|
|
|
V3LinkLevel.cpp
|
2023-01-05 11:00:54 +01:00
|
|
|
V3LinkParse.cpp
|
|
|
|
|
V3LinkResolve.cpp
|
|
|
|
|
V3Localize.cpp
|
|
|
|
|
V3MergeCond.cpp
|
|
|
|
|
V3Name.cpp
|
|
|
|
|
V3Number.cpp
|
|
|
|
|
V3OptionParser.cpp
|
|
|
|
|
V3Options.cpp
|
|
|
|
|
V3Order.cpp
|
2024-03-07 23:12:19 +01:00
|
|
|
V3OrderGraphBuilder.cpp
|
2024-03-17 14:15:39 +01:00
|
|
|
V3OrderMoveGraph.cpp
|
2024-03-09 13:43:09 +01:00
|
|
|
V3OrderParallel.cpp
|
|
|
|
|
V3OrderProcessDomains.cpp
|
|
|
|
|
V3OrderSerial.cpp
|
2023-01-05 11:00:54 +01:00
|
|
|
V3Os.cpp
|
|
|
|
|
V3Param.cpp
|
2025-05-17 21:46:15 +02:00
|
|
|
V3ParseGrammar.cpp
|
|
|
|
|
V3ParseImp.cpp
|
|
|
|
|
V3ParseLex.cpp
|
|
|
|
|
V3PreProc.cpp
|
2023-01-05 11:00:54 +01:00
|
|
|
V3PreShell.cpp
|
|
|
|
|
V3Premit.cpp
|
|
|
|
|
V3ProtectLib.cpp
|
2025-11-30 15:04:42 +01:00
|
|
|
V3RandSequence.cpp
|
2023-01-05 11:00:54 +01:00
|
|
|
V3Randomize.cpp
|
|
|
|
|
V3Reloop.cpp
|
2026-02-01 06:09:40 +01:00
|
|
|
V3Reorder.cpp
|
2024-07-10 00:31:58 +02:00
|
|
|
V3Sampled.cpp
|
2023-01-05 11:00:54 +01:00
|
|
|
V3Sched.cpp
|
|
|
|
|
V3SchedAcyclic.cpp
|
|
|
|
|
V3SchedPartition.cpp
|
|
|
|
|
V3SchedReplicate.cpp
|
|
|
|
|
V3SchedTiming.cpp
|
2025-10-27 16:16:28 +01:00
|
|
|
V3SchedTrigger.cpp
|
|
|
|
|
V3SchedUtil.cpp
|
2023-12-05 04:11:07 +01:00
|
|
|
V3SchedVirtIface.cpp
|
2023-01-05 11:00:54 +01:00
|
|
|
V3Scope.cpp
|
|
|
|
|
V3Scoreboard.cpp
|
|
|
|
|
V3Slice.cpp
|
|
|
|
|
V3Split.cpp
|
|
|
|
|
V3SplitAs.cpp
|
|
|
|
|
V3SplitVar.cpp
|
2024-01-06 22:14:58 +01:00
|
|
|
V3StackCount.cpp
|
2023-01-05 11:00:54 +01:00
|
|
|
V3Stats.cpp
|
|
|
|
|
V3StatsReport.cpp
|
|
|
|
|
V3String.cpp
|
|
|
|
|
V3Subst.cpp
|
2025-05-17 21:46:15 +02:00
|
|
|
V3TSP.cpp
|
2023-01-05 11:00:54 +01:00
|
|
|
V3Table.cpp
|
|
|
|
|
V3Task.cpp
|
2023-01-27 16:43:50 +01:00
|
|
|
V3ThreadPool.cpp
|
2025-05-17 21:46:15 +02:00
|
|
|
V3Timing.cpp
|
2023-01-05 11:00:54 +01:00
|
|
|
V3Trace.cpp
|
|
|
|
|
V3TraceDecl.cpp
|
|
|
|
|
V3Tristate.cpp
|
2025-04-16 12:32:18 +02:00
|
|
|
V3Udp.cpp
|
2023-01-05 11:00:54 +01:00
|
|
|
V3Undriven.cpp
|
2026-01-01 16:20:21 +01:00
|
|
|
V3UndrivenCapture.cpp
|
2023-01-05 11:00:54 +01:00
|
|
|
V3Unknown.cpp
|
|
|
|
|
V3Unroll.cpp
|
2025-09-29 16:25:25 +02:00
|
|
|
V3UnrollGen.cpp
|
2023-01-05 11:00:54 +01:00
|
|
|
V3VariableOrder.cpp
|
|
|
|
|
V3Waiver.cpp
|
|
|
|
|
V3Width.cpp
|
2023-10-07 05:18:26 +02:00
|
|
|
V3WidthCommit.cpp
|
2023-01-05 11:00:54 +01:00
|
|
|
V3WidthSel.cpp
|
2022-12-21 01:42:27 +01:00
|
|
|
)
|
|
|
|
|
|
2024-09-25 02:43:19 +02:00
|
|
|
set(COVERAGE_SOURCES VlcMain.cpp)
|
2022-12-21 01:42:27 +01:00
|
|
|
|
|
|
|
|
# Note about tests:
|
|
|
|
|
# VlcMain.cpp #includes the following files:
|
|
|
|
|
# V3Error.cpp, V3String.cpp, V3Os.cpp and VlcTop.cpp
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Generated sources and headers for the verilator binary
|
|
|
|
|
|
|
|
|
|
set(srcdir ${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
|
|
|
|
|
|
file(TO_NATIVE_PATH ${srcdir}/astgen ASTGEN)
|
|
|
|
|
file(TO_NATIVE_PATH ${srcdir}/bisonpre BISONPRE)
|
|
|
|
|
file(TO_NATIVE_PATH ${srcdir}/flexfix FLEXFIX)
|
|
|
|
|
file(TO_NATIVE_PATH ${srcdir}/../bin/verilator_includer VERILATOR_INCLUDER)
|
|
|
|
|
file(TO_NATIVE_PATH ${srcdir}/vlcovgen VLCOVGEN)
|
|
|
|
|
file(TO_NATIVE_PATH ${srcdir}/config_rev CONFIG_REV)
|
|
|
|
|
|
2023-07-27 11:42:35 +02:00
|
|
|
configure_file(config_package.h.in config_package.h @ONLY)
|
2022-12-21 01:42:27 +01:00
|
|
|
|
|
|
|
|
add_custom_command(
|
|
|
|
|
OUTPUT V3Ast__gen_forward_class_decls.h V3Dfg__gen_forward_class_decls.h
|
|
|
|
|
DEPENDS ./V3Ast.h ${ASTGEN}
|
2024-09-25 02:43:19 +02:00
|
|
|
COMMAND ${PYTHON3}
|
|
|
|
|
ARGS
|
|
|
|
|
${ASTGEN} -I "${srcdir}" --astdef V3AstNodeDType.h --astdef
|
2025-08-16 10:46:18 +02:00
|
|
|
V3AstNodeExpr.h --astdef V3AstNodeOther.h --astdef V3AstNodeStmt.h
|
|
|
|
|
--dfgdef V3DfgVertices.h --classes
|
2024-09-25 02:43:19 +02:00
|
|
|
)
|
|
|
|
|
list(
|
2025-11-08 16:57:16 +01:00
|
|
|
APPEND GENERATED_FILES
|
2024-09-25 02:43:19 +02:00
|
|
|
V3Ast__gen_forward_class_decls.h
|
|
|
|
|
V3Dfg__gen_forward_class_decls.h
|
2022-12-21 01:42:27 +01:00
|
|
|
)
|
|
|
|
|
# Output used directly by the `verilator` target
|
|
|
|
|
|
2024-09-25 02:43:19 +02:00
|
|
|
set(verilog_y "${srcdir}/verilog.y")
|
|
|
|
|
set(BISON_V3ParseBison_OUTPUT_HEADER
|
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/V3ParseBison.h"
|
|
|
|
|
)
|
|
|
|
|
set(BISON_V3ParseBison_OUTPUT_SOURCE
|
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/V3ParseBison.c"
|
|
|
|
|
)
|
2022-12-21 01:42:27 +01:00
|
|
|
add_custom_command(
|
|
|
|
|
OUTPUT V3ParseBison.c V3ParseBison.h
|
|
|
|
|
MAIN_DEPENDENCY ./verilog.y
|
|
|
|
|
DEPENDS ${BISONPRE}
|
2024-09-25 02:43:19 +02:00
|
|
|
COMMAND ${PYTHON3}
|
|
|
|
|
ARGS
|
|
|
|
|
${BISONPRE} --yacc "${BISON_EXECUTABLE}" -d -v -o
|
|
|
|
|
"${BISON_V3ParseBison_OUTPUT_SOURCE}" "${verilog_y}"
|
2022-12-21 01:42:27 +01:00
|
|
|
)
|
|
|
|
|
list(APPEND GENERATED_FILES V3ParseBison.c V3ParseBison.h)
|
|
|
|
|
# Output used directly by the `verilator` target
|
|
|
|
|
|
|
|
|
|
set(verilog_l "${srcdir}/verilog.l")
|
2024-09-25 02:43:19 +02:00
|
|
|
set(FLEX_V3Lexer_pregen_OUTPUTS
|
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/V3Lexer_pregen.yy.cpp"
|
|
|
|
|
)
|
2022-12-21 01:42:27 +01:00
|
|
|
add_custom_command(
|
|
|
|
|
OUTPUT V3Lexer_pregen.yy.cpp
|
|
|
|
|
MAIN_DEPENDENCY ./verilog.l
|
|
|
|
|
DEPENDS ${BISON_V3ParseBison_OUTPUT_HEADER} ${HEADERS}
|
2024-09-25 02:43:19 +02:00
|
|
|
COMMAND ${FLEX_EXECUTABLE}
|
|
|
|
|
ARGS ${LFLAGS} -o "${FLEX_V3Lexer_pregen_OUTPUTS}" "${verilog_l}"
|
2022-12-21 01:42:27 +01:00
|
|
|
)
|
|
|
|
|
# Output used by another command
|
|
|
|
|
|
|
|
|
|
set(FLEX_V3Lexer_OUTPUTS ${CMAKE_CURRENT_BINARY_DIR}/V3Lexer.yy.cpp)
|
|
|
|
|
add_custom_command(
|
|
|
|
|
OUTPUT V3Lexer.yy.cpp
|
|
|
|
|
MAIN_DEPENDENCY ${FLEX_V3Lexer_pregen_OUTPUTS}
|
|
|
|
|
DEPENDS ${FLEXFIX}
|
2024-09-25 02:43:19 +02:00
|
|
|
COMMAND ${PYTHON3}
|
|
|
|
|
ARGS
|
|
|
|
|
${FLEXFIX} V3Lexer < "$<SHELL_PATH:${FLEX_V3Lexer_pregen_OUTPUTS}>" >
|
|
|
|
|
"$<SHELL_PATH:${FLEX_V3Lexer_OUTPUTS}>"
|
|
|
|
|
)
|
|
|
|
|
add_custom_target(
|
|
|
|
|
V3Lexer_yy_cpp${CMAKE_BUILD_TYPE}
|
|
|
|
|
DEPENDS ${FLEX_V3Lexer_OUTPUTS}
|
2022-12-21 01:42:27 +01:00
|
|
|
)
|
|
|
|
|
# Output included by another source file
|
|
|
|
|
|
2024-09-25 02:43:19 +02:00
|
|
|
set(FLEX_V3PreLex_pregen_OUTPUTS
|
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/V3PreLex_pregen.yy.cpp
|
|
|
|
|
)
|
2022-12-21 01:42:27 +01:00
|
|
|
add_custom_command(
|
|
|
|
|
OUTPUT V3PreLex_pregen.yy.cpp
|
|
|
|
|
MAIN_DEPENDENCY ./V3PreLex.l
|
|
|
|
|
DEPENDS ${HEADERS}
|
2024-09-25 02:43:19 +02:00
|
|
|
COMMAND ${FLEX_EXECUTABLE}
|
|
|
|
|
ARGS ${LFLAGS} -o "${FLEX_V3PreLex_pregen_OUTPUTS}" "${srcdir}/V3PreLex.l"
|
2022-12-21 01:42:27 +01:00
|
|
|
)
|
|
|
|
|
# Output used by another command
|
|
|
|
|
|
|
|
|
|
set(FLEX_V3PreLex_OUTPUTS ${CMAKE_CURRENT_BINARY_DIR}/V3PreLex.yy.cpp)
|
|
|
|
|
add_custom_command(
|
|
|
|
|
OUTPUT V3PreLex.yy.cpp
|
|
|
|
|
MAIN_DEPENDENCY ${FLEX_V3PreLex_pregen_OUTPUTS}
|
|
|
|
|
DEPENDS ${FLEXFIX}
|
2024-09-25 02:43:19 +02:00
|
|
|
COMMAND ${PYTHON3}
|
|
|
|
|
ARGS
|
|
|
|
|
${FLEXFIX} V3PreLex < "$<SHELL_PATH:${FLEX_V3PreLex_pregen_OUTPUTS}>" >
|
|
|
|
|
"$<SHELL_PATH:${FLEX_V3PreLex_OUTPUTS}>"
|
|
|
|
|
)
|
|
|
|
|
add_custom_target(
|
|
|
|
|
V3PreLex_yy_cpp${CMAKE_BUILD_TYPE}
|
|
|
|
|
DEPENDS ${FLEX_V3PreLex_OUTPUTS}
|
2022-12-21 01:42:27 +01:00
|
|
|
)
|
|
|
|
|
# Output included by another source file
|
|
|
|
|
|
|
|
|
|
set(gitHead ${srcdir}/../.git/logs/HEAD)
|
2024-09-25 02:43:19 +02:00
|
|
|
if(NOT EXISTS ${githead})
|
2022-12-21 01:42:27 +01:00
|
|
|
set(gitHead "")
|
|
|
|
|
endif()
|
|
|
|
|
add_custom_command(
|
|
|
|
|
OUTPUT config_rev.h
|
|
|
|
|
MAIN_DEPENDENCY ${gitHead}
|
|
|
|
|
DEPENDS ${CONFIG_REV}
|
2024-09-25 02:43:19 +02:00
|
|
|
COMMAND ${PYTHON3}
|
|
|
|
|
ARGS
|
|
|
|
|
${CONFIG_REV} "${srcdir}" >
|
|
|
|
|
"$<SHELL_PATH:${CMAKE_CURRENT_BINARY_DIR}/config_rev.h>"
|
2022-12-21 01:42:27 +01:00
|
|
|
)
|
|
|
|
|
list(APPEND GENERATED_FILES config_rev.h)
|
|
|
|
|
# Output used directly by the `verilator` target
|
|
|
|
|
|
2024-09-25 02:43:19 +02:00
|
|
|
set(ASTGENERATED_NAMES V3Const)
|
2022-12-21 01:42:27 +01:00
|
|
|
|
|
|
|
|
foreach(astgen_name ${ASTGENERATED_NAMES})
|
|
|
|
|
add_custom_command(
|
|
|
|
|
OUTPUT ${astgen_name}__gen.cpp
|
|
|
|
|
MAIN_DEPENDENCY ${astgen_name}.cpp
|
|
|
|
|
DEPENDS ${ASTGEN} V3Ast.h
|
2024-09-25 02:43:19 +02:00
|
|
|
COMMAND ${PYTHON3}
|
|
|
|
|
ARGS
|
|
|
|
|
${ASTGEN} -I "${srcdir}" --astdef V3AstNodeDType.h --astdef
|
2025-08-16 10:46:18 +02:00
|
|
|
V3AstNodeExpr.h --astdef V3AstNodeOther.h --astdef V3AstNodeStmt.h
|
|
|
|
|
--dfgdef V3DfgVertices.h ${astgen_name}.cpp
|
2022-12-21 01:42:27 +01:00
|
|
|
)
|
|
|
|
|
list(APPEND GENERATED_FILES ${astgen_name}__gen.cpp)
|
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Set up the Coverage build type
|
|
|
|
|
|
2024-09-25 02:43:19 +02:00
|
|
|
addbuildtype(DEBUG COVERAGE)
|
2022-12-21 01:42:27 +01:00
|
|
|
|
|
|
|
|
# This regenerates include/verilated_cov_key.h in the source tree.
|
|
|
|
|
# It is a custom_target, not custom_command, because vlcovgen.d is
|
|
|
|
|
# a phony target (it doesn't exist as a file).
|
|
|
|
|
add_custom_target(
|
|
|
|
|
vlcovgen.d${CMAKE_BUILD_TYPE}
|
|
|
|
|
DEPENDS ../include/verilated_cov_key.h ${VLCOVGEN}
|
|
|
|
|
COMMENT "Updating include/verilated_cov_key.h"
|
2024-09-25 02:43:19 +02:00
|
|
|
COMMAND ${PYTHON3} ${VLCOVGEN} --srcdir ${srcdir}
|
2022-12-21 01:42:27 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Set up the verilator binary target
|
|
|
|
|
|
|
|
|
|
set(verilator verilator${CMAKE_BUILD_TYPE})
|
|
|
|
|
|
2024-09-25 02:43:19 +02:00
|
|
|
add_executable(
|
|
|
|
|
${verilator}
|
2022-12-21 01:42:27 +01:00
|
|
|
$<$<NOT:$<CONFIG:COVERAGE>>:${COMMON_SOURCES}>
|
|
|
|
|
$<$<NOT:$<CONFIG:COVERAGE>>:${GENERATED_FILES}>
|
2024-09-25 02:43:19 +02:00
|
|
|
$<$<CONFIG:COVERAGE>:${COVERAGE_SOURCES}
|
|
|
|
|
config_rev.h>
|
2022-12-21 01:42:27 +01:00
|
|
|
)
|
|
|
|
|
|
2024-09-25 02:43:19 +02:00
|
|
|
set_target_properties(
|
|
|
|
|
${verilator}
|
|
|
|
|
PROPERTIES
|
|
|
|
|
OUTPUT_NAME_RELEASE verilator_bin
|
|
|
|
|
OUTPUT_NAME_DEBUG verilator_bin_dbg
|
|
|
|
|
OUTPUT_NAME_COVERAGE verilator_coverage_bin_dbg
|
|
|
|
|
#UNITY_BUILD $<IF:$<CONFIG:DEBUG>,FALSE,${CMAKE_UNITY_BUILD}>
|
|
|
|
|
MSVC_RUNTIME_LIBRARY MultiThreaded$<IF:$<CONFIG:Release>,,DebugDLL>
|
|
|
|
|
#JOB_POOL_LINK one_job # Linking takes lots of resources
|
|
|
|
|
INTERPROCEDURAL_OPTIMIZATION_RELEASE $<IF:MINGW,FALSE,TRUE>
|
|
|
|
|
INCLUDE_DIRECTORIES ${FLEX_INCLUDE_DIR}
|
2022-12-21 01:42:27 +01:00
|
|
|
)
|
|
|
|
|
|
2024-09-25 02:43:19 +02:00
|
|
|
add_dependencies(
|
|
|
|
|
${verilator}
|
2022-12-21 01:42:27 +01:00
|
|
|
V3Lexer_yy_cpp${CMAKE_BUILD_TYPE}
|
|
|
|
|
V3PreLex_yy_cpp${CMAKE_BUILD_TYPE}
|
|
|
|
|
)
|
|
|
|
|
|
2024-06-21 16:34:11 +02:00
|
|
|
target_link_libraries(${verilator} PRIVATE Threads::Threads)
|
|
|
|
|
|
2022-12-21 01:42:27 +01:00
|
|
|
# verilated_cov_key.h is only regenerated in a single-configuration environment.
|
|
|
|
|
# This limitation can be lifted when `add_dependencies` will support generator
|
|
|
|
|
# expressions. See https://gitlab.kitware.com/cmake/cmake/issues/19467
|
2024-09-25 02:43:19 +02:00
|
|
|
if(CMAKE_BUILD_TYPE STREQUAL Coverage)
|
2022-12-21 01:42:27 +01:00
|
|
|
add_dependencies(${verilator} vlcovgen.d${CMAKE_BUILD_TYPE})
|
|
|
|
|
endif()
|
|
|
|
|
|
2024-09-25 02:43:19 +02:00
|
|
|
if(NOT MSVC)
|
2022-12-21 01:42:27 +01:00
|
|
|
target_compile_features(${verilator} PRIVATE cxx_std_11)
|
|
|
|
|
endif()
|
|
|
|
|
|
2024-09-25 02:43:19 +02:00
|
|
|
target_compile_definitions(
|
|
|
|
|
${verilator}
|
|
|
|
|
PRIVATE
|
|
|
|
|
YYDEBUG # Required to get nice error messages
|
|
|
|
|
$<$<CONFIG:DEBUG>:VL_DEBUG>
|
|
|
|
|
$<$<CONFIG:DEBUG>:_GLIBCXX_DEBUG>
|
2022-12-21 01:42:27 +01:00
|
|
|
)
|
|
|
|
|
|
2024-09-25 02:43:19 +02:00
|
|
|
target_include_directories(
|
|
|
|
|
${verilator}
|
2022-12-21 01:42:27 +01:00
|
|
|
PRIVATE
|
2024-09-25 02:43:19 +02:00
|
|
|
../include
|
|
|
|
|
${WIN_FLEX_BISON}
|
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/../include
|
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
2022-12-21 01:42:27 +01:00
|
|
|
)
|
|
|
|
|
|
2024-09-25 02:43:19 +02:00
|
|
|
if(WIN32)
|
2023-11-08 12:27:56 +01:00
|
|
|
if(MINGW)
|
|
|
|
|
target_compile_options(${verilator} PRIVATE -Wa,-mbig-obj)
|
2024-09-25 02:43:19 +02:00
|
|
|
target_link_options(
|
|
|
|
|
${verilator}
|
|
|
|
|
PRIVATE
|
|
|
|
|
-Wl,--stack,10000000
|
|
|
|
|
-mconsole
|
|
|
|
|
-lcomctl32
|
|
|
|
|
-DWIN_32_LEAN_AND_MEAN
|
|
|
|
|
)
|
2023-11-08 12:27:56 +01:00
|
|
|
else()
|
|
|
|
|
target_compile_options(${verilator} PRIVATE /bigobj)
|
|
|
|
|
target_link_options(${verilator} PRIVATE /STACK:10000000)
|
|
|
|
|
endif()
|
|
|
|
|
|
2024-09-25 02:43:19 +02:00
|
|
|
target_compile_definitions(${verilator} PRIVATE YY_NO_UNISTD_H)
|
2022-12-21 01:42:27 +01:00
|
|
|
target_include_directories(${verilator} PRIVATE ../platform/win32)
|
|
|
|
|
target_link_libraries(${verilator} PRIVATE bcrypt psapi)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
install(TARGETS ${verilator})
|