class tuple#( type T1 = int, type T2 = int, type T3 = int, type T4 = int, type T5 = int, type T6 = int, type T7 = int, type T8 = int, type T9 = int, type T10 = int )
Provides a tuple that carries up to ten values, which can be different types.
| T1 | optional The type of the first value of a tuple. The default is int. |
| T2 | optional The type of the second value of a tuple. The default is int. |
| T3 | optional The type of the third value of a tuple. The default is int. |
| T4 | optional The type of the fourth value of a tuple. The default is int. |
| T5 | optional The type of the fifth value of a tuple. The default is int. |
| T6 | optional The type of the sixth value of a tuple. The default is int. |
| T7 | optional The type of the seventh value of a tuple. The default is int. |
| T8 | optional The type of the eighth value of a tuple. The default is int. |
| T9 | optional The type of the ninth value of a tuple. The default is int. |
| T10 | optional The type of the tenth value of a tuple. The default is int. |
| tuple | Provides a tuple that carries up to ten values, which can be different types. |
| Types | |
| this_type | The shorthand of tuple#(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10) |
| Properties | |
| first | The first value inside the tuple. |
| second | The second value inside the tuple. |
| third | The third value inside the tuple. |
| fourth | The fourth value inside the tuple. |
| fifth | The fifth value inside the tuple. |
| sixth | The sixth value inside the tuple. |
| seventh | The seventh value inside the tuple. |
| eighth | The eighth value inside the tuple. |
| ninth | The ninth value inside the tuple. |
| tenth | The tenth value inside the tuple. |
| Functions | |
| new | Creates a tuple of values of types T1, T2, and T3. |
| eq | Returns 1 if this object is equal to the specified tuple. |
| ne | Returns 1 if this object is not equal to the specified tuple. |
| lt | Returns 1 if this object is less than the specified tuple. |
| gt | Returns 1 if this object is greater than the specified tuple. |
| le | Returns 1 if this object is less than or equal to the specified tuple. |
| ge | Returns 1 if this object is greater than or equal to the specified tuple. |
| clone | Creates a tuple by cloning this object. |
| swap | Swaps the contents of this tuple with the ones of the specified tuple. |
function new( T1 first, T2 second, T3 third, T4 fourth = 0, T5 fifth = 0, T6 sixth = 0, T7 seventh = 0, T8 eighth = 0, T9 ninth = 0, T10 tenth = 0, comparator#(this_type) cmp = null )
Creates a tuple of values of types T1, T2, and T3. Optionally, a tuple can have up to ten values of different types.
| first | The first value of a tuple. |
| second | The second value of a tuple. |
| third | The third value of a tuple. |
| fourth | optional The fourth value of a tuple. |
| fifth | optional The fifth value of a tuple. |
| sixth | optional The sixth value of a tuple. |
| seventh | optional The seventh value of a tuple. |
| eighth | optional The eighth value of a tuple. |
| ninth | optional The ninth value of a tuple. |
| tenth | optional The tenth value of a tuple. |
| cmp | optional A strategy object used to compare two tuples. If not specified or null, tuple_comparator #(this_type) is used. The default is null. |
None.
tuple#(int, string, bit[7:0]) t = new( 1, "apple", 8'hFF );
function bit eq( const ref this_type t )
Returns 1 if this object is equal to the specified tuple. The comparison is done by the strategy object specified at the object construction.
| t | A tuple to compare with. |
If this object is equal to t, then returns 1. Otherwise, returns 0.
tuple#(int, string, bit[7:0]) t = new( 1, "apple", 8'hFF ); tuple#(int, string, bit[7:0]) u = new( 1, "apple", 8'hFF ); assert( t.eq( u ) == 1 ); // 1 == 1 && "apple" == "apple" && 8'hFF == 8'hFF
function bit ne( const ref this_type t )
Returns 1 if this object is not equal to the specified tuple. The comparison is done by the strategy object specified at the object construction.
| t | A tuple to compare with. |
If this object is not equal to t, then returns 1. Otherwise, returns 0.
tuple#(int, string, bit[7:0]) t = new( 1, "apple", 8'hFF ); tuple#(int, string, bit[7:0]) u = new( 1, "orange", 8'hFF ); assert( t.ne( u ) == 1 ); // "apple" != "orange"
function bit lt( const ref this_type t )
Returns 1 if this object is less than the specified tuple. The comparison is done by the strategy object specified at the object construction.
| t | A tuple to compare with. |
If this object is less than t, then returns 1. Otherwise, returns 0.
tuple#(int, string, bit[7:0]) t = new( 1, "apple", 8'hFF ); tuple#(int, string, bit[7:0]) u = new( 2, "apple", 8'hFF ); assert( t.lt( u ) == 1 ); // 1 < 2
function bit gt( const ref this_type t )
Returns 1 if this object is greater than the specified tuple. The comparison is done by the strategy object specified at the object construction.
| t | A tuple to compare with. |
If this object is greater than t, then returns 1. Otherwise, returns 0.
tuple#(int, string, bit[7:0]) t = new( 1, "orange", 8'hFF ); tuple#(int, string, bit[7:0]) u = new( 1, "apple", 8'hFF ); assert( t.gt( u ) == 1 ); // "orange" > "apple" by the lexicographical order
function bit le( const ref this_type t )
Returns 1 if this object is less than or equal to the specified tuple. The comparison is done by the strategy object specified at the object construction.
| t | A tuple to compare with. |
If this object is less than or equal to t, then returns 1. Otherwise, returns 0.
tuple#(int, string, bit[7:0]) t = new( 1, "apple", 8'hFF ); tuple#(int, string, bit[7:0]) u = new( 1, "orange", 8'hFF ); assert( t.le( u ) == 1 ); // "apple" < "orange" by the lexicographical order
function bit ge( const ref this_type t )
Returns 1 if this object is greater than or equal to the specified tuple. The comparison is done by the strategy object specified at the object construction.
| t | A tuple to compare with. |
If this object is greater than or equal to t, then returns 1. Otherwise, returns 0.
tuple#(int, string, bit[7:0]) t = new( 2, "apple", 8'hFF ); tuple#(int, string, bit[7:0]) u = new( 1, "orange", 8'hFF ); assert( t.ge( u ) == 1 ); // 2 > 1
function void swap( ref this_type t )
Swaps the contents of this tuple with the ones of the specified tuple.
| t | A tuple to swap the contents. |
tuple#(int, string, bit[7:0]) t = new( 1, "apple", 8'hFF ); tuple#(int, string, bit[7:0]) u = new( 2, "orange", 8'hAA ); t.swap( u ); assert( t.first == 2 ); assert( u.first == 1 ); assert( t.second == "orange" ); assert( u.second == "apple" ); assert( t.third == 8'hAA ); assert( u.third == 8'hFF );
Provides a tuple that carries up to ten values, which can be different types.
class tuple#( type T1 = int, type T2 = int, type T3 = int, type T4 = int, type T5 = int, type T6 = int, type T7 = int, type T8 = int, type T9 = int, type T10 = int )
The shorthand of tuple#(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10)
typedef tuple#( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 ) this_type
The first value inside the tuple.
T1 first
The second value inside the tuple.
T2 second
The third value inside the tuple.
T3 third
The fourth value inside the tuple.
T4 fourth
The fifth value inside the tuple.
T5 fifth
The sixth value inside the tuple.
T6 sixth
The seventh value inside the tuple.
T7 seventh
The eighth value inside the tuple.
T8 eighth
The ninth value inside the tuple.
T9 ninth
The tenth value inside the tuple.
T10 tenth
Creates a tuple of values of types T1, T2, and T3.
function new( T1 first, T2 second, T3 third, T4 fourth = 0, T5 fifth = 0, T6 sixth = 0, T7 seventh = 0, T8 eighth = 0, T9 ninth = 0, T10 tenth = 0, comparator#(this_type) cmp = null )
Returns 1 if this object is equal to the specified tuple.
function bit eq( const ref this_type t )
Returns 1 if this object is not equal to the specified tuple.
function bit ne( const ref this_type t )
Returns 1 if this object is less than the specified tuple.
function bit lt( const ref this_type t )
Returns 1 if this object is greater than the specified tuple.
function bit gt( const ref this_type t )
Returns 1 if this object is less than or equal to the specified tuple.
function bit le( const ref this_type t )
Returns 1 if this object is greater than or equal to the specified tuple.
function bit ge( const ref this_type t )
Creates a tuple by cloning this object.
function this_type clone()
Swaps the contents of this tuple with the ones of the specified tuple.
function void swap( ref this_type t )
singleton Provides strategies to compare tuples.
class tuple_comparator#( type T = tuple ) extends comparator#(T)