Project

General

Profile

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

Issue #735

Strange Verilator behavior with power, signdness and more

Added by Clifford Wolf about 5 years ago. Updated about 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
WrongRuntimeResult
% Done:

0%


Description

The following module should output 0x00000000 for a=0 and 0x010000ff for a=1. But Verilator GIT 5c39420 outputs 0xffffffff for a=1 instead.

module test004(a, y);
  input a;
  output [31:0] y;

  wire [7:0] y0;
  wire [7:0] y1;
  wire [7:0] y2;
  wire [7:0] y3;
  assign y = {y0,y1,y2,y3};

  localparam [7:0] v0 = +8'sd1 ** -8'sd2;
  localparam [7:0] v1 = +8'sd2 ** -8'sd2;
  localparam [7:0] v2 = -8'sd2 ** -8'sd3;
  localparam [7:0] v3 = -8'sd1 ** -8'sd3;
  localparam [7:0] zero = 0;

  assign y0 = a ? v0 : zero;
  assign y1 = a ? v1 : zero;
  assign y2 = a ? v2 : zero;
  assign y3 = a ? v3 : zero;
endmodule

Interestingly the output value for y3 is correct, but setting y3 to a constant value (or otherwise removing the calculation for y3) makes the problem go away. Replacing a with 1 in the assign statements also does make the problem disappear.

Self-contained test case:
http://svn.clifford.at/handicraft/2014/verilatortest/test004.v
http://svn.clifford.at/handicraft/2014/verilatortest/test004.cc
http://svn.clifford.at/handicraft/2014/verilatortest/test004.sh

History

#1 Updated by Wilson Snyder about 5 years ago

  • Status changed from New to Resolved

Yes that was weird, the number library had "hidden state" that confused the generated C code.

Fixed in git towards 3.857.

#2 Updated by Wilson Snyder about 5 years ago

  • Status changed from Resolved to Closed

In 3.860.

Also available in: Atom