Support delays in emitted Verilog (#6177)

This commit is contained in:
Artur Bieniek 2025-07-16 17:52:56 +02:00 committed by GitHub
parent 1bf24c7eb4
commit abd509ce53
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 19 additions and 2 deletions

View File

@ -922,6 +922,20 @@ class EmitVBaseVisitorConst VL_NOT_FINAL : public EmitCBaseVisitorConst {
m_sensesp = nodep->sensesp();
iterateAndNextConstNull(nodep->stmtsp());
}
void visit(AstDelay* nodep) override {
puts(""); // this is for proper alignment
puts("#");
iterateConst(nodep->lhsp());
puts(";\n");
iterateAndNextConstNull(nodep->stmtsp());
}
void visit(AstCAwait* nodep) override {
AstCMethodHard* methodp = VN_CAST(nodep->exprp(), CMethodHard);
UASSERT_OBJ(methodp, nodep, "AstCAwait expression must be an AstCMethodHard");
puts(""); // this is for proper alignment
puts("#");
iterateConst(methodp->pinsp());
}
void visit(AstParseRef* nodep) override { puts(nodep->prettyName()); }
void visit(AstNodeText*) override {}
void visit(AstVarScope*) override {}

View File

@ -74,6 +74,8 @@ module Vt_debug_emitv_t;
if (the_ifaces[2].ifsig) begin
$write("");
end
#64'h1;
$write("After #1 delay");
end
end
bit [6:5] [4:3] [2:1] arraymanyd[10:11][12:13][14:15];

View File

@ -14,7 +14,7 @@ test.scenarios("vlt")
test.lint(
# We also have dump-tree turned on, so hit a lot of AstNode*::dump() functions
# Likewise XML
v_flags=["--lint-only --dumpi-tree 9 --dumpi-V3EmitV 9 --debug-emitv"])
v_flags=["--lint-only --dumpi-tree 9 --dumpi-V3EmitV 9 --debug-emitv --timing"])
output_vs = test.glob_some(test.obj_dir + "/" + test.vm_prefix + "_*_width.tree.v")

View File

@ -86,6 +86,7 @@ module t (/*AUTOARG*/
if (|downto_32[55+:3]) $write("");
if (|downto_32[60-:7]) $write("");
if (the_ifaces[2].ifsig) $write("");
#1 $write("After #1 delay");
end
bit [6:5][4:3][2:1] arraymanyd[10:11][12:13][14:15];

View File

@ -15,6 +15,6 @@ test.top_filename = "t/t_debug_emitv.v"
test.lint(
# We also have dump-tree turned on, so hit a lot of AstNode*::dump() functions
# Likewise XML
v_flags=["--lint-only --dumpi-tree 9 --dump-tree-addrids"])
v_flags=["--lint-only --dumpi-tree 9 --dump-tree-addrids --timing"])
test.passes()