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

Correct usage of enumerated type methods

Added by Tobias Rosenkranz 8 days ago

Hello everyone,

I have a problem with enumerated type methods. I always get an
Signal is not driven: '__Venumtab_enum_next0'
warning when compiling my SystemVerilog code.

If I interpret https://github.com/verilator/verilator/blob/master/test_regress/t/t_enum_type_methods.v correctly, then verilator supports what I am tring to do and my code should work. Is this a bug or am I doing something wrong? Please help.

Short example:

- some_pkg.sv
package some_pkg;

  /* Enum: some_state_t
   *
   */
  typedef enum {
    STATE_ONE,
    STATE_TWO,
    STATE_THREE,
    STATE_FOUR,
    STATE_FIVE,
    STATE_SIX,
    STATE_SEVEN,
    STATE_EIGHT,
    STATE_NINE,
    STATE_TEN
  } some_state_t;
endpackage
- some_module.sv
module some_module
  (
    input                                   clk,
    input                                   resetN,
    input                                   InOne, InTwo,
    output logic                            someOutput
  );

  import some_pkg::*;

  some_state_t some_FSM;

  always_ff @ (posedge clk or negedge resetN) begin
    if(!resetN)
      some_FSM <= some_FSM.first;
    else begin
      unique case (some_FSM)
      STATE_ONE, STATE_TWO, STATE_THREE: begin
        if(InOne & InTwo)
          some_FSM <= some_FSM.next;
        else if(InOne)
          some_FSM <= some_FSM;
        else
          some_FSM <= some_FSM.first;
      end
      default: begin
        some_FSM <= STATE_ONE;
      end
      endcase
    end
  end

  always_comb begin
    someOutput = (some_FSM == STATE_FOUR);
  end
endmodule
I use the https://github.com/tymonx/logic package to as a configuration and make toolchain - but i checked that the commandline invokation works:
/usr/local/bin/verilator_bin --cc --coverage --prefix some_module --exe -o some_module -Mdir . --top-module some_module -Wall -Wwarn-lint -Wwarn-style -DOVL_ASSERT_ON -I<repo_path>/rtl/configware/include -I<repo_path>/deps/logic/rtl/logic/include -I/usr/local/HDL/ovl/2.8.1 <repo_path>/build/verilator/libraries/some_module/some_module.vlt <repo_path>/rtl/configware/VerilatorTests/some_pkg.sv <repo_path>/rtl/configware/VerilatorTests/some_module.sv <repo_path>/build/verilator/coverage/run/some_module/some_module_main.cpp

Thanks in advance.


Replies (2)

RE: Correct usage of enumerated type methods - Added by Wilson Snyder 8 days ago

This was a false message. I just pushed a change to git to fix this towards eventual 4.024 release.

RE: Correct usage of enumerated type methods - Added by Tobias Rosenkranz 8 days ago

Thanks for the quick fix.

We are just starting development with SV and V at our company but it looks like that an important feature is missing in Verilator: classes. I intend to contribute some features in the future. I'll open new threads in the development section when necessary.

Keep up the great work.

Tobias

    (1-2/2)