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
|
// license:GPL-2.0+
// copyright-holders:Couriersud
/*
* nlid_proxy.h
*
* netlist proxy devices
*
* This file contains internal headers
*/
#ifndef NLID_PROXY_H_
#define NLID_PROXY_H_
#include "../nl_setup.h"
#include "../analog/nlid_twoterm.h"
namespace netlist
{
namespace devices
{
// -----------------------------------------------------------------------------
// nld_base_proxy
// -----------------------------------------------------------------------------
NETLIB_OBJECT(base_proxy)
{
public:
nld_base_proxy(netlist_t &anetlist, const pstring &name,
logic_t *inout_proxied, detail::core_terminal_t *proxy_inout);
virtual ~nld_base_proxy();
logic_t &term_proxied() const { return *m_term_proxied; }
detail::core_terminal_t &proxy_term() const { return *m_proxy_term; }
protected:
private:
logic_t *m_term_proxied;
detail::core_terminal_t *m_proxy_term;
};
// -----------------------------------------------------------------------------
// nld_a_to_d_proxy
// -----------------------------------------------------------------------------
NETLIB_OBJECT_DERIVED(base_a_to_d_proxy, base_proxy)
{
public:
virtual ~nld_base_a_to_d_proxy();
virtual logic_output_t &out() { return m_Q; }
protected:
nld_base_a_to_d_proxy(netlist_t &anetlist, const pstring &name,
logic_input_t *in_proxied, detail::core_terminal_t *in_proxy);
private:
logic_output_t m_Q;
};
NETLIB_OBJECT_DERIVED(a_to_d_proxy, base_a_to_d_proxy)
{
public:
nld_a_to_d_proxy(netlist_t &anetlist, const pstring &name, logic_input_t *in_proxied);
virtual ~nld_a_to_d_proxy() override;
analog_input_t m_I;
protected:
NETLIB_RESETI();
NETLIB_UPDATEI();
private:
};
// -----------------------------------------------------------------------------
// nld_base_d_to_a_proxy
// -----------------------------------------------------------------------------
NETLIB_OBJECT_DERIVED(base_d_to_a_proxy, base_proxy)
{
public:
virtual ~nld_base_d_to_a_proxy();
virtual logic_input_t &in() { return m_I; }
protected:
nld_base_d_to_a_proxy(netlist_t &anetlist, const pstring &name,
logic_output_t *out_proxied, detail::core_terminal_t &proxy_out);
logic_input_t m_I;
private:
};
NETLIB_OBJECT_DERIVED(d_to_a_proxy, base_d_to_a_proxy)
{
public:
nld_d_to_a_proxy(netlist_t &anetlist, const pstring &name, logic_output_t *out_proxied);
virtual ~nld_d_to_a_proxy() override {}
protected:
NETLIB_RESETI();
NETLIB_UPDATEI();
private:
analog_output_t m_GNDHack; // FIXME: Long term, we need to connect proxy gnd to device gnd
analog::NETLIB_SUB(twoterm) m_RV;
state_var<int> m_last_state;
bool m_is_timestep;
};
} //namespace devices
} // namespace netlist
#endif /* NLD_PROXY_H_ */
|