Initial instance

This commit is contained in:
Borna Rajkovic committed 2022-03-29 21:31:45 +02:00
commit 48e1c48579
65 files changed
+6233

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
#include "addressspace.h"
AddressSpace::AddressSpace()
{
}
+19
View File
@@ -0,0 +1,19 @@
#ifndef ADDRESSSPACE_H
#define ADDRESSSPACE_H
#include <string>
#include <comdel/parser/astnode.h>
class AddressSpace: public AstNode
{
public:
IdentifierNode name;
NumberNode start;
NumberNode end;
AddressSpace();
};
#endif // ADDRESSSPACE_H
+5
View File
@@ -0,0 +1,5 @@
#include "attribute.h"
Attribute::Attribute()
{
}
+21
View File
@@ -0,0 +1,21 @@
#ifndef DOMAIN_LIBRARY_ATTRIBUTE_H
#define DOMAIN_LIBRARY_ATTRIBUTE_H
#include "value.h"
#include "popup.h"
#include <optional>
class Attribute: AstNode
{
public:
Value::ValueType type;
IdentifierNode name;
std::optional<Value> defaultValue;
std::optional<Popup> popup;
Attribute();
};
#endif // DOMAIN_LIBRARY_ATTRIBUTE_H
+6
View File
@@ -0,0 +1,6 @@
#include "bus.h"
Bus::Bus()
{
}
+33
View File
@@ -0,0 +1,33 @@
#ifndef DOMAIN_LIBRARY_BUS_H
#define DOMAIN_LIBRARY_BUS_H
#include "wire.h"
#include <string>
#include <vector>
#include <domain/display/display.h>
#include <comdel/parser/astnode.h>
class Bus: AstNode
{
public:
enum BusType {
AUTOMATIC,
REGULAR
};
BusType type;
IdentifierNode name;
StringNode tooltip;
CountNode count;
Display display;
std::vector<Wire> wires;
Bus();
};
#endif // DOMAIN_LIBRARY_BUS_H
+6
View File
@@ -0,0 +1,6 @@
#include "component.h"
Component::Component()
{
}
+37
View File
@@ -0,0 +1,37 @@
#ifndef COMPONENT_H
#define COMPONENT_H
#include "rule.h"
#include "pin.h"
#include "attribute.h"
#include <string>
#include <vector>
#include <domain/display/display.h>
class Component: AstNode
{
public:
enum ComponentType {
OTHER,
PROCESSOR,
MEMORY
};
IdentifierNode name;
StringNode tooltip;
StringNode source;
ComponentType type;
std::vector<Rule> rules;
StringNode instanceName;
CountNode count;
Display display;
std::vector<Pin> pin;
std::vector<Attribute> attributes;
Component();
};
#endif // COMPONENT_H
+6
View File
@@ -0,0 +1,6 @@
#include "connection.h"
Connection::Connection()
{
}
+23
View File
@@ -0,0 +1,23 @@
#ifndef DOMAIN_LIBRARY_CONNECTION_H
#define DOMAIN_LIBRARY_CONNECTION_H
#include "attribute.h"
#include "bus.h"
#include "component.h"
#include <string>
#include <vector>
class Connection: AstNode
{
public:
IdentifierNode component;
IdentifierNode pin;
IdentifierNode bus;
std::vector<Attribute> attributes;
std::vector<IdentifierNode> wires;
Connection();
};
#endif // DOMAIN_LIBRARY_CONNECTION_H
+6
View File
@@ -0,0 +1,6 @@
#include "library.h"
Library::Library()
{
}
+34
View File
@@ -0,0 +1,34 @@
#ifndef LIBRARY_H
#define LIBRARY_H
#include "addressspace.h"
#include "bus.h"
#include "component.h"
#include "connection.h"
#include <map>
#include <string>
#include <vector>
class Library: AstNode
{
public:
StringNode name;
StringNode libraryInfo;
StringNode header;
StringNode componentDirectory;
std::vector<AddressSpace> addressSpaces;
std::vector<Component> components;
std::vector<Bus> buses;
std::vector<Connection> connections;
std::vector<PropertyNode> messages;
Library();
};
#endif // LIBRARY_H
+6
View File
@@ -0,0 +1,6 @@
#include "pin.h"
Pin::Pin()
{
}
+43
View File
@@ -0,0 +1,43 @@
#ifndef DOMAIN_LIBRARY_PIN_H
#define DOMAIN_LIBRARY_PIN_H
#include <domain/display/display.h>
#include <string>
#include <comdel/parser/astnode.h>
class PinConnection: AstNode {
public:
enum ConnectionType {
CHECK_ONLY,
AUTOMATICALLY
};
StringNode message;
ConnectionType type;
};
class Pin: AstNode
{
public:
enum PinType {
IN_OUT,
IN,
OUT
};
IdentifierNode name;
PinType type;
StringNode tooltip;
PinConnection connection;
Display display;
Pin();
};
#endif // DOMAIN_LIBRARY_PIN_H
+6
View File
@@ -0,0 +1,6 @@
#include "popup.h"
Popup::Popup()
{
}
+37
View File
@@ -0,0 +1,37 @@
#ifndef DOMAIN_LIBRARY_POPUP_H
#define DOMAIN_LIBRARY_POPUP_H
#include "rule.h"
#include <map>
#include <string>
#include <vector>
class EnumerationNode: AstNode {
public:
StringNode key;
Value value;
};
class Popup: AstNode
{
public:
enum PopupType {
AUTOMATIC,
ON_DEMAND
};
PopupType type;
StringNode title;
StringNode text;
bool enumerated;
std::vector<EnumerationNode> enumeration;
std::vector<Rule> rules;
Popup();
};
#endif // DOMAIN_LIBRARY_POPUP_H
+6
View File
@@ -0,0 +1,6 @@
#include "rule.h"
Rule::Rule()
{
}
+44
View File
@@ -0,0 +1,44 @@
#ifndef DOMAIN_LIBRARY_RULE_H
#define DOMAIN_LIBRARY_RULE_H
#include "value.h"
#include <string>
#include <vector>
class Action;
class Condition;
class IfStmt;
class Rule: AstNode
{
public:
std::vector<IfStmt> statements;
Rule();
};
class Action: AstNode {
public:
enum ActionType {
ERROR,
WARNING
};
ActionType type;
StringNode message;
};
class Condition {
public:
bool negated;
IdentifierNode functionName;
std::vector<Value> params;
};
class IfStmt: AstNode {
public:
Condition condition;
Action action;
};
#endif // DOMAIN_LIBRARY_RULE_H
+5
View File
@@ -0,0 +1,5 @@
#include "value.h"
Value::Value()
{
}
+100
View File
@@ -0,0 +1,100 @@
#ifndef DOMAIN_LIBRARY_VALUE_H
#define DOMAIN_LIBRARY_VALUE_H
#include <optional>
#include <string>
#include <comdel/parser/astnode.h>
class Value: AstNode
{
public:
enum ValueType {
INT,
STRING,
BOOL,
IDENTIFIER
};
private:
ValueType type;
std::optional<long long> intValue;
std::optional<std::string> stringValue;
std::optional<bool> boolValue;
std::optional<std::string> identifierValue;
public:
Value();
ValueType getType() {
return type;
}
long long asInt() {
if(is(INT)) {
return intValue.value();
}
throw "cannot convert type to int";
}
std::string asString() {
if(is(STRING)) {
return stringValue.value();
}
throw "cannot convert type to string";
}
std::string asIdentifier() {
if(is(IDENTIFIER)) {
return identifierValue.value();
}
throw "cannot convert type to identifier";
}
bool asBool() {
if(is(BOOL)) {
return boolValue.value();
}
throw "cannot convert type to bool";
}
bool is(ValueType type) {
return this->type == type;
}
static Value ofBool(bool _value) {
Value value;
value.type = BOOL;
value.boolValue = std::optional<bool>(_value);
return value;
}
static Value ofInt(long long _value) {
Value value;
value.type = INT;
value.intValue = std::optional<long long>(_value);
return value;
}
static Value ofString(std::string _value) {
Value value;
value.type = STRING;
value.stringValue = std::optional<std::string>(_value);
return value;
}
static Value ofIdentifier(std::string _value) {
Value value;
value.type = IDENTIFIER;
value.identifierValue = std::optional<std::string>(_value);
return value;
}
};
class PropertyNode: public AstNode {
public:
IdentifierNode key;
Value value;
PropertyNode() {}
};
#endif // DOMAIN_LIBRARY_VALUE_H
+6
View File
@@ -0,0 +1,6 @@
#include "wire.h"
Wire::Wire()
{
}
+31
View File
@@ -0,0 +1,31 @@
#ifndef DOMAIN_LIBRARY_WIRE_H
#define DOMAIN_LIBRARY_WIRE_H
#include <string>
#include <comdel/parser/astnode.h>
class Wire: public AstNode
{
public:
enum WireType {
WIRE,
WIRED_AND,
WIRED_OR,
R_WIRE
};
WireType type;
IdentifierNode name;
NumberNode size;
/*
bool isTerminatedWith;
long terminatedWith;
bool isIfUntrminated;
long ifUnterminated;
*/
Wire();
};
#endif // DOMAIN_LIBRARY_WIRE_H