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 #860

Support for /*verilator public*/ on SV structs too?

Added by Jonathon Donaldson over 4 years ago. Updated over 4 years ago.

Status:
Feature
Priority:
Low
Assignee:
-
Category:
Unsupported
% Done:

0%


Description

The recently added feature of being able to use /*verilator public*/ on SV enums is priceless and works very very well. I no longer have to duplicate (i.e. recreate) any enums in my C++ code that already exist in my SV code. This saves loads of tedious copy & paste work when creating the testbench!

I'm now wondering if the same capability can easily be added for SV structs? The reason I ask is because I also have a lot of SV structs in my designs that are made up of these enums and so I end up having to duplicate the SV structs in my C++ code.

Let's assume I have the following SV package that I verilate:

package our_types;

// Flags
typedef enum logic {n,N} T_Flg_N /*verilator public*/;
typedef enum logic {r,R} T_Flg_R /*verilator public*/;
typedef enum logic {o,O} T_Flg_O /*verilator public*/;

// Processor Status Register
typedef struct packed {
  T_Flg_N N;
  T_Flg_R R;
  T_Flg_O O;
} T_PS_Reg /*verilator public*/;

endpackage : our_types

With the current version of verilator the "/*verilator public*/" on the struct is ignored. So this results in having to do the following in the C++ testbench code:

#include "Vour_our_types.h" // for access to T_Flg_N/T_Flg_R/T_Flg_O

// My manually duplicated T_PS_Reg
typedef struct {
  Vour_our_types::T_Flg_N N;
  Vour_our_types::T_Flg_R R;
  Vour_our_types::T_Flg_O O;
} T_PS_Reg;

int main () {
  Vour_our_types::T_PS_Reg PS_Reg;
}

But if /*verilator public*/ worked on SV structs then all I would have to do is this:

#include "Vour_our_types.h" // for access to T_PS_Reg

int main () {
  Vour_our_types::T_PS_Reg PS_Reg;
}

With the existing support for /*verilator public*/ on SV enums is support for SV structs something that can be easily added? Or are SV structs a whole different problem altogether that would require a significant amount of work?

I attached an example in test_regress format.

t_struct_public.zip (1.34 KB) Jonathon Donaldson, 12/11/2014 07:55 AM

History

#1 Updated by Wilson Snyder over 4 years ago

  • Status changed from New to Feature

Structures can reference structures and arrays, so this is a lot harder than enums. If you'd like to work more on a patch an I can give suggestions as to how to proceed.

Also available in: Atom