I have the following code, file c.sv
:
virtual class C#(parameter W = 32); // line #2 where error message points
static function logic [W-1 : 0] f(input logic [W-1 : 0] in);
return ~in;
endfunction
endclass
I then call it from top.sv
:
`include "c.sv"
module top(input wire [3:0] key, ouptut wire [3:0] led);
assign led = C#(4)::f(sw);
endmodule
In ModelSim 10.3d it works fine, but Quartus II x64 15.0.1 build 150 reports this error after Analysis & Synthesis:
Error (10170): Verilog HDL syntax error at c.sv(2) near text "virtual"; expecting a description
If I comment out inlcude "c.sv"
and replace function call with a simple ~led then it works in the dev board.
What am I doing wrong?