2022-03-31 21:20:41 +00:00
|
|
|
#ifndef DOMAIN_BUS_H
|
|
|
|
#define DOMAIN_BUS_H
|
|
|
|
|
|
|
|
#include "display.h"
|
2022-04-24 20:21:45 +00:00
|
|
|
#include "value.h"
|
2022-03-31 21:20:41 +00:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <optional>
|
2022-04-05 21:48:07 +00:00
|
|
|
#include <vector>
|
2022-03-31 21:20:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace domain {
|
|
|
|
|
2022-04-05 21:48:07 +00:00
|
|
|
class Wire
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum WireType {
|
|
|
|
WIRE_DEFAULT,
|
|
|
|
WIRED_AND,
|
|
|
|
WIRED_OR,
|
|
|
|
R_WIRE
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::string name;
|
|
|
|
WireType type;
|
|
|
|
int width;
|
|
|
|
bool hidden;
|
2022-04-24 20:21:45 +00:00
|
|
|
bool hasTerminate;
|
|
|
|
Value terminateWith;
|
2022-04-05 21:48:07 +00:00
|
|
|
|
|
|
|
public:
|
2022-04-24 20:21:45 +00:00
|
|
|
Wire(std::string name, WireType type, int width, bool hidden, bool hasTerminate, Value terminateWith);
|
2022-04-05 21:48:07 +00:00
|
|
|
|
|
|
|
std::string getName();
|
|
|
|
int getWidth();
|
|
|
|
bool isHidden();
|
2022-04-24 20:21:45 +00:00
|
|
|
bool hasTerminateWith();
|
|
|
|
Value getTerminateWith();
|
2022-04-05 21:48:07 +00:00
|
|
|
WireType getType();
|
|
|
|
};
|
|
|
|
|
2022-03-31 21:20:41 +00:00
|
|
|
class Bus
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum BusType {
|
|
|
|
AUTOMATIC,
|
2022-04-05 21:48:07 +00:00
|
|
|
REGULAR,
|
2022-05-08 12:50:56 +00:00
|
|
|
SINGLE_AUTOMATIC
|
2022-03-31 21:20:41 +00:00
|
|
|
};
|
|
|
|
private:
|
|
|
|
std::string name;
|
|
|
|
std::string tooltip;
|
|
|
|
BusType type;
|
|
|
|
|
|
|
|
std::pair<int, int> count;
|
|
|
|
std::optional<Display> display;
|
2022-04-05 21:48:07 +00:00
|
|
|
std::vector<Wire> wires;
|
2022-03-31 21:20:41 +00:00
|
|
|
|
|
|
|
public:
|
2022-04-05 21:48:07 +00:00
|
|
|
Bus(std::string name, std::string tooltip, BusType type, std::pair<int, int> count, std::vector<Wire> wires, std::optional<Display> display = std::nullopt);
|
2022-03-31 21:20:41 +00:00
|
|
|
|
|
|
|
std::string getName();
|
|
|
|
std::string getTooltip();
|
|
|
|
BusType getType();
|
|
|
|
std::pair<int, int> getCount();
|
2022-04-05 21:48:07 +00:00
|
|
|
std::vector<Wire> getWires();
|
2022-03-31 21:20:41 +00:00
|
|
|
std::optional<Display> getDisplay();
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace domain
|
|
|
|
|
|
|
|
#endif // DOMAIN_BUS_H
|