Skip to content

emily-tsai11/Cornell_CM_Production_Scripts

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scripts Used for Cornell CM Produciton Checkout

IBERTpy Plotting Script

Overview

Requirements

  • Python 3+
  • fpdf (the package used to make a pdf file from converting a csv file of a Vivado eyescan. For instruction on how to install it, please follow https://github.com/reingart/pyfpdf)

Instructions

The IBERTpy is a set of modified scripts from https://github.com/mvsoliveira/IBERTpy to convert Vivado eyescans from .csv to .pdf and .png formats. The path to a csv input file is structured for Cornell CM Production in the following manner: Cornell_CM_Production_Scripts/scans/CM#/mm-dd-yy/*.csv'.

To generate these csv files, first connect to the CM203 in Vivado. Program the FPGAs with the desired firmware. If the CM203 is connected to the lnx4189, the following firmware properly programs the two FPGAs for eyescans of the standard links:

FPGA1 bitstream: /mnt/scratch/rz393/firmware/top_Cornell_rev2_p1_VU13p-1-SM_7s_IBERT_lpGBT_v1_25GLHS.bit
FPGA2 bitstream: /mnt/scratch/rz393/firmware/top_Cornell_rev2_p2_VU13p-1-SM_7s_IBERT_lpGBT_v1_25GLHS.bit

Next, set the MGT links. Autodetect links often misses several of the links, so instead run the command below in the Vivado tcl console:

source <path to this imported repository>/Cornell_CM_Production_Scripts/autotuning/tcl/CM_VU13P_setup_IBERT.tcl

We can now run eyescans over all of these links, but first we must create a directories in which to save the csv files. The current version of the command that runs the eyescans in Vivado saves the scans to two locations: once into the downloaded Cornell_CM_ProductionScripts output directories and once into the shared track trigger output directories ( should be of the form mm-dd-yy):

mkdir <path to this imported repository>/Cornell_CM_Production_Scripts/scans/CM203/<date>
mkdir /nfs/cms/tracktrigger/apollo/CM203/scans/<date>

Then, modify line 9 of /Cornell_CM_Production_Scripts/autotuning/tcl/apollo10_eyescan.tcl so that the date in the file path corresponds to the directory in which you wish to save the results of the scans, and run the following command in the tcl console to run eyescans over all of the links that we just set:

source <path to this imported repository>/Cornell_CM_Production_Scripts/autotuning/tcl/apollo10_eyescan.tcl

To convert a csv input file to a pdf + png file and store them in the same directory as the csv input file, run the following command in /Cornell_CM_Production_Scripts/IBERTpy/python, where is the id of the scanned board (e.g. CM203) and date is of the form mm-dd-yy:

$ python3 generate_all_plots.py <board> <date of scans>

After generating pdfs and png files, one can generate a summary pdf that organizes all eyescans of the standard CM203 MGT configuration into a more easily navigated summary document by entering the following command in /Cornell_CM_Production_Scripts/IBERTpy/latex:

$ pdflatex --jobname=<desired name of output file, don't add on ".pdf"> "\def\dateofscans{<date of scans>} \input{eyescan_summary.tex}"

Upon encountering a warning, type the letter r and hit enter to force the computer to ignore all further warnings. If you wish to save the output files to a different directory you can add --output-directory= as an additional argument after --jobname.

Autotuning System for Xilinx MGTs

Overview

Directory containing scripts to tune the emphasis and equalization of high-speed serial links between two Xilinx FPGA's.

Requirements

  • Python 3+
  • Vivado (the scripts consider that it is possible to start the vivado software by calling vivado at the terminal. If that is not the case, change the __init__ method of XilinxTCL class)
  • Boards programmed with the IBERT bitstream, configured with the MGT's to be tuned at the desired line rate

Instructions

The autotuning is done in 3 steps: preparing the boards, setting the config.ini and running the autotuning script. In this respository, all parameters were set for an optical transmission between two KC705 kits, running at 10 Gbps and using PRBS31.

Preparing the boards

The transmitter and receiver boards should be programmed with an IBERT bitstream generated by Vivado. The line rate, reference clock and enabled MGT's should be set according to the conditions the system is going to operate.

[Optional] Set up the automated autotuning script

Please create and/or adjust the hw_*.tcl in the autotuning/automate folder.

Setting the config.ini

The config.ini file is where the test parameters should be set. They are loaded by the run.py script and specify the MGT's to be tuned, the FPGA's on which the transmitters and receivers are located, the tuning configurations to be tested, stop conditions for the tuning process, among other parameters. The file is organized in sections and their variables, as the following example:

[Section1]
variable1 = value
variable2 = value

[Section2]
variable3 = value
variable4 = value
variable5 = value

[DEFAULT]
variable1 = value
variable4 = value
variable5 = value

The DEFAULT section is a special one, and stablishes the default value for some of the variables of other sections. If they are not set in their own sections, the DEFAULT value is used.

Setting other files

In the program's current state, autotuning can only run over a set of MGT's that all share the same transmitter and receiver FPGA locations (e.g. all MGT's with transmitters on FPGA 1 and all receivers on FPGA 2). Autotuning of MGT's with different transmitter and receiver FPGA locations must be performed in multiple runs of the autotuning program for each collection of MGT's that have the same transmitter and receiver FPGA locations, properly modifying the relevant files after each run. Before running the files, be sure to set the FPGA on which the transmitters and receivers of the MGT's are located in CM_VU13P_rcv_setup.tcl and CM_VU13P_trm_setup.tcl. Both of these files have a line near the top of the code that specifies the FPGA location: xcvu13p_0 for FPGA 1 and xcvu13p_1 for FPGA 2.

Running the autotuning script

The autotuning script is run by the following command:

$ python3 run.py

It loads the parameters in config.ini, opening two vivado instances and connecting one to the transmitter and the other to the receiver FPGA. The initial setting it then loaded through TCL files, which can set the initial tuning configuration, PRBS pattern, DFE setting and invert RX/TX differential pins (if this is required by the PCB design. The script then tests everyone of the tuning configurations, saves its performance in a CSV file and then presents the best configuration found.

[Optional] Run the automated autotuning script

This script opens Vivado instances and configures the FPGAs with bit files. The Vivado instances remain open (no need to start Vivado by yourself). Then the test is perormed by using the run.py script:

$ cd automate
$ ./run_MGT_autotune.sh

Results

The results are presented in a CSV file. The columns present the TX Differential Swing, TX Pre, TX Post, RX termination voltage and the respective eye scan open area resultant for that configuration. This parameter measures how open the eye scan is, and should be maximized to improve the link integrity. An example of a CSV result file is shown bellow.

TXDIFFSWING,TXPRE,TXPOST,RXTERM,Open Area
269 mV (0000),0.00 dB (00000),0.00 dB (00000),900 mV,2664
269 mV (0000),0.00 dB (00000),4.44 dB (10000),900 mV,2268
269 mV (0000),4.44 dB (10000),0.00 dB (00000),900 mV,1692
269 mV (0000),4.44 dB (10000),4.44 dB (10000),900 mV,1332
------------BEST------------
269 mV (0000),0.00 dB (00000),0.00 dB (00000),900 mV,2664

Running the margin scanning script

The margin scanning script is run by the following command. It uses the same logic as the autotuning script but scans with 1D bathtub plot instead of 2D eyescan.

$ python3 run1D.py

This only scans parameters on the FPGA. To scan parameter on the firefly, one needs to directly change the setting on the firefly via mcu and run the scan for each of the changed setting. Make sure to modify the name of the files saved everytime the firefly setting changes.

To plot. First run the following command to make a table with all the data.

$ python3 table.py

This creates a log that gathers all the settings and links together as well as an array of number of good links in the end.

Copy and paste the last array into the following script and run to create plot.

$ python3 plotting.py

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 50.5%
  • Tcl 31.1%
  • TeX 18.2%
  • Shell 0.2%