Compilation error ..please hlp me solve this

** Error: …/Wr-agent-top/wr_monitor.sv(1): near “class”: syntax error, unexpected class
** Error: …/Wr-agent-top/wr_monitor.sv(2): near “endfunction”: syntax error, unexpected endfunction, expecting endtask
** Error: …/Wr-agent-top/wr_monitor.sv(2): near “endfunction”: syntax error, unexpected endfunction, expecting endtask
** Error: …/Wr-agent-top/wr_monitor.sv(2): near “endfunction”: syntax error, unexpected endfunction, expecting endtask
** Error: …/Wr-agent-top/wr_monitor.sv(15): (vlog-2164) Class or package ‘wr_monitor’ not found.
** Error: …/Wr-agent-top/wr_monitor.sv(16): ‘super.new()’ call can only be made from within a class constructor.
** Error: …/Wr-agent-top/wr_monitor.sv(17): near “endfunction”: syntax error, unexpected endfunction, expecting endtask
** Error: …/Wr-agent-top/wr_monitor.sv(20): (vlog-2164) Class or package ‘wr_monitor’ not found.

this is my code

class wr_monitor extends uvm_monitor;
`uvm_component_utils(wr_monitor)

virtual v_if.WMR_MP vif;

wr_agent_config wr_cfg;

extern function new(string name=“wr_monitor”,uvm_component parent);
extern function void build_phase (uvm_phase phase);
extern function connect_phase(uvm_phase phase);
extern task run_phase(uvm_phase phase);
extern task collect_data();
endclass

function wr_monitor:: new(string name=“wr_monitor”,uvm_component parent);
super.new(name,parent);
endfunction
//********************build_phase//

function void wr_monitor::build_phase(uvm_phase phase );
    if(!uvm_config_db#(wr_agent_config)::get(this,"wr_agent_config",wr_cfg))
	   `uvm_fatal("CONFIG"," CANNOT GET()in wr_monitor")
       super.build_phase(phase);

endfunction
//*************connect_phase//
function void wr_monitor::conneect_phase(uvm_phase phase);
vif=wr_cfg.vif;
endfunction
//********RUN_PHASE//
task wr_monitor::run_phase(uvm_phase phase);
forever
begin
collect_data();
end
endtask
//***COLLECT_DATA//

  task wr_monitor::collect_data();
     bit [6:0] temp_length;
   write_xtn data_send;
  data_send=write_xtn::type_id::create(data_send);

  wait(!vif.wmr_cb.wb_int_o)
      wait(vif.wmr_cb.wb_ack_o)
         begin 
           if(vif.wmr_cb.wb_adr_i==5'h00)
            begin 
         data_send.mosi_temp[31:0]=vif.wmr_cb.wb_dat_i;           //mosi collect
		 end
		 end


wait(vif.wmr_cb.wb_int_o)
    begin
       wait(vif.wmr_cb.ab_ack_o)
	   begin 
	    if(vif.wmr_cb.wb_adr_i==5'h00)
		 begin 
		  data_send.miso_temp[31:0]=vif.wmr_cb.wb_dat_o;                 //miso collct
		  end
		  end
		  end

`uvm_info(“SPI_MASTER_MONITOR”,$sformatf(“printing from master monitor \n %s”, data_send.sprint()),UVM_MEDIUM)

		  endtask

In reply to Rohith j:

You are trying to compile the Monitor file alone. Correct?

You have to import the uvm_pkg and to include uvm_macros first.

In reply to Rohith j:

Hi Rohith,

When I ran your code, it seems that you have not pasted all of your code(wr_agent_config, interface etc) instead just monitor. So can you please whole UVM environment here which will help to debug.

Regards,
Priyank

In reply to Agrawal Priyank:

Here is whole uvm please find Thank you
https://www.dropbox.com/sh/gpc0y6mz5trbjs3/AADdxLMVbtUbFOYyy5clh0aYa?dl=0

In reply to Rohith j:

There is something wrong with the data structure in wr_driver.sv

endtask is missing at the end of the last Task implementation.

Your data structure and the compile strategy you are using is chaotic and makes debugging very hard.
You should make for each agent a seperate package you can include easily in the test.

I’d recommend you should use a UVM Framework generator to cretae a complete Environment with a proven UVM structure (see EasierUVM from Doulos: Doulos KnowHow or UVMF from Mentor).

In reply to Rohith j:

There is something wrong with the data structure in wr_driver.sv

endtask is missing at the end of the last Task implementation.

Your data structure and the compile strategy you are using is chaotic and makes debugging very hard.
You should make for each agent a seperate package you can include easily in the test.

I’d recommend you should use a UVM Framework generator to cretae a complete Environment with a proven UVM structure (see EasierUVM from Doulos: Doulos KnowHow or UVMF from Mentor).

In reply to chr_sue:

Thank you

In reply to Rohith j:

Hi Rohith,

I also debugged your test but was bit slower then chr_sue … :)

I find the same issue that in wr_driver, you dint add endtask for task “send_to_dut”. After doing this, above errors are not coming but there are some syntax error coming from your code which you will be knowing better

Regards,
Priyank