Project

General

Profile

[logo] 
 
Home
News
Activity
About/Contact
Major Tools
  Dinotrace
  Verilator
  Verilog-mode
  Verilog-Perl
Other Tools
  BugVise
  CovVise
  Force-Gate-Sim
  Gspice
  IPC::Locker
  Rsvn
  SVN::S4
  Voneline
  WFH
General Info
  Papers

Issue #1394

Verilog::Std::std can return blank `std` package.

Added by Corey Teffetalor 7 months ago. Updated 7 months ago.

Status:
Closed
Priority:
Normal
Assignee:
% Done:

0%


Description

Due to how perl `fork` behaves, Verilog::Std::std can return no SystemVerilog std package definition. Additionally if the standards mode of Verilog::Perl is changed at runtime the std package for some Verilog versions can be blank.

In my program this happens because the DATA filehandle behaves unexpectedly after a call to `fork` and seems to share the filehandle seek pointer with the child process, but it's possible to reproduce without `fork`. The DATA filehandle in Verilog::Std is getting advanced and not reset, this results in the SystemVerilog std package not being defined for some Verilog::Perl parses.

This program should reproduce and produce the FAILED message.

use Verilog::Std;
use Verilog::Language;

my $pid = fork();

if ($pid == 0) {
    printf "Standard is %d bytes long.\n", length Verilog::Std::std();
    exit 0;
} else {
    waitpid $pid, 0;
}

my $stdLen = length Verilog::Std::std();

if ($stdLen == 0) {
    print "FAILED standard is blank!\n";
    exit 0;
} else {
    printf "PASSED standard is %d bytes long\n", $stdLen;
    exit 1;
}

However this simpler case also reproduces:

use Verilog::Std;
use Verilog::Language;

length Verilog::Std::std('1800-2009');
my $stdLen = length Verilog::Std::std();

if ($stdLen == 0) {
    print "FAILED standard is blank!\n";
    exit 0;
} else {
    printf "PASSED standard is %d bytes long\n", $stdLen;
    exit 1;
}

Instead of the __DATA__ section possibly a here-document could be used, should be good back to Perl 5.8.8 at-least?

my $stdHeader = <<'EOF';
...
import std::*;
EOF

History

#1 Updated by Wilson Snyder 7 months ago

  • Status changed from New to Closed
  • Assignee set to Wilson Snyder

Thanks for the good debugging, fixed it as you suggested in git, released as 3.460.

#2 Updated by Corey Teffetalor 7 months ago

Confirmed, thanks for the quick fix!

Also available in: Atom