Xilinx Reed-Solomon Tutorial 2 |
This is the second of two tutorials developed to introduce the Xilinx Reed-Solomon Encoder and Decoder LogiCOREs. Tutorial 1 concentrates on using the encoder core, while this tutorial concentrates on the decoder core. |
Getting Started |
If you have already completed Tutorial 1, then you can skip this section, as long as you: |
|
The tutorials were developed and verified on a PC-based Windows platform. It should be possible to complete them on a unix-based system, although this has not been fully tested. Before commencing this tutorial, you must complete the following steps:
|
Generating the decoder core |
Go to the Xilinx Reed-Solomon web page at www.xilinx.com/ipcenter/reed_solomon Click on Generate a RS Decoder Core. The Username and Password Required window will appear: Enter your username and password. Once they have been confirmed, the Xilinx LogiCORE Reed-Solomon Decoder, Configuration and Download page will be displayed. Fill in the fields in the decoder configuration GUI within this page so that they match the following: The values in the Code-Block Parameters panel correspond to the values for the encoder generated in Tutorial 1 (except the Clock Periods per Symbol parameter which will be explained later). Check that the Latency and Processing Delay values displayed in the Information panel match the ones shown above. Once you have entered all the parameters click the Submit button. The Download Form window will appear. Enter your email address and ensure that the other fields match the following: When you have completed the Download Form, click OK. The Request Successfully Submitted page will appear. Xilinx Webmaster will send you a confirmation email detailing the core parameters and options you selected. It will then generate your customized core. This should only take a few minutes (unless the web server is particularly busy). Xilinx Webmaster will then send you an email with an attached zip file. Unzip this file in:
Within this directory, the following 7 files should now be accessible:
View these files using a text editor such as WordPad, starting with readme.txt. |
Adding pads and global buffers |
The steps for pushing the core through FPGAExpress and the Xilinx implementation tools are exactly the same as you did for the encoder core, so if you have already completed Tutorial 1, you may want to skip straight to the Simulation section. |
Before the core can be pushed through the Xilinx implementation tools, pads and buffers must be added. In this tutorial we will use FPGAExpress to accomplish this (if you use another sythesis tool, you should still be able to follow this part of the tutorial - just substitute the appropriate commands for your tool). You could just use the rsdec_wrap.vhd included in the emailed zip file. However, you should use an enhanced version called C:\xrs\fpgaexpress\rsdec_wrap.vhd. This version has:
Complete the following steps to create an EDIF wrapper from rsdec_wrap.vhd:
|
Implementation |
We're now ready to push the design through the Xilinx implementation tools. To save time, you will use the command-line approach rather than the Design Manager. First of all open a DOS command prompt window and, move to the appropriate directory:
The EDIF netlists for the core and wrapper should be copied to this directory:
The user constraints file generated by FPGAExpress should also be copied to this directory. However, it's extension must be changed to .ucf using the following command:
FPGAExpress did not add a register-to-register timespec to rsdec_wrap.ucf because there are no registers within rsdec_wrap.vhd. Therefore you have to manually add the following timespec to rsdec_wrap.ucf:
Note that the TS_P2P timespec will be ignored by the implementation tools as there are no direct pad-to-pad boolean paths. |
This directory should have the following files:
At the DOS prompt, run the script files in the following order:
(Unix users should use the go_* scripts without the ".bat" extensions.) |
Check the rsdec_routed.twr file. Did the place-and-route tools meet the timing constraints you set? View the core with FPGAEditor using the following command at the DOS prompt:
Notice that the core is made up of several relationally placed macros (RPMs). |
Processing Delay |
The testbench has been configured so that it only puts new data onto data_in if the decoder ready signal is asserted high. |
Q1. Using the Processing Delay figure you noted from the configuration GUI, how many symbol periods would you expect ready to stay low for after a complete code word (n = 207) has been sampled? |
Answer : ___________________(predicted) |
In the Wave window, add two cursors using Cursor->Add Cursor. Then measure how long ready goes low for between the first and second code word blocks. |
Q2. For how many symbol periods is ready low? |
Answer : ___________________(measured) |
Does your predicted value match your measured value? |
Latency |
The testbench assumes that the core uses the Start Pulse Synchronization mode, so the sync signal is asserted for one symbol period at the start of each code word block. |
Q3. Use cursors to measure the time between the first symbol of the first code word being sampled on data_in, and when the corrected version of the first symbol appears on data_out. |
Answer : ___________________(in symbol periods) |
Does your measured value agree with the value that was displayed on the configuration GUI? |
Status signals |
Check that the blk_strt and blk_end signals encapsulate the first code word block. Note that both err_found and err_cnt are updated each time blk_end is asserted. |
Q4. Does the value on err_cnt agree with the number of errors added to each code word in tutorial 1? |
Answer : ___________ |
Run the simulation to completion using:
The testbench should have created a new pgm file called decoded.pgm. Use LViewPro to verify (qualitively) that the errors have been corrected. |
Going beyond the error correcting capability of the Reed-Solomon code |
Edit received.pgm, the beginning of which should look like:
Change the first pixel value in row 0 from 124 to 255. Save received.pgm. There should now be 11 errors in the first code word. Re-start the simulation using:
Q5. Scroll along to the first blk_strt pulse - did the decoder manage to correct the symbol you added an error to? |
Answer : _______ |
Q6. Scroll along to the first blk_end pulse - did the decoder calculate the correct number of errors in the code block? |
Answer : _______ |
Q7. Which signal should you use to check whether the decoder has successfully decoded a code word? |
Answer : _______ |
If you have time, run the simulation to completion and view decoded.pgm, paying particular attention to the first row of pixels. It should be quite obvious that this row was not decoded successfully. |
Multiple clock periods per symbol |
The decoder can be configured to use multiple clock periods per symbol. This helps reduce the Processing Delay
(with respect to symbol periods), so that the core can accept continuous input data i.e. no gaps between code words,
which is required by some applications. As you are using the (parameterizable) behavioral model of the core,
you can increase the number of clock periods per symbol simply by editing the appropriate parameter that is passed
to the core instantiation within the testbench. The tb_rs_decoder.vhd testbench currently has
Re-compile using the following command:
Use the following command to run the simulation:
Note that tutorial2.pgm is almost identical to received.pgm except that:
Take a note of the Processing Delay and Latency values now displayed in the Modelsim command prompt window: |
Processing Delay: ________________(symbol_periods) |
Latency:________________(symbol_periods) |
Q8. Will the core be able to accept continuous input data? |
Answer : ___________________ |
Add the core signals to the Wave window using the following commands:
The clock period is still 20 ns, so run the simulation for 750 symbol periods:
|
Answer : __________________________________________ |
Latency (for multiple clock periods per symbol) |
The symbol on data_in is sampled on the last rising edge of clk when sync is asserted. |
Q10. Use cursors to measure the time between the last rising edge of clk when sync is asserted and the rising edge of blk_strt. |
Answer : ___________________(in symbol periods) |
Does your measured value agree with the value you noted earlier? |
Re-synchronization |
When multiple clock periods per symbol are used, the decoder initially doesn't know where the symbol period is relative to the clock. The decoder uses the rising edge of sync to synchronize itself with respect to the incoming symbols on data_in. It may be helpful to imagine that the decoder has an internal clock that has a rising edge at the end of each symbol period. Initially this imaginary clock is likely to be out of phase with the symbols on data_in. The decoder will always be able to synchronize itself to the incoming symbols. However, if the rising edge of sync occurs less than two clock periods before the rising edge of the imaginary clock, the decoder samples the first symbol twice. Note that the decoder still operates correctly, but an interesting thing happens on the data_out bus. The testbench has been configured to illustrate this case. |
Zoom in on the first rising edge of blk_strt until the individual symbols on the data buses are visible. Notice that the uncorrected version (255) of the first symbol appears on data_out for one symbol period before blk_strt is asserted. Therefore in a user's design, circuits downstream should use blk_strt and blk_end to define when data_out is valid, so that the uncorrected version of the first symbol is ignored. |
IMPORTANT - If a new code word block is started on data_in prior to the first corrected symbols from the previous block appearing on data_out, there must be a whole number of symbol periods between the last symbol of the previous block and the first symbol of the new block. Otherwise the decoder may lose track of processing the previous block. |
End of Tutorial 2! |
By now you should know how to:
and understand:
|
Further reading |
[1] P. J. Ashenden. "The designer's guide to VHDL". Section 18.2. Morgan Kaufmann Publishers, Inc., 1995. (ISBN 1-55860-270-4) |
[2] S. Lin and D. J. Costello. "Error control coding: fundamentals and applications". Prentice-Hall, 1983. (ISBN 0-13-283796-X) |
[3] S. B. Wicker and V. K. Bhargava (editors). "Reed-Solomon codes and their applications". IEEE Communications Society and IEEE Information Theory Society, 1994. (ISBN 0-7803-1025-X) |
Back to Xilinx Reed-Solomon Solution page |