1
0
mirror of https://github.com/aolofsson/oh.git synced 2025-01-30 02:32:53 +08:00

Fixed burst tail bug

- Clearing the "done" register with tx_burst. Kind of makes sense logically since while we are in burst mode we are not done.
- Still not 100% happy with this circuit, but there arent' a lot of lines of code left...
- But elink now passes 500 random burst transactions!!!
This commit is contained in:
Andreas Olofsson 2015-11-17 16:51:19 -05:00
parent 5698302e05
commit 673fba168d
4 changed files with 55 additions and 60 deletions

View File

@ -13,15 +13,14 @@ module erx_clocks (/*AUTOARG*/
`endif
//Frequency Settings (Mhz)
parameter FREQ_SYSCLK = 100;
parameter FREQ_RXCLK = 300;
parameter FREQ_RXCLK = 200;
parameter FREQ_IDELAY = 200;
parameter RXCLK_PHASE = 0; //270; //-90 deg rxclk phase shift
parameter PLL_VCO_MULT = 4; //RX
//Don't touch these! (derived parameters)
localparam real RXCLK_PERIOD = 1000.000000/FREQ_RXCLK;
localparam integer IREF_DIVIDE = PLL_VCO_MULT * FREQ_RXCLK/FREQ_IDELAY;
localparam real RXCLK_PERIOD = 1000.000000 / FREQ_RXCLK;
localparam integer IREF_DIVIDE = PLL_VCO_MULT * FREQ_RXCLK / FREQ_IDELAY;
localparam integer RXCLK_DIVIDE = PLL_VCO_MULT; //1:1
//Input clock, reset, config interface
@ -42,8 +41,7 @@ module erx_clocks (/*AUTOARG*/
output rx_active; // rx active
output erx_nreset; // reset for rx core logic
output erx_io_nreset; // io reset (synced to high speed clock)
//############
//# WIRES
//############
@ -83,15 +81,13 @@ module erx_clocks (/*AUTOARG*/
reset_counter[RCW-1:0] <= reset_counter[RCW-1:0]+1'b1;
heartbeat <= ~(|reset_counter[RCW-1:0]);
end
`define RX_RESET_ALL 3'b000
`define RX_START_PLL 3'b001
`define RX_ACTIVE 3'b010
//Reset sequence state machine
always @ (posedge sys_clk or negedge rx_nreset_in)
if(!rx_nreset_in)
reset_state[2:0] <= `RX_RESET_ALL;

View File

@ -15,14 +15,14 @@ module etx_clocks (/*AUTOARG*/
//Frequency Settings (Mhz)
parameter FREQ_SYSCLK = 100;
parameter FREQ_TXCLK = 300;
parameter FREQ_CCLK = 600;
parameter FREQ_TXCLK = 100;
parameter FREQ_CCLK = 400;
parameter TXCLK_PHASE = 90; //txclk phase shift
//Don't touch these! (derived parameters)
localparam real SYSCLK_PERIOD = 1000.000000/FREQ_SYSCLK;
localparam integer TXCLK_DIVIDE = MMCM_VCO_MULT*FREQ_SYSCLK/FREQ_TXCLK;
localparam integer CCLK_DIVIDE = MMCM_VCO_MULT*FREQ_SYSCLK/FREQ_CCLK;
localparam real SYSCLK_PERIOD = 1000.000000 / FREQ_SYSCLK;
localparam integer TXCLK_DIVIDE = MMCM_VCO_MULT * FREQ_SYSCLK / FREQ_TXCLK;
localparam integer CCLK_DIVIDE = MMCM_VCO_MULT * FREQ_SYSCLK / FREQ_CCLK;
//VCO multiplers
parameter MMCM_VCO_MULT = 12; //TX + CCLK

View File

@ -64,7 +64,6 @@ module etx_io (/*AUTOARG*/
wire txo_lclk90;
wire tx_new_frame;
wire tx_lclk90_ddr;
wire tx_wr_wait_async;
wire tx_rd_wait_async;
wire firstedge;
@ -101,12 +100,6 @@ module etx_io (/*AUTOARG*/
if(firstedge & ~tx_wait & ~(~tx_burst_reg & tx_state[2:0]==`CYCLE3))
tx_packet_reg[PW-1:0] <= tx_packet[PW-1:0];
//#########################################
//# Transmit state machine
//#########################################
//decode incoming packet
packet2emesh p2e_reg (
.write_out (write),
@ -116,9 +109,10 @@ module etx_io (/*AUTOARG*/
.data_out (data[31:0]),
.srcaddr_out (srcaddr[31:0]),
.packet_in (tx_packet_reg[PW-1:0]));
assign tx_new_frame = (tx_state[2:0]==`CYCLE1);
//#########################################
//# Transmit state machine
//#########################################
always @ (posedge tx_lclk_io)
if(!nreset)
@ -132,13 +126,16 @@ module etx_io (/*AUTOARG*/
`CYCLE4 : tx_state[2:0] <= `CYCLE5;
`CYCLE5 : tx_state[2:0] <= `CYCLE6;
`CYCLE6 : tx_state[2:0] <= `CYCLE7;
`CYCLE7 : tx_state[2:0] <= tx_burst_reg & ~tx_wait ? `CYCLE4 :
`IDLE;
//NOTE: Burst jumps into middle of state, except for on end of burst
`CYCLE7 : tx_state[2:0] <= (tx_burst_reg & tx_burst) & ~tx_wait ? `CYCLE4 :
`IDLE;
endcase // case (tx_state)
assign tx_new_frame = (tx_state[2:0]==`CYCLE1);
reg [31:0] trans_counter;
//A transaction counter for debugging, might be nice to put this in hardware, but then it should go in div4 domain
`ifdef TARGET_SIM
reg [31:0] trans_counter;
always @ (posedge tx_lclk_io)
if(!nreset)
trans_counter[31:0]<='b0;

View File

@ -86,31 +86,8 @@ module etx_protocol (/*AUTOARG*/
//Clear out the access while in wait state
//the IO pipeline flushes out
assign tx_access = tx_access_reg &
// ~burst_negedge &
~(tx_wr_wait | tx_rd_wait);
//#################################
//# Checking for transaction "done"
//#################################
//if burst, you get immediate "ack"
//otherwise you get ack in one cycle
reg done;
wire tx_io_wait;
always @ (posedge clk or negedge nreset)
if(!nreset)
done <= 1'b0;
else
done <= tx_access & ~done;
assign tx_io_wait = tx_access & ~done & ~tx_burst;//tx_burst_reg
assign adjust = tx_io_wait_reg & (tx_rd_wait | tx_wr_wait);
//#############################
//# Burst Detection
//#############################
packet2emesh p2m1 (
.write_out (tx_write),
.datamode_out (tx_datamode[1:0]),
@ -119,7 +96,33 @@ module etx_protocol (/*AUTOARG*/
.data_out (),
.srcaddr_out (),
.packet_in (tx_packet[PW-1:0]));//input
//############################################################
//# Checking for transaction "done"
//#############################################################
//if burst, you get immediate "ack"
//otherwise you get ack in one cycle (since it takes 2 clocks for trans to exit IO)
reg done;
wire tx_io_wait;
always @ (posedge clk or negedge nreset)
if(!nreset)
done <= 1'b0;
else
done <= tx_access & ~done & ~tx_burst;
assign tx_io_wait = tx_access & ~done & ~tx_burst;//tx_burst_reg
//Ugly hack. When there is an async wait coming in and we are in the middle of a transction
//we sample in a new value to realign the pipeline since the current transaction already went
//out to the IO.(must be a better way???)
assign adjust = tx_io_wait_reg & (tx_rd_wait | tx_wr_wait);
//#############################
//# Burst Detection
//#############################
assign burst_addr_match = ((tx_dstaddr[31:0]+32'h8) == etx_dstaddr[31:0]);
assign current_match = tx_access &
@ -151,17 +154,16 @@ module etx_protocol (/*AUTOARG*/
end
assign tx_burst = tx_burst_reg &
tx_burst_in &
// tx_burst_in &
~(tx_wr_wait | tx_rd_wait);
assign burst_negedge = ~tx_burst_in &
tx_burst_reg;
//#############################
//# Wait propagation circuit
//#############################
assign etx_wr_wait = (tx_wr_wait | tx_io_wait | burst_negedge) & ~adjust;
assign etx_rd_wait = (tx_rd_wait | tx_io_wait | burst_negedge) & ~adjust;
//#######################################
//# Wait propagation circuit backwards
//########################################
assign etx_wr_wait = (tx_wr_wait | tx_io_wait ) & ~adjust;
assign etx_rd_wait = (tx_rd_wait | tx_io_wait ) & ~adjust;
endmodule // etx_protocol
// Local Variables: