-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDefs.H
More file actions
136 lines (109 loc) · 3.11 KB
/
Defs.H
File metadata and controls
136 lines (109 loc) · 3.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#ifndef CONST_H
#define CONST_H
//This header file contains some defenitions to be used all over the application
//All possible actions
enum ActionType
{
NotYet,
ADD_Buff, //Add 1-input Buffer gate
ADD_INV, //Add 1-input Inverter gate
ADD_AND_GATE_2, //Add 2-input AND gate
ADD_OR_GATE_2, //Add 2-input OR gate
ADD_OR_GATE_3,
ADD_NAND_GATE_2,
ADD_NAND_GATE_3, //Add 2-input NAND gate
ADD_NOR_GATE_2, //Add 2-input NOR gate
ADD_XOR_GATE_2, //Add 2-input XOR gate
ADD_XNOR_GATE_2, //Add 2-input XNOR gate
ADD_AND_GATE_3, //Add 3-input AND gate
ADD_NOR_GATE_3, //Add 3-input NOR gate
ADD_XOR_GATE_3, //Add 3-input XOR gate
ADD_XNOR_GATE_3,
ADD_Switch, //Add Switch
ADD_LED, //Add LED
ADD_CONNECTION, //Add Wire Connection
ADD_GATE_BAR,
ADD_AND,
ADD_OR,
ADD_XOR,
ADD_Label, //Add Label to a Component, a Connection
EDIT_Label, //Edit Label of a Component, a Connection
DRWNG_AREA,
Create_TruthTable, //Create Truth Table of the Circuit
Change_Switch, //Change Switch Status in Simulation Mode
SELECT, //Select a Component, a Connection
DEL, //Delete a Component, a Connection
MOVE, //Move a Component, a Connection
SAVE, //Save the whole Circuit to a file
LOAD, //Load a Circuit from a file
UNDO, //Undo the last Action preformed
REDO, //Redo the last Action canceled
DSN_MODE, //Switch to Design mode
SIM_MODE, //Switch to Simulatiom mode
EXIT, //Exit the application
STATUS_BAR, //A click on the status bar
DSN_TOOL, //A click on an empty place in the design tool bar
};
//Possible Status for the pin
enum STATUS
{
LOW,
HIGH
};
enum MODE //Modes of operation
{
DESIGN,
SIMULATION
};
enum DsgnMenuItem //The items of the design menu (you should add more items)
{
//Note: Items are ordered here as they appear in menu
//If you want to change the menu items order, change the order here
ITM_AND2, //AND gate item in menu
ITM_OR2, //OR gate item in menu
ITM_EXIT, //Exit item
//TODO: Add more items names here
ITM_DSN_CNT //no. of design menu items ==> This should be the last line in this enum
};
enum SimMenuItem //The items of the simulation menu (you should add more items)
{
//Note: Items are ordered here as they appear in menu
ITM_SIM, //Simulate menu item
ITM_TRUTH, //Truth table menu item
//TODO:Add more items names here
ITM_SIM_CNT //no. of simulation menu items ==> This should be the last line in this enum
};
//Maximum number of input pins that can be connected to any output pin
#define MAX_CONNS 20
//assume fan out is 5 for now it can be read from the user or can be predefined as const
enum FANOUT
{
AND2_FANOUT = 5 //Default fan out of 2-input AND gate
};
//A structure to contain drawing parameters for each component
//Each component occupies a rectangluar area so it needs 2 points to represent that area
//this structure can be extended if desired
struct GraphicsInfo
{
int x1,y1, x2, y2;
GraphicsInfo(int x1, int y1, int x2, int y2)
{
this->x1 = x1;
this->x2 = x2;
this->y1 = y1;
this->y2 = y2;
}
GraphicsInfo()
{}
};
enum Cell
{
Empty = 0,
Line = 1,
Connection = 2,
Gate = 3
};
#ifndef NULL
#define NULL 0
#endif
#endif