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
|
/***************************************************************************
* Copyright (C) 2010 by santiago González *
* santigoro@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, see <http://www.gnu.org/licenses/>. *
* *
***************************************************************************/
#ifndef ELOGICDEVICE_H
#define ELOGICDEVICE_H
#include <math.h>
#include "e-source.h"
#include "e-pin.h"
class MAINMODULE_EXPORT eLogicDevice : public eElement
{
public:
eLogicDevice( QString id );
~eLogicDevice();
int numInps() const { return m_numInputs; }
virtual void setNumInps( int inputs );
int numOuts() const { return m_numOutputs; }
void setNumOuts( int outputs );
double inputHighV() const { return m_inputHighV; }
void setInputHighV( double volt ) { m_inputHighV = volt; }
double inputLowV() const { return m_inputLowV; }
void setInputLowV( double volt ) { m_inputLowV = volt; }
double outHighV() const { return m_outHighV; }
void setOutHighV( double volt );
double outLowV() const { return m_outLowV; }
void setOutLowV( double volt );
double inputImp() const { return m_inputImp; }
void setInputImp( double imp );
double outImp() const { return m_outImp; }
void setOutImp( double imp );
bool clockInv() const { return m_clockSource->isInverted(); }
void setClockInv( bool inv );
bool inverted() { return m_inverted; }
void setInverted( bool inverted );
bool invertInps() { return m_invInputs; }
void setInvertInps( bool invert );
int eTrigger() { return m_etrigger; }
virtual void seteTrigger( int trigger );
void setOutputEnabled( bool enabled );
void updateOutEnabled();
virtual ePin* getEpin( QString pinName );
int getClockState();
bool outputEnabled();
virtual void stamp() override;
virtual void initialize() override;
virtual void createPins( int inputs, int outputs );
void setClockPin( eSource* clockSource) { m_clockSource = clockSource; }
void setInput( int n, eSource* input );
void createClockPin();
void createOutEnablePin();
protected:
void createClockPin( ePin* epin );
void createClockeSource( ePin* epin );
void createOutEnablePin( ePin* epin );
void createOutEnableeSource( ePin* epin );
void createInput( ePin* epin );
void createOutput( ePin* epin );
void createInputs( int inputs );
void createOutputs( int outputs );
void deleteInputs( int inputs );
void deleteOutputs( int inputs );
void setOut( int num, bool out );
bool getInputState( int input );
bool getOutputState( int output );
double m_inputHighV;
double m_inputLowV;
double m_outHighV;
double m_outLowV;
double m_inputImp;
double m_outImp;
int m_numInputs;
int m_numOutputs;
int m_etrigger;
bool m_clock;
bool m_outEnable;
bool m_inverted;
bool m_invInputs;
eSource* m_outEnSource;
eSource* m_clockSource;
std::vector<eSource*> m_output;
std::vector<eSource*> m_input;
std::vector<bool> m_inputState;
};
#endif
|