Loading device/oob_dev.v +1 −1 Original line number Diff line number Diff line Loading @@ -92,7 +92,7 @@ always @ (posedge clk) retry_timer <= rst | ~(state == STATE_AWAITCOMWAKE) ? 32'h0 : retry_timer + 1'b1; reg [31:0] wait_timer; assign wait_interval_elapsed = wait_timer == 32'd1000; assign wait_interval_elapsed = wait_timer == 32'd4096; always @ (posedge clk) wait_timer <= rst | ~(state == STATE_SENDALIGN) ? 32'h0 : wait_timer + 1'b1; Loading host/gtx_8x10enc.v +11 −4 Original line number Diff line number Diff line Loading @@ -37,15 +37,22 @@ assign addr1 = {inisk[1], indata[15:8]}; // table[i] [9:0] in case of current disparity +, [19:10] in case of - wire [31:0] table0_out; wire [31:0] table1_out; reg [19:0] table0_r; reg [19:0] table1_r; wire [19:0] table0; wire [19:0] table1; assign table0 = table0_out[19:0]; assign table1 = table1_out[19:0]; always @ (posedge clk) begin table0_r <= table0; table1_r <= table1; end // encoded bytes wire [9:0] enc0; wire [9:0] enc1; reg [9:0] enc0_r; reg [9:0] enc1_r; //reg [9:0] enc0_r; //reg [9:0] enc1_r; // running displarity, 0 = -, 1 = + reg disparity; Loading @@ -65,8 +72,8 @@ always @ (posedge clk) // select encoded bytes depending on a previous disparity assign enc0 = {10{~disparity}} & table0[19:10] | {10{disparity}} & table0[9:0]; assign enc1 = {10{~disparity_interm}} & table1[19:10] | {10{disparity_interm}} & table1[9:0]; assign enc0 = {10{~disparity}} & table0_r[19:10] | {10{disparity}} & table0_r[9:0]; assign enc1 = {10{~disparity_interm}} & table1_r[19:10] | {10{disparity_interm}} & table1_r[9:0]; // latch output data reg [19:0] outdata_l; Loading host/gtx_comma_align.v +22 −1 Original line number Diff line number Diff line Loading @@ -76,9 +76,12 @@ assign window = {indata, indata_r}; // there is only 1 matched subwindow due to 20-bit comma's non-repetative pattern wire [19:0] subwindow [19:0]; wire [19:0] comma_match; wire [19:0] comma_match_p; reg [19:0] aligned_data; reg [19:0] comma_match_prev; wire comma_detected; wire [19:0] comma_p = 20'b10101010100101111100; wire [19:0] comma_n = 20'b10101010101010000011; genvar ii; generate Loading @@ -87,7 +90,8 @@ generate assign subwindow[ii] = window[ii + 19:ii]; // assign comma_match[ii] = subwindow[ii] == 20'b01010101010011111010 | subwindow[ii] == 20'b01010101011100000101; // stream comes inverted assign comma_match[ii] = subwindow[ii] == 20'b10101010100101111100 | subwindow[ii] == 20'b10101010101010000011; assign comma_match_p[ii] = subwindow[ii] == comma_p; assign comma_match[ii] = comma_match_p[ii] | subwindow[ii] == comma_n; end endgenerate Loading @@ -97,8 +101,25 @@ assign comma_detected = |comma_match; always @ (posedge clk) comma_match_prev <= rst ? 20'h1 : comma_detected ? comma_match : comma_match_prev; // shift /* TODO wire [38:0] shifted_window; assign shifted_window = comma_detected ? {window >> (comma_match - 1)} : {window >> (comma_match_prev - 1)}; */ // temp shift wire [19:0] shifted_window; wire [19:0] ored_subwindow [19:0]; wire [19:0] ored_subwindow_comdet [19:0]; assign ored_subwindow_comdet[0] = {20{comma_match_p[0]}} & comma_p | {20{~comma_match_p[0] & comma_match[0]}} & comma_n; assign ored_subwindow[0] = {20{comma_match_prev[0]}} & subwindow[0]; generate for (ii = 1; ii < 20; ii = ii + 1) begin: or_all_possible_windows assign ored_subwindow_comdet[ii] = {20{comma_match_p[ii]}} & comma_p | {20{~comma_match_p[ii] & comma_match[ii]}} & comma_n | ored_subwindow_comdet[ii-1]; assign ored_subwindow[ii] = {20{comma_match_prev[ii]}} & subwindow[ii] | ored_subwindow[ii-1]; end endgenerate assign shifted_window = comma_detected ? ored_subwindow_comdet[19] : ored_subwindow[19]; always @ (posedge clk) // aligned_data <= comma_detected ? {window >> (comma_match - 1)}[19:0] : {window >> (comma_match_prev - 1)}[19:0]; aligned_data <= shifted_window[19:0]; Loading host/gtx_wrap.v +3 −2 Original line number Diff line number Diff line Loading @@ -197,9 +197,10 @@ gtx_8x10enc gtx_8x10enc( wire xclk; // assuming GTX interface width = 20 bits // comma aligner wire [19:0] rxdata_comma_in; reg [19:0] rxdata_comma_in; wire [19:0] rxdata_comma_out; assign rxdata_comma_in = {rxdisperr_gtx[1], rxcharisk_gtx[1], rxdata_gtx[15:8], rxdisperr_gtx[0], rxcharisk_gtx[0], rxdata_gtx[7:0]}; always @ (posedge xclk) rxdata_comma_in <= {rxdisperr_gtx[1], rxcharisk_gtx[1], rxdata_gtx[15:8], rxdisperr_gtx[0], rxcharisk_gtx[0], rxdata_gtx[7:0]}; // aligner status generation // if we detected comma & there was 1st realign after non-aligned state -> triggered, we wait until the next comma Loading host/oob.v +1 −0 Original line number Diff line number Diff line Loading @@ -408,6 +408,7 @@ begin $display("[Host] OOB: Started continious align sending"); end end `endif always @ (posedge clk) rxcom_timer <= rst | rxcominit_done & state_wait_cominit | rxcomwake_done & state_wait_comwake | rxcominitdet & state_wait_cominit | rxcomwakedet & state_wait_comwake ? 10'h0 : cominit_req_l & state_idle | rxcominitdet_l & state_wait_cominit | rxcomwakedet_l & state_wait_comwake ? rxcom_timer + CLK_TO_TIMER_CONTRIB : 10'h0; Loading Loading
device/oob_dev.v +1 −1 Original line number Diff line number Diff line Loading @@ -92,7 +92,7 @@ always @ (posedge clk) retry_timer <= rst | ~(state == STATE_AWAITCOMWAKE) ? 32'h0 : retry_timer + 1'b1; reg [31:0] wait_timer; assign wait_interval_elapsed = wait_timer == 32'd1000; assign wait_interval_elapsed = wait_timer == 32'd4096; always @ (posedge clk) wait_timer <= rst | ~(state == STATE_SENDALIGN) ? 32'h0 : wait_timer + 1'b1; Loading
host/gtx_8x10enc.v +11 −4 Original line number Diff line number Diff line Loading @@ -37,15 +37,22 @@ assign addr1 = {inisk[1], indata[15:8]}; // table[i] [9:0] in case of current disparity +, [19:10] in case of - wire [31:0] table0_out; wire [31:0] table1_out; reg [19:0] table0_r; reg [19:0] table1_r; wire [19:0] table0; wire [19:0] table1; assign table0 = table0_out[19:0]; assign table1 = table1_out[19:0]; always @ (posedge clk) begin table0_r <= table0; table1_r <= table1; end // encoded bytes wire [9:0] enc0; wire [9:0] enc1; reg [9:0] enc0_r; reg [9:0] enc1_r; //reg [9:0] enc0_r; //reg [9:0] enc1_r; // running displarity, 0 = -, 1 = + reg disparity; Loading @@ -65,8 +72,8 @@ always @ (posedge clk) // select encoded bytes depending on a previous disparity assign enc0 = {10{~disparity}} & table0[19:10] | {10{disparity}} & table0[9:0]; assign enc1 = {10{~disparity_interm}} & table1[19:10] | {10{disparity_interm}} & table1[9:0]; assign enc0 = {10{~disparity}} & table0_r[19:10] | {10{disparity}} & table0_r[9:0]; assign enc1 = {10{~disparity_interm}} & table1_r[19:10] | {10{disparity_interm}} & table1_r[9:0]; // latch output data reg [19:0] outdata_l; Loading
host/gtx_comma_align.v +22 −1 Original line number Diff line number Diff line Loading @@ -76,9 +76,12 @@ assign window = {indata, indata_r}; // there is only 1 matched subwindow due to 20-bit comma's non-repetative pattern wire [19:0] subwindow [19:0]; wire [19:0] comma_match; wire [19:0] comma_match_p; reg [19:0] aligned_data; reg [19:0] comma_match_prev; wire comma_detected; wire [19:0] comma_p = 20'b10101010100101111100; wire [19:0] comma_n = 20'b10101010101010000011; genvar ii; generate Loading @@ -87,7 +90,8 @@ generate assign subwindow[ii] = window[ii + 19:ii]; // assign comma_match[ii] = subwindow[ii] == 20'b01010101010011111010 | subwindow[ii] == 20'b01010101011100000101; // stream comes inverted assign comma_match[ii] = subwindow[ii] == 20'b10101010100101111100 | subwindow[ii] == 20'b10101010101010000011; assign comma_match_p[ii] = subwindow[ii] == comma_p; assign comma_match[ii] = comma_match_p[ii] | subwindow[ii] == comma_n; end endgenerate Loading @@ -97,8 +101,25 @@ assign comma_detected = |comma_match; always @ (posedge clk) comma_match_prev <= rst ? 20'h1 : comma_detected ? comma_match : comma_match_prev; // shift /* TODO wire [38:0] shifted_window; assign shifted_window = comma_detected ? {window >> (comma_match - 1)} : {window >> (comma_match_prev - 1)}; */ // temp shift wire [19:0] shifted_window; wire [19:0] ored_subwindow [19:0]; wire [19:0] ored_subwindow_comdet [19:0]; assign ored_subwindow_comdet[0] = {20{comma_match_p[0]}} & comma_p | {20{~comma_match_p[0] & comma_match[0]}} & comma_n; assign ored_subwindow[0] = {20{comma_match_prev[0]}} & subwindow[0]; generate for (ii = 1; ii < 20; ii = ii + 1) begin: or_all_possible_windows assign ored_subwindow_comdet[ii] = {20{comma_match_p[ii]}} & comma_p | {20{~comma_match_p[ii] & comma_match[ii]}} & comma_n | ored_subwindow_comdet[ii-1]; assign ored_subwindow[ii] = {20{comma_match_prev[ii]}} & subwindow[ii] | ored_subwindow[ii-1]; end endgenerate assign shifted_window = comma_detected ? ored_subwindow_comdet[19] : ored_subwindow[19]; always @ (posedge clk) // aligned_data <= comma_detected ? {window >> (comma_match - 1)}[19:0] : {window >> (comma_match_prev - 1)}[19:0]; aligned_data <= shifted_window[19:0]; Loading
host/gtx_wrap.v +3 −2 Original line number Diff line number Diff line Loading @@ -197,9 +197,10 @@ gtx_8x10enc gtx_8x10enc( wire xclk; // assuming GTX interface width = 20 bits // comma aligner wire [19:0] rxdata_comma_in; reg [19:0] rxdata_comma_in; wire [19:0] rxdata_comma_out; assign rxdata_comma_in = {rxdisperr_gtx[1], rxcharisk_gtx[1], rxdata_gtx[15:8], rxdisperr_gtx[0], rxcharisk_gtx[0], rxdata_gtx[7:0]}; always @ (posedge xclk) rxdata_comma_in <= {rxdisperr_gtx[1], rxcharisk_gtx[1], rxdata_gtx[15:8], rxdisperr_gtx[0], rxcharisk_gtx[0], rxdata_gtx[7:0]}; // aligner status generation // if we detected comma & there was 1st realign after non-aligned state -> triggered, we wait until the next comma Loading
host/oob.v +1 −0 Original line number Diff line number Diff line Loading @@ -408,6 +408,7 @@ begin $display("[Host] OOB: Started continious align sending"); end end `endif always @ (posedge clk) rxcom_timer <= rst | rxcominit_done & state_wait_cominit | rxcomwake_done & state_wait_comwake | rxcominitdet & state_wait_cominit | rxcomwakedet & state_wait_comwake ? 10'h0 : cominit_req_l & state_idle | rxcominitdet_l & state_wait_cominit | rxcomwakedet_l & state_wait_comwake ? rxcom_timer + CLK_TO_TIMER_CONTRIB : 10'h0; Loading