Line 41... |
Line 41... |
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//
|
//
|
// CVS Revision History
|
// CVS Revision History
|
//
|
//
|
// $Log: not supported by cvs2svn $
|
// $Log: not supported by cvs2svn $
|
|
// Revision 1.10 2004/01/13 11:28:14 mohor
|
|
// tmp version.
|
|
//
|
// Revision 1.9 2004/01/10 07:50:24 mohor
|
// Revision 1.9 2004/01/10 07:50:24 mohor
|
// temp version.
|
// temp version.
|
//
|
//
|
// Revision 1.8 2004/01/09 12:48:44 mohor
|
// Revision 1.8 2004/01/09 12:48:44 mohor
|
// tmp version.
|
// tmp version.
|
Line 191... |
Line 194... |
|
|
wire status_cnt_end;
|
wire status_cnt_end;
|
|
|
wire byte, half, long;
|
wire byte, half, long;
|
reg byte_q, half_q, long_q;
|
reg byte_q, half_q, long_q;
|
|
reg byte_q2, half_q2, long_q2;
|
reg cmd_read;
|
reg cmd_read;
|
reg cmd_write;
|
reg cmd_write;
|
reg cmd_go;
|
reg cmd_go;
|
//reg cmd_old_read;
|
//reg cmd_old_read;
|
|
|
Line 216... |
Line 220... |
reg [799:0] TDO_WISHBONE;
|
reg [799:0] TDO_WISHBONE;
|
reg [399:0] latching_data;
|
reg [399:0] latching_data;
|
|
|
reg set_addr, set_addr_sync, set_addr_wb, set_addr_wb_q;
|
reg set_addr, set_addr_sync, set_addr_wb, set_addr_wb_q;
|
reg read_cycle;
|
reg read_cycle;
|
|
reg write_cycle;
|
reg [2:0] read_type;
|
reg [2:0] read_type;
|
wire [31:0] input_data;
|
wire [31:0] input_data;
|
|
|
wire len_eq_0;
|
wire len_eq_0;
|
wire crc_cnt_31;
|
wire crc_cnt_31;
|
Line 302... |
Line 307... |
latching_data = "32 bit shifted";
|
latching_data = "32 bit shifted";
|
end
|
end
|
end
|
end
|
endcase
|
endcase
|
end
|
end
|
else if (enable & ((~addr_len_cnt_end) | (~cmd_cnt_end) | (~data_cnt_end)))
|
// else if (enable & ((~addr_len_cnt_end) | (~cmd_cnt_end) | (~data_cnt_end)))
|
|
else if (enable & ((~addr_len_cnt_end) | (~cmd_cnt_end) | ((~data_cnt_end) & write_cycle)))
|
begin
|
begin
|
dr <= #1 {dr[49:0], tdi_i};
|
dr <= #1 {dr[49:0], tdi_i};
|
latching_data = "tdi shifted in";
|
latching_data = "tdi shifted in";
|
end
|
end
|
|
else
|
|
latching_data = "nothing";
|
end
|
end
|
|
|
|
|
assign cmd_cnt_en = enable & (~cmd_cnt_end);
|
assign cmd_cnt_en = enable & (~cmd_cnt_end);
|
|
|
Line 370... |
Line 378... |
// else
|
// else
|
// begin
|
// begin
|
byte_q <= #1 byte;
|
byte_q <= #1 byte;
|
half_q <= #1 half;
|
half_q <= #1 half;
|
long_q <= #1 long;
|
long_q <= #1 long;
|
|
byte_q2 <= #1 byte_q;
|
|
half_q2 <= #1 half_q;
|
|
long_q2 <= #1 long_q;
|
// end
|
// end
|
end
|
end
|
|
|
|
|
|
|
Line 417... |
Line 428... |
addr_len_cnt_limit = 6'd48;
|
addr_len_cnt_limit = 6'd48;
|
end
|
end
|
end
|
end
|
|
|
|
|
|
wire go_prelim;
|
|
|
|
assign go_prelim = (cmd_cnt == 2'h2) & dr[1] & (~dr[0]) & (~tdi_i);
|
|
|
|
/*
|
|
always @ (posedge tck_i)
|
|
begin
|
|
if (update_dr_i)
|
|
data_cnt_limit = 19'h0;
|
|
// else if (((cmd_cnt == 2'h2) & dr[1] & (~dr[0]) & (~tdi_i) & cmd_write) | // current command is WB_GO and previous command is WB_WRITEx)
|
|
else if ( go_prelim & cmd_write | // current command is WB_GO and previous command is WB_WRITEx)
|
|
crc_cnt_31 & dr_go_latched & cmd_read // current command is WB_GO and previous command is WB_READx)
|
|
)
|
|
data_cnt_limit = {len, 3'b000};
|
|
end
|
|
*/
|
|
|
always @ (posedge tck_i)
|
always @ (posedge tck_i)
|
begin
|
begin
|
if (update_dr_i)
|
if (update_dr_i)
|
data_cnt_limit = 19'h0;
|
|
else if (((cmd_cnt == 2'h2) & dr[1] & (~dr[0]) & (~tdi_i) & cmd_write) | // current command is WB_GO and previous command is WB_WRITEx)
|
|
(crc_cnt_31 & dr_go_latched & cmd_read) // current command is WB_GO and previous command is WB_READx)
|
|
)
|
|
data_cnt_limit = {len, 3'b000};
|
data_cnt_limit = {len, 3'b000};
|
end
|
end
|
|
|
|
|
assign crc_cnt_en = enable & cmd_cnt_end & addr_len_cnt_end & data_cnt_end & (~crc_cnt_end);
|
//assign crc_cnt_en = enable & cmd_cnt_end & addr_len_cnt_end & data_cnt_end & (~crc_cnt_end);
|
|
assign crc_cnt_en = enable & (~crc_cnt_end) & (cmd_cnt_end & addr_len_cnt_end & (~write_cycle) | (data_cnt_end & write_cycle));
|
|
|
// crc counter
|
// crc counter
|
always @ (posedge tck_i or posedge trst_i)
|
always @ (posedge tck_i or posedge trst_i)
|
begin
|
begin
|
if (trst_i)
|
if (trst_i)
|
Line 463... |
Line 487... |
begin
|
begin
|
if (trst_i)
|
if (trst_i)
|
status_cnt1 <= #1 1'b0;
|
status_cnt1 <= #1 1'b0;
|
else if (update_dr_i)
|
else if (update_dr_i)
|
status_cnt1 <= #1 1'b0;
|
status_cnt1 <= #1 1'b0;
|
// else if (data_cnt_end & (~data_cnt_end_q) & cmd_old_read & dr_go_latched |
|
// else if (data_cnt_end & (~data_cnt_end_q) & read_cycle |
|
else if (data_cnt_end & (~data_cnt_end_q) & read_cycle |
|
// crc_cnt_end & (~crc_cnt_end_q) & (~(cmd_read & dr_go_latched)) // cmd is not changed, yet.
|
crc_cnt_end & (~crc_cnt_end_q) & (~(cmd_read & dr_go_latched)) // cmd is not changed, yet.
|
// )
|
|
else if (data_cnt_end & read_cycle |
|
|
crc_cnt_end & (~(cmd_read & dr_go_latched)) // cmd is not changed, yet.
|
)
|
)
|
status_cnt1 <= #1 1'b1;
|
status_cnt1 <= #1 1'b1;
|
end
|
end
|
|
|
|
|
Line 547... |
Line 573... |
else if (read_cycle & crc_cnt_end & (~data_cnt_end))
|
else if (read_cycle & crc_cnt_end & (~data_cnt_end))
|
begin
|
begin
|
tdo_o = dr[31];
|
tdo_o = dr[31];
|
TDO_WISHBONE = "read data";
|
TDO_WISHBONE = "read data";
|
end
|
end
|
else if (data_cnt_end & (~data_cnt_end_q) & read_cycle) // cmd is already updated
|
else if (read_cycle & data_cnt_end & (~data_cnt_end_q)) // cmd is already updated
|
begin
|
begin
|
tdo_o = crc_match_reg;
|
tdo_o = crc_match_reg;
|
TDO_WISHBONE = "crc_match_reg";
|
TDO_WISHBONE = "crc_match_reg";
|
end
|
end
|
else if (crc_cnt_end & data_cnt_end) // cmd is already updated
|
else if (crc_cnt_end & data_cnt_end) // cmd is already updated
|
Line 652... |
Line 678... |
|
|
|
|
// Start wishbone read cycle
|
// Start wishbone read cycle
|
always @ (posedge tck_i)
|
always @ (posedge tck_i)
|
begin
|
begin
|
if (cmd_cnt_end & (~cmd_cnt_end_q) & cmd_read & dr_go) // First read after cmd is entered igor !!! Add something to block too many accesses.
|
if (cmd_read & go_prelim) // First read after cmd is entered
|
start_rd_tck <= #1 1'b1;
|
start_rd_tck <= #1 1'b1;
|
else if (read_cycle & dr_go_latched & crc_cnt_end & (~crc_cnt_end_q) & (~len_eq_0)) // Second read after first data is latched igor !!! Add something to block too many accesses.
|
else if (read_cycle & dr_go_latched & crc_cnt_end & (~crc_cnt_end_q) & (~len_eq_0)) // Second read after first data is latched
|
start_rd_tck <= #1 1'b1;
|
start_rd_tck <= #1 1'b1;
|
else if (read_cycle & (~len_eq_0))
|
else if (read_cycle & (~len_eq_0))
|
begin
|
begin
|
case (read_type) // synthesis parallel_case full_case
|
case (read_type) // synthesis parallel_case full_case
|
`WB_READ8 : begin
|
`WB_READ8 : begin
|
Line 688... |
Line 714... |
|
|
always @ (posedge tck_i)
|
always @ (posedge tck_i)
|
begin
|
begin
|
if (update_dr_i)
|
if (update_dr_i)
|
read_cycle <= #1 1'b0;
|
read_cycle <= #1 1'b0;
|
else if (cmd_cnt_end & (~cmd_cnt_end_q) & cmd_read & dr_go)
|
// else if (cmd_cnt_end & (~cmd_cnt_end_q) & cmd_read & dr_go)
|
|
else if (cmd_read & go_prelim)
|
read_cycle <= #1 1'b1;
|
read_cycle <= #1 1'b1;
|
end
|
end
|
|
|
|
|
always @ (posedge tck_i)
|
always @ (posedge tck_i)
|
begin
|
begin
|
if (cmd_cnt_end & (~cmd_cnt_end_q) & cmd_read & dr_go)
|
// if (cmd_cnt_end & (~cmd_cnt_end_q) & cmd_read & dr_go)
|
|
if (cmd_read & go_prelim)
|
read_type <= #1 cmd;
|
read_type <= #1 cmd;
|
end
|
end
|
|
|
|
|
|
always @ (posedge tck_i)
|
|
begin
|
|
if (update_dr_i)
|
|
write_cycle <= #1 1'b0;
|
|
// else if (cmd_cnt_end & (~cmd_cnt_end_q) & cmd_write & dr_go)
|
|
else if (cmd_write & go_prelim)
|
|
write_cycle <= #1 1'b1;
|
|
end
|
|
|
|
|
|
|
|
|
|
|
// Start wishbone write cycle
|
// Start wishbone write cycle
|
always @ (posedge tck_i)
|
always @ (posedge tck_i)
|
begin
|
begin
|
if (dr_go_latched & cmd_write)
|
if (dr_go_latched & cmd_write)
|
begin
|
begin
|
case (cmd) // synthesis parallel_case full_case
|
case (cmd) // synthesis parallel_case full_case
|
`WB_WRITE8 : begin
|
`WB_WRITE8 : begin
|
if (byte & (~byte_q))
|
if (byte_q & (~byte_q2))
|
begin
|
begin
|
start_wr_tck <= #1 1'b1;
|
start_wr_tck <= #1 1'b1;
|
wb_dat_o <= #1 {4{dr[7:0]}};
|
wb_dat_o <= #1 {4{dr[7:0]}};
|
end
|
end
|
else
|
else
|
begin
|
begin
|
start_wr_tck <= #1 1'b0;
|
start_wr_tck <= #1 1'b0;
|
end
|
end
|
end
|
end
|
`WB_WRITE16 : begin
|
`WB_WRITE16 : begin
|
if (half & (~half_q))
|
if (half_q & (~half_q2))
|
begin
|
begin
|
start_wr_tck <= #1 1'b1;
|
start_wr_tck <= #1 1'b1;
|
wb_dat_o <= #1 {2{dr[15:0]}};
|
wb_dat_o <= #1 {2{dr[15:0]}};
|
end
|
end
|
else
|
else
|
begin
|
begin
|
start_wr_tck <= #1 1'b0;
|
start_wr_tck <= #1 1'b0;
|
end
|
end
|
end
|
end
|
`WB_WRITE32 : begin
|
`WB_WRITE32 : begin
|
if (long & (~long_q))
|
if (long_q & (~long_q2))
|
begin
|
begin
|
start_wr_tck <= #1 1'b1;
|
start_wr_tck <= #1 1'b1;
|
wb_dat_o <= #1 dr[31:0];
|
wb_dat_o <= #1 dr[31:0];
|
end
|
end
|
else
|
else
|