I was exploring rand sequence
and wanted to try value passing between productions and wrote code like this with reference from accellera LRM,
class rand_seq;
//------------------------------------------------------------------------------
task seq_gen();
begin
randsequence(main)
main : first second gen;
first : gen("abc");
second : gen("def");
gen(string s = "done") : { $display(s);};
endsequence
end
endtask
//------------------------------------------------------------------------------
function new();
endfunction
//-----------------------------------------------------------------------------
endclass
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
module test;
initial begin
rand_seq seq;
seq = new();
seq.seq_gen();
end
endmodule
it was showing error
rand_seq.sv
first : gen(“abc”);
|
xmvlog: *E,RSSEMICLN (rand_seq.sv,7|16): Expected semicolon after a randsequence production [SystemVerilog LRM, randsequence].
first : gen(“abc”);
|
xmvlog: *E,RSENDSEQ (rand_seq.sv,7|21): randsequence must end with “endsequence”.
first : gen(“abc”);
|
xmvlog: *E,NOTSTT (rand_seq.sv,7|22): expecting a statement [9(IEEE)].
gen(string s = “done”) : { $display(s);};
|
xmvlog: *E,ILLPRI (rand_seq.sv,9|14): illegal expression primary [4.2(IEEE)].
gen(string s = “done”) : { $display(s);};
|
xmvlog: *E,EXPRPA (rand_seq.sv,9|18): expecting a right parenthesis (‘)’) [10.2.2(IEEE)].
gen(string s = “done”) : { $display(s);};
|
xmvlog: *E,EXPSMC (rand_seq.sv,9|26): expecting a semicolon (‘;’) [9.2.2(IEEE)].
gen(string s = “done”) : { $display(s);};
|
xmvlog: *E,NOTSTT (rand_seq.sv,9|28): expecting a statement [9(IEEE)].
gen(string s = “done”) : { $display(s);};
|
xmvlog: *E,EXPIDN (rand_seq.sv,9|30): expecting an identifier [SystemVerilog].
function new();
|
xmvlog: *E,NEWOIC (rand_seq.sv,14|11): The class constructor method ‘new’ is only allowed within a class declaration.
endfunction
|
xmvlog: *E,NOTSTT (rand_seq.sv,15|10): expecting a statement [9(IEEE)].
rand_seq seq;
|
xmvlog: *E,SVNOTY (rand_seq.sv,22|9): Syntactically this identifier appears to begin a datatype but it does not refer to a visible datatype in the current scope.
module worklib.test:sv
errors: 1, warnings: 0
xmvlog: *W,NOTOPL: no top-level unit found, must have recursive instances.
Total errors/warnings found outside modules and primitives:
errors: 10, warnings: 1
but if i replace it with normal $display it is working.