Documentation

Frame-Based Scrambler Using Communications System Toolbox™

This example illustrates the validation of a VHDL implementation of a 6-order scrambler. A scrambler is used in communication systems to randomize transitions in the transmitted signal by shuffling the bits. One purpose of scrambling is to reduce the length of strings of 0s or 1s in a transmitted signal, since a long string of 0s or 1s may cause transmission synchronization problems. Scrambling may also be used as a cheap encryption technique. This example consists of two models. The first model (scrambler_frame) validates the VHDL implementation and the second model (scrambler_fsk) uses the VHDL scrambler as part of a communication channel.

VHDL Implementation and Validation

The scrambler_frame model illustrates the validation of a VHDL implementation of a 6-order scrambler. The handwritten VHDL code is intended to replicate the behavior of the Scrambler block in the Communications System Toolbox™. The EDA Simulator Link™ is used here as a validation tool to test the functional equivalence of the VHDL scrambler to the Communications System Toolbox scrambler.

The model generates a binary sequence and simultaneously drives it to the VHDL implementation and the original Simulink® block. Two copies of the Descrambler block from the Communications System Toolbox are used to reconstitute the original data stream from the outputs of the two scramblers. The outputs are compared to the input data sequence to detect any discrepancies that may be introduced by differences between the scramblers using the Error Calculation block. Because the ModelSim® block always delays the data by one frame, we delay the data in all other branches so that the comparison will be valid.

Channel Encoding with a VHDL Scrambler Block

The scrambler_fsk shows the use of a Scrambler as part of a communication channel. The block of interest is a 6-order scrambler implemented in VHDL and co-simulated with Simulink by the HDL Verifier. It has previously been verified to be functionally equivalent to the Scrambler block in the Communications System Toolbox. The Descrambler block is from the Communications System Toolbox and is also of order-6. The channel uses 11 bits per frame and BCH 11-->31 bits encoding (and the opposite BCH 31-->11 bits decoding). This encoding method is theoretically able to correct burst errors with up to 5 flipped bits. The data is passed through a channel with burst errors of 6 consecutive bits (i.e. 6 out of 11 bits in each frame will be flipped).

The data is then transmitted using 2-ary FSK modulator and demodulator and a Gaussian channel with very high signal to noise ratio, so we assume that almost all errors are burst errors and not Gaussian white noise errors. The locations of the flipped bits are randomly chosen in each frame. Since the current encoding configuration cannot fix all errors when 6 bits are flipped, there will be some errors after decoding the data and the BER (Bit Error Rate) will not be zero. The model contains 2 channels, one includes Scrambler / Descrambler blocks, and the other one does not. In the case of our model, it is clear that the BER is improved (becomes lower) when we use the Scrambler / Descrambler blocks as part of our communication channel.

Was this topic helpful?