[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
  Schedule::Load
  SVN::S4
  Synopsys-modes
  SystemPerl
  Verilog-Pli
  Voneline
  Vregs
General Info
  Papers

Issue #327

$bits of type does not work

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

Status:Closed Start date:02/23/2011
Priority:Normal Due date:
Assignee:Wilson Snyder % Done:

0%

Category:Unsupported
Target version:-

Description

The following code:

typedef enum [3:0] { NOP = 0 } req_t;

module arbiter ( output wire valid_out, output req_t type_out, input wire valid_in, input req_t type_in );

wire [$bits(req_t):0] internal_type = { 1'b0, type_in };

endmodule // arbiter

results in error:

verilator --cc typedef_bug.v %Error: typedef_bug.v:11: syntax error, unexpected TYPE-IDENTIFIER %Error: Exiting due to 1 warning(s) %Error: Command Failed verilator_bin --cc typedef_bug.v

This is supposed to work according to SystemVerilog 3.1a LRM which has the following example:

typedef struct { logic valid; bit [8:1] data; } MyType;

typedef bit[$bits(MyType):1] MyBits; MyBits b;

History

Updated by Wilson Snyder about 1 year ago

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

That's a easy one line repair.

Fixed in git for 3.812+.

Updated by Alex Solomatnikov about 1 year ago

It works.

Thanks for a quick fix!

Updated by Wilson Snyder about 1 year ago

  • Status changed from Resolved to Closed

In 3.812.

Also available in: Atom