I have the following code block where a syntax error is fired:
virtual task body();
forever begin
my_transaction m_req;
// Blocking wait for a transaction request:
p_sequencer.m_request_fifo.get(m_req);
// Generate response based on "req_kind" value:
if ( m_req.req_kind == REQ ) begin
`uvm_do_with(req, {req_kind == REQ;} )
end
else begin
`uvm_do_with(req, {req_kind == NO_REQ;} )
end
end
endtask
I get the following error message:
Error-[SE] Syntax error
Following verilog source has syntax error :
"./src/my_transaction.sv", 77: token is ')'
if ( m_req.req_kind == REQ ) begin
^
If I comment the if and else lines as follows, this code block compiles normally:
virtual task body();
forever begin
my_transaction m_req;
// Blocking wait for a transaction request:
p_sequencer.m_request_fifo.get(m_req);
// Generate response based on "req_kind" value:
//if ( m_req.req_kind == REQ ) begin
`uvm_do_with(req, {req_kind == REQ;} )
//end
//else begin
`uvm_do_with(req, {req_kind == NO_REQ;} )
//end
end
endtask
I tried commenting this line
my_transaction m_req;
as well and expected an error to fire up due to undefined
m_req
identifier. But the code actually compiles!
What can possibly be the issue?