blob: 3e2fb8dff13d332d4624ceabb8436c129d3ce73c [file] [log] [blame]
#pragma once
#include <hei_includes.hpp>
#include <util/hei_bit_string.hpp>
namespace libhei
{
/**
@brief An abstract class for register objects.
Purpose: Register is an abstract base class for real and virtual registers.
A few examples of these registers are; HardwareRegister, ConstantRegister,
NotRegister, and AndRegister. As a base class of register types, Register
creates a place where these registers can be put together like logical
building blocks. For example, Register makes this possible:
Register * fir = new HardwareRegister(REG_ADDRESS, REG_WIDTH,
CHIP_TYPE, ACCESS_RO);
Register * mask = new ConstantRegister( 0xffffffff00000000 );
Register * fir_mask = new AndRegister(fir, mask);
const BitString * bs = fir_mask->getBitString();
The getBitString function (defined by each register) provides access to
the BitString that manages each register's data. In this example bs will
contain the result of fir & mask.
*/
class Register
{
public:
/** @brief Pure virtual destructor. */
virtual ~Register() = 0;
/**
@brief Provides access to the BitString that manages
this register's data.
@return A pointer to a BitString.
*/
virtual const BitString * getBitString() const = 0;
};
// Pure virtual destructor must be defined.
inline Register::~Register() {}
}//end namespace libhei