Line 39... |
Line 39... |
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//
|
//
|
// CVS Revision History
|
// CVS Revision History
|
//
|
//
|
// $Log: not supported by cvs2svn $
|
// $Log: not supported by cvs2svn $
|
|
// Revision 1.22 2002/04/24 08:52:19 mohor
|
|
// Compiler directives added. Tx and Rx fifo size incremented. A "late collision"
|
|
// bug fixed.
|
|
//
|
// Revision 1.21 2002/03/29 16:18:11 lampret
|
// Revision 1.21 2002/03/29 16:18:11 lampret
|
// Small typo fixed.
|
// Small typo fixed.
|
//
|
//
|
// Revision 1.20 2002/03/25 16:19:12 mohor
|
// Revision 1.20 2002/03/25 16:19:12 mohor
|
// Any address can be used for Tx and Rx BD pointers. Address does not need
|
// Any address can be used for Tx and Rx BD pointers. Address does not need
|
Line 360... |
Line 364... |
wire [7:0] TempRxBDAddress;
|
wire [7:0] TempRxBDAddress;
|
|
|
wire SetGotData;
|
wire SetGotData;
|
wire GotDataEvaluate;
|
wire GotDataEvaluate;
|
|
|
reg temp_ack;
|
reg WB_ACK_O;
|
|
|
wire [6:0] RxStatusIn;
|
wire [6:0] RxStatusIn;
|
reg [6:0] RxStatusInLatched;
|
reg [6:0] RxStatusInLatched;
|
|
|
`ifdef ETH_REGISTERED_OUTPUTS
|
|
reg temp_ack2;
|
|
reg [31:0] registered_ram_do;
|
|
`endif
|
|
|
|
reg WbEn, WbEn_q;
|
reg WbEn, WbEn_q;
|
reg RxEn, RxEn_q;
|
reg RxEn, RxEn_q;
|
reg TxEn, TxEn_q;
|
reg TxEn, TxEn_q;
|
|
|
wire ram_ce;
|
wire ram_ce;
|
Line 394... |
Line 393... |
|
|
always @ (posedge WB_CLK_I or posedge Reset)
|
always @ (posedge WB_CLK_I or posedge Reset)
|
begin
|
begin
|
if(Reset)
|
if(Reset)
|
begin
|
begin
|
temp_ack <=#Tp 1'b0;
|
WB_ACK_O <=#Tp 1'b0;
|
`ifdef ETH_REGISTERED_OUTPUTS
|
|
temp_ack2 <=#Tp 1'b0;
|
|
registered_ram_do <=#Tp 32'h0;
|
|
`endif
|
|
end
|
end
|
else
|
else
|
begin
|
begin
|
temp_ack <=#Tp BDWrite & WbEn & WbEn_q | BDRead & WbEn & ~WbEn_q;
|
WB_ACK_O <=#Tp BDWrite & WbEn & WbEn_q | BDRead & WbEn & ~WbEn_q;
|
`ifdef ETH_REGISTERED_OUTPUTS
|
|
temp_ack2 <=#Tp temp_ack;
|
|
registered_ram_do <=#Tp ram_do;
|
|
`endif
|
|
end
|
end
|
end
|
end
|
|
|
`ifdef ETH_REGISTERED_OUTPUTS
|
|
assign WB_ACK_O = temp_ack2;
|
|
assign WB_DAT_O = registered_ram_do;
|
|
`else
|
|
assign WB_ACK_O = temp_ack;
|
|
assign WB_DAT_O = ram_do;
|
assign WB_DAT_O = ram_do;
|
`endif
|
|
|
|
|
|
// Generic synchronous single-port RAM interface
|
// Generic synchronous single-port RAM interface
|
generic_spram #(8, 32) ram (
|
generic_spram #(8, 32) ram (
|
// Generic synchronous single-port RAM interface
|
// Generic synchronous single-port RAM interface
|
.clk(WB_CLK_I), .rst(Reset), .ce(ram_ce), .we(ram_we), .oe(ram_oe), .addr(ram_addr), .di(ram_di), .do(ram_do)
|
.clk(WB_CLK_I), .rst(Reset), .ce(ram_ce), .we(ram_we), .oe(ram_oe), .addr(ram_addr), .di(ram_di), .do(ram_do)
|
Line 442... |
Line 426... |
else
|
else
|
if(TxPointerRead & TxEn & TxEn_q)
|
if(TxPointerRead & TxEn & TxEn_q)
|
TxEn_needed <=#Tp 1'b0;
|
TxEn_needed <=#Tp 1'b0;
|
end
|
end
|
|
|
|
reg [3:0] stm_status;
|
// Enabling access to the RAM for three devices.
|
// Enabling access to the RAM for three devices.
|
always @ (posedge WB_CLK_I or posedge Reset)
|
always @ (posedge WB_CLK_I or posedge Reset)
|
begin
|
begin
|
if(Reset)
|
if(Reset)
|
begin
|
begin
|
Line 455... |
Line 439... |
TxEn <=#Tp 1'b0;
|
TxEn <=#Tp 1'b0;
|
ram_addr <=#Tp 8'h0;
|
ram_addr <=#Tp 8'h0;
|
ram_di <=#Tp 32'h0;
|
ram_di <=#Tp 32'h0;
|
BDRead <=#Tp 1'b0;
|
BDRead <=#Tp 1'b0;
|
BDWrite <=#Tp 1'b0;
|
BDWrite <=#Tp 1'b0;
|
|
stm_status <=#Tp 4'h0;
|
end
|
end
|
else
|
else
|
begin
|
begin
|
// Switching between three stages depends on enable signals
|
// Switching between three stages depends on enable signals
|
case ({WbEn_q, RxEn_q, TxEn_q, RxEn_needed, TxEn_needed}) // synopsys parallel_case
|
case ({WbEn_q, RxEn_q, TxEn_q, RxEn_needed, TxEn_needed}) // synopsys parallel_case
|
5'b100_10, 5'b100_11 :
|
5'b100_10, 5'b100_11 :
|
begin
|
begin
|
|
stm_status <=#Tp 4'h1;
|
WbEn <=#Tp 1'b0;
|
WbEn <=#Tp 1'b0;
|
RxEn <=#Tp 1'b1; // wb access stage and r_RxEn is enabled
|
RxEn <=#Tp 1'b1; // wb access stage and r_RxEn is enabled
|
TxEn <=#Tp 1'b0;
|
TxEn <=#Tp 1'b0;
|
ram_addr <=#Tp RxBDAddress + RxPointerRead;
|
ram_addr <=#Tp RxBDAddress + RxPointerRead;
|
ram_di <=#Tp RxBDDataIn;
|
ram_di <=#Tp RxBDDataIn;
|
end
|
end
|
5'b100_01 :
|
5'b100_01 :
|
begin
|
begin
|
|
stm_status <=#Tp 4'h2;
|
WbEn <=#Tp 1'b0;
|
WbEn <=#Tp 1'b0;
|
RxEn <=#Tp 1'b0;
|
RxEn <=#Tp 1'b0;
|
TxEn <=#Tp 1'b1; // wb access stage, r_RxEn is disabled but r_TxEn is enabled
|
TxEn <=#Tp 1'b1; // wb access stage, r_RxEn is disabled but r_TxEn is enabled
|
ram_addr <=#Tp TxBDAddress + TxPointerRead;
|
ram_addr <=#Tp TxBDAddress + TxPointerRead;
|
ram_di <=#Tp TxBDDataIn;
|
ram_di <=#Tp TxBDDataIn;
|
end
|
end
|
5'b010_00, 5'b010_10 :
|
5'b010_00, 5'b010_10 :
|
begin
|
begin
|
|
stm_status <=#Tp 4'h3;
|
WbEn <=#Tp 1'b1; // RxEn access stage and r_TxEn is disabled
|
WbEn <=#Tp 1'b1; // RxEn access stage and r_TxEn is disabled
|
RxEn <=#Tp 1'b0;
|
RxEn <=#Tp 1'b0;
|
TxEn <=#Tp 1'b0;
|
TxEn <=#Tp 1'b0;
|
ram_addr <=#Tp WB_ADR_I[9:2];
|
ram_addr <=#Tp WB_ADR_I[9:2];
|
ram_di <=#Tp WB_DAT_I;
|
ram_di <=#Tp WB_DAT_I;
|
BDWrite <=#Tp BDCs & WB_WE_I;
|
BDWrite <=#Tp BDCs & WB_WE_I;
|
BDRead <=#Tp BDCs & ~WB_WE_I;
|
BDRead <=#Tp BDCs & ~WB_WE_I;
|
end
|
end
|
5'b010_01, 5'b010_11 :
|
5'b010_01, 5'b010_11 :
|
begin
|
begin
|
|
stm_status <=#Tp 4'h4;
|
WbEn <=#Tp 1'b0;
|
WbEn <=#Tp 1'b0;
|
RxEn <=#Tp 1'b0;
|
RxEn <=#Tp 1'b0;
|
TxEn <=#Tp 1'b1; // RxEn access stage and r_TxEn is enabled
|
TxEn <=#Tp 1'b1; // RxEn access stage and r_TxEn is enabled
|
ram_addr <=#Tp TxBDAddress + TxPointerRead;
|
ram_addr <=#Tp TxBDAddress + TxPointerRead;
|
ram_di <=#Tp TxBDDataIn;
|
ram_di <=#Tp TxBDDataIn;
|
end
|
end
|
5'b001_00, 5'b001_01, 5'b001_10, 5'b001_11 :
|
5'b001_00, 5'b001_01, 5'b001_10, 5'b001_11 :
|
begin
|
begin
|
|
stm_status <=#Tp 4'h5;
|
WbEn <=#Tp 1'b1; // TxEn access stage (we always go to wb access stage)
|
WbEn <=#Tp 1'b1; // TxEn access stage (we always go to wb access stage)
|
RxEn <=#Tp 1'b0;
|
RxEn <=#Tp 1'b0;
|
TxEn <=#Tp 1'b0;
|
TxEn <=#Tp 1'b0;
|
ram_addr <=#Tp WB_ADR_I[9:2];
|
ram_addr <=#Tp WB_ADR_I[9:2];
|
ram_di <=#Tp WB_DAT_I;
|
ram_di <=#Tp WB_DAT_I;
|
BDWrite <=#Tp BDCs & WB_WE_I;
|
BDWrite <=#Tp BDCs & WB_WE_I;
|
BDRead <=#Tp BDCs & ~WB_WE_I;
|
BDRead <=#Tp BDCs & ~WB_WE_I;
|
end
|
end
|
5'b100_00 :
|
5'b100_00 :
|
begin
|
begin
|
|
stm_status <=#Tp 4'h6;
|
WbEn <=#Tp 1'b0; // WbEn access stage and there is no need for other stages. WbEn needs to be switched off for a bit
|
WbEn <=#Tp 1'b0; // WbEn access stage and there is no need for other stages. WbEn needs to be switched off for a bit
|
end
|
end
|
5'b000_00 :
|
5'b000_00 :
|
begin
|
begin
|
|
stm_status <=#Tp 4'h7;
|
WbEn <=#Tp 1'b1; // Idle state. We go to WbEn access stage.
|
WbEn <=#Tp 1'b1; // Idle state. We go to WbEn access stage.
|
RxEn <=#Tp 1'b0;
|
RxEn <=#Tp 1'b0;
|
TxEn <=#Tp 1'b0;
|
TxEn <=#Tp 1'b0;
|
ram_addr <=#Tp WB_ADR_I[9:2];
|
ram_addr <=#Tp WB_ADR_I[9:2];
|
ram_di <=#Tp WB_DAT_I;
|
ram_di <=#Tp WB_DAT_I;
|