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

Support for interfaces in top level ports

Added by Kevin Kiningham over 2 years ago. Updated 12 days ago.

Status:
WillNotFix
Priority:
Normal
Assignee:
-
Category:
Unsupported
% Done:

0%


Description

I'd like to add support for interfaces in top level ports. A simple test cast:

@interface bus_if(input wire clock); logic data; endinterface

modport slave(input data);
modport master(output data);

module top(bus_if.slave bus);

endmodule@

Current git HEAD (ca265966957d1028307e295ef1e3bd6dbba4773d) currently fails with the following:

kkiningh@kkiningh:~/Workspace/$ ./verilator/build/bin/verilator test.sv -cc %Error: test.sv:8: Unsupported: Interfaced port on top level module %Error: test.sv:8: Parent cell's interface is not found: bus_if %Error: Exiting due to 2 error(s) %Error: See the manual and http://www.veripool.org/verilator for more assistance. %Error: Command Failed /home/kkiningh/Workspace/verilator/build/bin/verilator_bin test.sv -cc

How much work would it be to support this feature? Can you give me a few hints on how to get started? I've looked in verilator/src/V3LinkParse.cpp and can see where the error is generated but cannot figure out how to proceed. Also, can you expand a bit on what the comment on line 198 is talking about ("What breaks later is we don't have a Scope/Cell representing the interface to attach to")?

Thanks!

History

#1 Updated by Wilson Snyder about 2 years ago

Interfaces work in Verilator by creating a variable on both the upper and lower scope that links into an instantiated interface (CELL in the AST). The top doesn't have any upper scope to contain this. The other problem would be how would you access the variables from C? Verilator doesn't presently create structs that C can use, so it's not obvious what this would look like.

You could of course make wrapper code that flattened the interfaces into normal signals for C. I realize this isn't clean of course.

#2 Updated by Wilson Snyder about 2 years ago

  • Status changed from New to Feature

#3 Updated by Wilson Snyder 12 days ago

  • Status changed from Feature to WillNotFix

This is unlikely to be supported in the medium term due to the complexities of mapping into C++. A wrapper is suggested instead.

If someone wants to contribute a fix, we can discuss.

Also available in: Atom