spll_defs.h 1.64 KB
Newer Older
Grzegorz Daniluk's avatar
Grzegorz Daniluk committed
1 2 3 4 5 6 7 8 9 10 11 12
/*

White Rabbit Softcore PLL (SoftPLL) - common definitions

WARNING: These parameters must be in sync with the generics of the HDL instantiation of wr_softpll_ng.

*/


#include <stdio.h>

/* Reference clock frequency, in [Hz] */
13 14 15 16
#define CLOCK_FREQ 125000000

/* Reference clock period, in picoseconds */
#define CLOCK_PERIOD_PICOSECONDS 8000
Grzegorz Daniluk's avatar
Grzegorz Daniluk committed
17

18 19 20 21 22
/* optional DMTD clock division to improve FPGA timing closure by avoiding
   clock nets directly driving FD inputs. Must be consistent with the 
   g_divide_inputs_by_2 generic. */
#define DIVIDE_DMTD_CLOCKS_BY_2 		1

Grzegorz Daniluk's avatar
Grzegorz Daniluk committed
23 24 25 26 27 28 29 30 31 32 33 34 35
/* Number of bits in phase tags generated by the DMTDs. Used to sign-extend the tags. 
	 Corresponding VHDL generic: g_tag_bits. */
#define TAG_BITS 22

/* Helper PLL N divider (2**(-N) is the frequency offset). Must be big enough
   to offer reasonable PLL bandwidth, and small enough so the offset frequency fits
   within the tuning range of the helper oscillator. */
#define HPLL_N 14

/* Fractional bits in PI controller coefficients */
#define PI_FRACBITS 12

/* Max. allowed number of reference channels. Can be used to tweak memory usage. */
36
#define MAX_CHAN_REF 1
Grzegorz Daniluk's avatar
Grzegorz Daniluk committed
37

38 39
/* Max. allowed number of auxillary channels */
#define MAX_CHAN_AUX 1
Grzegorz Daniluk's avatar
Grzegorz Daniluk committed
40 41

/* Max. allowed number of phase trackers */
Tomasz Wlostowski's avatar
Tomasz Wlostowski committed
42
#define MAX_PTRACKERS 1
Grzegorz Daniluk's avatar
Grzegorz Daniluk committed
43 44 45

/* Number of bits of the DAC(s) driving the oscillator(s). Must be the same for
   all the outputs. */
46 47
#define DAC_BITS 16

48 49 50
/* Number of samples in a single ptracker averaging bin */
#define PTRACKER_AVERAGE_SAMPLES 512

51 52
/* 1.0 / (Speed of the phase shifter) - the higher value, the slower phase shifting.
   Used to prevent de-locking PLLs when shifting large offsets. */
53
#define PHASE_SHIFTER_SPEED 1