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 Perl does not parse widths correctly #153

veripoolbot opened this issue Jul 26, 2007 · 1 comment

Verilog Perl does not parse widths correctly #153

veripoolbot opened this issue Jul 26, 2007 · 1 comment


Copy link

@veripoolbot veripoolbot commented Jul 26, 2007

Author Name: Wilson Snyder (@wsnyder)
Original Redmine Issue: 153 from
Original Date: 2007-07-26
Original Assignee: Wilson Snyder (@wsnyder)

This bug was cloned from Perl-RT, rt28496.

Email addresses have have been truncated.

Id: 	28496
Status: 	resolved
Worked: 	5 min
Left: 	0 min
Queue: 	Verilog-Perl
Owner: 	Nobody
Requestors: 	vananth@

Severity: 	(no value)

Thu Jul 26 18:24:58 2007 vananth@ - Ticket created

Subject: 	Verilog Perl does not parse widths correctly
Date: 	Thu, 26 Jul 2007 15:24:39 -0700
To: 	<bug-Verilog-Perl@>
From: 	"Vinod Ananth" <vananth@>


I found the following problem when trying to parse a Verilog file using

One of the ports in the module is defined like this

input [32-1:0] DATA_IN;

When the parser hits that line, it prints the following message

Argument "32-1" isn't numeric in subtraction (-) at <lib path>/
line 35

(This is valid Verilog syntax though)

When I then try to get the width of this signal, it shows 33 instead of



Fri Aug 03 11:45:26 2007 WSNYDER - TimeWorked changed from (no value) to '5'

Fri Aug 03 11:45:27 2007 WSNYDER - Status changed from 'new' to 'resolved'

Copy link
Collaborator Author

@veripoolbot veripoolbot commented Dec 9, 2010

Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2010-12-09T23:09:41Z

Reply to original message on 26 Jul 2007: line 35 couldn't cause that error. I presume it's line 67 ish?

The parser definitely supports that syntax, however the Netlist:: packages don't know how to convert arithmetic expressions as that would require a full verilog evaluation engine, and it simply wouldn't work with things like parameters. They only tells you what the expressions are and you need to evaluate them yourself if you want a single numeric result. You can probably use

my $width = eval($net->msb." - ".$self->lsb." + 1");

perhaps it should do that automatically if the expression is simple....

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

Successfully merging a pull request may close this issue.

None yet
2 participants