Command line arguments usage in sequence/coverage file

Hi dave,

Q1.could you please help me with a example in which how i can feed my config variable with the value passed by command line arguments ?

is it possible to do ?

Q2 how to take coverage command line arguments as well same way i need that information in coverage file of $valueplusar

In reply to abhiverif1715:

Hi,

Please find the below example to get the configuration value from command line. I am getting delay value from command line using $value$plusargs and pushing it into the config_db and getting in driver component.


// Example compiled by Putta Satish

module top;
  	`include "uvm_macros.svh"
	import uvm_pkg::*;
  
	class config_db extends uvm_object;
		int num;
		
		function new(string name = "config_db");
			super.new(name);
		endfunction
	endclass

	class drv extends uvm_driver #(uvm_sequence_item);
		config_db cfg_h;
		
		function new(string name = "drv", uvm_component parent = null);
			super.new(name, parent);
		endfunction
		
		function void build_phase(uvm_phase phase);
          if(!uvm_config_db#(config_db)::get(this, "", "STR", cfg_h))
            `uvm_fatal(get_type_name,"getting failed");
		endfunction
		
		task run_phase(uvm_phase phase);
			phase.raise_objection(this);
			repeat(cfg_h.num)
				#1;
			$display("Current simulation time is %t", $time);
			phase.drop_objection(this);
		endtask	
	endclass		
	
	config_db cfg_h_top;
	int del;
	drv drv_h;
	
	initial
		begin
			drv_h = new("drv_h");
			if ($value$plusargs("delay=%d", del))
				$display("got the delay value");
				
			cfg_h_top = new("cfg_h_top");
			cfg_h_top.num = del;
			
			uvm_config_db#(config_db)::set(null, "", "STR", cfg_h_top);
			
			run_test();
		end
endmodule