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

Issue #1545

Warning-CASEOVERLAP is not triggering for signals wider than 12

Added by Yossi Nivin 2 months ago. Updated 2 months ago.

Status:
Confirmed
Priority:
Normal
Assignee:
-
Category:
Lint
% Done:

0%


Description

Hi,

I noticed that I'm not getting the CASEOVERLAP warnings if the value is wider than 12 bits. In the example below, the warning will trigger only for the second case, which uses the 12 bits input. The first case with 13 bits is ignored.

module top (
    input [12:0] case_input_13,
    input [11:0] case_input_12,
    output result_13,
    output result_12
);

    always_comb
        case (case_input_13)
            13'h0: result_13 = |case_input_13;
            13'h1: result_13 = |case_input_13;
            13'h2: result_13 = |case_input_13;
            13'h3: result_13 = |case_input_13;
            13'h0: result_13 = |case_input_13; // Case overlap
            default: result_13 = |case_input_13;
        endcase

    always_comb
        case (case_input_12)
            12'h0: result_12 = |case_input_12;
            12'h1: result_12 = |case_input_12;
            12'h2: result_12 = |case_input_12;
            12'h3: result_12 = |case_input_12;
            12'h0: result_12 = |case_input_12; // Case overlap
            default: result_12 = |case_input_12;
        endcase

endmodule

Steps to reproduce: verilator -Wall -cc top.sv

top.sv (857 Bytes) Yossi Nivin, 10/07/2019 09:32 AM

History

#1 Updated by Wilson Snyder 2 months ago

  • Status changed from New to Confirmed

Currently the algorithm is very stupid, namely build a lookup table and check for duplicates.

I changed this define to something larger, e.g. 16 bits:

#define CASE_OVERLAP_WIDTH 12           // Maximum width we can check for overlaps in

(You can do that in your build if you want also).

Leaving this open as the real correct fix for this is to use a binary decision diagram or other better algorithm to prove the overlaps in a way that isn't so memory-stupid.

If you or someone would be interested, this would be a fun contained project to work on.

#2 Updated by Yossi Nivin 2 months ago

Thanks for confirming and providing the workaround. I was suspecting this kind of lookup table to be the limiting factor. I will try to have a look to see whether it is something I can implement with my limited knowledge of C/C++.

Also available in: Atom