address review: checkd macro, emitv visit for AstSClocked, comment trim, cleanOut bool

This commit is contained in:
Yilou Wang 2026-06-17 21:00:53 +02:00
parent b8bab5093c
commit 80f4ac6d77
6 changed files with 36 additions and 13 deletions

View File

@ -2014,9 +2014,7 @@ class AssertNfaVisitor final : public VNVisitor {
VL_DO_DANGLING(pushDeletep(innerPropp), innerPropp); VL_DO_DANGLING(pushDeletep(innerPropp), innerPropp);
} }
// Hoist a leading clocking event (IEEE 1800-2023 16.7: // Hoist a leading clocking event (IEEE 1800-2023 16.7):
// sequence_expr ::= clocking_event sequence_expr) from the sequence body onto
// the enclosing assertion clock. Returns true if E_UNSUPPORTED was emitted.
bool hoistClockedSeq(AstPropSpec* specp) { bool hoistClockedSeq(AstPropSpec* specp) {
while (AstSClocked* const clockedp = VN_CAST(specp->propp(), SClocked)) { while (AstSClocked* const clockedp = VN_CAST(specp->propp(), SClocked)) {
if (specp->sensesp()) { if (specp->sensesp()) {

View File

@ -2240,7 +2240,7 @@ public:
ASTGEN_MEMBERS_AstSClocked; ASTGEN_MEMBERS_AstSClocked;
string emitVerilog() override { V3ERROR_NA_RETURN(""); } string emitVerilog() override { V3ERROR_NA_RETURN(""); }
string emitC() override { V3ERROR_NA_RETURN(""); } string emitC() override { V3ERROR_NA_RETURN(""); }
bool cleanOut() const override { V3ERROR_NA_RETURN(""); } bool cleanOut() const override { V3ERROR_NA_RETURN(false); }
}; };
class AstSConsRep final : public AstNodeExpr { class AstSConsRep final : public AstNodeExpr {
// Consecutive repetition [*N], [*N:M], [+], [*] (IEEE 1800-2023 16.9.2) // Consecutive repetition [*N], [*N:M], [+], [*] (IEEE 1800-2023 16.9.2)

View File

@ -1142,6 +1142,13 @@ class EmitVBaseVisitorConst VL_NOT_FINAL : public VNVisitorConst {
puts(") "); puts(") ");
iterateConst(nodep->propp()); iterateConst(nodep->propp());
} }
void visit(AstSClocked* nodep) override {
puts("@(");
iterateConst(nodep->sensesp());
puts(") ");
iterateConst(nodep->exprp());
puts("\n");
}
void visit(AstPropAlways* nodep) override { void visit(AstPropAlways* nodep) override {
puts(nodep->isStrong() ? "s_always" : "always"); puts(nodep->isStrong() ? "s_always" : "always");
if (!VN_IS(nodep->loBoundp(), Unbounded) || !VN_IS(nodep->hiBoundp(), Unbounded)) { if (!VN_IS(nodep->loBoundp(), Unbounded) || !VN_IS(nodep->hiBoundp(), Unbounded)) {

View File

@ -4,6 +4,11 @@
// SPDX-FileCopyrightText: 2026 PlanV GmbH // SPDX-FileCopyrightText: 2026 PlanV GmbH
// SPDX-License-Identifier: CC0-1.0 // SPDX-License-Identifier: CC0-1.0
// verilog_format: off
`define stop $stop
`define checkd(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got=%0d exp=%0d (%s !== %s)\n", `__FILE__,`__LINE__, (gotv), (expv), `"gotv`", `"expv`"); `stop; end while(0);
// verilog_format: on
module t ( module t (
input clk input clk
); );
@ -39,15 +44,10 @@ module t (
end end
// Counts read in final (Postponed) to avoid same-timestep races. // Counts read in final (Postponed) to avoid same-timestep races.
// Concrete Verilator counts; cross-checked equal in Questa 2022.3 // Concrete Verilator counts; Questa: fails_single=17 fails_multi=17
// on the self-clocked equivalent (same CRC stimulus).
// Questa: fails_single=17 fails_multi=17
final begin final begin
if (fails_single == 17 && fails_multi == 17) begin `checkd(fails_single, 17);
$write("*-* All Finished *-*\n"); `checkd(fails_multi, 17);
end else begin $write("*-* All Finished *-*\n");
$write("FAILED fails_single=%0d fails_multi=%0d\n", fails_single, fails_multi);
$stop;
end
end end
endmodule endmodule

View File

@ -364,6 +364,16 @@ module Vt_debug_emitv_t;
release sum; release sum;
end end
end end
sequence s_clocked;
@(posedge clk) in
endsequence
begin : assert_seq_clocked
assert property ( s_clocked()
) begin
end
else begin
end
end
property p; property p;
@(posedge clk) ##1 sum[0] @(posedge clk) ##1 sum[0]
endproperty endproperty

View File

@ -286,6 +286,14 @@ module t (/*AUTOARG*/
release sum; release sum;
end end
// verilog_format: off // verible does not support clocking events inside sequence declarations
sequence s_clocked;
@(posedge clk) in
endsequence
// verilog_format: on
assert_seq_clocked: assert property (s_clocked);
property p; property p;
@(posedge clk) ##1 sum[0] @(posedge clk) ##1 sum[0]
endproperty endproperty