1
0
mirror of https://github.com/aolofsson/oh.git synced 2025-01-17 20:02:53 +08:00
oh/elink/hdl/etx_remap.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

75 lines
1.9 KiB
Verilog

module etx_remap (/*AUTOARG*/
// Outputs
emesh_access_out, emesh_packet_out,
// Inputs
clk, emesh_access_in, emesh_packet_in, remap_en, remap_bypass,
etx_rd_wait, etx_wr_wait
);
parameter AW = 32;
parameter DW = 32;
parameter PW = 104;
//Clock
input clk;
//Input from arbiter
input emesh_access_in;
input [PW-1:0] emesh_packet_in;
input remap_en; //enable tx remap (static)
input remap_bypass; //dynamic control (read request)
//Output to TX IO
output emesh_access_out;
output [PW-1:0] emesh_packet_out;
//Wait signals from protocol block
input etx_rd_wait;
input etx_wr_wait;
wire [31:0] addr_in;
wire [31:0] addr_remap;
wire [31:0] addr_out;
wire write_in;
reg emesh_access_out;
reg [PW-1:0] emesh_packet_out;
packet2emesh p2e (// Outputs
.write_out (write_in),
.datamode_out (),
.ctrlmode_out (),
.data_out (),
.dstaddr_out (addr_in[31:0]),
.srcaddr_out (),
// Inputs
.packet_in (emesh_packet_in[PW-1:0]));
assign addr_remap[31:0] = {addr_in[29:18],//ID
addr_in[17:16],//SPECIAL GROUP
{(2){(|addr_in[17:16])}},//ZERO IF NOT SPECIAL
addr_in[15:0]
};
assign addr_out[31:0] = (remap_en & ~remap_bypass) ? addr_remap[31:0] :
addr_in[31:0];
//stall read/write access appropriately
always @ (posedge clk)
if(~(etx_wr_wait | etx_rd_wait))
begin
emesh_access_out <= emesh_access_in;
emesh_packet_out[PW-1:0] <= {emesh_packet_in[PW-1:40],
addr_out[31:0],
emesh_packet_in[7:0]
};
end
endmodule // etx_remap
// Local Variables:
// verilog-library-directories:("." "../../emesh/hdl")
// End: