87 lines
1.7 KiB
C++
87 lines
1.7 KiB
C++
#ifndef DOMAIN_BUS_H
|
|
#define DOMAIN_BUS_H
|
|
|
|
#include "display.h"
|
|
#include "value.h"
|
|
|
|
#include <string>
|
|
#include <optional>
|
|
#include <vector>
|
|
|
|
|
|
namespace domain {
|
|
|
|
class Wire {
|
|
public:
|
|
enum WireType {
|
|
WIRE_DEFAULT,
|
|
WIRED_AND,
|
|
WIRED_OR,
|
|
R_WIRE
|
|
};
|
|
|
|
|
|
private:
|
|
std::string name;
|
|
WireType type;
|
|
int width;
|
|
bool hidden;
|
|
bool hasTerminate;
|
|
Value terminateWith;
|
|
|
|
public:
|
|
Wire(std::string name, WireType type, int width, bool hidden, bool hasTerminate, Value terminateWith);
|
|
|
|
std::string getName();
|
|
|
|
int getWidth();
|
|
|
|
bool isHidden();
|
|
|
|
bool hasTerminateWith();
|
|
|
|
Value getTerminateWith();
|
|
|
|
WireType getType();
|
|
};
|
|
|
|
class Bus {
|
|
public:
|
|
enum BusType {
|
|
AUTOMATIC,
|
|
REGULAR,
|
|
SINGLE_AUTOMATIC
|
|
};
|
|
private:
|
|
std::string name;
|
|
std::string instanceName;
|
|
std::string tooltip;
|
|
BusType type;
|
|
|
|
std::pair<int, int> count;
|
|
std::optional<ui::Bus> displayBus;
|
|
std::vector<Wire> wires;
|
|
|
|
public:
|
|
Bus(std::string name, std::string instanceName, std::string tooltip, BusType type, std::pair<int, int> count, std::vector<Wire> wires,
|
|
std::optional<ui::Bus> display = std::nullopt);
|
|
|
|
std::string getName();
|
|
|
|
std::string getInstanceName();
|
|
|
|
std::string getTooltip();
|
|
|
|
BusType getType();
|
|
|
|
std::pair<int, int> getCount();
|
|
|
|
std::vector<Wire> getWires();
|
|
|
|
std::optional<ui::Bus> getDisplayBus();
|
|
};
|
|
|
|
} // namespace domain
|
|
|
|
#endif // DOMAIN_BUS_H
|