1
0
mirror of https://github.com/aolofsson/oh.git synced 2025-01-17 20:02:53 +08:00
oh/elink/hdl/erx_fifo.v
Andreas Olofsson 91f8e3db5a Complete redesign of the TX
- After finding the bug in the reference model and wasting countless hours going back and forth with FPGA timing optimization and bug tweaks, I realized that the  design was fundementally broken. The decision to use two clock domains (high speed) and low speed was correct from the beginning. The FPGA is dreadfully slow, (you definitely don't want to do much logic at 300MHz...), but the handoff between tclk and tclk_div4 was too complicated. The puzzle of having to respond to wait quickly, covering the corner cases, and meeting timing was just too ugly.
- The "new" design goes back to the method of using the high speed logic only for doing a "dumb" parallel to serial converter and preparing all the necessary signals in the low speed domain.
- This feel A LOT cleaner and the it already passes basic tests with the chip reference and the loopback after less than 3 hours of redesign work!
- The TX meets timing but there is still some work to do with wait pushback testing.
2015-11-24 01:12:07 -05:00

134 lines
4.4 KiB
Verilog

module erx_fifo (/*AUTOARG*/
// Outputs
rxwr_access, rxwr_packet, rxrd_access, rxrd_packet, rxrr_access,
rxrr_packet, rxrd_fifo_wait, rxrr_fifo_wait, rxwr_fifo_wait,
// Inputs
sys_clk, rx_lclk_div4, erx_nreset, rxwr_wait, rxrd_wait, rxrr_wait,
rxrd_fifo_access, rxrd_fifo_packet, rxrr_fifo_access,
rxrr_fifo_packet, rxwr_fifo_access, rxwr_fifo_packet
);
parameter AW = 32;
parameter DW = 32;
parameter PW = 104;
parameter RFAW = 6;
//reset & clocks
input sys_clk;
input rx_lclk_div4;
input erx_nreset; //keep in reset longer
//WR to AXI master
output rxwr_access;
output [PW-1:0] rxwr_packet;
input rxwr_wait;
//RD to AXI master
output rxrd_access;
output [PW-1:0] rxrd_packet;
input rxrd_wait;
//RR to AXI slave
output rxrr_access;
output [PW-1:0] rxrr_packet;
input rxrr_wait;
//RD from IO
input rxrd_fifo_access; // To rxrd_fifo of fifo_cdc.v
input [PW-1:0] rxrd_fifo_packet; // To rxrd_fifo of fifo_cdc.v
output rxrd_fifo_wait; // From rxrd_fifo of fifo_cdc.v
//RR from IO
input rxrr_fifo_access; // To rxrr_fifo of fifo_cdc.v
input [PW-1:0] rxrr_fifo_packet; // To rxrr_fifo of fifo_cdc.v
output rxrr_fifo_wait; // From rxrr_fifo of fifo_cdc.v
//WR from IO
input rxwr_fifo_access; // To rxwr_fifo of fifo_cdc.v
input [PW-1:0] rxwr_fifo_packet; // To rxwr_fifo of fifo_cdc.v
output rxwr_fifo_wait; // From rxwr_fifo of fifo_cdc.v
/*AUTOOUTPUT*/
/*AUTOINPUT*/
/*AUTOWIRE*/
/************************************************************/
/*FIFOs */
/*(for AXI 1. read request, 2. write, and 3. read response) */
/************************************************************/
/*fifo_cdc AUTO_TEMPLATE (
// Outputs
.packet_out (@"(substring vl-cell-name 0 4)"_packet[PW-1:0]),
.access_out (@"(substring vl-cell-name 0 4)"_access),
.wait_out (@"(substring vl-cell-name 0 4)"_fifo_wait),
// Inputs
.clk_out (sys_clk),
.clk_in (rx_lclk_div4),
.access_in (@"(substring vl-cell-name 0 4)"_fifo_access),
.wait_in (@"(substring vl-cell-name 0 4)"_wait),
.nreset (erx_nreset),
.packet_in (@"(substring vl-cell-name 0 4)"_fifo_packet[PW-1:0]),
);
*/
//Read request fifo (from Epiphany)
fifo_cdc #(.DW(104), .DEPTH(32))
rxrd_fifo (
/*AUTOINST*/
// Outputs
.wait_out (rxrd_fifo_wait), // Templated
.access_out (rxrd_access), // Templated
.packet_out (rxrd_packet[PW-1:0]), // Templated
// Inputs
.nreset (erx_nreset), // Templated
.clk_in (rx_lclk_div4), // Templated
.access_in (rxrd_fifo_access), // Templated
.packet_in (rxrd_fifo_packet[PW-1:0]), // Templated
.clk_out (sys_clk), // Templated
.wait_in (rxrd_wait)); // Templated
//Write fifo (from Epiphany)
fifo_cdc #(.DW(104), .DEPTH(32))
rxwr_fifo(
/*AUTOINST*/
// Outputs
.wait_out (rxwr_fifo_wait), // Templated
.access_out (rxwr_access), // Templated
.packet_out (rxwr_packet[PW-1:0]), // Templated
// Inputs
.nreset (erx_nreset), // Templated
.clk_in (rx_lclk_div4), // Templated
.access_in (rxwr_fifo_access), // Templated
.packet_in (rxwr_fifo_packet[PW-1:0]), // Templated
.clk_out (sys_clk), // Templated
.wait_in (rxwr_wait)); // Templated
//Read response fifo (for host)
fifo_cdc #(.DW(104), .DEPTH(32))
rxrr_fifo(
/*AUTOINST*/
// Outputs
.wait_out (rxrr_fifo_wait), // Templated
.access_out (rxrr_access), // Templated
.packet_out (rxrr_packet[PW-1:0]), // Templated
// Inputs
.nreset (erx_nreset), // Templated
.clk_in (rx_lclk_div4), // Templated
.access_in (rxrr_fifo_access), // Templated
.packet_in (rxrr_fifo_packet[PW-1:0]), // Templated
.clk_out (sys_clk), // Templated
.wait_in (rxrr_wait)); // Templated
endmodule // erx
// Local Variables:
// verilog-library-directories:("." "../../emmu/hdl" "../../edma/hdl" "../../memory/hdl" "../../emailbox/hdl")
// End: