[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
  Schedule::Load
  SVN::S4
  Synopsys-modes
  SystemPerl
  Verilog-Pli
  Voneline
  Vregs
General Info
  Papers

how does one get the attributes of unconnected ports

Added by Gautam Hazari about 2 years ago

I observe that an output port that does not connect to any other module does not have any net associated with it. For such a port, is there any way to get the attributes such as width, msb and lsb, since these are contained in the net object associated with the ports.


Replies (3)

RE: how does one get the attributes of unconnected ports - Added by Wilson Snyder about 2 years ago

Sorry, I'm not understanding:

$ cat > a.v <<_EOF
module x;
   output [1:0] zz;
endmodule
_EOF

$ cat >a.pl <<_EOF
use Verilog::Netlist;
use Verilog::Getopt;
my $opt = new Verilog::Getopt;
my $nl = new Verilog::Netlist (options => $opt);
$nl->read_file (filename=>"a.v");
$nl->dump;
_EOF

$ perl a.pl
Module:x  Kwd:module  File:a.v
  Port:zz  Dir:out  DataT:[1:0]  Array:
  Net:zz    DeclT:port  NetT:  DataT:[1:0]  Array:  1:0

There is a net.

RE: how does one get the attributes of unconnected ports - Added by Gautam Hazari about 2 years ago

Hi,

Your example has helped me understand my situation a lot better. It is probably a mistake on my part due to an incomplete understanding of pins versus ports.
To demonstrate, I expanded your example to the following:

module x;

y y1 ( zz );

endmodule

module y (
    .zz    (zz)
    );

reg [1:0] zz;

   output [1:0] zz;
endmodule

Now, the "$nl->dump" gave the output as expected. Then when I accessed "$pin->net()->msb()", I got:
Can't call method "msb" on an undefined value at

but with "$pin->port()->net()->msb()" I got it as desired.

(1-3/3)