I’m trying to build a dummy uvm enviroment. I’ve got an compilation error which I actually solved but I don’t know the reason . What I recognized is that i can not write anything before the create statement.
In the run_phase of my dummy test I want to raise an objection, create a sequence, start the sequence and drop the objection.
Below is run_phase method which can be compiled without errors.
Below is run_phase method which can’t be compiled due to Illegal declaration error.
Error message; dummy_test.sv(25): Illegal declaration after the statement near line ‘23’. Declarations must be precede statements. Look for stray semicolons.
Line 25 is the sequence start line
Line 23 is the raise objection line
In reply to enbiya.h:
Hi,
in system verilog it is not allowed to declare variables after a command.
In verilog a task was defined like this:
task a();
reg i = 0;
begin
call_to_function();
endtask;
In system verilog it is allowed to leave the begin out but you still have to follow the
order.
I hope this helps bye
Thank you.
By building the enviroment I was referring to the cookbook examples. In the Block Level Testbench example we can see the blow given run phase method in spi_test.
In reply to enbiya.h:
That code snippit is not legal - within any procedural block of code, all declarations must precede any statements. If you can post a link to where you saw this, I can try to get it fixed,
In reply to enbiya.h:
That code snippit is not legal - within any procedural block of code, all declarations must precede any statements. If you can post a link to where you saw this, I can try to get it fixed,
Hi Dave,
I saw it on the example “Complete block level testbench example for a simple SPI DUT”. Below is the download link for the example and the path for the code snippet.
Hi,
If you only requirement is to create the sequence after raising an objection, you can spilt the declaration and creation of the sequence.
For eg.
task dummy_test::run_phase(uvm_phase phase);
abc_sequence abc; ==================================> Sequence declared
phase.raise_objection (this, “dummy_test”);
abc = abc_sequence::type_id::create(“abc”); =========> Sequence created
abc.start(m_env.m_v_sequencer.abc_sequencer_t); #100ns;
phase.drop_objection(this , “dummy_test”);
endtask : run_phase
Hi,
If your only requirement is to create the sequence after raising an objection, you can spilt the declaration and creation of the sequence.
For eg.
task dummy_test::run_phase(uvm_phase phase);
abc_sequence abc; ==================================> Sequence declared
phase.raise_objection (this, “dummy_test”);
abc = abc_sequence::type_id::create(“abc”); =========> Sequence created
abc.start(m_env.m_v_sequencer.abc_sequencer_t); #100ns;
phase.drop_objection(this , “dummy_test”);
endtask : run_phase