SyoSil ApS UVM Scoreboard  1.0.3.0
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
cl_syoscb_compare_base Class Reference

Base class for all compare algorithms. More...

+ Inheritance diagram for cl_syoscb_compare_base:
+ Collaboration diagram for cl_syoscb_compare_base:

Public Member Functions

virtual void compare_control (bit cc)
 Compare API: Toggle comparisons on or off More...
 
virtual void compare_trigger (string queue_name="", cl_syoscb_item item=null)
 Compare API: Starts a comparison by calling compare_main if comparisons are not disabled. More...
 
virtual void compare_main (t_scb_compare_greed greed)
 Compare API: Main function that contains all the actual compare operations requested by the compare algorithm. More...
 
virtual void set_cfg (cl_syoscb_cfg cfg)
 Set the scoreboard configuration associated with this comparer's scoreboard. More...
 
virtual cl_syoscb_cfg get_cfg ()
 Gets the scoreboard configuration object associated with this scoreboard.
 
virtual string generate_miscmp_table (cl_syoscb_item primary_item, cl_syoscb_item secondary_item, string sec_queue_name, uvm_comparer comparer, string cmp_name)
 Generates a side-by-side comparison of the seq. More...
 
virtual void do_copy (uvm_object rhs)
 Custom do_dopy implementation for secondary queues.
 

Protected Member Functions

virtual void init ()
 Compare Strategy API: Executes some preliminary common operations before starting comparisons:

  1. Split queues into primary and secondary
  2. Create iterator for the chosen primary queue

 
virtual void compare_do_greed (t_scb_compare_greed greed)
 Compare Strategy API: Try to remove a match and drain all the potential remaining matches inside the queues according to the greed level given as argument. More...
 
virtual void compare_init ()
 Compare Strategy API: Verifies if the conditions for starting a compare are met:

  1. Verify that all queues currently contain at least one element
  2. Verify that all queues have at least one element from the same producer as the producer returned by get_count_producer() (the primary item being searched for) If the conditions are met then go variable is triggered, and the compare process can start.
More...
 
virtual void compare_do ()
 Compare Strategy API: Starts the actual comparison operation

  1. Perform initialization on the primary queue, if necessary
  2. Start the primary queue loop

 
virtual string get_primary_queue_name ()
 Compare Strategy API: Gets the name of this scoreboard's primary queue. More...
 
virtual void split_queues ()
 Compare Strategy API: Splits the scoreboard's queues into 1 primary queue and N-1 secondary queues. More...
 
virtual void check_queues ()
 Compare Strategy API: Check if any queue is empty. More...
 
virtual void count_producers (string producer="")
 Compare Strategy API: Checks if the producer of the current item exists in all other queues, and whether all other queues have at least 1 item from that producer. More...
 
virtual void create_primary_iterator ()
 Compare Strategy API: Creates the iterator for the primary queue and sets the pointer to its first element
 
virtual void primary_loop_init ()
 Compare Strategy API: Contains all the operations to be executed immediately before starting the primary loop. More...
 
virtual void primary_loop_do ()
 Compare Strategy API: Loop over the primary queue, selecting primary items to compare against items in the secondary queues. More...
 
virtual void secondary_loop_do ()
 Compare Strategy API: Loop over all secondary queues to find a match for the primary item. More...
 
virtual void static_queue_split_do ()
 Compare Strategy API: Splits queues into primary and secondary when a primary queue has been specified. More...
 
virtual void dynamic_queue_split_do ()
 Compare Strategy API: Splits queues into primary and secondary when a primary queue has not been specified. More...
 
virtual bit delete ()
 Compare Strategy API: Deletes matched items from the primary and all secondary queues if a match was found. More...
 
virtual string get_count_producer ()
 Compare Strategy API: Returns the name of the producer that the compare method should evaluate in order to verify if it makes sense to start a comparison. More...
 
virtual int unsigned get_queues_item_cnt ()
 Compare Strategy API: Gets the total number of items in all the queues at the moment of the function call. More...
 

Protected Attributes

cl_syoscb_cfg cfg
 Handle to the configuration object.
 
bit do_split = 0b1
 Indicates how queues should be split into a primary queue and array of secondary queues. More...
 
bit go = 0b1
 Indicates whether a comparison can be started (1) or not (0)
 
bit disable_compare = 0b0
 If set to 1'b1, no comparisons are performed. If 1'b0, comparisons are executed.
 
string primary_queue_name
 Name of primary queue.
 
cl_syoscb_queue_base primary_queue
 Handle to primary queue.
 
string secondary_queue_names []
 Names of secondary queues.
 
cl_syoscb_queue_base secondary_queues []
 Handles to secondary queues.
 
cl_syoscb_proxy_item_base secondary_item_found [string]
 Associative array used to indicate if a matching item was found in a secondary queue. More...
 
cl_syoscb_proxy_item_base primary_item_proxy
 Proxy item for the item being searched for in all secondary queue.
 
cl_syoscb_queue_iterator_base primary_queue_iter
 Iterator into primary queue.
 
string current_queue_name
 Name of the queue currently being searched.
 
cl_syoscb_item current_item
 Handle to the item passed in by cl_syoscb::add_item.
 

Private Member Functions

virtual int num_uvm_errors ()
 Returns the number of UVM_ERROR messages that have been generated so far.
 

Detailed Description

Base class for all compare algorithms.

The chosen compare algorithm defines how matches are found. For more information on the comparison algorithms included with the SyoSil UVM Scoreboard, see Compare implementation notes.

Definition at line 4 of file cl_syoscb_compare_base.svh.

Member Function Documentation

◆ check_queues()

void cl_syoscb_compare_base::check_queues ( )
protectedvirtual

Compare Strategy API: Check if any queue is empty.

Assigns 0 to the member variable go when any of the queues are empty, indicating that a comparison cannot be started. Assigns 1 if all queues are non-empty, indicating that the comparison may be started.

Definition at line 250 of file cl_syoscb_compare_base.svh.

References cl_syoscb_queue_base::empty(), go, primary_queue, and secondary_queues.

Referenced by cl_syoscb_compare_iop::compare_init(), and compare_init().

◆ compare_control()

void cl_syoscb_compare_base::compare_control ( bit  cc)
virtual

Compare API: Toggle comparisons on or off

Parameters
cccompare control bit. If 1, comparisons are enabled, if 0, comparisons are disabled

Definition at line 114 of file cl_syoscb_compare_base.svh.

References disable_compare.

Referenced by cl_syoscb_compare::compare_control().

◆ compare_do_greed()

void cl_syoscb_compare_base::compare_do_greed ( t_scb_compare_greed  greed)
protectedvirtual

Compare Strategy API: Try to remove a match and drain all the potential remaining matches inside the queues according to the greed level given as argument.

Performs the following:

  1. Calling the checkers in order to verify that starting a comparison makes sense
  2. Calling the actual compare_do function if a comparison should be starte
  3. Looping to remove additional matches if the greed levels prescribes this
    Parameters
    greedThe greed level to use when performing comparisons. See cl_syoscb_cfg::trigger_greediness

Definition at line 165 of file cl_syoscb_compare_base.svh.

References cfg, compare_do(), compare_init(), disable_compare, cl_syoscb_cfg::get_disable_compare_after_error(), get_queues_item_cnt(), go, num_uvm_errors(), and secondary_queues.

Referenced by compare_main().

◆ compare_init()

void cl_syoscb_compare_base::compare_init ( )
protectedvirtual

Compare Strategy API: Verifies if the conditions for starting a compare are met:

  1. Verify that all queues currently contain at least one element
  2. Verify that all queues have at least one element from the same producer as the producer returned by get_count_producer() (the primary item being searched for) If the conditions are met then go variable is triggered, and the compare process can start.

Reimplemented in cl_syoscb_compare_iop, and cl_syoscb_compare_iop.

Definition at line 196 of file cl_syoscb_compare_base.svh.

References check_queues(), and count_producers().

Referenced by compare_do_greed().

◆ compare_main()

void cl_syoscb_compare_base::compare_main ( t_scb_compare_greed  greed)
virtual

Compare API: Main function that contains all the actual compare operations requested by the compare algorithm.

It cares about:

  1. Splitting queues into primary and secondary queues, generating an interator into the primary queue
  2. Calling compare_do_greed with the proper draining value passed as argument
  3. Deleting the primary queue iterator after the compare algo has finished all comparisons
    Parameters
    greedThe greed level to use when performing comparisons. See cl_syoscb_cfg::trigger_greediness

Definition at line 142 of file cl_syoscb_compare_base.svh.

References compare_do_greed(), and init().

Referenced by compare_trigger(), and cl_syoscb_compare::extract_phase().

◆ compare_trigger()

void cl_syoscb_compare_base::compare_trigger ( string  queue_name = "",
cl_syoscb_item  item = null 
)
virtual

Compare API: Starts a comparison by calling compare_main if comparisons are not disabled.

Parameters
queue_nameName of the queue which had an item inserted into it
itemThe scoreboard wrapper item that was inserted into the SCB

Definition at line 121 of file cl_syoscb_compare_base.svh.

References cfg, compare_main(), current_item, current_queue_name, disable_compare, and cl_syoscb_cfg::get_trigger_greediness().

Referenced by cl_syoscb_compare::compare_trigger().

◆ count_producers()

void cl_syoscb_compare_base::count_producers ( string  producer = "")
protectedvirtual

Compare Strategy API: Checks if the producer of the current item exists in all other queues, and whether all other queues have at least 1 item from that producer.

If true, assigns 1'b1 to member variable go If false, assigns 1'b0 to member variable go

Parameters
producerThe producer to check if exists in all other queues. If not set, checks if the producer of current_item exists in other queues. If set, checks for that producer in other queues.

Reimplemented in cl_syoscb_compare_io, and cl_syoscb_compare_io.

Definition at line 271 of file cl_syoscb_compare_base.svh.

References cl_syoscb_queue_base::exists_cnt_producer(), cl_syoscb_queue_base::get_cnt_producer(), get_count_producer(), go, primary_queue, and secondary_queues.

Referenced by compare_init(), and cl_syoscb_compare_iop::primary_loop_do().

◆ delete()

bit cl_syoscb_compare_base::delete ( )
protectedvirtual

Compare Strategy API: Deletes matched items from the primary and all secondary queues if a match was found.

If no match is found, no items are deleted from the queues.

Returns
0b1 if a match was found and items were deleted, 10b0 otherwise

Definition at line 303 of file cl_syoscb_compare_base.svh.

References cfg, cl_syoscb_queue_base::delete_item(), cl_syoscb_cfg::get_scb_name(), primary_queue, primary_queue_name, secondary_item_found, secondary_queue_names, and secondary_queues.

◆ dynamic_queue_split_do()

void cl_syoscb_compare_base::dynamic_queue_split_do ( )
protectedvirtual

Compare Strategy API: Splits queues into primary and secondary when a primary queue has not been specified.

Selects as the primary queue the shortest queue, the rest are the secondary queues.

Definition at line 398 of file cl_syoscb_compare_base.svh.

References cfg, cl_syoscb_cfg::get_queue(), cl_syoscb_cfg::get_queues(), cl_syoscb_queue_base::get_size(), primary_queue, primary_queue_name, secondary_queue_names, and secondary_queues.

Referenced by split_queues().

◆ generate_miscmp_table()

string cl_syoscb_compare_base::generate_miscmp_table ( cl_syoscb_item  primary_item,
cl_syoscb_item  secondary_item,
string  sec_queue_name,
uvm_comparer  comparer,
string  cmp_name 
)
virtual

Generates a side-by-side comparison of the seq.

items that prompted a miscompare. The table includes a header with information on which queues the items originated in, a side-by-side view of the two seq. items and, if cl_syoscb_cfg::enable_comparer_report is set, it also includes a number of miscompare descriptions from the uvm_comparer used.

Parameters
primary_itemThe primary item in the comparison
secondary_itemThe secondary item in the comparison
sec_queue_nameThe name of the secondary queue
comparerThe uvm_comparer used for the comparison
cmp_nameName of the comparison type, to be used when printing the header.
Returns
The miscompare table

Definition at line 496 of file cl_syoscb_compare_base.svh.

References cfg, cl_syoscb_string_library::generate_cmp_table_body(), cl_syoscb_string_library::generate_cmp_table_footer(), cl_syoscb_string_library::generate_cmp_table_header(), cl_syoscb_cfg::get_enable_comparer_report(), cl_syoscb_item::get_producer(), cl_syoscb_cfg::get_scb_name(), and primary_queue_name.

Referenced by cl_syoscb_compare_io_2hp::primary_loop_do(), cl_syoscb_compare_io::secondary_loop_do(), and cl_syoscb_compare_iop::secondary_loop_do().

◆ get_count_producer()

string cl_syoscb_compare_base::get_count_producer ( )
protectedvirtual

Compare Strategy API: Returns the name of the producer that the compare method should evaluate in order to verify if it makes sense to start a comparison.

Note
This needs to be overridden by the derived compare methods in order to change the behaviour accordingly to the requested needs. By default, the function returns the producer of current_item.
Returns
The name producer which should be evaluated

Reimplemented in cl_syoscb_compare_iop, cl_syoscb_compare_iop, cl_syoscb_compare_ooo, and cl_syoscb_compare_ooo.

Definition at line 336 of file cl_syoscb_compare_base.svh.

References current_item, and cl_syoscb_item::get_producer().

Referenced by count_producers().

◆ get_primary_queue_name()

string cl_syoscb_compare_base::get_primary_queue_name ( )
protectedvirtual

Compare Strategy API: Gets the name of this scoreboard's primary queue.

Convenience method wrapping cl_syoscb_cfg::get_primary_queue

Definition at line 213 of file cl_syoscb_compare_base.svh.

References cfg, and cl_syoscb_cfg::get_primary_queue().

Referenced by static_queue_split_do().

◆ get_queues_item_cnt()

int unsigned cl_syoscb_compare_base::get_queues_item_cnt ( )
protectedvirtual

Compare Strategy API: Gets the total number of items in all the queues at the moment of the function call.

Returns
Number of items currently stored in all queues

Definition at line 343 of file cl_syoscb_compare_base.svh.

References cfg, cl_syoscb_cfg::get_queue(), cl_syoscb_cfg::get_queues(), and cl_syoscb_queue_base::get_size().

Referenced by compare_do_greed().

◆ primary_loop_do()

void cl_syoscb_compare_base::primary_loop_do ( )
protectedvirtual

Compare Strategy API: Loop over the primary queue, selecting primary items to compare against items in the secondary queues.

Note
Abstract method. This method must be implemented in a subclass.

Reimplemented in cl_syoscb_compare_iop, cl_syoscb_compare_iop, cl_syoscb_compare_io, cl_syoscb_compare_io_2hp, cl_syoscb_compare_io, cl_syoscb_compare_io_2hp, cl_syoscb_compare_ooo, and cl_syoscb_compare_ooo.

Definition at line 361 of file cl_syoscb_compare_base.svh.

Referenced by compare_do().

◆ primary_loop_init()

void cl_syoscb_compare_base::primary_loop_init ( )
protectedvirtual

Compare Strategy API: Contains all the operations to be executed immediately before starting the primary loop.

By default is an empty function (no other operations needed).

Definition at line 463 of file cl_syoscb_compare_base.svh.

Referenced by cl_syoscb_compare_io_2hp::compare_do(), and compare_do().

◆ secondary_loop_do()

void cl_syoscb_compare_base::secondary_loop_do ( )
protectedvirtual

Compare Strategy API: Loop over all secondary queues to find a match for the primary item.

Note
Abstract method. This method must be implemented in a subclass.

Reimplemented in cl_syoscb_compare_iop, cl_syoscb_compare_iop, cl_syoscb_compare_io, cl_syoscb_compare_io, cl_syoscb_compare_ooo, and cl_syoscb_compare_ooo.

Definition at line 367 of file cl_syoscb_compare_base.svh.

◆ set_cfg()

void cl_syoscb_compare_base::set_cfg ( cl_syoscb_cfg  cfg)
virtual

Set the scoreboard configuration associated with this comparer's scoreboard.

Parameters
cfgThe scoreboard configuration object

Definition at line 476 of file cl_syoscb_compare_base.svh.

References cfg.

Referenced by cl_syoscb_compare::build_phase().

◆ split_queues()

void cl_syoscb_compare_base::split_queues ( )
protectedvirtual

Compare Strategy API: Splits the scoreboard's queues into 1 primary queue and N-1 secondary queues.

Selects the primary queue and creates an array of secondary queues with the rest. If a dynamic primary queue is used, this split is performed every time a comparison is started. If a static primary queue is used, this split is only performed on the first comparison.

Definition at line 221 of file cl_syoscb_compare_base.svh.

References cfg, do_split, cl_syoscb_cfg::dynamic_primary_queue(), dynamic_queue_split_do(), secondary_queue_names, secondary_queues, and static_queue_split_do().

Referenced by init().

◆ static_queue_split_do()

void cl_syoscb_compare_base::static_queue_split_do ( )
protectedvirtual

Compare Strategy API: Splits queues into primary and secondary when a primary queue has been specified.

The primary queue is the one set by cl_syoscb_cfg::set_primary_queue_name, all other queues will be secondary queues

Definition at line 374 of file cl_syoscb_compare_base.svh.

References cfg, get_primary_queue_name(), cl_syoscb_cfg::get_queue(), cl_syoscb_cfg::get_queues(), primary_queue, primary_queue_name, secondary_queue_names, and secondary_queues.

Referenced by split_queues().

Member Data Documentation

◆ do_split

bit cl_syoscb_compare_base::do_split = 0b1
protected

Indicates how queues should be split into a primary queue and array of secondary queues.

This is done once with a static primary queue, done every time compare is invoked with a dynamic primary queue

Definition at line 13 of file cl_syoscb_compare_base.svh.

Referenced by init(), and split_queues().

◆ secondary_item_found

cl_syoscb_proxy_item_base cl_syoscb_compare_base::secondary_item_found
protected

Associative array used to indicate if a matching item was found in a secondary queue.

If matches are found in all secondary queues, all items are removed from their respective queues

Definition at line 28 of file cl_syoscb_compare_base.svh.

Referenced by delete(), cl_syoscb_compare_ooo::primary_loop_do(), cl_syoscb_compare_io::primary_loop_do(), cl_syoscb_compare_io_2hp::primary_loop_do(), cl_syoscb_compare_iop::primary_loop_do(), cl_syoscb_compare_ooo::secondary_loop_do(), cl_syoscb_compare_io::secondary_loop_do(), and cl_syoscb_compare_iop::secondary_loop_do().


The documentation for this class was generated from the following files:

Project: SyoSil ApS UVM Scoreboard, Revision: 1.0.3.0

Copyright 2014-2022 SyoSil ApS
All Rights Reserved Worldwide

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
doxygen
Doxygen Version: 1.8.14
Generated with IDV SV Filter Version: 2.6.3
Fri Sep 2 2022 14:41:02
Find a documentation bug? Report bugs to: scoreboard@syosil.com