Line 5... |
Line 5... |
//// ////
|
//// ////
|
//// This file is part of the SoC Debug Interface. ////
|
//// This file is part of the SoC Debug Interface. ////
|
//// ////
|
//// ////
|
//// Author(s): ////
|
//// Author(s): ////
|
//// Igor Mohor (igorm@opencores.org) ////
|
//// Igor Mohor (igorm@opencores.org) ////
|
|
//// Nathan Yawn (nyawn@opencores.org) ////
|
//// ////
|
//// ////
|
//// ////
|
//// ////
|
//// ////
|
//// ////
|
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//// ////
|
//// ////
|
//// Copyright (C) 2000 - 2010 Authors ////
|
//// Copyright (C) 2000 - 2011 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 39... |
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//
|
//
|
// CVS Revision History
|
// CVS Revision History
|
//
|
//
|
// $Log: adbg_or1k_status_reg.v,v $
|
// $Log: adbg_or1k_status_reg.v,v $
|
|
// Revision 1.3 2011-10-24 02:25:11 natey
|
|
// Removed extraneous '#1' delays, which were a holdover from the original
|
|
// versions in the previous dbg_if core.
|
|
//
|
// Revision 1.2 2010-01-10 22:54:10 Nathan
|
// Revision 1.2 2010-01-10 22:54:10 Nathan
|
// Update copyright dates
|
// Update copyright dates
|
//
|
//
|
// 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 100... |
Line 105... |
// signal, we insure that the CPU will remain in the stalled state until
|
// signal, we insure that the CPU will remain in the stalled state until
|
// the debug host can read the state.
|
// the debug host can read the state.
|
always @ (posedge cpu_clk_i or posedge rst_i)
|
always @ (posedge cpu_clk_i or posedge rst_i)
|
begin
|
begin
|
if(rst_i)
|
if(rst_i)
|
stall_bp <= #1 1'b0;
|
stall_bp <= 1'b0;
|
else if(bp_i)
|
else if(bp_i)
|
stall_bp <= #1 1'b1;
|
stall_bp <= 1'b1;
|
else if(stall_reg_cpu)
|
else if(stall_reg_cpu)
|
stall_bp <= #1 1'b0;
|
stall_bp <= 1'b0;
|
end
|
end
|
|
|
|
|
// Synchronizing
|
// Synchronizing
|
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
|
stall_bp_csff <= #1 1'b0;
|
stall_bp_csff <= 1'b0;
|
stall_bp_tck <= #1 1'b0;
|
stall_bp_tck <= 1'b0;
|
end
|
end
|
else
|
else
|
begin
|
begin
|
stall_bp_csff <= #1 stall_bp;
|
stall_bp_csff <= stall_bp;
|
stall_bp_tck <= #1 stall_bp_csff;
|
stall_bp_tck <= stall_bp_csff;
|
end
|
end
|
end
|
end
|
|
|
|
|
always @ (posedge cpu_clk_i or posedge rst_i)
|
always @ (posedge cpu_clk_i or posedge rst_i)
|
begin
|
begin
|
if (rst_i)
|
if (rst_i)
|
begin
|
begin
|
stall_reg_csff <= #1 1'b0;
|
stall_reg_csff <= 1'b0;
|
stall_reg_cpu <= #1 1'b0;
|
stall_reg_cpu <= 1'b0;
|
end
|
end
|
else
|
else
|
begin
|
begin
|
stall_reg_csff <= #1 stall_reg;
|
stall_reg_csff <= stall_reg;
|
stall_reg_cpu <= #1 stall_reg_csff;
|
stall_reg_cpu <= stall_reg_csff;
|
end
|
end
|
end
|
end
|
|
|
// bp_i forces a stall immediately on a breakpoint
|
// bp_i forces a stall immediately on a breakpoint
|
// stall_bp holds the stall until the debug host acts
|
// stall_bp holds the stall until the debug host acts
|
Line 150... |
Line 155... |
// This can be set either by the debug host, or by
|
// This can be set either by the debug host, or by
|
// a CPU breakpoint. It can only be cleared by the host.
|
// a CPU breakpoint. It can only be cleared by the host.
|
always @ (posedge tck_i or posedge rst_i)
|
always @ (posedge tck_i or posedge rst_i)
|
begin
|
begin
|
if (rst_i)
|
if (rst_i)
|
stall_reg <= #1 1'b0;
|
stall_reg <= 1'b0;
|
else if (stall_bp_tck)
|
else if (stall_bp_tck)
|
stall_reg <= #1 1'b1;
|
stall_reg <= 1'b1;
|
else if (we_i)
|
else if (we_i)
|
stall_reg <= #1 data_i[0];
|
stall_reg <= data_i[0];
|
end
|
end
|
|
|
|
|
// Writing data to the control registers (reset)
|
// Writing data to the control registers (reset)
|
always @ (posedge tck_i or posedge rst_i)
|
always @ (posedge tck_i or posedge rst_i)
|
begin
|
begin
|
if (rst_i)
|
if (rst_i)
|
cpu_reset <= #1 1'b0;
|
cpu_reset <= 1'b0;
|
else if(we_i)
|
else if(we_i)
|
cpu_reset <= #1 data_i[1];
|
cpu_reset <= data_i[1];
|
end
|
end
|
|
|
|
|
// Synchronizing signals from registers
|
// Synchronizing signals from registers
|
always @ (posedge cpu_clk_i or posedge rst_i)
|
always @ (posedge cpu_clk_i or posedge rst_i)
|
begin
|
begin
|
if (rst_i)
|
if (rst_i)
|
begin
|
begin
|
cpu_reset_csff <= #1 1'b0;
|
cpu_reset_csff <= 1'b0;
|
cpu_rst_o <= #1 1'b0;
|
cpu_rst_o <= 1'b0;
|
end
|
end
|
else
|
else
|
begin
|
begin
|
cpu_reset_csff <= #1 cpu_reset;
|
cpu_reset_csff <= cpu_reset;
|
cpu_rst_o <= #1 cpu_reset_csff;
|
cpu_rst_o <= cpu_reset_csff;
|
end
|
end
|
end
|
end
|
|
|
|
|
|
|