Unable to invoke the python script by using $system() in UVM monitor to compare two files after they are generated

Here is the monitor code that I’m trying


virtual task run_phase(uvm_phase phase);
  super.run_phase(phase);

  fin = $fopen("input_data_in.txt","w");
  fout = $fopen("output_data_out.txt","w");

  fork
    collect_transactions(phase); // files are written here
    `uvm_info("MONITOR","Python script START PYTHON ",UVM_NONE)

    $system($sformatf("python files_compare.py")); // first print "HELLO WORLD"
    `uvm_info("MONITOR","Python script END PYTHON ",UVM_NONE)
  join
	
endtask : run_phase

In reply to Abhishek S:

UVM is designed so that you can use a scoreboard/comparitor to do transactional checking while your test is in progress. This allows better debug as you can easier pinpoint when your errors occur.

If you want to do file compare, you probably want to do it in the check_phase() when all data is written to your files instead of the run_phase() while the files are being written.

In reply to cgales:

One thing to add here why this did not work is that a “fork” in SystemVerilog does not create a background process on the host OS running the simulation. Process threads of activity in SystemVerilog are completely independent concepts from what happens in a multi-program operating system. The call to $system acts as a function call that returns in 0 simulation time.