This is a readme file for lfcpnx_versa_sgmii, a hardware example design for CertusPro-NX Versa Board with Tri-Speed Ethernet SGMII(SerDes).
Hardware Setup: Connect SFP+ loopback module to J12 SFP+ cage, and power up the CertusPro-NX Versa Board.

-------------------------
Preparing Radiant Project
-------------------------
Steps:
1. Create a new Radiant project.
2. Generate Tri-Speed Ethernet IP using IP configurations from Table 1.
3. Add sgmii_top.v and cpnx_sgmii.pdc to Radiant project, optionally may add tb_sgmii_top.v for simulation.
   Files can be found in <IP_INSTANCE_NAME>/eval/versa_top/lfcpnx_versa_sgmii
   Top-level file: sgmii_top.v
   Simulation for top-level file: tb_sgmii_top.v
   Post-synthesis constraint file: cpnx_sgmii.pdc
   *Alternatively, user may run below command in Radiant's Tcl Console to setup the example design using .tcl script. Please rename <IP_INSTANCE_NAME> to actual instance name in step_2
       source <IP_INSTANCE_NAME>/eval/versa_top/lfcpnx_versa_sgmii/ed_setup.tcl

4. Set sgmii_top.v as top level module of Radiant project. Skip this if example design is setup using TCL script.
5. Set tb_sgmii_top.v to include for simulation only. Skip this if example design is setup using TCL script.
6. Set cpnx_sgmii.pdc as active constraint. Skip this if example design is setup using TCL script.


-------------------------
Running Simulation
-------------------------
Steps:
1. Launch Simulation Wizard.
2. Proceed based on steps of Simulation Wizard.
3. Questa Lattice-Edition will be launched and start simulation.
4. Transmitted and received packets will be displayed in Transcript window.
5. Simulation Pass will be displayed in Transcript window when simulation completed.

-------------------------
Running Hardware
-------------------------
Steps:
1. Run complete Radiant process flow to generate bitstream file.
2. Launch Radiant Programmer.
3. Select bitstream file generated by Radiant.
4. Program bitstream file to the CertusPro-NX Versa Board (Please ensure SW1 and SW2 are in OFF position when programming)
5. Reset the design by toggling SW1 to ON position. LED D63K and D64K shall be ON.
6. Deassert reset by toggling SW1 to OFF position. LED D63K, D64K, D67K, D65K, D66K and 104K shall be OFF.
7. Select required Ethernet rate. (refer Table 3 for LED definition)
    a. Pause pattern generator by toggling SW2 to OFF position. LED D67K, D65K shall be OFF, LED D66K shall be ON.
    b. Toggle SW3 and SW4 to select required SGMII rate (refer to Table 4).
    c. Start/resume pattern generator by toggling SW2 to ON position. LED D67K, D65K shall be ON, LED D66K shall be OFF.

Expected Passing Scenario:
LEDs (D63K, D64K, D67K, D65K) are expected to turn ON to indicate hardware is working.

Failing Scenarios:
Any of these LEDs D63K, D64K, D67K, D65K) not turned ON, or LED 104K is turned ON.

-------------------------------------------------------
| Table 1: TSE IP instance configuration              |
-------------------------------------------------------
| IP Option                    | MAC + SGMII(SerDes)  |
| Host Interface               | APB                  |
| Statistics Counter Registers | Unchecked            |
| RX CTC Mode                  | Dynamic              |
| Select MPCS lane or channel  | 6                    |
| MPCS PMA loopback            | Unchecked            |
| MPCS NAME                    | 0                    |
-------------------------------------------------------

-------------------------------------------------------
| Table 2: DIP Switch Definition                      |
-------------------------------------------------------
| SW1   | Reset                                       |
| SW2   | Start/Pause/Resume pattern generator        |
| SW3   | SPEED_MODE[0] for SGMII speed selection     |
| SW4   | SPEED_MODE[1] for SGMII speed selection     |
| SW5   | Not used                                    |
-------------------------------------------------------

-----------------------------------------------------------------------
| Table 3: LED Definition                                             |
-----------------------------------------------------------------------
| LED   | Description                                 | Pass Scenario |
-----------------------------------------------------------------------
| D63K  | AN Link OK                                  |       ON      |
| D64K  | APB configuration completed                 |       ON      |
| D67K  | TX transmission is live                     |       ON      |
| D65K  | RX transmission is live                     |       ON      |
| D66K  | Transmission is paused or done              |               |
| D104K | Traffic checker detected failure            |               |
| D105K | SPEED_MODE[0] for SGMII speed selection     |               |
| D68K  | SPEED_MODE[1] for SGMII speed selection     |               |
-----------------------------------------------------------------------

----------------------------------------------------------
| Table 4: Speed Mode Definition                         |
| Please pause transmission when performing speed change.|
----------------------------------------------------------
| {SPEED_MODE[1], SPEED_MODE[0]} |       Speed           |
----------------------------------------------------------
|            2'b00               |         10M           |
|            2'b01               |        100M           |
|            2'b10               |          1G           |
|            2'b11               |    Reserved           |
----------------------------------------------------------
