blob: 936d95e61ebcbfba31098306b5e706e7acdb1cf7 [file] [log] [blame]
Zane Shelley871adec2019-07-30 11:01:39 -05001#pragma once
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -05002
Paul Greenwood701fcc12019-08-15 19:29:31 -05003#include <stdio.h>
Zane Shelley52cb1a92019-08-21 14:38:31 -05004#include <hei_includes.hpp>
5#include <util/hei_bit_string.hpp>
6
Zane Shelley871adec2019-07-30 11:01:39 -05007namespace libhei
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -05008{
9
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050010/**
Paul Greenwood701fcc12019-08-15 19:29:31 -050011@brief Description: The Register class.
12
13Purpose: Register is an abstract base class for real and virtual registers.
14A few examples of these registers are; HardwareRegister, ConstantRegister,
15NotRegister, and AndRegister. As a base class of register types, Register
16creates a place where these registers can be put together like logical
17building blocks. For example, Register makes this possible:
18
19Register * fir = new HardwareRegister(REG_ADDRESS, REG_WIDTH,
20 DEFAULT_CHIP_TYPE, ACCESS_RO);
21Register * mask = new ConstantRegister( 0xffffffff00000000 );
22Register * fir_mask = new AndRegister(fir, mask);
23const BitString * bs = fir_mask->getBitString();
24
25The getBitString function (defined by each register) provides access to
26the BitString that manages each register's data. In this example bs will
27contain the result of fir & mask.
28*/
29class Register
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050030{
Paul Greenwood701fcc12019-08-15 19:29:31 -050031 public:
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050032
33 /**
Paul Greenwood701fcc12019-08-15 19:29:31 -050034 @brief Default constructor
35 */
36 Register() = default;
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050037
38 /**
Paul Greenwood701fcc12019-08-15 19:29:31 -050039 @brief Delete copy, assignment, and move operators. Deleting
40 copy causes the compiler to delete move.
41 */
42 Register(const Register&) = delete;
43 Register& operator=(const Register&) = delete;
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050044
45 /**
Paul Greenwood701fcc12019-08-15 19:29:31 -050046 @brief Default destructor
47 */
48 virtual ~Register() = default;
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050049
Paul Greenwood701fcc12019-08-15 19:29:31 -050050 /**
51 @brief Provides access to the BitString that manages
52 this register's data.
53 @return A pointer to a BitString.
54 */
55 virtual const BitString * getBitString() const = 0;
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050056
57};
58
Paul Greenwood701fcc12019-08-15 19:29:31 -050059}//end namespace libhei