[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 #458

verilator generates vluint64_t ports for signed types

Added by Alex Solomatnikov about 1 year ago. Updated about 1 year ago.

Status:WillNotFix Start date:03/16/2012
Priority:Normal Due date:
Assignee:Wilson Snyder % Done:

0%

Category:Unsupported
Target version:-

Description

Slightly modified test case from bug 456:

typedef logic signed [35-1:0] rc_t;

module test_negative( output logic o,
                      output rc_t  rc_out,
                      input       rc_t rc,
                      input logic clk);

   localparam RATIO = 2;

   rc_t rc_d[RATIO:1];

   always_ff @(posedge clk) begin
      integer  k;

      rc_d[1] <= rc;

      for( k=2; k<RATIO+1; k++ ) begin
         rc_d[k] <= rc_d[k-1];
      end
   end // always_ff @

   assign o = rc_d[RATIO] < 0;
   assign rc_out = rc_d[RATIO];

endmodule // test_negative

verilator -sv --sp --top-module test_negative test_negative.v

SC_MODULE(Vtest_negative) {
    /*AUTOATTR(verilated)*/

  public:
    /*AUTOSUBCELLS*/

    // PORTS
    // The application code writes and reads these signals to
    // propagate new values into/out from the Verilated model.
    sc_out<bool>    o;
    sc_in<bool>    clk;
    sc_out<vluint64_t>    rc_out;
    sc_in<vluint64_t>    rc;

Not clear how sign would be handled when casting signed 35-bit value to unsigned 64-bit value.

History

Updated by Wilson Snyder about 1 year ago

As your last comment noted, there isn't a way to get proper behavior out of C for anything but a "natural" size of signed 8/16/32/64 bits, so the assumption is you always need C/SystemC wrapper code to pack the signedness properly. Thus there's no point in using signed types as pins in the wrapper.

Furthermore given how SystemC interconnects having a mix of signed types for some ports and unsigned for others would cause problems, as SystemC does not allow connecting a signed port to any generic (presumably unsigned) component.

Updated by Wilson Snyder about 1 year ago

  • Category set to Unsupported
  • Status changed from New to WillNotFix
  • Assignee set to Wilson Snyder

Also available in: Atom