pair_comparator

class pair_comparator#(type T =  pair) extends comparator#(T)

singleton Provides strategies to compare pairs.

Parameter

Toptional The type of a pair object to be compared.  The default is pair (with its default parameters).
Summary
pair_comparatorsingleton Provides strategies to compare pairs.
Types
this_typeThe shorthand of pair_comparator #(T).
Functions
newprotected Creates a new comparator.
get_instancestatic Returns the singleton instance of this comparator.
eqvirtual Returns 1 if two pairs are equal.
ltvirtual Returns 1 if x is less than y.

Types

this_type

typedef pair_comparator#(T) this_type

The shorthand of pair_comparator #(T).

Functions

new

protected function new()

protected Creates a new comparator.

get_instance

static function this_type get_instance()

static Returns the singleton instance of this comparator.

Returns

The singleton instance.

eq

virtual function bit eq(x,
y)

virtual Returns 1 if two pairs are equal.

Arguments

xA pair.
yAnother pair.

Returns

If x.first is equal to y.first and x.second is equal to y.second, then returns 1.  Otherwise, returns 0.

lt

virtual function bit lt(x,
y)

virtual Returns 1 if x is less than y.  Compares x.first and y.first.  If equal, then compares x.second and y.second.

Arguments

xA pair.
yAnother pair.

Returns

Returns 1 if x is less than y.  Otherwise, returns 0.

class pair_comparator#(type T =  pair) extends comparator#(T)
singleton Provides strategies to compare pairs.
class pair#(type T1 =  int,
type T2 =  T1)
Provides a pair that carries two values, which can be different types.
typedef pair_comparator#(T) this_type
The shorthand of pair_comparator #(T).
protected function new()
protected Creates a new comparator.
static function this_type get_instance()
static Returns the singleton instance of this comparator.
virtual function bit eq(x,
y)
virtual Returns 1 if two pairs are equal.
virtual function bit lt(x,
y)
virtual Returns 1 if x is less than y.