[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
  SystemPerl
  Voneline
  WFH
General Info
  Papers

Issue #274

implicit wires not correctly handled

Added by max baker almost 3 years ago. Updated over 2 years ago.

Status:Closed Start date:07/31/2010
Priority:Normal Due date:
Assignee:Wilson Snyder % Done:

0%

Category:-
Target version:-

Description

Top level implicit wires are discarded. Adding a 'wire a;' declaration fixes it.

input :
module sink (input in, output out);

endmodule

module buffer (input in, output out);

wire out = in;

endmodule

module source( input in, output out);

endmodule;

module wrap( input sink_in, buffer_in, source_in, 
             output sink_out, buffer_out, source_out );

source Isource (.in(source_in), .out(source_out));
buffer Ibuffer (.in(buffer_in), .out(buffer_out));
sink   Isink    (top_.in(top_sink_in),  .out(top_sink_out));

endmodule;

module test;

wire top_sink_in = 1;

// source -> buffer -> sink
wrap Iwrap (
    .sink_in(top_buffer_out),
    .buffer_in(top_source_out),
    .source_in(top_buffer_out),
    .sink_out(top_sink_out),
    .buffer_out(top_buffer_out),
    .source_out(top_source_out)
);

endmodule

test code :
use Verilog::Netlist;

$Netlist  = shift @ARGV || 'test.v';
$Top      = shift @ARGV || 'test';

print "Loading $Netlist...\n";
my $N = new Verilog::Netlist(
    implicit_wires_ok=>1,
);
$N->read_file (filename=>$Netlist);
$N->link();
$N->lint();
$N->exit_if_error();
print "Done.\n";

my $root = $N->find_module($Top) or die "Can't find $Top in $Netlist!\n";

print "Nets : \n";
foreach my $n ($root->nets_sorted) {
    print $n,' ',$n->name,"\n";
}

print "Cell Pins :\n";
foreach my $c ($root->cells_sorted) {
    print $c->submodname,' ',$c->name,"\n";
    foreach my $p ($c->pins) {
        print "  ",$p->name," ",$p->netname,"=",$p->net,"\n";
    }
}
Bad Output :
Loading test.v...
Done.
Nets : 
Verilog::Netlist::Net=ARRAY(0xb18960) top_source_in
Cell Pins :
wrap Iwrap
  source_in top_buffer_out=
  sink_in top_buffer_out=
  sink_out top_sink_out=
  source_out top_source_out=
  buffer_out top_buffer_out=
  buffer_in top_source_out=
Now add this into module test :
wire top_sink_out;
wire top_buffer_out;
wire top_buffer_in;
wire top_source_in;
wire top_source_out;

and you get this

Good Output:
Loading test2.v...
Done.
Nets : 
Verilog::Netlist::Net=ARRAY(0xb19680) top_buffer_in
Verilog::Netlist::Net=ARRAY(0xb194d0) top_buffer_out
Verilog::Netlist::Net=ARRAY(0xb18ba0) top_sink_in
Verilog::Netlist::Net=ARRAY(0xb18d50) top_sink_out
Verilog::Netlist::Net=ARRAY(0xb1a590) top_source_in
Verilog::Netlist::Net=ARRAY(0xb1a740) top_source_out
Cell Pins :
wrap Iwrap
  source_in top_buffer_out=Verilog::Netlist::Net=ARRAY(0xb194d0)
  sink_in top_sink_in=Verilog::Netlist::Net=ARRAY(0xb18ba0)
  sink_out top_sink_out=Verilog::Netlist::Net=ARRAY(0xb18d50)
  source_out top_source_out=Verilog::Netlist::Net=ARRAY(0xb1a740)
  buffer_out top_buffer_out=Verilog::Netlist::Net=ARRAY(0xb194d0)
  buffer_in top_sink_out=Verilog::Netlist::Net=ARRAY(0xb18d50)

History

Updated by max baker almost 3 years ago

forgot to update test.v... the fixed one has

wire top_source_in = 1;

not

wire top_sink_in = 1;

results still the same.

Updated by Wilson Snyder almost 3 years ago

  • Status changed from New to Feature

The problem here is that correctly creating all implicit wires requires complete elaboration of the netlist. This isn't something Verilog-Perl does (partially because none of my netlists allow implicit wires). Someday probably, but nothing I can tackle myself at the moment.

It may be possible to add some hack to do what you need, however. This would simply be a function that would be specially called, that loops over all of the pins in the netlist and creates the wires that don't already exist. If you'd like to write such a function, I'll be glad to take it back and integrate it.

Updated by max baker almost 3 years ago

That makes sense about the elaboration.

Is the data I need still available for a post-process step? For instance, in the above example does the name "top_buffer_out" still exist somewhere in the Netlist object for the two pins it's connected to? (the above shows 3, oops, fixed locally).

Updated by max baker almost 3 years ago

I have a workaround for now. The netlist I am using is from Cadence Virtuoso's netlister.

There is a magic switch you can put in your .simrc to make it print out the wire declarations : hnlVerilogDeclareScalarSig='t

now on to the signal tracer

Updated by Wilson Snyder over 2 years ago

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

Workaround was found; see notes.

Also available in: Atom