8000 Support unassigned virtual interfaces · Issue #5265 · verilator/verilator · GitHub
[go: up one dir, main page]

Skip to content

Support unassigned virtual interfaces #5265

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
solomatnikov opened this issue Jul 15, 2024 · 5 comments
Open

Support unassigned virtual interfaces #5265

solomatnikov opened this issue Jul 15, 2024 · 5 comments
Labels
status: ready Issue is ready for someone to fix; then goes to 'status: assigned' type: feature-IEEE Request to add new feature, described in IEEE 1800

Comments

@solomatnikov
Copy link
Contributor
%Error-UNSUPPORTED: test2.sv:740:12: Unsupported: virtual interface never assigned any actual interface
  740 |    virtual z_driver_if vif;
      |            ^~~~~~~~~~~
                    ... For error description see https://verilator.org/warn/UNSUPPORTED?v=5.027
%Error-UNSUPPORTED: test2.sv:741:25: Unsupported: virtual interface never assigned any actual interface
  741 |    function new(virtual z_driver_if _vif);
      |                         ^~~~~~~~~~~
%Error: Exiting due to 2 error(s)
        ... See the manual at https://verilator.org/verilator_doc.html for more assistance.

VCS compiles without errors.

Can you attach an example that shows the issue? (Must be openly licensed, ideally in test_regress format.)

class z_bfm;  
   virtual z_driver_if vif;
   function new(virtual z_driver_if _vif);
      vif = _vif;
   endfunction  
   virtual function void init;
   endfunction  
endclass
module test_cw;
  (
   input  logic     clk,
   input  logic     reset_l,
   z_if.sender    z,
                    mmio_z
   );
   z_driver_if    mem_z_drv(clk, z),
                    mmio_z_drv(clk, mmio_z);
   z_bfm mem_z_bfm,
           mmio_z_bfm;
   initial begin
      mem_z_bfm  = new(mem_z_drv);
      mmio_z_bfm = new(mmio_z_drv);
      mem_z_bfm.init;
      mmio_z_bfm.init;
   end
endmodule

test_cw is never used/instantiated.

What 'verilator' command line do we use to run your example?

verilator -Wno-LATCH -Wno-STMTDLY -Wno-WIDTH -Wno-UNUSED --cc --exe -sv --assert --trace --trace-params --trace-structs --report-unoptflat --no-timing --timescale 1ps/1ps --x-assign unique -fno-const-bit-op-tree -fno-dfg-peephole -Wno-SYMRSVDWORD --top-module top test2.sv

What 'verilator --version' are you using? Did you try it with the git master version?

v5.026-g34e37d7bd

What OS and distribution are you using?

Linux 5.14.0-427.24.1.el9_4.x86_64
@solomatnikov solomatnikov added the new New issue not seen by maintainers label Jul 15, 2024
@sterin
Copy link
sterin commented Jul 22, 2024

Simpler examples:

interface I;
endinterface

class C;  
   virtual I vi;
endclass

module top;
endmodule

results in

%Error-UNSUPPORTED: bug.sv:5:12: Unsupported: virtual interface never assigned any actual interface
    5 |    virtual I vi;
      |            ^

and

interface I;
endinterface

class C;  
   task automatic t(virtual I vif);
   endtask
endclass

module top;
endmodule

results in

%Error-UNSUPPORTED: bug.sv:5:29: Unsupported: virtual interface never assigned any actual interface
    5 |    task automatic t(virtual I vif);
      |                             ^

Both with the following arguments:

verilator --timing --trace-fst --top-module top --binary bug.sv

@wsnyder
Copy link
Member
wsnyder commented Jul 22, 2024

As it says this isn't currently supported. I presume your request is to add support for this.

@kozdra is there a reason we can't just ignore unused virtual interfaces like this?

@wsnyder wsnyder added status: ready Issue is ready for someone to fix; then goes to 'status: assigned' type: feature-IEEE Request to add new feature, described in IEEE 1800 and removed new New issue not seen by maintainers labels Jul 22, 2024
@wsnyder wsnyder changed the title Unsupported: virtual interface never assigned any actual interface Support unassigned virtual interfaces Jul 22, 2024
@kozdra
Copy link
Member
kozdra commented Jul 23, 2024

Use of an actual interface as a value of virtual interface dtype is required in V3LinkDot, because unused interfaces are marked dead and not resolved correctly afterwards.
We could try to mark them as not dead, but I am not sure if just doing it would work without plugging them as used cells anywhere. If I remember correctly, further stages might assume that interfaces are either dead or used by actual cells, in that case this feature would require modifying their checks.

@wsnyder
Copy link
Member
wsnyder commented Apr 26, 2025

BTW if #2227 is fixed, Verilator will detect the unused class and this error will go away in the cases mentioned.

@solomatnikov
Copy link
Contributor Author

More examples from https://github.com/pulp-platform/common_cells

%Error-UNSUPPORTED: common_cells/test/stream_test.sv:26:13: Unsupported: virtual interface never assigned any actual interface
   26 |     virtual STREAM_DV #(
      |             ^~~~~~~~~
                    ... For error description see https://verilator.org/warn/UNSUPPORTED?v=5.037
%Error-UNSUPPORTED: common_cells/test/stream_test.sv:31:15: Unsupported: virtual interface never assigned any actual interface
   31 |       virtual STREAM_DV #(
      |               ^~~~~~~~~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: ready Issue is ready for someone to fix; then goes to 'status: assigned' type: feature-IEEE Request to add new feature, described in IEEE 1800
Projects
None yet
Development

No branches or pull requests

4 participants
0