Project

General

Profile

[logo] 
 
Home
News
Activity
About/Contact
Major Tools
  Dinotrace
  Verilator
  Verilog-mode
  Verilog-Perl
Other Tools
  IPC::Locker
  Parallel::Forker
  Voneline
General Info
  Papers

get input/output ports of a module

Added by chao lee 5 months ago

Hi, I'm using the version 3.466 Verilog-perl, and the option language version is 1800-2017, but looks like I can't get ports from below kind of modules:

modult test #(parameter WIDTH=32) ( input clk, input rst, input [WIDTH-1:0] data, output [WIDTH-1:0] da_o);

..... endmodule

all of our verilog modules are wrote in above style, I used the same parse codes from vhier, it could get all modules, but get no ports for all modules, my code is similar to vhier

my $fh = shift;
my @files = @_;
my $nl = new Verilog::Netlist(options => $Opt,
              keep_comments => 0,
              use_vars => 0,
              link_read_nonfatal => !$Opt_Missing,
              synthesis => $Opt_Synthesis,
              );
foreach my $file (@files) {
print "   Reading $file\n" if $Debug;
$nl->read_file(filename=>$file);
}
$nl->link();
$nl->lint();  # Simplified as use_vars => 0
$nl->exit_if_error();
foreach my $mod ($nl->modules_sorted) {
    foreach my $port ($mod->ports) {
        printf "port name is %s",$port->name();
    }
 }

could you help to tell me what's the problem ? any other options do I need ?


Replies (5)

RE: get input/output ports of a module - Added by Wilson Snyder 5 months ago

You turned off reading variables/ports:

use_vars => 0,

Turn this on and should be good.

RE: get input/output ports of a module - Added by chao lee 5 months ago

thanks Wilson very much , it could dump out all netlist information.

One more question, does the current verilog-Perl support parameters pass through, for example:

module top (a,b,c);

input a; input b; input c;

localparam width = 16;

FIFO #(.WID) (.r_clk(r_clk), .w_clk(w_clk), .......

endmodule

after parse, it will show the parameter WID value is 16 instead of localparam 16 ?

RE: get input/output ports of a module - Added by Wilson Snyder 5 months ago

Verilog-Perl does not elaborate (pass thru parameters). See https://www.veripool.org/projects/verilog-perl/wiki/Manual-verilog-perl#WHICH-PARSER-PACKAGE

RE: get input/output ports of a module - Added by chao lee 5 months ago

okay , thanks a lot , Wilson.

One more question, I want to know all the pins/ports/parameters/Nets from Netlist, but it always report some warnings which are not multi-driven, and script exit with warnings, Could you tell me how to ignore those warnings and make the script proceed ?

I tried to pass hash $exit_on{allow} = "warning" to $nl->exit_if_error(\%exit_on), but it doesn't work.

RE: get input/output ports of a module - Added by Wilson Snyder 5 months ago

Don't call "lint()".

    (1-5/5)