-
Notifications
You must be signed in to change notification settings - Fork 4
Support for ZCU111 #55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
evanwsun
wants to merge
2
commits into
main
Choose a base branch
from
zcu111
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| -F src.f | ||
| example_designs/zcu111/src/qeciphy_syn_wrapper.sv |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,156 @@ | ||
| // SPDX-License-Identifier: BSD-2-Clause | ||
| // Copyright (c) 2025 Riverlane Ltd. | ||
| // Original authors: Aniket Datta, Gargi Sunil | ||
|
|
||
| module qeciphy_syn_wrapper ( | ||
| input logic gt_refclk_in_p, | ||
| input logic gt_refclk_in_n, | ||
| input logic gt_rx_p, | ||
| input logic gt_rx_n, | ||
| output logic gt_tx_p, | ||
| output logic gt_tx_n, | ||
| output logic [3:0] SFP_tx_enable, | ||
| output logic [2:0] led | ||
| ); | ||
|
|
||
| // Signal declarations | ||
| logic RCLK; | ||
| logic FCLK; | ||
| logic ACLK; | ||
| logic ARSTn; | ||
| logic [63:0] TX_TDATA; | ||
| logic [63:0] TX_TDATA_nxt; | ||
| logic TX_TVALID; | ||
| logic TX_TREADY; | ||
| logic [63:0] RX_TDATA; | ||
| logic RX_TVALID; | ||
| logic RX_TREADY; | ||
| logic [ 3:0] STATUS; | ||
| logic [ 3:0] ECODE; | ||
| logic [ 4:0] rst_counter; | ||
| logic [ 4:0] rst_counter_nxt; | ||
| logic rst_n_async; | ||
| logic [ 1:0] rst_n_sf; | ||
| logic rst_n; | ||
| logic clk_freerun; | ||
| logic [ 3:0] sfp_enable; | ||
| logic [63:0] RX_TDATA_ref; | ||
| logic [63:0] RX_TDATA_ref_nxt; | ||
| logic RXDATA_error; | ||
| logic RXDATA_error_nxt; | ||
|
|
||
| assign SFP_tx_enable = sfp_enable; | ||
|
|
||
| // Refer: https://docs.amd.com/r/en-US/ug974-vivado-ultrascale-libraries/IBUFDS_GTE4 | ||
| IBUFDS_GTE4 #( | ||
| .REFCLK_EN_TX_PATH(1'b0), | ||
| .REFCLK_HROW_CK_SEL(2'b00), | ||
| .REFCLK_ICNTL_RX(2'b00) | ||
| ) i_buff_gtrefclk ( | ||
| .O (RCLK), | ||
| .ODIV2(clk_freerun), | ||
| .CEB (1'b0), | ||
| .I (gt_refclk_in_p), | ||
| .IB (gt_refclk_in_n) | ||
| ); | ||
|
|
||
| BUFG_GT i_buff_fclk ( | ||
| .O (FCLK), | ||
| .CE (1'b1), | ||
| .CEMASK (1'b1), | ||
| .CLR (1'b0), | ||
| .CLRMASK(1'b1), | ||
| .DIV (3'b000), | ||
| .I (clk_freerun) | ||
| ); | ||
|
|
||
| qeciphy_rx_ila i_rx_ila ( | ||
| .clk (ACLK), | ||
| .probe0(RX_TDATA), | ||
| .probe1(RX_TVALID), | ||
| .probe2(STATUS), | ||
| .probe3(ECODE), | ||
| .probe4(sfp_enable), | ||
| .probe5(RXDATA_error) | ||
| ); | ||
|
|
||
| qeciphy_vio i_vio ( | ||
| .clk (ACLK), | ||
| .probe_out0(rst_n_async), | ||
| .probe_out1(sfp_enable) | ||
| ); | ||
|
|
||
| // Generate 16 cycle reset that de-asserts synchronously | ||
| assign ARSTn = rst_counter[4]; | ||
| assign rst_counter_nxt = ARSTn ? rst_counter : rst_counter + 5'h1; | ||
| assign rst_n = rst_n_sf[1]; | ||
|
|
||
| always_ff @(posedge ACLK or negedge rst_n) begin | ||
| if (!rst_n) rst_counter <= 5'h0; | ||
| else rst_counter <= rst_counter_nxt; | ||
| end | ||
|
|
||
| always_ff @(posedge ACLK) begin | ||
| if (!rst_n_async) rst_n_sf <= 2'h0; | ||
| else rst_n_sf <= {rst_n_sf[0], 1'b1}; | ||
| end | ||
|
|
||
| // Connect free-running clock to AXI clock for simplicity | ||
| assign ACLK = FCLK; | ||
|
|
||
| // By the spec | ||
| assign RX_TREADY = 1'b1; | ||
|
|
||
| // For debugging | ||
| assign led[0] = (STATUS == 4'b0100) ? 1'b1 : 1'b0; | ||
| assign led[1] = (ECODE == 4'b0000) ? 1'b1 : 1'b0; | ||
| assign led[2] = ~RXDATA_error; | ||
|
|
||
| // Drive the transmitter QECI-PHY TX data pins | ||
| always_ff @(posedge FCLK or negedge ARSTn) begin | ||
| if (!ARSTn) TX_TVALID <= 1'b0; | ||
| else TX_TVALID <= 1'b1; | ||
| end | ||
|
|
||
| assign TX_TDATA_nxt = TX_TREADY ? TX_TDATA + 64'h1 : TX_TDATA; | ||
|
|
||
| always_ff @(posedge FCLK or negedge ARSTn) begin | ||
| if (!ARSTn) TX_TDATA <= 'h0; | ||
| else TX_TDATA <= TX_TDATA_nxt; | ||
| end | ||
|
|
||
| // Verify receiver data | ||
| assign RX_TDATA_ref_nxt = RX_TVALID ? RX_TDATA_ref + 64'h1 : RX_TDATA_ref; | ||
|
|
||
| always_ff @(posedge FCLK or negedge ARSTn) begin | ||
| if (!ARSTn) RX_TDATA_ref <= 'h0; | ||
| else RX_TDATA_ref <= RX_TDATA_ref_nxt; | ||
| end | ||
|
|
||
| assign RXDATA_error_nxt = RX_TVALID ? (RX_TDATA_ref != RX_TDATA) : RXDATA_error; | ||
|
|
||
| always_ff @(posedge FCLK or negedge ARSTn) begin | ||
| if (!ARSTn) RXDATA_error <= 'h0; | ||
| else RXDATA_error <= RXDATA_error_nxt; | ||
| end | ||
|
|
||
| QECIPHY i_QECIPHY ( | ||
| .RCLK (RCLK), | ||
| .FCLK (FCLK), | ||
| .ACLK (ACLK), | ||
| .ARSTn (ARSTn), | ||
| .TX_TDATA (TX_TDATA), | ||
| .TX_TVALID(TX_TVALID), | ||
| .TX_TREADY(TX_TREADY), | ||
| .RX_TDATA (RX_TDATA), | ||
| .RX_TVALID(RX_TVALID), | ||
| .RX_TREADY(RX_TREADY), | ||
| .STATUS (STATUS), | ||
| .ECODE (ECODE), | ||
| .GT_RX_P (gt_rx_p), | ||
| .GT_RX_N (gt_rx_n), | ||
| .GT_TX_P (gt_tx_p), | ||
| .GT_TX_N (gt_tx_n) | ||
| ); | ||
|
|
||
| endmodule |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| # SPDX-License-Identifier: BSD-2-Clause | ||
| # Copyright (c) 2025 Riverlane Ltd. | ||
| # Original authors: Dogancan Davutoglu, Aniket Datta, Gargi Sunil | ||
|
|
||
| create_clock -period 6.400 -name gt_refclk [get_ports gt_refclk_in_p] | ||
| set_property PACKAGE_PIN W33 [get_ports gt_refclk_in_p] | ||
|
|
||
| # ------------------------------------------------------------------------- | ||
| # QECIPHY instance 0 clocks | ||
| # ------------------------------------------------------------------------- | ||
| create_generated_clock -name rx_clk [get_pins -hierarchical -filter {NAME =~ *i_QECIPHY/i_qeciphy_serdes/i_qeciphy_gt_wrapper/gen_GTY_transceiver.i_BUFG_rx_clk/O}] | ||
| create_generated_clock -name gt_rx_clk [get_pins -hierarchical -filter {NAME =~ *i_QECIPHY/i_qeciphy_serdes/i_qeciphy_gt_wrapper*channel_inst/gtye4_channel_gen.gen_gtye4_channel_inst[0].GTYE4_CHANNEL_PRIM_INST/RXOUTCLK}] | ||
| create_generated_clock -name tx_clk [get_pins -hierarchical -filter {NAME =~ *i_QECIPHY/i_qeciphy_serdes/i_qeciphy_gt_wrapper/gen_GTY_transceiver.i_BUFG_tx_clk/O}] | ||
| create_generated_clock -name gt_tx_clk [get_pins -hierarchical -filter {NAME =~ *i_QECIPHY/i_qeciphy_serdes/i_qeciphy_gt_wrapper*channel_inst/gtye4_channel_gen.gen_gtye4_channel_inst[0].GTYE4_CHANNEL_PRIM_INST/TXOUTCLK}] | ||
|
|
||
| set_clock_groups -asynchronous -group [get_clocks gt_refclk] -group [get_clocks {rx_clk gt_rx_clk}] -group [get_clocks {tx_clk gt_tx_clk}] | ||
| set_property CLOCK_DELAY_GROUP rx_clk_dly_grp [get_nets -hierarchical -filter {NAME =~ *i_QECIPHY/i_qeciphy_serdes/i_qeciphy_gt_wrapper/rx_clk_o || NAME =~ *i_QECIPHY/i_qeciphy_serdes/i_qeciphy_gt_wrapper/rx_clk_2x_o}] | ||
| set_property CLOCK_DELAY_GROUP tx_clk_dly_grp [get_nets -hierarchical -filter {NAME =~ *i_QECIPHY/i_qeciphy_serdes/i_qeciphy_gt_wrapper/tx_clk_o || NAME =~ *i_QECIPHY/i_qeciphy_serdes/i_qeciphy_gt_wrapper/tx_clk_2x_o}] | ||
|
|
||
| #Define multicycle path between sync clocks | ||
| set_multicycle_path -setup -end -from [get_clocks rx_clk] -to [get_clocks gt_rx_clk] 2 | ||
| set_multicycle_path -hold -end -from [get_clocks rx_clk] -to [get_clocks gt_rx_clk] 1 | ||
| set_multicycle_path -setup -start -from [get_clocks gt_rx_clk] -to [get_clocks rx_clk] 2 | ||
| set_multicycle_path -hold -start -from [get_clocks gt_rx_clk] -to [get_clocks rx_clk] 1 | ||
| set_multicycle_path -setup -end -from [get_clocks tx_clk] -to [get_clocks gt_tx_clk] 2 | ||
| set_multicycle_path -hold -end -from [get_clocks tx_clk] -to [get_clocks gt_tx_clk] 1 | ||
| set_multicycle_path -setup -start -from [get_clocks gt_tx_clk] -to [get_clocks tx_clk] 2 | ||
| set_multicycle_path -hold -start -from [get_clocks gt_tx_clk] -to [get_clocks tx_clk] 1 | ||
|
|
||
| set_property IOSTANDARD LVCMOS18 [get_ports {led[0]}] | ||
| set_property IOSTANDARD LVCMOS18 [get_ports {led[1]}] | ||
| set_property IOSTANDARD LVCMOS18 [get_ports {led[2]}] | ||
|
|
||
| set_property PACKAGE_PIN AR13 [get_ports {led[0]}] | ||
| set_property PACKAGE_PIN AP13 [get_ports {led[1]}] | ||
| set_property PACKAGE_PIN AR16 [get_ports {led[2]}] | ||
|
|
||
| set_property IOSTANDARD LVCMOS12 [get_ports {SFP_tx_enable[0]}] | ||
| set_property IOSTANDARD LVCMOS12 [get_ports {SFP_tx_enable[1]}] | ||
| set_property IOSTANDARD LVCMOS12 [get_ports {SFP_tx_enable[2]}] | ||
| set_property IOSTANDARD LVCMOS12 [get_ports {SFP_tx_enable[3]}] | ||
|
|
||
| set_property PACKAGE_PIN G12 [get_ports {SFP_tx_enable[0]}] | ||
| set_property PACKAGE_PIN G10 [get_ports {SFP_tx_enable[1]}] | ||
| set_property PACKAGE_PIN K12 [get_ports {SFP_tx_enable[2]}] | ||
| set_property PACKAGE_PIN J7 [get_ports {SFP_tx_enable[3]}] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to define a default target here?