tb_values.h
// INCLUDE CLASSES USED IN THE IMPLEMENTATION

#include <vector>

//*****************************
// CLASS DECLARATION: TB_Values
//*****************************

class TB_Values
{
public:
    // CONSTRUCTOR

    TB_Values();

    // DESTRUCTOR

    ~TB_Values();

    // METHOD: random(size, mask)
    //
    // ARGUMENT: size
    //   Number of words in each data sequence.
    //
    // ARGUMENT: mask
    //   Bit-wise AND mask applied to all generated data values.
    //
    // DESCRIPTION:
    //   Initializes the read sequence with random values masked with a
    //   bit-mask.

    void random(unsigned int size, unsigned long mask);

    // METHOD: sequence(size, mask, constant)
    //
    // ARGUMENT: size
    //   Number of words in each data sequence.
    //
    // ARGUMENT: mask
    //   Bit-wise AND mask applied to all generated data values.
    //
    // ARGUMENT: constant
    //   Value OR'd with the value before the mask is applied.
    //
    // DESCRIPTION:
    //   Initializes the read sequence with values masked with a
    //   bit-mask. The value used is the index number of the data OR'd with a
    //   constant. Typically, the constant is used to identify the data stream.

    void sequence(unsigned int size, unsigned long mask, unsigned long constant);

    // METHOD: is_equal()
    //
    // RETURNS:
    //   True if read and write sequences are equal else false.

    bool is_equal();

    // METHOD: is_full()
    //
    // RETURNS:
    //   True if the read and write sequences are the same size else false.

    bool is_full();

    // METHOD: has_value()
    //
    // RETURNS:
    //   True if there are values in the read sequence that have not been read,
    //   else false.

    bool has_value();

    // METHOD: get_value()
    //
    // RETURNS:
    //   The next value in the read sequence.

    unsigned long get_value();

    // METHOD: put_value(value)
    //
    // ARGUMENT: value
    //   Value appended to the write sequence.

    void put_value(unsigned long value);

    // METHOD: get_read_size
    //
    // RETURNS:
    //   The number of values in the read sequence.

    unsigned long get_read_size();

    // METHOD: get_write_size
    //
    // RETURNS:
    //   The number of values in the write sequence.

    unsigned long get_write_size();

private:
    // DATA: THE READ SEQUENCE

    vector d_stimulus;

    // DATA: THE WRITE SEQUENCE

    vector d_response;

    // DATA: POINTER INTO READ SEQUENCE

    vector::iterator d_read;

    // DISABLE DEFAULT CONSTRUCTOR

    TB_Values(const TB_Values&);
};
© Copyright 2000-2001 Adrian Lewis