Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
veripoolbot opened this issue Jan 26, 2019 · 2 comments
Closed

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

veripoolbot opened this issue Jan 26, 2019 · 2 comments
Assignees

Comments

@veripoolbot
Copy link
Collaborator

@veripoolbot veripoolbot commented Jan 26, 2019


Author Name: Corey Teffetalor
Original Redmine Issue: 1394 from https://www.veripool.org

Original Assignee: Wilson Snyder (@wsnyder)


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

@veripoolbot

This comment has been minimized.

Copy link
Collaborator Author

@veripoolbot veripoolbot commented Jan 26, 2019


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2019-01-26T13:09:12Z


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

@veripoolbot

This comment has been minimized.

Copy link
Collaborator Author

@veripoolbot veripoolbot commented Jan 28, 2019


Original Redmine Comment
Author Name: Corey Teffetalor
Original Date: 2019-01-28T22:18:36Z


Confirmed, thanks for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.