Skip to content

Commit f0be0ce

Browse files
committed
Merge branch 'try_doublebit' into 'master'
Add structures to implement GigE using 16-bit GTP at 125 MHz Adds experimental (but not yet functional) code to double each bit in the 125 MT/s 10-bit word so it can fit into a 7-series GTP with a bit-clock of 2.5 GHz. Code looks nominally complete. * Adds fpga_family/mgt/gtp_common_2_50.tcl with wild guess on comma setup. * Adds fpga_family/mgt/gtp_ethernet_2_50.tcl with new clock setup. * Setting DOUBLEBIT = 1 in projects/comms_top/gige_eth/gige_top.v and adjusting projects/comms_top/gige_eth/gtp_gige_top.tcl will enable testing on AC701, but the result doesn't actually work. See merge request hdl-libraries/bedrock!218
2 parents 646fa4b + 5ef7764 commit f0be0ce

File tree

8 files changed

+184
-25
lines changed

8 files changed

+184
-25
lines changed

board_support/ac701/base.xdc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,5 @@ set_property -dict "PACKAGE_PIN T24 IOSTANDARD LVCMOS33" [get_ports {LED[1]}]
1515
set_property -dict "PACKAGE_PIN T25 IOSTANDARD LVCMOS33" [get_ports {LED[2]}]
1616
set_property -dict "PACKAGE_PIN R26 IOSTANDARD LVCMOS33" [get_ports {LED[3]}]
1717

18-
set_property -dict "PACKAGE_PIN U4 IOSTANDARD LVCMOS15" [get_ports {RESET}]
19-
2018
# UG471 page 50
21-
set_property INTERNAL_VREF 0.90 [get_banks BANK13]
19+
set_property INTERNAL_VREF 0.90 [get_iobanks 13]
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
set cfg_dict {
2+
CONFIG.identical_val_tx_line_rate {2.50}
3+
CONFIG.gt0_val {true}
4+
CONFIG.gt0_val_drp_clock {50}
5+
CONFIG.gt0_val_rx_refclk {REFCLK0_Q0}
6+
CONFIG.gt0_val_tx_refclk {REFCLK0_Q0}
7+
CONFIG.gt0_val_txbuf_en {true}
8+
CONFIG.gt0_val_rxbuf_en {true}
9+
CONFIG.gt0_val_port_rxslide {false}
10+
CONFIG.gt0_usesharedlogic {0}
11+
CONFIG.identical_val_rx_line_rate {2.50}
12+
CONFIG.gt_val_tx_pll {PLL0}
13+
CONFIG.gt_val_rx_pll {PLL1}
14+
CONFIG.identical_val_tx_reference_clock {125.000}
15+
CONFIG.identical_val_rx_reference_clock {125.000}
16+
CONFIG.gt0_val_tx_line_rate {2.50}
17+
CONFIG.gt0_val_tx_data_width {20}
18+
CONFIG.gt0_val_tx_int_datawidth {20}
19+
CONFIG.gt0_val_tx_reference_clock {125.000}
20+
CONFIG.gt0_val_rx_line_rate {2.50}
21+
CONFIG.gt0_val_rx_data_width {20}
22+
CONFIG.gt0_val_rx_int_datawidth {20}
23+
CONFIG.gt0_val_rx_reference_clock {125.000}
24+
CONFIG.gt0_val_cpll_fbdiv {4}
25+
CONFIG.gt0_val_cpll_rxout_div {4}
26+
CONFIG.gt0_val_cpll_txout_div {4}
27+
CONFIG.gt0_val_tx_buffer_bypass_mode {Auto}
28+
CONFIG.gt0_val_txoutclk_source {false}
29+
CONFIG.gt0_val_rx_buffer_bypass_mode {Auto}
30+
CONFIG.gt0_val_rxusrclk {RXOUTCLK}
31+
CONFIG.gt0_val_rxslide_mode {OFF}
32+
CONFIG.gt0_val_port_txbufstatus {true}
33+
CONFIG.gt0_val_port_rxbufstatus {true}
34+
CONFIG.gt0_val_port_rxpmareset {true}
35+
CONFIG.gt0_val_align_mcomma_det {true}
36+
CONFIG.gt0_val_align_pcomma_det {true}
37+
CONFIG.gt0_val_comma_preset {User_defined}
38+
CONFIG.gt0_val_align_pcomma_value {1111110000}
39+
CONFIG.gt0_val_align_mcomma_value {0011001111}
40+
CONFIG.gt0_val_align_comma_enable {1111111111}
41+
CONFIG.gt0_val_align_comma_double {true}
42+
CONFIG.gt0_val_align_comma_word {Two_Byte_Boundaries}
43+
CONFIG.gt0_val_port_rxpcommaalignen {false}
44+
CONFIG.gt0_val_port_rxmcommaalignen {false}
45+
CONFIG.gt0_val_dfe_mode {LPM-Auto}
46+
CONFIG.gt0_val_rx_termination_voltage {Programmable}
47+
CONFIG.gt0_val_rx_cm_trim {800}
48+
CONFIG.gt0_val_port_rxdfereset {true}
49+
CONFIG.gt0_val_pd_trans_time_to_p2 {100}
50+
CONFIG.gt0_val_pd_trans_time_from_p2 {60}
51+
CONFIG.gt0_val_pd_trans_time_non_p2 {25}
52+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
set cfg_dict {
2+
CONFIG.identical_val_tx_line_rate {2.50}
3+
CONFIG.gt0_val {true}
4+
CONFIG.gt0_val_drp_clock {50}
5+
CONFIG.gt0_val_rx_refclk {REFCLK0_Q0}
6+
CONFIG.gt0_val_tx_refclk {REFCLK0_Q0}
7+
CONFIG.gt0_val_txbuf_en {true}
8+
CONFIG.gt0_val_rxbuf_en {true}
9+
CONFIG.gt0_val_port_rxslide {false}
10+
CONFIG.gt0_usesharedlogic {0}
11+
CONFIG.identical_val_rx_line_rate {2.50}
12+
CONFIG.gt_val_tx_pll {PLL0}
13+
CONFIG.gt_val_rx_pll {PLL0}
14+
CONFIG.identical_val_tx_reference_clock {125.000}
15+
CONFIG.identical_val_rx_reference_clock {125.000}
16+
CONFIG.gt0_val_tx_line_rate {2.50}
17+
CONFIG.gt0_val_tx_data_width {20}
18+
CONFIG.gt0_val_tx_int_datawidth {20}
19+
CONFIG.gt0_val_tx_reference_clock {125.000}
20+
CONFIG.gt0_val_rx_line_rate {2.50}
21+
CONFIG.gt0_val_rx_data_width {20}
22+
CONFIG.gt0_val_rx_int_datawidth {20}
23+
CONFIG.gt0_val_rx_reference_clock {125.000}
24+
CONFIG.gt0_val_cpll_fbdiv {4}
25+
CONFIG.gt0_val_cpll_rxout_div {4}
26+
CONFIG.gt0_val_cpll_txout_div {4}
27+
CONFIG.gt0_val_tx_buffer_bypass_mode {Auto}
28+
CONFIG.gt0_val_txoutclk_source {false}
29+
CONFIG.gt0_val_rx_buffer_bypass_mode {Auto}
30+
CONFIG.gt0_val_rxusrclk {RXOUTCLK}
31+
CONFIG.gt0_val_rxslide_mode {OFF}
32+
CONFIG.gt0_val_port_txbufstatus {true}
33+
CONFIG.gt0_val_port_rxbufstatus {true}
34+
CONFIG.gt0_val_port_rxpmareset {true}
35+
CONFIG.gt0_val_align_mcomma_det {true}
36+
CONFIG.gt0_val_align_pcomma_det {true}
37+
CONFIG.gt0_val_comma_preset {User_defined}
38+
CONFIG.gt0_val_align_pcomma_value {1111110000}
39+
CONFIG.gt0_val_align_mcomma_value {0011001111}
40+
CONFIG.gt0_val_align_comma_enable {1111111111}
41+
CONFIG.gt0_val_align_comma_double {true}
42+
CONFIG.gt0_val_align_comma_word {Two_Byte_Boundaries}
43+
CONFIG.gt0_val_port_rxpcommaalignen {false}
44+
CONFIG.gt0_val_port_rxmcommaalignen {false}
45+
CONFIG.gt0_val_dfe_mode {LPM-Auto}
46+
CONFIG.gt0_val_rx_termination_voltage {Programmable}
47+
CONFIG.gt0_val_rx_cm_trim {800}
48+
CONFIG.gt0_val_port_rxdfereset {true}
49+
CONFIG.gt0_val_pd_trans_time_to_p2 {100}
50+
CONFIG.gt0_val_pd_trans_time_from_p2 {60}
51+
CONFIG.gt0_val_pd_trans_time_non_p2 {25}
52+
}

projects/comms_top/gige_eth/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ VERILOG_DEFINE_FLAGS =
1717
include $(COMMS_TOP_DIR)/rules.mk
1818
include $(BUILD_DIR)/top_rules.mk
1919

20-
all: gen $(APP_NAME).bit
20+
all: $(APP_NAME).bit
2121

2222
$(APP_NAME).bit: $(IP_TCL)
2323

@@ -35,5 +35,5 @@ ifneq (,$(findstring bit,$(MAKECMDGOALS)))
3535
endif
3636
endif
3737

38-
CLEAN += *.bit ../test/*.dat
38+
CLEAN += *.bit *.bin ../test/*.dat
3939
include $(BUILD_DIR)/bottom_rules.mk

projects/comms_top/gige_eth/gige_top.v

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ module gige_top (
2929

3030
localparam IPADDR = {8'd192, 8'd168, 8'd1, 8'd179};
3131
localparam MACADDR = 48'h00105ad155b5;
32+
localparam DOUBLEBIT = 0; // XXX DOUBLEBIT = 1 fails hardware test
3233

3334
`define AC701
3435
`ifdef AC701
@@ -58,6 +59,7 @@ module gige_top (
5859
gtp_sys_clk_mmcm i_gtp_sys_clk_mmcm (
5960
.clk_in (sys_clk_fast),
6061
.sys_clk (sys_clk), // Buffered 50 MHz
62+
.reset (1'b0),
6163
.locked ()
6264
);
6365
`else
@@ -87,21 +89,31 @@ module gige_top (
8789

8890
// Route 62.5 MHz TXOUTCLK through clock manager to generate 125 MHz clock
8991
// Ethernet clock managers
92+
wire gmii_tx_clk_half;
9093
mgt_eth_clks i_gt_eth_clks_tx (
9194
.reset (~gt_cpll_locked[0]),
9295
.mgt_out_clk (gt0_tx_out_clk), // From transceiver
93-
.mgt_usr_clk (gt0_tx_usr_clk), // Buffered 62.5 MHz
96+
.mgt_usr_clk (gmii_tx_clk_half), // Buffered 62.5 MHz
9497
.gmii_clk (gmii_tx_clk), // Buffered 125 MHz
9598
.pll_lock (tx0_pll_lock)
9699
);
97100

101+
wire gmii_rx_clk_half;
98102
mgt_eth_clks i_gt_eth_clks_rx (
99103
.reset (~gt_cpll_locked[0]),
100104
.mgt_out_clk (gt0_rx_out_clk), // From transceiver
101-
.mgt_usr_clk (gt0_rx_usr_clk),
105+
.mgt_usr_clk (gmii_rx_clk_half),
102106
.gmii_clk (gmii_rx_clk),
103107
.pll_lock (rx0_pll_lock)
104108
);
109+
// two cases: gt0_*_out_clk = 125 MHz or 62.5 MHz
110+
generate if (DOUBLEBIT) begin : G_DOUBLEBIT
111+
assign gt0_tx_usr_clk = gmii_tx_clk;
112+
assign gt0_rx_usr_clk = gmii_rx_clk;
113+
end else begin: G_SLOW
114+
assign gt0_tx_usr_clk = gmii_tx_clk_half;
115+
assign gt0_rx_usr_clk = gmii_rx_clk_half;
116+
end endgenerate
105117

106118
// ----------------------------------
107119
// GTP Instantiation
@@ -167,9 +179,10 @@ module gige_top (
167179
eth_gtx_bridge #(
168180
.IP (IPADDR),
169181
.MAC (MACADDR),
170-
.GTX_DW (GTX_ETH_WIDTH))
182+
.GTX_DW (GTX_ETH_WIDTH),
183+
.DOUBLEBIT (DOUBLEBIT))
171184
i_eth_gtx_bridge (
172-
.gtx_tx_clk (gt0_tx_usr_clk), // Transceiver clock at half rate
185+
.gtx_tx_clk (gt0_tx_usr_clk), // Transceiver clock, sometimes at half rate
173186
.gmii_tx_clk (gmii_tx_clk), // Clock for Ethernet fabric - 125 MHz for 1GbE
174187
.gmii_rx_clk (gmii_rx_clk),
175188
.gtx_rxd (gt0_rxd),

projects/comms_top/gige_eth/gtp_gige_top.tcl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ source $MGT_CONFIG_DIR/mgt_gen.tcl
1717
set quad 0
1818
set pll0_refclk "REFCLK0"
1919
set pll1_refclk "REFCLK0"
20+
# Stupid but working with 62.5 MHz clk:
2021
add_gtcommon $MGT_CONFIG_DIR/gtp_common_1_25.tcl $quad $pll0_refclk $pll1_refclk
22+
# for DOUBLEBIT experiments:
23+
# add_gtcommon $MGT_CONFIG_DIR/gtp_common_2_50.tcl $quad $pll0_refclk $pll1_refclk
2124

2225
# proc add_gt_protocol {gt_type config_file quad_num gt_num en8b10b pll_type}
2326

@@ -28,7 +31,10 @@ set gt 0
2831
set en8b10b 0
2932
set endrp 0
3033
set pll_type "PLL0"
34+
# Stupid but working with 62.5 MHz clk:
3135
add_gt_protocol $gt_type $MGT_CONFIG_DIR/gtp_ethernet.tcl $quad $gt $en8b10b $endrp $pll_type
36+
# for DOUBLEBIT experiments:
37+
# add_gt_protocol $gt_type $MGT_CONFIG_DIR/gtp_ethernet_2_50.tcl $quad $gt $en8b10b $endrp $pll_type
3238

3339
# proc add_aux_ip {ipname config_file module_name}
3440
add_aux_ip clk_wiz $MGT_CONFIG_DIR/mgt_eth_clk.tcl mgt_eth_mmcm

serial_io/eth_gtx_bridge.v

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// ------------------------------------
44
// eth_gtx_bridge.v
55
//
6-
// DEPRECATED
6+
// DEPRECATED (but still used in projects/comms_top!)
77
// Wrapper around rtefi_blob and eth_gtx_hook with a TX/RX path width conversion for GTX compatibility
88
// Note that this module "just" instantiates two others:
99
// eth_gtx_hook and rtefi_blob.
@@ -18,10 +18,11 @@
1818
module eth_gtx_bridge #(
1919
parameter IP = {8'd192, 8'd168, 8'd7, 8'd4},
2020
parameter MAC = 48'h112233445566,
21-
parameter JUMBO_DW = 14, // Not used, just holdover for compatibility with older eth_gtx_bridge
22-
parameter GTX_DW = 20) // Parallel GTX data width; Supported values are 10b and 20b
21+
parameter JUMBO_DW = 14, // Not used, just holdover for compatibility with older eth_gtx_bridge
22+
parameter GTX_DW = 20, // Parallel GTX data width; Supported values are 10b and 20b
23+
parameter DOUBLEBIT = 0) // Experimental
2324
(
24-
input gtx_tx_clk, // Transceiver clock at half rate
25+
input gtx_tx_clk, // Transceiver clock, sometimes at half rate
2526
input gmii_tx_clk, // Clock for Ethernet fabric - 125 MHz for 1GbE
2627
input gmii_rx_clk,
2728
input [GTX_DW-1:0] gtx_rxd,
@@ -60,7 +61,7 @@ module eth_gtx_bridge #(
6061
wire [7:0] gmii_rxd, gmii_txd;
6162
wire gmii_tx_en, gmii_rx_dv;
6263

63-
eth_gtx_hook #(.JUMBO_DW(14), .GTX_DW(20)) hook(
64+
eth_gtx_hook #(.JUMBO_DW(14), .GTX_DW(GTX_DW), .DOUBLEBIT(DOUBLEBIT)) hook(
6465
.gtx_tx_clk (gtx_tx_clk),
6566
.gmii_tx_clk (gmii_tx_clk),
6667
.gmii_rx_clk (gmii_rx_clk),

serial_io/eth_gtx_hook.v

Lines changed: 48 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,20 @@
33
// ------------------------------------
44
// eth_gtx_hook.v
55
// ------------------------------------
6+
// Converts between an internal/virtual GMII Ethernet port (8-bit, 125 MHz)
7+
// and the user pins of an on-chip serdes
8+
// GTX_DW = 10 : 125 MHz serdes clk for Spartan-6 LXT
9+
// GTX_DW = 20 DOUBLEBIT = 0 : 62.5 MHz serdes clk for Xilinx 7-series
10+
// GTX_DW = 20 DOUBLEBIT = 1 : 125 MHz serdes clk for Xilinx 7-series (experimental)
611

712
module eth_gtx_hook #(
8-
parameter JUMBO_DW = 14, // Not used, just holdover for compatibility with older eth_gtx_bridge
13+
parameter JUMBO_DW = 14, // Not used, just holdover for compatibility with older eth_gtx_bridge
914
parameter EVENINIT = 0,
1015
parameter ENC_DISPINIT=1'b0,
11-
parameter GTX_DW = 20) // Parallel GTX data width; Supported values are 10b and 20b
16+
parameter GTX_DW = 20, // Parallel GTX data width; Supported values are 10b and 20b
17+
parameter DOUBLEBIT = 0) // Experimental
1218
(
13-
input gtx_tx_clk, // Transceiver clock at half rate
19+
input gtx_tx_clk, // Transceiver clock, sometimes at half rate
1420
input gmii_tx_clk, // Clock for Ethernet fabric - 125 MHz for 1GbE
1521
input gmii_rx_clk,
1622
input [GTX_DW-1:0] gtx_rxd,
@@ -29,20 +35,44 @@ module eth_gtx_hook #(
2935

3036
);
3137

32-
wire [9:0] gtx_txd_10;
38+
wire [9:0] gtx_txd_10; // driven by i_gmii_link
39+
wire [9:0] gtx_rxd_10; // input to i_gmii_link
3340

3441
// ----------------------------------
3542
// Data width and rate conversion
3643
// ---------------------------------
3744

38-
wire [9:0] gtx_rxd_10;
39-
40-
generate if (GTX_DW==20) begin: G_GTX_DATA_CONV
41-
45+
generate if ((GTX_DW==20) && DOUBLEBIT) begin: G_GTX_DOUBLEBIT_CONV
46+
47+
// gmii and gtx clocks are considered the same in this stanza
48+
// One could also write this bit rearrangement with a generate loop,
49+
// but I don't mind being explicit about it.
50+
assign gtx_txd = {
51+
gtx_txd_10[9], gtx_txd_10[9], gtx_txd_10[8], gtx_txd_10[8],
52+
gtx_txd_10[7], gtx_txd_10[7], gtx_txd_10[6], gtx_txd_10[6],
53+
gtx_txd_10[5], gtx_txd_10[5], gtx_txd_10[4], gtx_txd_10[4],
54+
gtx_txd_10[3], gtx_txd_10[3], gtx_txd_10[2], gtx_txd_10[2],
55+
gtx_txd_10[1], gtx_txd_10[1], gtx_txd_10[0], gtx_txd_10[0]};
56+
assign gtx_rxd_10 = {
57+
gtx_rxd[19], gtx_rxd[17],
58+
gtx_rxd[15], gtx_rxd[13],
59+
gtx_rxd[11], gtx_rxd[9],
60+
gtx_rxd[7], gtx_rxd[5],
61+
gtx_rxd[3], gtx_rxd[1]};
62+
wire confused = // XXX how to read out this status bit in hardware?
63+
(gtx_rxd[19]^gtx_rxd[18]) | (gtx_rxd[17]^gtx_rxd[16]) |
64+
(gtx_rxd[15]^gtx_rxd[14]) | (gtx_rxd[13]^gtx_rxd[12]) |
65+
(gtx_rxd[11]^gtx_rxd[10]) | (gtx_rxd[9]^gtx_rxd[8]) |
66+
(gtx_rxd[7]^gtx_rxd[6]) | (gtx_rxd[5]^gtx_rxd[4]) |
67+
(gtx_rxd[3]^gtx_rxd[2]) | (gtx_rxd[1]^gtx_rxd[0]);
68+
69+
end else if (GTX_DW==20) begin: G_GTX_DATA_CONV
70+
71+
// gtx clock is half the gmii clock rate in this stanza
4272
reg [9:0] gtx_rxd_10_r=0;
4373
reg [9:0] gtx_txd_r=0;
44-
wire [9:0] gtp_rxd_l = gtx_rxd[9:0];
45-
wire [9:0] gtp_rxd_h = gtx_rxd[19:10];
74+
wire [9:0] gtx_rxd_l = gtx_rxd[9:0];
75+
wire [9:0] gtx_rxd_h = gtx_rxd[19:10];
4676
reg [19:0] gtx_txd_l=0;
4777
reg even=EVENINIT;
4878

@@ -52,10 +82,16 @@ module eth_gtx_hook #(
5282

5383
always @(posedge gmii_rx_clk) begin
5484
even <= ~even;
55-
gtx_rxd_10_r <= even ? gtp_rxd_l : gtp_rxd_h;
85+
// This next line would be a CDC, except Vivado "knows" that
86+
// gmii_rx_clk and gtx_rx_clk are "related clocks".
87+
// Note that gtx_rx_clk is only implicit in this module:
88+
// it's the clock domain of the gtx_rxd input port.
89+
gtx_rxd_10_r <= even ? gtx_rxd_l : gtx_rxd_h;
5690
end
5791

5892
always @(posedge gtx_tx_clk) begin
93+
// This next line would be a CDC, except Vivado "knows" that
94+
// gtx_tx_clk and gmii_tx_clk are "related clocks".
5995
gtx_txd_l <= {gtx_txd_10, gtx_txd_r};
6096
end
6197

@@ -64,6 +100,7 @@ module eth_gtx_hook #(
64100

65101
end else begin
66102

103+
// gmii and gtx clocks are considered the same in this stanza
67104
assign gtx_txd = gtx_txd_10;
68105
assign gtx_rxd_10 = gtx_rxd;
69106

0 commit comments

Comments
 (0)