Line 13... |
Line 13... |
//// All additional information is avaliable in the README.txt ////
|
//// All additional information is avaliable in the README.txt ////
|
//// file. ////
|
//// file. ////
|
//// ////
|
//// ////
|
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//// ////
|
//// ////
|
//// Copyright (C) 2000 - 2003 Authors ////
|
//// Copyright (C) 2000 - 2004 Authors ////
|
//// ////
|
//// ////
|
//// This source file may be used and distributed without ////
|
//// This source file may be used and distributed without ////
|
//// restriction provided that this copyright statement is not ////
|
//// restriction provided that this copyright statement is not ////
|
//// removed from the file and that any derivative work contains ////
|
//// removed from the file and that any derivative work contains ////
|
//// the original copyright notice and the associated disclaimer. ////
|
//// the original copyright notice and the associated disclaimer. ////
|
Line 41... |
Line 41... |
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//
|
//
|
// CVS Revision History
|
// CVS Revision History
|
//
|
//
|
// $Log: not supported by cvs2svn $
|
// $Log: not supported by cvs2svn $
|
|
// Revision 1.18 2004/01/25 14:04:18 mohor
|
|
// All flipflops are reset.
|
|
//
|
// Revision 1.17 2004/01/22 13:58:53 mohor
|
// Revision 1.17 2004/01/22 13:58:53 mohor
|
// Port signals are all set to zero after reset.
|
// Port signals are all set to zero after reset.
|
//
|
//
|
// Revision 1.16 2004/01/19 07:32:41 simons
|
// Revision 1.16 2004/01/19 07:32:41 simons
|
// Reset values width added because of FV, a good sentence changed because some tools can not handle it.
|
// Reset values width added because of FV, a good sentence changed because some tools can not handle it.
|
Line 169... |
Line 172... |
reg tdo_o;
|
reg tdo_o;
|
|
|
reg [50:0] dr;
|
reg [50:0] dr;
|
wire enable;
|
wire enable;
|
wire cmd_cnt_en;
|
wire cmd_cnt_en;
|
reg [1:0] cmd_cnt;
|
reg [`DBG_WB_CMD_CNT_WIDTH -1:0] cmd_cnt;
|
wire cmd_cnt_end;
|
wire cmd_cnt_end;
|
reg cmd_cnt_end_q;
|
reg cmd_cnt_end_q;
|
wire addr_len_cnt_en;
|
wire addr_len_cnt_en;
|
reg [5:0] addr_len_cnt;
|
reg [5:0] addr_len_cnt;
|
reg [5:0] addr_len_cnt_limit;
|
reg [5:0] addr_len_cnt_limit;
|
Line 221... |
Line 224... |
reg cmd_write;
|
reg cmd_write;
|
reg cmd_go;
|
reg cmd_go;
|
|
|
reg status_cnt1, status_cnt2, status_cnt3, status_cnt4;
|
reg status_cnt1, status_cnt2, status_cnt3, status_cnt4;
|
|
|
reg [`STATUS_LEN -1:0] status;
|
reg [`DBG_WB_STATUS_LEN -1:0] status;
|
|
|
reg wb_error, wb_error_sync, wb_error_tck;
|
reg wb_error, wb_error_sync, wb_error_tck;
|
reg wb_overrun, wb_overrun_sync, wb_overrun_tck;
|
reg wb_overrun, wb_overrun_sync, wb_overrun_tck;
|
reg underrun_tck;
|
reg underrun_tck;
|
|
|
Line 354... |
Line 357... |
|
|
// Command counter
|
// Command counter
|
always @ (posedge tck_i or posedge rst_i)
|
always @ (posedge tck_i or posedge rst_i)
|
begin
|
begin
|
if (rst_i)
|
if (rst_i)
|
cmd_cnt <= #1 2'h0;
|
cmd_cnt <= #1 {`DBG_WB_CMD_CNT_WIDTH{1'b0}};
|
else if (update_dr_i)
|
else if (update_dr_i)
|
cmd_cnt <= #1 2'h0;
|
cmd_cnt <= #1 {`DBG_WB_CMD_CNT_WIDTH{1'b0}};
|
else if (cmd_cnt_en)
|
else if (cmd_cnt_en)
|
cmd_cnt <= #1 cmd_cnt + 1'b1;
|
cmd_cnt <= #1 cmd_cnt + 1'b1;
|
end
|
end
|
|
|
|
|
Line 458... |
Line 461... |
// Upper limit. Address/length counter counts until this value is reached
|
// Upper limit. Address/length counter counts until this value is reached
|
always @ (posedge tck_i or posedge rst_i)
|
always @ (posedge tck_i or posedge rst_i)
|
begin
|
begin
|
if (rst_i)
|
if (rst_i)
|
addr_len_cnt_limit <= #1 6'd0;
|
addr_len_cnt_limit <= #1 6'd0;
|
else if (cmd_cnt == 2'h2)
|
else if (cmd_cnt == `DBG_WB_CMD_CNT_WIDTH'h2)
|
begin
|
begin
|
if ((~dr[0]) & (~tdi_i)) // (current command is WB_STATUS or WB_GO)
|
if ((~dr[0]) & (~tdi_i)) // (current command is WB_STATUS or WB_GO)
|
addr_len_cnt_limit <= #1 6'd0;
|
addr_len_cnt_limit <= #1 6'd0;
|
else // (current command is WB_WRITEx or WB_READx)
|
else // (current command is WB_WRITEx or WB_READx)
|
addr_len_cnt_limit <= #1 6'd48;
|
addr_len_cnt_limit <= #1 6'd48;
|
Line 495... |
Line 498... |
crc_cnt <= #1 crc_cnt + 1'b1;
|
crc_cnt <= #1 crc_cnt + 1'b1;
|
else if (update_dr_i)
|
else if (update_dr_i)
|
crc_cnt <= #1 6'h0;
|
crc_cnt <= #1 6'h0;
|
end
|
end
|
|
|
assign cmd_cnt_end = cmd_cnt == 2'h3;
|
assign cmd_cnt_end = cmd_cnt == `DBG_WB_CMD_LEN;
|
assign addr_len_cnt_end = addr_len_cnt == addr_len_cnt_limit;
|
assign addr_len_cnt_end = addr_len_cnt == addr_len_cnt_limit;
|
assign crc_cnt_end = crc_cnt == 6'd32;
|
assign crc_cnt_end = crc_cnt == 6'd32;
|
assign crc_cnt_31 = crc_cnt == 6'd31;
|
assign crc_cnt_31 = crc_cnt == 6'd31;
|
assign data_cnt_end = (data_cnt == data_cnt_limit);
|
assign data_cnt_end = (data_cnt == data_cnt_limit);
|
|
|
Line 563... |
Line 566... |
// Status register
|
// Status register
|
always @ (posedge tck_i or posedge rst_i)
|
always @ (posedge tck_i or posedge rst_i)
|
begin
|
begin
|
if (rst_i)
|
if (rst_i)
|
begin
|
begin
|
status <= #1 {`STATUS_LEN{1'b0}};
|
status <= #1 {`DBG_WB_STATUS_LEN{1'b0}};
|
end
|
end
|
else if(crc_cnt_end & (~crc_cnt_end_q) & (~read_cycle))
|
else if(crc_cnt_end & (~crc_cnt_end_q) & (~read_cycle))
|
begin
|
begin
|
status <= #1 {crc_match_i, wb_error_tck, wb_overrun_tck, busy_tck};
|
status <= #1 {crc_match_i, wb_error_tck, wb_overrun_tck, busy_tck};
|
end
|
end
|
Line 575... |
Line 578... |
begin
|
begin
|
status <= #1 {crc_match_reg, wb_error_tck, underrun_tck, busy_tck};
|
status <= #1 {crc_match_reg, wb_error_tck, underrun_tck, busy_tck};
|
end
|
end
|
else if (shift_dr_i & (~status_cnt_end))
|
else if (shift_dr_i & (~status_cnt_end))
|
begin
|
begin
|
status <= #1 {status[0], status[`STATUS_LEN -1:1]};
|
status <= #1 {status[0], status[`DBG_WB_STATUS_LEN -1:1]};
|
end
|
end
|
end
|
end
|
// Following status is shifted out:
|
// Following status is shifted out:
|
// 1. bit: 1 if crc is OK, else 0
|
// 1. bit: 1 if crc is OK, else 0
|
// 2. bit: 1 while WB access is in progress (busy_tck), else 0
|
// 2. bit: 1 while WB access is in progress (busy_tck), else 0
|