2022-11-12 15:14:32 +01:00
|
|
|
// DESCRIPTION: Verilator: Verilog Test module
|
|
|
|
|
//
|
|
|
|
|
// This file ONLY is placed under the Creative Commons Public Domain, for
|
|
|
|
|
// any use, without warranty, 2022 by Geza Lore.
|
|
|
|
|
// SPDX-License-Identifier: CC0-1.0
|
|
|
|
|
|
|
|
|
|
`default_nettype none
|
|
|
|
|
|
|
|
|
|
module t(
|
2025-07-21 18:33:12 +02:00
|
|
|
input wire [10:0] i,
|
|
|
|
|
input wire [10:0] j [4],
|
|
|
|
|
input wire [10:0] k [4],
|
|
|
|
|
|
2022-11-12 15:14:32 +01:00
|
|
|
output wire [10:0] o
|
|
|
|
|
);
|
|
|
|
|
logic [10:0] a;
|
|
|
|
|
assign a[3:0] = i[3:0];
|
|
|
|
|
assign a[4:1] = ~i[4:1];
|
|
|
|
|
assign a[3] = ~i[3];
|
|
|
|
|
assign a[8:5] = i[8:5];
|
|
|
|
|
assign a[7:6] = ~i[7:6];
|
|
|
|
|
assign a[9] = i[9];
|
|
|
|
|
assign a[9] = ~i[9];
|
|
|
|
|
assign a[10] = i[10];
|
2025-07-21 18:33:12 +02:00
|
|
|
|
|
|
|
|
logic [10:0] u [4];
|
|
|
|
|
assign u = j;
|
|
|
|
|
assign u = k;
|
|
|
|
|
|
|
|
|
|
logic [10:0] v [4];
|
|
|
|
|
assign v = j;
|
|
|
|
|
assign v[1] = i;
|
|
|
|
|
|
|
|
|
|
logic [10:0] w [4];
|
|
|
|
|
assign w[0] = i;
|
|
|
|
|
assign w = j;
|
|
|
|
|
|
|
|
|
|
logic [10:0] x [4];
|
|
|
|
|
assign x[3] = i;
|
|
|
|
|
assign x[3][3:2] = ~i[1:0];
|
|
|
|
|
// No warning for w[2]!
|
|
|
|
|
assign x[2][3:2] = ~i[1:0];
|
|
|
|
|
assign x[2][1:0] = ~i[1:0];
|
|
|
|
|
|
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
|
|
|
logic [10:0] y;
|
|
|
|
|
always_comb begin
|
|
|
|
|
y = i;
|
|
|
|
|
{y[1:0], y[2:1]} = i[3:0] + 4'd5;
|
|
|
|
|
end
|
2025-07-21 18:33:12 +02:00
|
|
|
|
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
|
|
|
logic [10:0] z;
|
|
|
|
|
always_comb begin
|
|
|
|
|
z[2:0] = i[2:0];
|
|
|
|
|
z[7:5] = i[7:5];
|
|
|
|
|
end
|
|
|
|
|
always_comb begin
|
|
|
|
|
z[6:4] = i[6:4];
|
|
|
|
|
z[3:1] = i[3:1];
|
|
|
|
|
end
|
|
|
|
|
assign z[10:7] = i[10:7];
|
|
|
|
|
|
|
|
|
|
sub sub_1(i);
|
|
|
|
|
assign sub_1.a = i;
|
|
|
|
|
|
|
|
|
|
sub sub_2(i);
|
|
|
|
|
assign sub_2.a[10:5] = i[10:5];
|
|
|
|
|
assign sub_2.a[3:0] = i[3:0];
|
|
|
|
|
|
|
|
|
|
assign o = a ^ u[3] ^ v[3] ^ w[3] ^ x[3] ^ y ^ z ^ sub_1.a ^ sub_2.a;
|
|
|
|
|
|
|
|
|
|
endmodule
|
|
|
|
|
|
|
|
|
|
module sub(input wire [10:0] i);
|
|
|
|
|
logic [10:0] a;
|
|
|
|
|
assign a[5:2] = i[5:2];
|
2022-11-12 15:14:32 +01:00
|
|
|
endmodule
|