summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/netlist/examples/noise.cpp
blob: 870d526e47784a6119b031413ec15f2ab5eec26a (plain) (blame)
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
// license:CC0
// copyright-holders:Couriersud

/*
 * noise.cpp
 *
 */

//! [noise_example]
#include "netlist/devices/net_lib.h"

// ./nltool -t 1 -l X.3 -l X.4 -n oscillator src/lib/netlist/examples/noise.cpp
//  X.3 : Square out
//  X.4 : Triangle out

NETLIST_START(noise)

	SOLVER(Solver, 48000)

	CLOCK(nclk, 2000)

	SYS_NOISE_MT_N(noise, 0.5)

	RES(R1,1000)
	RES(R2,1000)

	ANALOG_INPUT(VP, 12.0)

	NET_C(nclk.Q, noise.I)
	NET_C(VP, R1.1, nclk.VCC)
	NET_C(noise.1, R1.2)
	NET_C(noise.2, R2.1)
	NET_C(GND, R2.2, nclk.GND)

NETLIST_END()
//! [noise_example]