-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsc_lfilter.h
More file actions
92 lines (83 loc) · 2.69 KB
/
sc_lfilter.h
File metadata and controls
92 lines (83 loc) · 2.69 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
/**
* MIT License
*
* Copyright (c) 2018 Américo Dias <americo.dias@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
/** @file sc_lfilter.h
* @brief Loop filter module include file
*
* @author Americo Dias
* @date 06/02/2018
*/
#pragma once
/** @cond */
#include "systemc-ams.h"
/** @endcond */
/**
* Loop filter module
*/
SC_MODULE(sc_lfilter) {
private:
// Private variables
int order;
double r0_value;
double c1_value;
double r2_value;
double c2_value;
double r3_value;
double c3_value;
// Circuit nodes
sca_eln::sca_node node0, node1, node2, node3;
sca_eln::sca_node_ref gnd;
// Circuit components
sca_eln::sca_r *r0;
sca_eln::sca_c *c1;
sca_eln::sca_r *r2;
sca_eln::sca_c *c2;
sca_eln::sca_r *r3;
sca_eln::sca_c *c3;
// Conversion TDF->ELN->TDF
sca_eln::sca_tdf_isource *i_in;
sca_eln::sca_tdf_vsink *v_cp;
sca_eln::sca_tdf_vsink *v_out;
public:
// Ports
sca_tdf::sca_in<double> sca_tdf_in_ictrl; //< Input control current
sca_tdf::sca_out<double> sca_tdf_out_vcp; //< Voltage of the input node (charge pump)
sca_tdf::sca_out<double> sca_tdf_out_vctrl; //< Voltage of the output (=v_cp for the 2nd order filter)
/**
* @param name_ Name of the module
* @param order_ Filter order (2 or 3)
* @param r1_value_ R1 value in ohms
* @param c1_value_ C1 value in farads
* @param c2_value_ C2 value in farads
* @param r3_value_ R3 value in ohms
* @param c3_value_ C3 value in farads
*/
sc_lfilter (sc_module_name name_,
int order_,
double c1_value_,
double r2_value_,
double c2_value_,
double r3_value_,
double c3_value_ );
};