stringverilogmodelsim

What is the reason for this error in ModelSim for my Verilog code? (string_literal.v(3): near ";": Syntax error.)


module string_l();

string a;

initial
begin
a="Hello";
$display ("@%gns a=%s", $time, a);
end
endmodule

Solution

  • Your problem is a string is a SystemVerilog datatype and you compiled with a Verilog .v file extension. Change the file extension to .sv.