From 44750602686c6e31ed30f5e91fa15a047a985216 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Tue, 27 Oct 2015 20:37:52 -0400 Subject: [PATCH] Ignore %l in , bug983. --- Changes | 2 ++ src/V3Const.cpp | 1 + src/V3EmitC.cpp | 6 +++++- src/V3LinkResolve.cpp | 3 +++ src/V3Width.cpp | 1 + test_regress/t/t_display_l.pl | 18 ++++++++++++++++++ test_regress/t/t_display_l.v | 15 +++++++++++++++ 7 files changed, 45 insertions(+), 1 deletion(-) create mode 100755 test_regress/t/t_display_l.pl create mode 100644 test_regress/t/t_display_l.v diff --git a/Changes b/Changes index 329a565f3..9c6a3557e 100644 --- a/Changes +++ b/Changes @@ -15,6 +15,8 @@ indicates the contributor was also the author of the fix; Thanks! **** Add VerilatedScopeNameMap for introspection, bug966. [Todd Strader] +**** Ignore %l in $display, bug983. [Todd Strader] + **** Fix very long module names, bug937. [Todd Strader] **** Fix internal error on dotted refs into generates, bug958. [Jie Xu] diff --git a/src/V3Const.cpp b/src/V3Const.cpp index ed757d855..594dfc285 100644 --- a/src/V3Const.cpp +++ b/src/V3Const.cpp @@ -1846,6 +1846,7 @@ private: switch (tolower(ch)) { case '%': break; // %% - just output a % case 'm': break; // %m - auto insert "name" + case 'l': break; // %m - auto insert "library" default: // Most operators, just move to next argument if (argp) { AstNode* nextp=argp->nextp(); diff --git a/src/V3EmitC.cpp b/src/V3EmitC.cpp index 63d32492d..465c32c29 100644 --- a/src/V3EmitC.cpp +++ b/src/V3EmitC.cpp @@ -1358,9 +1358,13 @@ void EmitCStmts::displayNode(AstNode* nodep, AstScopeName* scopenamep, emitDispState.pushFormat(suffix); break; } + case 'l': { + // Better than not compiling + emitDispState.pushFormat("----"); + break; + } case 'u': case 'z': - case 'l': case 'v': nodep->v3error("Unsupported: $display-like format code: %"<v3error("Unsupported: %m in $fscanf"); break; + case 'l': // %l - auto insert "library" + if (isScan) nodep->v3error("Unsupported: %l in $fscanf"); + break; default: // Most operators, just move to next argument if (!V3Number::displayedFmtLegal(ch)) { nodep->v3error("Unknown $display-like format code: %"<isSigned()) { // Convert it ch = '~'; diff --git a/test_regress/t/t_display_l.pl b/test_regress/t/t_display_l.pl new file mode 100755 index 000000000..f91289753 --- /dev/null +++ b/test_regress/t/t_display_l.pl @@ -0,0 +1,18 @@ +#!/usr/bin/perl +if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; } +# DESCRIPTION: Verilator: Verilog Test driver/expect definition +# +# Copyright 2003 by Wilson Snyder. 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. + +compile ( + ); + +execute ( + check_finished=>1, + ); + +ok(1); +1; diff --git a/test_regress/t/t_display_l.v b/test_regress/t/t_display_l.v new file mode 100644 index 000000000..c299f67cc --- /dev/null +++ b/test_regress/t/t_display_l.v @@ -0,0 +1,15 @@ +// DESCRIPTION: Verilator: $display() test for %l +// +// This file ONLY is placed into the Public Domain, for any use, +// without warranty, 2015 by Todd Strader. + +module t (/*AUTOARG*/); + + initial begin + assert (0 == 0) else $fatal(2, "%l %m : %d", 0); + $display("%l %m"); + $write("*-* All Finished *-*\n"); + $finish; + end + +endmodule