[UVM]UVM經驗總結

                                            UVM學習筆記

 

1、seq_item_port              Derived driver classes should use this port to request items from the sequencer.

 

2、seq_item_export            This export provides access to this sequencer’simplementation of the sequencer interface,uvm_sqr_if_base #(REQ,RSP), which defines the

 

function void set_inst_override(string relative_inst_path,

string original_type_name,

string override_type_name )

 

 

3、class uvm_config_db#(type T =int)extends uvm_resource_db#(T)

 

static function bit get( uvm_component cntxt,

string inst_name,

string field_name,

ref T value )

 

 

4、uvm_analysis_port       Broadcasts a value to all subscribers

implementing auvm_analysis_imp.

Ex.uvm_analysis_port#(trans) ap;

 

5、uvm_analysis_imp         Receives all transactions

broadcasted by a uvm_analysis_port.

 

6、uvm_analysis_export      Exports a lower-level uvm_analysis_imp to its parent

 

 

7、is_active                          The int configuration parameter is_active is used to identify whether this agent should beacting in active or passive mode.

set_config_int("<path_to_agent>", "is_active", UVM_ACTIVE);

 

8、uvm_in_order_class_comparator #(T)   Compares two streams of data objects of the type parameter, T.

 

 

9、set_sequencer      Sets the default sequencer for the sequence to sequencer. It will take effect immediately, so it should not be called while the sequence is actively communicating with the sequencer.

10、starting_phase

virtual task user_sequence::body();

if (starting_phase != null)

starting_phase.raise_objection(this,"user_seq not finished");

...

if (starting_phase != null)

starting_phase.drop_objection(this,"user_seq finished");

endtask

 

The starting_phaseis set automatically when this sequence is started as the default sequence

 

11、set drain_time

  uvm_objection objection = starting_phase.get_objection();

  objection.set_drain_time(this,1us)

 

18、function uvm_sequence_base get_parent_sequence()

Returns a reference to the parent sequence of any sequence on which this method was called. If this is a parent sequence, the method returns null

 

19、about parent

A sequence’s start method has a parent_sequence argument that controls whether pre_do, mid_do, and post_do are called in the parent sequence. It also has a call_pre_post argument that controls whether its pre_body and post_body methods are called. In all cases, its pre_start and post_start methods are always called.

A sequence can also be indirectly started as a child in the body of a parent sequence. The child sequence’s start method is called indirectly by invoking any of the `uvm_do macros.In thise cases, start is called with call_pre_post set to 0, preventing the started sequence’s pre_body and post_body methods from being called. During execution of the child sequence, the parent’s pre_do, mid_do, and post_do methods are called.

  Remember, it is the parent sequence’s pre|mid|post_do that are called, not the

sequence being executed

如果 seq不是通过set default_sequencecalled,那么他的starting_phasenull可以这样做去得到parent starting_phase:

uvm_sequence_base parent;

parent = get_parent_sequence();

if(parent !=null)  starting_phase=parent.starting_phase;

 

 

20、virtual task pre_body()

This task is a user-definable callback that is called before the execution of body only

when the sequence is started with start. If start is called with call_pre_post set to 0,

pre_body is not called. This method should not be called directly by the user.

 

 

 

21、uvm_resource_db#(int)::set("A", "*", 17, this);----p156

   static function void set(input string scope,

input string name,

T val,

input uvm_object accessor = null)

Create a new resource, write a val to it, and set it into the database using name and scope as the lookup parameters. The accessor is used for auditting.

  static function bit read_by_name(input string scope,

input string name,

ref T val,

input uvm_object accessor = null)

locate a resource by name and scope and read its value. The value is returned throughthe ref argument val. The return value is a bit that indicates whether or not the readwas successful. The accessor is used for auditing

   static function bit write_by_name(input string scope,

input string name,

T val,

input uvm_object accessor = null)

write a val into the resources database. First, look up the resource by name and scope.If it is not located then add a new resource to the database and then write its value.

 

22、set_type_override

  static function void set_type_override

(uvm_object_wrapper override_type,

bit replace = 1

Configures the factory to create an object of the type represented by override_type

whenever a request is made to create an object of the type represented by this proxy,provided no instance override applies. The original type, T, is typically a super class of the override type

  ex: B_driver::type_id::set_type_override(D_driver::get_type());

 

23、set_inst_override

static function void set_inst_override(

uvm_object_wrapper override_type,

string inst_path,

uvm_component parent = null)

 

 

24、CALLBACKS:

                    

 

                         

 

 

25、`uvm_register_cb(T,CB)

Registers the given CB callback type with the given T object type. If a type-callback pairis not registered then a warning is issued if an attempt is made to use the pair (add,delete, etc.).

 

26、`uvm_do_callbacks(T,CB,METHOD,CALL)

Calls the given METHOD of all callbacks of type CB registered with the calling object (i.e.this object), which is or is based on type T.

This macro executes all of the callbacks associated with the calling object (i.e. this

object). The macro takes three arguments:

  • CB is the class type of the callback objects to execute. The class type must have a function signature that matches the METHOD argument.
  • T is the type associated with the callback. Typically, an instance of type T ispassed as one the arguments in the METHOD call.
  • METHOD is the method call to invoke, with all required arguments as if they were invoked directly.
  • CALL: 上面沒說,貌似function要返回值時必須要用到這個參數

 

 

27、virtual function string get_type_name ()

This function returns the type name of the object, which is typically the type identifier enclosed in quotes. It is used for various debugging functions in the library, and it is used by the factory for creating objects.

This function must be defined in every derived class

28、virtual function string get_full_name()

Get the hierarchical name

Return the hierarchal name of this block. The base of the hierarchical name is the root block.

 

29、function string get_sequence_path()

Provides a string of names of each sequence in the full hierarchical path. A “.” is used as the separator between each sequence

 


RegisterModel

1、uvm_status_e

Return status for register operations

UVM_IS_OK Operation completed successfully

UVM_NOT_OK Operation completed with error

UVM_HAS_X Operation completed successfully bit had unknown bits.

2、uvm_path_e

Path used for register operation

UVM_FRONTDOOR Use the front door

UVM_BACKDOOR Use the back door

UVM_PREDICT Operation derived from observations by a bus monitor

via the uvm_reg_predictor class.

UVM_DEFAULT_PATH Operation specified by the context

 

3、uvm_reg_data_t

2-state data value with `UVM_REG_DATA_WIDTH bits, by default, the maximum size is 64 bits

4、write/set/get/reset/poke/peek/update/mirror    ---  P534

Write the specified value in this register

virtual task write(output uvm_status_e status,

input uvm_reg_data_t value,

input uvm_path_e path = UVM_DEFAULT_PATH,

input uvm_reg_map map = null,

input uvm_sequence_base parent = null,

input int prior = -1,

input uvm_object extension = null,

input string fname = "",

input int lineno = 0

 

5、uvm_reg_bus_op    Struct that defines a generic bus transaction for register and memory accesses, having kind (read or write), address, data, and byte enable information.

6、kind Kind of access: READ or WRITE.

7、addr The bus address.

8、data The data to write.

9、n_bits The number of bits of uvm_reg_item::value being transferred by

this transaction.

10、byte_en Enables for the byte lanes on the bus.

11、status The result of the transaction: UVM_IS_OK, UVM_HAS_X, UVM_NOT_OK.

12、function void set_auto_predict(bit on = 1)

When on is TRUE, the register model will automatically update its mirror (what it thinks should be in the DUT) immediately after any bus read or write operation via this map.

By default, auto-prediction is turned off.

regmodel.defualt_map.set_auto_predict(1);

 

13、Pre-defined Test Sequences        --userguide 137

   只能用create, start 来call,要注意将regmodel传给seq.model

 

14、uvm_component phase             --class reference 315

15、uvm_sequence_base phase         --class reference 399

 


 

Interrupt sequence

  interrupt sequence       --userguide 141

 

1、task grab(uvm_sequencer_base sequencer = null)

  Requests a lock on the specified sequencer. If no argument is supplied, the lock will be requested on the current default sequencer.

A grab equest is put in front of the arbitration queue. It will be arbitrated before any other requests. A grab is granted when no other grabs or locks are blocking this

sequence.

The grab call will return when the grab has been granted.

2、function void ungrab(uvm_sequencer_base sequencer = null)

Removes any locks or grabs obtained by this sequence on the specified sequencer. If sequencer is null, then the unlock will be done on the current default sequencer.


RUN-TIME control of seq relevance

 

1、run-time control of seq relevance        -userguide 143

2、is_relevant(),wait_for_relevant()        --class reference 405

 


SET_DRAIN_TIME

Sets the drain time on the given object to drain.

The drain time is the amount of time to wait once all objections have been dropped before calling the all_dropped callback and propagating the objection to the parent.

If a new objection for this object or any of its descendents is raised during the drain time or during execution of the all_dropped callbacks, the drain_time/all_dropped execution is terminated.

1、set_id_info

function void set_id_info(uvm_sequence_item item)

Copies the sequence_id and transaction_id from the referenced item into the calling

item. This routine should always be used by drivers to initialize responses for future compatibility

 

2、get_response

  virtual task get_response(output RSP response,

input int transaction_id = -1)

By default, sequences must retrieve responses by calling get_response. If no

transaction_id is specified, this task will return the next response sent to this sequence.If no response is available in the response queue, the method will block until a response is recieved.

If a transaction_id is parameter is specified, the task will block until a response with that transaction_id is received in the response queue.

The default size of the response queue is 8. The get_response method must be called soon enough to avoid an overflow of the response queue to prevent responses from being dropped.

If a response is dropped in the response queue, an error will be reported unless the error reporting is disabled via set_response_queue_error_report_disabled.

 

3、wait_for_item_done

A sequence may optionally call wait_for_item_done. This task will block until the driver calls item_done() or put() on a transaction issued by the specified sequence. If no transaction_id parameter is specified, then the call will return the next time that the driver calls item_done() or put(). If a specific transaction_id is specified, then the call

4、seq_item_port.put(response)

 

 

已标记关键词 清除标记
©️2020 CSDN 皮肤主题: 撸撸猫 设计师:C马雯娟 返回首页