2016-02-26 19:08:40 -05:00
|
|
|
//############################################################
|
|
|
|
//#This block handles the autoincrement needed for bursting
|
|
|
|
//############################################################
|
2014-12-14 17:18:53 -05:00
|
|
|
module erx_protocol (/*AUTOARG*/
|
|
|
|
// Outputs
|
2015-11-29 19:07:28 -05:00
|
|
|
erx_access, erx_packet,
|
2014-12-14 17:18:53 -05:00
|
|
|
// Inputs
|
2015-10-08 10:34:59 -04:00
|
|
|
clk, test_mode, rx_packet, rx_burst, rx_access
|
2014-12-14 17:18:53 -05:00
|
|
|
);
|
|
|
|
|
2015-04-28 16:58:05 -04:00
|
|
|
parameter AW = 32;
|
|
|
|
parameter DW = 32;
|
|
|
|
parameter PW = 104;
|
2015-11-12 00:58:06 -05:00
|
|
|
parameter ID = 12'h999; //link id
|
2015-04-23 17:59:36 -04:00
|
|
|
|
2014-12-14 17:18:53 -05:00
|
|
|
// System reset input
|
2015-10-07 19:12:57 -04:00
|
|
|
input clk;
|
2015-10-07 21:58:50 -04:00
|
|
|
|
|
|
|
//test mode
|
|
|
|
input test_mode; //block all traffic in test mode
|
|
|
|
|
2014-12-14 17:18:53 -05:00
|
|
|
// Parallel interface, 8 eLink bytes at a time
|
2015-10-07 19:12:57 -04:00
|
|
|
|
2015-05-13 23:27:35 -04:00
|
|
|
input [PW-1:0] rx_packet;
|
|
|
|
input rx_burst;
|
|
|
|
input rx_access;
|
2014-12-14 17:18:53 -05:00
|
|
|
|
|
|
|
// Output to MMU / filter
|
2015-11-29 19:07:28 -05:00
|
|
|
output erx_access;
|
2015-04-23 17:59:36 -04:00
|
|
|
output [PW-1:0] erx_packet;
|
2014-12-14 17:18:53 -05:00
|
|
|
|
2015-08-14 15:37:37 -04:00
|
|
|
//wires
|
2015-05-18 15:38:30 -04:00
|
|
|
reg [31:0] dstaddr_reg;
|
|
|
|
wire [31:0] dstaddr_next;
|
|
|
|
wire [31:0] dstaddr_mux;
|
2015-11-29 19:07:28 -05:00
|
|
|
reg erx_access;
|
2015-05-18 15:38:30 -04:00
|
|
|
reg [PW-1:0] erx_packet;
|
2015-08-14 15:37:37 -04:00
|
|
|
wire [31:0] rx_addr;
|
2015-10-07 21:58:50 -04:00
|
|
|
|
2015-08-14 15:37:37 -04:00
|
|
|
//parsing inputs
|
|
|
|
assign rx_addr[31:0] = rx_packet[39:8];
|
2014-12-14 17:18:53 -05:00
|
|
|
|
2015-05-18 15:38:30 -04:00
|
|
|
//Address generator for bursting
|
|
|
|
always @ (posedge clk)
|
|
|
|
if(rx_access)
|
2015-10-07 21:58:50 -04:00
|
|
|
dstaddr_reg[31:0] <= dstaddr_mux[31:0];
|
2015-03-24 20:44:03 -04:00
|
|
|
|
2015-05-18 15:38:30 -04:00
|
|
|
assign dstaddr_next[31:0] = dstaddr_reg[31:0] + 4'b1000;
|
|
|
|
|
2015-10-07 21:58:50 -04:00
|
|
|
assign dstaddr_mux[31:0] = rx_burst ? dstaddr_next[31:0] :
|
2016-01-19 23:34:56 -05:00
|
|
|
rx_addr[31:0];
|
2015-11-29 19:07:28 -05:00
|
|
|
|
2015-08-14 15:37:37 -04:00
|
|
|
//Pipeline stage and decode
|
2015-11-02 20:51:35 -05:00
|
|
|
|
2015-10-08 10:34:59 -04:00
|
|
|
always @ (posedge clk)
|
|
|
|
begin
|
2015-10-07 21:58:50 -04:00
|
|
|
//Write/read request
|
2015-11-29 19:07:28 -05:00
|
|
|
erx_access <= ~test_mode & rx_access;
|
2015-10-07 21:58:50 -04:00
|
|
|
//Common packet
|
|
|
|
erx_packet[PW-1:0] <= {rx_packet[PW-1:40],
|
|
|
|
dstaddr_mux[31:0],
|
2015-11-02 20:51:35 -05:00
|
|
|
{1'b0,rx_packet[7:1]} //NOTE: remvoing redundant access packet bit
|
|
|
|
}; //This is to conform to new format
|
2015-05-18 15:38:30 -04:00
|
|
|
end
|
2015-10-07 21:58:50 -04:00
|
|
|
|
2015-04-23 17:59:36 -04:00
|
|
|
endmodule // erx_protocol
|
|
|
|
// Local Variables:
|
|
|
|
// verilog-library-directories:("." "../../common/hdl")
|
|
|
|
// End:
|
|
|
|
|