Line 41... |
Line 41... |
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//
|
//
|
// CVS Revision History
|
// CVS Revision History
|
//
|
//
|
// $Log: not supported by cvs2svn $
|
// $Log: not supported by cvs2svn $
|
|
// Revision 1.22 2004/04/01 11:56:59 igorm
|
|
// Port names and defines for the supported CPUs changed.
|
|
//
|
// Revision 1.21 2004/03/31 14:34:09 igorm
|
// Revision 1.21 2004/03/31 14:34:09 igorm
|
// data_cnt_lim length changed to reduce number of warnings.
|
// data_cnt_lim length changed to reduce number of warnings.
|
//
|
//
|
// Revision 1.20 2004/03/28 20:27:02 igorm
|
// Revision 1.20 2004/03/28 20:27:02 igorm
|
// New release of the debug interface (3rd. release).
|
// New release of the debug interface (3rd. release).
|
Line 250... |
Line 253... |
|
|
reg [1:0] ptr;
|
reg [1:0] ptr;
|
reg [2:0] fifo_cnt;
|
reg [2:0] fifo_cnt;
|
wire fifo_full;
|
wire fifo_full;
|
wire fifo_empty;
|
wire fifo_empty;
|
//reg [7:0] mem [0:3];
|
reg [7:0] mem [0:3];
|
reg [7:0] mem0, mem1, mem2, mem3;
|
|
reg [2:0] mem_ptr_dsff;
|
reg [2:0] mem_ptr_dsff;
|
reg wishbone_ce_csff;
|
reg wishbone_ce_csff;
|
reg mem_ptr_init;
|
reg mem_ptr_init;
|
reg [`DBG_WB_CMD_LEN -1: 0] curr_cmd;
|
reg [`DBG_WB_CMD_LEN -1: 0] curr_cmd;
|
wire curr_cmd_go;
|
wire curr_cmd_go;
|
Line 316... |
Line 318... |
dr[31:0] <= #1 input_data[31:0];
|
dr[31:0] <= #1 input_data[31:0];
|
latch_data <= #1 1'b1;
|
latch_data <= #1 1'b1;
|
end
|
end
|
else if (acc_type_read && curr_cmd_go && crc_cnt_end) // Latching data (from WB)
|
else if (acc_type_read && curr_cmd_go && crc_cnt_end) // Latching data (from WB)
|
begin
|
begin
|
case (acc_type) // synthesis parallel_case full_case
|
if (acc_type == `DBG_WB_READ8)
|
`DBG_WB_READ8 : begin
|
begin
|
if(byte & (~byte_q))
|
if(byte & (~byte_q))
|
begin
|
begin
|
case (ptr) // synthesis parallel_case
|
case (ptr) // synthesis parallel_case
|
2'b00 : dr[31:24] <= #1 input_data[31:24];
|
2'b00 : dr[31:24] <= #1 input_data[31:24];
|
2'b01 : dr[31:24] <= #1 input_data[23:16];
|
2'b01 : dr[31:24] <= #1 input_data[23:16];
|
Line 334... |
Line 336... |
begin
|
begin
|
dr[31:24] <= #1 {dr[30:24], 1'b0};
|
dr[31:24] <= #1 {dr[30:24], 1'b0};
|
latch_data <= #1 1'b0;
|
latch_data <= #1 1'b0;
|
end
|
end
|
end
|
end
|
`DBG_WB_READ16: begin
|
else if (acc_type == `DBG_WB_READ16)
|
|
begin
|
if(half & (~half_q))
|
if(half & (~half_q))
|
begin
|
begin
|
if (ptr[1])
|
if (ptr[1])
|
dr[31:16] <= #1 input_data[15:0];
|
dr[31:16] <= #1 input_data[15:0];
|
else
|
else
|
Line 349... |
Line 352... |
begin
|
begin
|
dr[31:16] <= #1 {dr[30:16], 1'b0};
|
dr[31:16] <= #1 {dr[30:16], 1'b0};
|
latch_data <= #1 1'b0;
|
latch_data <= #1 1'b0;
|
end
|
end
|
end
|
end
|
`DBG_WB_READ32: begin
|
else if (acc_type == `DBG_WB_READ32)
|
|
begin
|
if(long & (~long_q))
|
if(long & (~long_q))
|
begin
|
begin
|
dr[31:0] <= #1 input_data[31:0];
|
dr[31:0] <= #1 input_data[31:0];
|
latch_data <= #1 1'b1;
|
latch_data <= #1 1'b1;
|
end
|
end
|
Line 361... |
Line 365... |
begin
|
begin
|
dr[31:0] <= #1 {dr[30:0], 1'b0};
|
dr[31:0] <= #1 {dr[30:0], 1'b0};
|
latch_data <= #1 1'b0;
|
latch_data <= #1 1'b0;
|
end
|
end
|
end
|
end
|
endcase
|
|
end
|
end
|
else if (enable && (!addr_len_cnt_end))
|
else if (enable && (!addr_len_cnt_end))
|
begin
|
begin
|
dr <= #1 {dr[`DBG_WB_DR_LEN -2:0], tdi_i};
|
dr <= #1 {dr[`DBG_WB_DR_LEN -2:0], tdi_i};
|
end
|
end
|
Line 608... |
Line 611... |
len_var <= #1 {1'b0, {`DBG_WB_LEN_LEN{1'b0}}};
|
len_var <= #1 {1'b0, {`DBG_WB_LEN_LEN{1'b0}}};
|
else if(update_dr_i)
|
else if(update_dr_i)
|
len_var <= #1 len + 1'b1;
|
len_var <= #1 len + 1'b1;
|
else if (start_rd_tck)
|
else if (start_rd_tck)
|
begin
|
begin
|
case (acc_type) // synthesis parallel_case full_case
|
case (acc_type) // synthesis parallel_case
|
`DBG_WB_READ8 :
|
`DBG_WB_READ8 :
|
if (len_var > 'd1)
|
if (len_var > 'd1)
|
len_var <= #1 len_var - 1'd1;
|
len_var <= #1 len_var - 1'd1;
|
else
|
else
|
len_var <= #1 {1'b0, {`DBG_WB_LEN_LEN{1'b0}}};
|
len_var <= #1 {1'b0, {`DBG_WB_LEN_LEN{1'b0}}};
|
Line 624... |
Line 627... |
`DBG_WB_READ32:
|
`DBG_WB_READ32:
|
if (len_var > 'd4)
|
if (len_var > 'd4)
|
len_var <= #1 len_var - 3'd4;
|
len_var <= #1 len_var - 3'd4;
|
else
|
else
|
len_var <= #1 {1'b0, {`DBG_WB_LEN_LEN{1'b0}}};
|
len_var <= #1 {1'b0, {`DBG_WB_LEN_LEN{1'b0}}};
|
|
default: len_var <= #1 {1'bx, {`DBG_WB_LEN_LEN{1'bx}}};
|
endcase
|
endcase
|
end
|
end
|
end
|
end
|
|
|
|
|
Line 820... |
Line 824... |
begin
|
begin
|
if (rst_i)
|
if (rst_i)
|
wb_sel_dsff[3:0] <= #1 4'h0;
|
wb_sel_dsff[3:0] <= #1 4'h0;
|
else
|
else
|
begin
|
begin
|
case ({wb_adr_dsff[1:0], acc_type_8bit, acc_type_16bit, acc_type_32bit}) // synthesis parallel_case full_case
|
case ({wb_adr_dsff[1:0], acc_type_8bit, acc_type_16bit, acc_type_32bit}) // synthesis parallel_case
|
{2'd0, 3'b100} : wb_sel_dsff[3:0] <= #1 4'h8;
|
{2'd0, 3'b100} : wb_sel_dsff[3:0] <= #1 4'h8;
|
{2'd0, 3'b010} : wb_sel_dsff[3:0] <= #1 4'hC;
|
{2'd0, 3'b010} : wb_sel_dsff[3:0] <= #1 4'hC;
|
{2'd0, 3'b001} : wb_sel_dsff[3:0] <= #1 4'hF;
|
{2'd0, 3'b001} : wb_sel_dsff[3:0] <= #1 4'hF;
|
{2'd1, 3'b100} : wb_sel_dsff[3:0] <= #1 4'h4;
|
{2'd1, 3'b100} : wb_sel_dsff[3:0] <= #1 4'h4;
|
{2'd2, 3'b100} : wb_sel_dsff[3:0] <= #1 4'h2;
|
{2'd2, 3'b100} : wb_sel_dsff[3:0] <= #1 4'h2;
|
{2'd2, 3'b010} : wb_sel_dsff[3:0] <= #1 4'h3;
|
{2'd2, 3'b010} : wb_sel_dsff[3:0] <= #1 4'h3;
|
{2'd3, 3'b100} : wb_sel_dsff[3:0] <= #1 4'h1;
|
{2'd3, 3'b100} : wb_sel_dsff[3:0] <= #1 4'h1;
|
|
default: wb_sel_dsff[3:0] <= #1 4'hx;
|
endcase
|
endcase
|
end
|
end
|
end
|
end
|
|
|
|
|
Line 1016... |
Line 1021... |
mem_ptr_dsff <= #1 mem_ptr_dsff + 2'd2;
|
mem_ptr_dsff <= #1 mem_ptr_dsff + 2'd2;
|
end
|
end
|
end
|
end
|
|
|
|
|
/* Logic for latching data that is read from wishbone
|
|
always @ (posedge wb_clk_i)
|
|
begin
|
|
if (wb_ack_i)
|
|
begin
|
|
case (wb_sel_dsff) // synthesis parallel_case full_case
|
|
4'b1000 : mem[mem_ptr_dsff[1:0]] <= #1 wb_dat_i[31:24]; // byte
|
|
4'b0100 : mem[mem_ptr_dsff[1:0]] <= #1 wb_dat_i[23:16]; // byte
|
|
4'b0010 : mem[mem_ptr_dsff[1:0]] <= #1 wb_dat_i[15:08]; // byte
|
|
4'b0001 : mem[mem_ptr_dsff[1:0]] <= #1 wb_dat_i[07:00]; // byte
|
|
|
|
4'b1100 : // half
|
|
begin
|
|
mem[mem_ptr_dsff[1:0]] <= #1 wb_dat_i[31:24];
|
|
mem[mem_ptr_dsff[1:0]+1'b1] <= #1 wb_dat_i[23:16];
|
|
end
|
|
4'b0011 : // half
|
|
begin
|
|
mem[mem_ptr_dsff[1:0]] <= #1 wb_dat_i[15:08];
|
|
mem[mem_ptr_dsff[1:0]+1'b1] <= #1 wb_dat_i[07:00];
|
|
end
|
|
4'b1111 : // long
|
|
begin
|
|
mem[0] <= #1 wb_dat_i[31:24];
|
|
mem[1] <= #1 wb_dat_i[23:16];
|
|
mem[2] <= #1 wb_dat_i[15:08];
|
|
mem[3] <= #1 wb_dat_i[07:00];
|
|
end
|
|
endcase
|
|
end
|
|
end
|
|
*/
|
|
|
|
// Logic for latching data that is read from wishbone
|
// Logic for latching data that is read from wishbone
|
always @ (posedge wb_clk_i)
|
always @ (posedge wb_clk_i)
|
begin
|
begin
|
if (wb_ack_i)
|
if (wb_ack_i)
|
begin
|
begin
|
case (wb_sel_dsff) // synthesis parallel_case full_case
|
case (wb_sel_dsff) // synthesis parallel_case
|
4'b1000 : begin
|
4'b1000 : mem[mem_ptr_dsff[1:0]] <= #1 wb_dat_i[31:24]; // byte
|
case (mem_ptr_dsff[1:0]) // synthesis parallel_case full_case
|
4'b0100 : mem[mem_ptr_dsff[1:0]] <= #1 wb_dat_i[23:16]; // byte
|
2'b00: mem0 <= #1 wb_dat_i[31:24];
|
4'b0010 : mem[mem_ptr_dsff[1:0]] <= #1 wb_dat_i[15:08]; // byte
|
2'b01: mem1 <= #1 wb_dat_i[31:24];
|
4'b0001 : mem[mem_ptr_dsff[1:0]] <= #1 wb_dat_i[07:00]; // byte
|
2'b10: mem2 <= #1 wb_dat_i[31:24];
|
|
2'b11: mem3 <= #1 wb_dat_i[31:24];
|
|
endcase
|
|
end
|
|
4'b0100 : begin
|
|
case (mem_ptr_dsff[1:0]) // synthesis parallel_case full_case
|
|
2'b00: mem0 <= #1 wb_dat_i[23:16];
|
|
2'b01: mem1 <= #1 wb_dat_i[23:16];
|
|
2'b10: mem2 <= #1 wb_dat_i[23:16];
|
|
2'b11: mem3 <= #1 wb_dat_i[23:16];
|
|
endcase
|
|
end
|
|
4'b0010 : begin
|
|
case (mem_ptr_dsff[1:0]) // synthesis parallel_case full_case
|
|
2'b00: mem0 <= #1 wb_dat_i[15:08];
|
|
2'b01: mem1 <= #1 wb_dat_i[15:08];
|
|
2'b10: mem2 <= #1 wb_dat_i[15:08];
|
|
2'b11: mem3 <= #1 wb_dat_i[15:08];
|
|
endcase
|
|
end
|
|
4'b0001 : begin
|
|
case (mem_ptr_dsff[1:0]) // synthesis parallel_case full_case
|
|
2'b00: mem0 <= #1 wb_dat_i[07:00];
|
|
2'b01: mem1 <= #1 wb_dat_i[07:00];
|
|
2'b10: mem2 <= #1 wb_dat_i[07:00];
|
|
2'b11: mem3 <= #1 wb_dat_i[07:00];
|
|
endcase
|
|
end
|
|
|
|
4'b1100 : // half
|
4'b1100 : // half
|
begin
|
begin
|
case (mem_ptr_dsff[1:0]) // synthesis parallel_case full_case
|
mem[mem_ptr_dsff[1:0]] <= #1 wb_dat_i[31:24];
|
2'b00: mem0 <= #1 wb_dat_i[31:24];
|
mem[mem_ptr_dsff[1:0]+1'b1] <= #1 wb_dat_i[23:16];
|
2'b01: mem1 <= #1 wb_dat_i[31:24];
|
|
2'b10: mem2 <= #1 wb_dat_i[31:24];
|
|
2'b11: mem3 <= #1 wb_dat_i[31:24];
|
|
endcase
|
|
case (mem_ptr_dsff[1:0]) // synthesis parallel_case full_case
|
|
2'b00: mem1 <= #1 wb_dat_i[23:16];
|
|
2'b01: mem2 <= #1 wb_dat_i[23:16];
|
|
2'b10: mem3 <= #1 wb_dat_i[23:16];
|
|
2'b11: mem0 <= #1 wb_dat_i[23:16];
|
|
endcase
|
|
end
|
end
|
4'b0011 : // half
|
4'b0011 : // half
|
begin
|
begin
|
case (mem_ptr_dsff[1:0]) // synthesis parallel_case full_case
|
mem[mem_ptr_dsff[1:0]] <= #1 wb_dat_i[15:08];
|
2'b00: mem0 <= #1 wb_dat_i[15:08];
|
mem[mem_ptr_dsff[1:0]+1'b1] <= #1 wb_dat_i[07:00];
|
2'b01: mem1 <= #1 wb_dat_i[15:08];
|
|
2'b10: mem2 <= #1 wb_dat_i[15:08];
|
|
2'b11: mem3 <= #1 wb_dat_i[15:08];
|
|
endcase
|
|
case (mem_ptr_dsff[1:0]) // synthesis parallel_case full_case
|
|
2'b00: mem1 <= #1 wb_dat_i[07:00];
|
|
2'b01: mem2 <= #1 wb_dat_i[07:00];
|
|
2'b10: mem3 <= #1 wb_dat_i[07:00];
|
|
2'b11: mem0 <= #1 wb_dat_i[07:00];
|
|
endcase
|
|
end
|
end
|
4'b1111 : // long
|
4'b1111 : // long
|
begin
|
begin
|
mem0 <= #1 wb_dat_i[31:24];
|
mem[0] <= #1 wb_dat_i[31:24];
|
mem1 <= #1 wb_dat_i[23:16];
|
mem[1] <= #1 wb_dat_i[23:16];
|
mem2 <= #1 wb_dat_i[15:08];
|
mem[2] <= #1 wb_dat_i[15:08];
|
mem3 <= #1 wb_dat_i[07:00];
|
mem[3] <= #1 wb_dat_i[07:00];
|
|
end
|
|
default : // long
|
|
begin
|
|
mem[0] <= #1 8'hxx;
|
|
mem[1] <= #1 8'hxx;
|
|
mem[2] <= #1 8'hxx;
|
|
mem[3] <= #1 8'hxx;
|
end
|
end
|
endcase
|
endcase
|
end
|
end
|
end
|
end
|
|
|
|
|
//assign input_data = {mem[0], mem[1], mem[2], mem[3]};
|
|
assign input_data = {mem0, mem1, mem2, mem3};
|
assign input_data = {mem[0], mem[1], mem[2], mem[3]};
|
|
|
|
|
// Fifo counter and empty/full detection
|
// Fifo counter and empty/full detection
|
always @ (posedge tck_i or posedge rst_i)
|
always @ (posedge tck_i or posedge rst_i)
|
begin
|
begin
|
Line 1143... |
Line 1074... |
fifo_cnt <= #1 3'h0;
|
fifo_cnt <= #1 3'h0;
|
else if (update_dr_i)
|
else if (update_dr_i)
|
fifo_cnt <= #1 3'h0;
|
fifo_cnt <= #1 3'h0;
|
else if (wb_end_tck && (!wb_end_tck_q) && (!latch_data) && (!fifo_full)) // incrementing
|
else if (wb_end_tck && (!wb_end_tck_q) && (!latch_data) && (!fifo_full)) // incrementing
|
begin
|
begin
|
case (acc_type) // synthesis parallel_case full_case
|
case (acc_type) // synthesis parallel_case
|
`DBG_WB_READ8 : fifo_cnt <= #1 fifo_cnt + 1'd1;
|
`DBG_WB_READ8 : fifo_cnt <= #1 fifo_cnt + 1'd1;
|
`DBG_WB_READ16: fifo_cnt <= #1 fifo_cnt + 2'd2;
|
`DBG_WB_READ16: fifo_cnt <= #1 fifo_cnt + 2'd2;
|
`DBG_WB_READ32: fifo_cnt <= #1 fifo_cnt + 3'd4;
|
`DBG_WB_READ32: fifo_cnt <= #1 fifo_cnt + 3'd4;
|
|
default: fifo_cnt <= #1 3'bxxx;
|
endcase
|
endcase
|
end
|
end
|
else if (!(wb_end_tck && (!wb_end_tck_q)) && latch_data && (!fifo_empty)) // decrementing
|
else if (!(wb_end_tck && (!wb_end_tck_q)) && latch_data && (!fifo_empty)) // decrementing
|
begin
|
begin
|
case (acc_type) // synthesis parallel_case full_case
|
case (acc_type) // synthesis parallel_case
|
`DBG_WB_READ8 : fifo_cnt <= #1 fifo_cnt - 1'd1;
|
`DBG_WB_READ8 : fifo_cnt <= #1 fifo_cnt - 1'd1;
|
`DBG_WB_READ16: fifo_cnt <= #1 fifo_cnt - 2'd2;
|
`DBG_WB_READ16: fifo_cnt <= #1 fifo_cnt - 2'd2;
|
`DBG_WB_READ32: fifo_cnt <= #1 fifo_cnt - 3'd4;
|
`DBG_WB_READ32: fifo_cnt <= #1 fifo_cnt - 3'd4;
|
|
default: fifo_cnt <= #1 3'bxxx;
|
endcase
|
endcase
|
end
|
end
|
end
|
end
|
|
|
|
|