Line 10... |
Line 10... |
//// ////
|
//// ////
|
//// ////
|
//// ////
|
//// ////
|
//// ////
|
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//// ////
|
//// ////
|
//// Copyright (C) 2008 Authors ////
|
//// Copyright (C) 2008 - 2010 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 38... |
Line 38... |
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//
|
//
|
// CVS Revision History
|
// CVS Revision History
|
//
|
//
|
// $Log: adbg_or1k_module.v,v $
|
// $Log: adbg_or1k_module.v,v $
|
|
// Revision 1.5 2010-01-13 00:55:45 Nathan
|
|
// Created hi-speed mode for burst reads. This will probably be most beneficial to the OR1K module, as GDB does a burst read of all the GPRs each time a microinstruction is single-stepped.
|
|
//
|
// Revision 1.2 2009/05/17 20:54:56 Nathan
|
// Revision 1.2 2009/05/17 20:54:56 Nathan
|
// Changed email address to opencores.org
|
// Changed email address to opencores.org
|
//
|
//
|
// Revision 1.1 2008/07/22 20:28:31 Nathan
|
// Revision 1.1 2008/07/22 20:28:31 Nathan
|
// Changed names of all files and modules (prefixed an a, for advanced). Cleanup, indenting. No functional changes.
|
// Changed names of all files and modules (prefixed an a, for advanced). Cleanup, indenting. No functional changes.
|
Line 54... |
Line 57... |
// to ignore the command present in the input shift register after e.g.
|
// to ignore the command present in the input shift register after e.g.
|
// a burst read.
|
// a burst read.
|
//
|
//
|
|
|
|
|
|
`include "adbg_defines.v"
|
`include "adbg_or1k_defines.v"
|
`include "adbg_or1k_defines.v"
|
|
|
// Module interface
|
// Module interface
|
module adbg_or1k_module (
|
module adbg_or1k_module (
|
// JTAG signals
|
// JTAG signals
|
Line 189... |
Line 193... |
|
|
assign module_cmd = ~(data_register_i[52]);
|
assign module_cmd = ~(data_register_i[52]);
|
assign operation_in = data_register_i[51:48];
|
assign operation_in = data_register_i[51:48];
|
assign address_data_in = data_register_i[47:16];
|
assign address_data_in = data_register_i[47:16];
|
assign count_data_in = data_register_i[15:0];
|
assign count_data_in = data_register_i[15:0];
|
|
`ifdef ADBG_USE_HISPEED
|
|
assign data_to_biu = {tdi_i,data_register_i[52:22]};
|
|
`else
|
assign data_to_biu = data_register_i[52:21];
|
assign data_to_biu = data_register_i[52:21];
|
|
`endif
|
assign reg_select_data = data_register_i[47:(47-(`DBG_OR1K_REGSELECT_SIZE-1))];
|
assign reg_select_data = data_register_i[47:(47-(`DBG_OR1K_REGSELECT_SIZE-1))];
|
|
|
////////////////////////////////////////////////
|
////////////////////////////////////////////////
|
// Operation decoder
|
// Operation decoder
|
|
|
Line 451... |
Line 459... |
end
|
end
|
`STATE_Rburst:
|
`STATE_Rburst:
|
begin
|
begin
|
if(update_dr_i) module_next_state <= `STATE_idle;
|
if(update_dr_i) module_next_state <= `STATE_idle;
|
else if(bit_count_max && word_count_zero) module_next_state <= `STATE_Rcrc;
|
else if(bit_count_max && word_count_zero) module_next_state <= `STATE_Rcrc;
|
|
`ifndef ADBG_USE_HISPEED
|
else if(bit_count_max) module_next_state <= `STATE_Rstatus;
|
else if(bit_count_max) module_next_state <= `STATE_Rstatus;
|
|
`endif
|
else module_next_state <= `STATE_Rburst;
|
else module_next_state <= `STATE_Rburst;
|
end
|
end
|
`STATE_Rcrc:
|
`STATE_Rcrc:
|
begin
|
begin
|
if(update_dr_i) module_next_state <= `STATE_idle;
|
if(update_dr_i) module_next_state <= `STATE_idle;
|
Line 476... |
Line 486... |
else module_next_state <= `STATE_Wwait;
|
else module_next_state <= `STATE_Wwait;
|
end
|
end
|
`STATE_Wburst:
|
`STATE_Wburst:
|
begin
|
begin
|
if(update_dr_i) module_next_state <= `STATE_idle; // client terminated early
|
if(update_dr_i) module_next_state <= `STATE_idle; // client terminated early
|
else if(bit_count_max) module_next_state <= `STATE_Wstatus;
|
else if(bit_count_max)
|
|
begin
|
|
`ifdef ADBG_USE_HISPEED
|
|
if(word_count_zero) module_next_state <= `STATE_Wcrc;
|
|
else module_next_state <= `STATE_Wburst;
|
|
`else
|
|
module_next_state <= `STATE_Wstatus;
|
|
`endif
|
|
end
|
else module_next_state <= `STATE_Wburst;
|
else module_next_state <= `STATE_Wburst;
|
end
|
end
|
`STATE_Wstatus:
|
`STATE_Wstatus:
|
begin
|
begin
|
if(update_dr_i) module_next_state <= `STATE_idle; // client terminated early
|
if(update_dr_i) module_next_state <= `STATE_idle; // client terminated early
|
Line 579... |
Line 597... |
`STATE_Rstatus:
|
`STATE_Rstatus:
|
begin
|
begin
|
tdo_output_sel <= 2'h0;
|
tdo_output_sel <= 2'h0;
|
top_inhibit_o <= 1'b1; // in case of early termination
|
top_inhibit_o <= 1'b1; // in case of early termination
|
|
|
if (module_next_state == `STATE_Rburst) begin
|
if (module_next_state == `STATE_Rburst)
|
|
begin
|
out_reg_data_sel <= 1'b0; // select BIU data
|
out_reg_data_sel <= 1'b0; // select BIU data
|
out_reg_ld_en <= 1'b1;
|
out_reg_ld_en <= 1'b1;
|
bit_ct_rst <= 1'b1;
|
bit_ct_rst <= 1'b1;
|
word_ct_sel <= 1'b1;
|
word_ct_sel <= 1'b1;
|
word_ct_en <= 1'b1;
|
word_ct_en <= 1'b1;
|
if(!(decremented_word_count == 0) && !word_count_zero) begin // Start a biu read transaction
|
if(!(decremented_word_count == 0) && !word_count_zero) // Start a biu read transaction
|
|
begin
|
biu_strobe <= 1'b1;
|
biu_strobe <= 1'b1;
|
addr_sel <= 1'b1;
|
addr_sel <= 1'b1;
|
addr_ct_en <= 1'b1;
|
addr_ct_en <= 1'b1;
|
end
|
end
|
end
|
end
|
Line 601... |
Line 621... |
out_reg_shift_en <= 1'b1;
|
out_reg_shift_en <= 1'b1;
|
bit_ct_en <= 1'b1;
|
bit_ct_en <= 1'b1;
|
crc_en <= 1'b1;
|
crc_en <= 1'b1;
|
crc_in_sel <= 1'b0; // read data in output shift register LSB (tdo)
|
crc_in_sel <= 1'b0; // read data in output shift register LSB (tdo)
|
top_inhibit_o <= 1'b1; // in case of early termination
|
top_inhibit_o <= 1'b1; // in case of early termination
|
|
|
|
`ifdef ADBG_USE_HISPEED
|
|
if(bit_count_max)
|
|
begin
|
|
out_reg_data_sel <= 1'b0; // select BIU data
|
|
out_reg_ld_en <= 1'b1;
|
|
bit_ct_rst <= 1'b1;
|
|
word_ct_sel <= 1'b1;
|
|
word_ct_en <= 1'b1;
|
|
if(!(decremented_word_count == 0) && !word_count_zero) // Start a biu read transaction
|
|
begin
|
|
biu_strobe <= 1'b1;
|
|
addr_sel <= 1'b1;
|
|
addr_ct_en <= 1'b1;
|
|
end
|
|
end
|
|
`endif
|
end
|
end
|
|
|
`STATE_Rcrc:
|
`STATE_Rcrc:
|
begin
|
begin
|
// Just shift out the data, don't bother counting, we don't move on until update_dr_i
|
// Just shift out the data, don't bother counting, we don't move on until update_dr_i
|
Line 634... |
Line 671... |
bit_ct_en <= 1'b1;
|
bit_ct_en <= 1'b1;
|
tdo_output_sel <= 2'h1;
|
tdo_output_sel <= 2'h1;
|
crc_en <= 1'b1;
|
crc_en <= 1'b1;
|
crc_in_sel <= 1'b1; // read data from tdi_i
|
crc_in_sel <= 1'b1; // read data from tdi_i
|
top_inhibit_o <= 1'b1; // in case of early termination
|
top_inhibit_o <= 1'b1; // in case of early termination
|
|
|
|
`ifdef ADBG_USE_HISPEED
|
|
// It would be better to do this in STATE_Wstatus, but we don't use that state
|
|
// if ADBG_USE_HISPEED is defined.
|
|
if(bit_count_max)
|
|
begin
|
|
bit_ct_rst <= 1'b1; // Zero the bit count
|
|
// start transaction. Can't do this here if not hispeed, biu_ready
|
|
// is the status bit, and it's 0 if we start a transaction here.
|
|
biu_strobe <= 1'b1; // Start a BIU transaction
|
|
addr_ct_en <= 1'b1; // Increment thte address counter
|
|
// Also can't dec the byte count yet unless hispeed,
|
|
// that would skip the last word.
|
|
word_ct_sel <= 1'b1; // Decrement the byte count
|
|
word_ct_en <= 1'b1;
|
|
end
|
|
`endif
|
end
|
end
|
|
|
`STATE_Wstatus:
|
`STATE_Wstatus:
|
begin
|
begin
|
tdo_output_sel <= 2'h0; // Send the status bit to TDO
|
tdo_output_sel <= 2'h0; // Send the status bit to TDO
|