## Introduction

Digital modulation is extensively used in telecommunications, radar systems and quantum technologies. Corresponding to every analog modulation technique, i.e. amplitude modulation (AM), phase modulation (PM) and frequency modulation (FM), there is a digital version of signal modulation: amplitude-shift keying (ASK) [1], phase-shift keying (PSK) [2], and frequency-shift keying (FSK) [3]. In addition to these one-dimensional modulation schemes, multi-dimensional modulation can be obtained by modulating more than one parameter of a carrier wave. The so-called Quadrature Amplitude Modulation (QAM) is extensively used in communication systems such as the 802.11 Wi-Fi standard [4]. QAM is a two-dimensional modulation scheme in which both amplitude and phase of the carrier are varied by a message signal. Thanks to its simultaneous phase and amplitude modulation, the QAM technique has found applications in other areas such as multi-qubit quantum computing and quantum communications. In this blog post, we learn how to generate QAM signals with the HDAWG Arbitrary Waveform Generator. To verify the method, we acquire the constellation diagram and eye pattern of the generated QAM signals by carrying out I/Q demodulation.

## QAM Signaling

In this section, we take a look at the theoretical background of QAM signaling and how its constellation diagram looks like. Suppose we are interested in communicating a stream of digital bits and we divide the stream into $$n$$-bit blocks or codewords ($$n$$ is even). Each block is represented by a signal, and thus $$N=2^n$$ distinct signals are required to cover all possible codewords. One way to generate $$N$$ different signals is to modulate the amplitude and phase of a carrier wave. Equivalently, the in-phase and quadrature components of the carrier can be modulated each by $$M=\sqrt{N}$$ amplitude levels resulting to $$N$$ distinct vectors in the 2-dimensional signal space as shown in Fig. 1.  Each cluster in the following figure represents a signal vector in the complex plane. For instance, the 64-QAM signaling (bottom-left figure) converts a 6-bit codeword to one of the 64 signal vectors in the signal space. It is evident from the figure that each of the in-phase (horizontal axis) and quadrature (vertical axis) components can take 8 different values.

Fig. 1. Constellation diagram of four QAM signals measured by the UHFQA Quantum Analyzer. Different SNR values are employed for better visualization. 4-QAM or QPSK (top left), 16-QAM (top right), 64-QAM (bottom left), and 256-QAM (bottom right).

As another example, the 4-QAM signaling, which is also called quadrature phase-shift keying (QPSK), has 2-level I and Q components as shown in the top left plot of Fig. 1. It should be noted that the above constellations are acquired by the UHFQA Quantum Analyzer, which is able to carry out weighted integration (matched filtering) on the received I and Q components of QAM signals. The signal-to-noise ratio (SNR) of the QAM signals in Fig. 1 is intentionally degraded to highlight the spreading of signal points in repetitive acquisition which results in a cluster for each signal point; the larger the SNR, the smaller the cluster diameter will be.

For a carrier at frequency $$\omega=2\pi f$$, the QAM signaling is simply an I/Q modulation of the following form [5]:

$s(t)=I(t)\sin(\omega t) + Q(t)\cos(\omega t),$

where $$I$$ and $$Q$$ are the baseband in-phase and quadrature components both covering an amplitude range as follows:

$-M+1, -M+3, … , -3, -1, +1, +3, … , M-3, M-1 .$

Accordingly, each component has $$M$$ amplitude levels and thus the signal obtained form the combination of I and Q components occupy $$M^2=N$$ distinct points of the form $$I+iQ$$ in the complex plane as depicted in Fig. 1.

## Signal Generation

The HDAWG is able to carry out I/Q modulation thanks to its separate sine and waveform generation units. Baseband I and Q signals generated by the wave generation unit can modulate multiple sine signals produced by the sine generation part of the device. Besides providing I/Q modulation, this feature can save waveform memory substantially by generating baseband signals with a small number of samples which modulate high-frequency sine signals.

In order to define a 2-dimensional array of I and Q waveforms for QAM signaling, we simply need to use 2 nested ‘for’ loops in the HDAWG sequencer language SeqC. The following code snippet shows how to define all the 4 in-phase and quadrature components for the 16-QAM signaling in an array which includes all the possible 4×4=16 combinations of I and Q waveforms.

//----------------------------------------------------------------------------- // Defining I and Q for QAM signaling   wave wBase = ones(8000);   const M = 4;   wave wI, wQ;   cvar i, q;   for (i = -(M-1); i < M; i += 2) {     for (q = -(M-1); q < M; q += 2) {       wI = join(wI, (i/M)*wBase);       wQ = join(wQ, (q/M)*wBase);     }   } //-----------------------------------------------------------------------------

Fig. 2 depicts the signal components I and Q generated by a code similar to the above one, clearly showing all 16 combinations of in-phase and quadrature waveforms. There are 4 amplitude levels for both signal components; for each amplitude level of in-phase (blue curve) there are 4 amplitude levels in the quadrature component (orange curve). Each pulse has a duration of 8 μs which leads to a whole period of 16×8=128 μs as shown with the vertical cursors in Fig. 2. Note that the baseband pulse can have any arbitrary wave shape as we have both rectangular (top) and Gaussian (bottom) in the following figure.

Fig. 2. In-phase (blue) and quadrature (orange) components of 16-QAM signaling with rectangular (top) and Gaussian (bottom) baseband pulses.

After defining the I and Q components for QAM signaling, we need to modulate these components by sine and cosine carriers according to the I/Q modulation formula given in the previous section. To do so, we use the modulation feature of the HDAWG which can multiply the in-phase and quadrature components in sine and cosine signals, respectively, and then add them together to generate a proper I/Q modulation. To send both I and Q components to the same output channel, the playback command should look like the following:

  playWave(1, wI, 1, wQ);

To multiply the baseband waveforms by sine and cosine carriers, we can simply set the modulation field to ‘Sine 12’ or ‘Sine 21’ while the phase difference between the two sine signals is set to 90° as highlighted in the screenshot below:

Fig. 3. Settings to perform I/Q modulation: Oscillator 1 generates 2 carriers with a 90° phase shift. The signal field shows the generated I/Q modulation as “AWG 1×Sine 1 + AWG 2×Sine 2”.

Using the UHFLI Lock-in Amplifier, we can capture the QAM signal generated by the HDAWG. Fig. 4 shows one cycle of the 16-QAM signal (blue plot) captured by the UHFLI scope. Each pulse lasts for 8 µs and thus the whole cycle has a duration of 128 µs as depicted by the vertical cursors in the figures. The modulation frequency is set to 2 MHz for better visibility. However, it can be set to any frequency within the output bandwidth of the HDAWG. Using the UHFLI as a dual-phase lock-in amplifier with a frequency range of 600 MHz and a demodulation bandwidth of 5 MHz, we can extract the amplitude and phase of our QAM signal. The green curves in the top and bottom plots of Fig. 4 show the amplitude and phase of the QAM signal, respectively. The slight delay between the received signal and demodulated amplitude or phase is due to the demodulator latency.

Fig. 4. Blue: All the 16 pulses of the 16-QAM signaling at 2 MHz. Green: Demodulated signals; amplitude (top) and phase (bottom). Click on the figures to enlarge.

The constellation diagram of 16-QAM in Fig. 1 shows that all the 16 signals of the constellation cover 4 amplitude levels and 12 phase levels. This is verified by the 4 amplitude levels and 12 phase values of the demodulated signal in Fig. 4.

## Eye Pattern

An eye pattern is the result of repetitive measurements of randomly generated signals with a triggered scope [6]. To acquire an eye diagram, the scope is set to persistent mode to put all the measurement shots on top of each other. In the previous section, the whole cycle of a QAM signaling is generated in a deterministic way. However, in practice random bits from an information source select the corresponding signal from the constellation diagram, and due to the stochastic nature of information the waveforms are generated randomly. In order to mimic the randomness inherent in information bits, we can use a pseudo-random binary sequence (PRBS) to select the signal points from the constellation diagram [7]. The simplest way to produce a PRBS in real-time is to set a feedback mechanism on a shift register to make a linear-feedback shift register (LFSR) [8]. An LFSR of length $$r$$ produces a PRBS of period $$2^r-1$$ bits. Here we use an LFSR of length 9 which generates a PRBS-9 with a period of 511 bits. The feedback mechanism of LFSR is based on a characteristic polynomial which is obtained from finite or Galois fields [9]. PRBS-9 has the following characteristic polynomial:

$\text{PRBS-9:}\ \ \ x^9+x^5+1$

The characteristic polynomial determines which information bits should contribute to the feedback. The following diagram shows the implementation of PRBS-9 with LFSR which has the 5th and 9th bits in the feedback process according to the above polynomial. Further details on how to implement pseudo-random number generators (PRNG) using the HDAWG can be found in this blog post.

Fig. 5. LFSR to generate PRBS-9 showing the feedback calculated by the XOR of the 5th and 9th bits.

Using the HDAWG sequencer we can implement the above PRBS and address specific waveforms from the constellation depending on the output of LFSR during the AWG run-time. For instance, a baseband binary phase-shift keying (BPSK) modulation can be implemented by sending out a positive- or negative-amplitude pulse depending on the outcome of the above PRBS-9. By time-multiplexing two BPSK channels with an appropriate delay we can measure the eye pattern of BPSK modulation in the presence of interference from other channels as captured in Fig. 6 by the persistence mode of the UHFLI scope.

Fig. 6. Eye pattern of 2 time-multiplexed baseband BPSK signal channels. The SNR has been degraded intentionally for better visibility.

In order to generate QAM signals based on a PRBS, the corresponding LFSR is implemented in the AWG sequencer to generate pseudo-random bits addressing the desired waveforms. This can be done by adjusting the argument offset in the following playback command during the sequencer run-time.

  playWaveIndexed(channel, waveform, offset, length);

As an example, consider the 16-QAM signaling which needs 4 bits to determine which one of the 16 waveforms should be generated at the output. Every 4-bit block of the PRBS is transformed to a decimal number from 0 to 16 and the result is multiplied by the length of each waveform to determine the offset value in the playback command as shown on the last line of the following AWG program. This SeqC code generates a 16-QAM signaling based on the PRBS-9 bit sequence:

//----------------------------------------------------------------------------- //----------------------------- Parameters and settings -----------------------   const nSampRate = AWG_RATE_75MHZ;             // sampling rate   const sampRate = (2.4e9)*pow(2,-nSampRate);   // sampling rate [Sa/s]   const amp = 0.1;                               // amplitude of signal   const T = 8e-6;                               // baud (symbol) time [s]   const nSamp = round(sampRate*T/8)*8;           // samples in a symbol   const m = 2;                         // number of bits per I or Q   const n = 2*m;                       // number of bits per symbol   const M = pow(2,m);         // number of signals in each dimension   setInt('awgs/0/time', nSampRate); //----------------------------- QAM waveform calculation ---------------------- //wave wBase = amp*ones(nSamp);   wave wBase = gauss(nSamp, amp, nSamp/2, nSamp/5);   cvar i, q;   wave wI, wQ;   for (i = -(M-1); i < M; i += 2) {     for (q = -(M-1); q < M; q += 2) {       wI = join(wI, (i/M)*wBase);       wQ = join(wQ, (q/M)*wBase);     }   } //----------------------------- QAM signal generation ------------------------- // XOR function   var XOR(var X, var Y){     return ~(X & Y) & (X | Y);   }   var S0 = 0, RN;   var S01 = 0b1, S02 = 0b0, S03 = 0b0, S04 = 0b0, S05 = 0b0;   var S06 = 0b0, S07 = 0b0, S08 = 0b0, S09 = 0b0; //S10 = 0b0;   var j; // Playback with PRBS   while (true) {     setTrigger(1);     for (j = 0; j < n; j++) {       S0 = XOR(S09,S05);       S09 = S08; S08 = S07; S07 = S06; S06 = S05;       S05 = S04; S04 = S03; S03 = S02; S02 = S01; S01 = S0;     }     RN = S01 + S02*pow(2,1) + S03*pow(2,2) + S04*pow(2,3);     setTrigger(0);     playWaveIndexed(1, wI, 1, wQ, RN*nSamp, nSamp);   } //----------------------------------------------------------------------------- 

The eye diagram can also be captured for band-pass QAM signals after demodulation. For instance, the I and Q components of 4-QAM have been acquired in Fig. 7 after demodulating at 100 MHz using the high-speed (5-MHz bandwidth) demodulator of the UHFLI Lock-in Amplifier. As expected for 4-QAM, both I and Q components have 2 amplitude levels symmetric around zero. Fig. 7  depicts the eye pattern of 4-QAM for low (top) and high (bottom) SNR values demonstrating the impact of noise on closing the eye window.

Fig. 7. Eye pattern of I and Q components of demodulated 4-QAM signal for low (top) and high (bottom) SNR levels.

Using the same dual-phase demodulation technique, we can obtain the eye pattern of higher-order QAM signaling such as 16-QAM and 64-QAM as shown in Fig. 8. For 16-QAM, both I and Q components have 4 amplitude levels; there are 8 levels for 64-QAM as illustrated in Fig. 8.

Fig. 8. Eye pattern of I and Q components of demodulated 16-QAM (top) and 64-QAM (bottom) signals showing 4 and 8 amplitude levels, respectively.

It is worth mentioning that eye patterns provide valuable information about the signal quality and synchronization. The vertical axis shows the SNR level of the received signal, whereas the horizontal axis determines the timing jitter.

## Constellation Diagram

Constellation diagrams are obtained by plotting the I and Q components of a demodulated signal on a 2-D complex plane so that the I component is on the real (horizontal) axis while the Q component is on the imaginary (vertical) axis [10]. This way, each point on the plane determines a specific pair of values for amplitude and phase as depicted in Fig. 1. The constellation diagrams in Fig. 1 were obtained with the UHFQA. However, we can acquire such diagrams using the demodulator of the UHFLI by setting its scope module into the X-Y mode and assigning the in-phase and quadrature components of the demodulated signal to the horizontal and vertical axes, respectively.  Fig. 9 shows the acquisition of 64-QAM constellation diagram using the UHFLI scope. Each dense (red) point on the grid corresponds to a waveform with a specific amplitude and phase while the scope plotter connects the consecutive signal points by thin lines (green) together.

Fig. 9. Constellation diagram of 64-QAM obtained with the UHFLI dual-phase demodulator.

The modulator carrier (HDAWG) and demodulator carrier (UHFLI) are frequency-synchronized by using the same 10-MHz reference clock for both instruments. Otherwise, the constellation rotates with a constant speed proportional to the frequency difference between the two carriers. It should be also noted that the initial phase of the demodulator is adjusted so that both modulator and demodulator carriers are phase-synchronized as well. This guarantees that the constellation diagram is a square with edges parallel to the horizontal and vertical axes. Otherwise, it will be rotated by a fixed angle.

## Conclusion

The HDAWG Arbitrary Waveform Generator is capable of producing various digital modulation patterns such as QAM, ASK, and PSK. Its I/Q modulation feature provides an efficient and easy-to-use method for implementing modulation patterns. Moreover, the separation between the waveform and carrier generation units of the device saves a lot of waveform memory because high-frequency band-pass signals can be generated by I/Q modulation of carriers using low-frequency baseband waveforms. Last but not least, the flexibility of the AWG sequencer as well as its wide variety of playback methods, such as waveform indexing, facilitates complex signal patterns generation with relatively short AWG codes.

## References

1. Wikipedia: “Amplitude-shift keying.”
2. Wikipedia: “Phase-shift keying.”
3. Wikipedia: “Frequency-shift keying.”