Line 1... |
Line 1... |
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//// ////
|
//// ////
|
//// cpu_behavioral.v ////
|
//// cpu_behavioral.v ////
|
//// ////
|
//// ////
|
//// ////
|
//// ////
|
//// This file is part of the SoC/OpenRISC Development Interface ////
|
//// This file is part of the SoC Debug Interface. ////
|
//// http://www.opencores.org/projects/DebugInterface/ ////
|
//// http://www.opencores.org/projects/DebugInterface/ ////
|
//// ////
|
//// ////
|
//// Author(s): ////
|
//// Author(s): ////
|
//// Igor Mohor (igorm@opencores.org) ////
|
//// Igor Mohor (igorm@opencores.org) ////
|
//// ////
|
//// ////
|
Line 41... |
Line 41... |
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//
|
//
|
// CVS Revision History
|
// CVS Revision History
|
//
|
//
|
// $Log: not supported by cvs2svn $
|
// $Log: not supported by cvs2svn $
|
|
// Revision 1.3 2004/01/22 11:07:28 mohor
|
|
// test stall_test added.
|
|
//
|
// Revision 1.2 2004/01/17 18:01:31 mohor
|
// Revision 1.2 2004/01/17 18:01:31 mohor
|
// New version.
|
// New version.
|
//
|
//
|
// Revision 1.1 2004/01/17 17:01:25 mohor
|
// Revision 1.1 2004/01/17 17:01:25 mohor
|
// Almost finished.
|
// Almost finished.
|
Line 66... |
Line 69... |
cpu_addr_i,
|
cpu_addr_i,
|
cpu_data_o,
|
cpu_data_o,
|
cpu_data_i,
|
cpu_data_i,
|
cpu_bp_o,
|
cpu_bp_o,
|
cpu_stall_i,
|
cpu_stall_i,
|
cpu_stall_all_i,
|
|
cpu_stb_i,
|
cpu_stb_i,
|
cpu_sel_i,
|
|
cpu_we_i,
|
cpu_we_i,
|
cpu_ack_o,
|
cpu_ack_o,
|
cpu_rst_o
|
cpu_rst_o
|
);
|
);
|
|
|
Line 83... |
Line 84... |
input [31:0] cpu_addr_i;
|
input [31:0] cpu_addr_i;
|
output [31:0] cpu_data_o;
|
output [31:0] cpu_data_o;
|
input [31:0] cpu_data_i;
|
input [31:0] cpu_data_i;
|
output cpu_bp_o;
|
output cpu_bp_o;
|
input cpu_stall_i;
|
input cpu_stall_i;
|
input cpu_stall_all_i;
|
|
input cpu_stb_i;
|
input cpu_stb_i;
|
input [`CPU_NUM -1:0] cpu_sel_i;
|
|
input cpu_we_i;
|
input cpu_we_i;
|
output cpu_ack_o;
|
output cpu_ack_o;
|
output cpu_rst_o;
|
output cpu_rst_o;
|
|
|
reg cpu_clk_o;
|
reg cpu_clk_o;
|
reg [31:0] cpu_data_o;
|
reg [31:0] cpu_data_o;
|
reg cpu_bp_o;
|
reg cpu_bp_o;
|
|
reg cpu_ack_o;
|
|
reg cpu_ack_q;
|
|
wire cpu_ack;
|
initial
|
initial
|
begin
|
begin
|
cpu_clk_o = 1'b0;
|
cpu_clk_o = 1'b0;
|
forever #5 cpu_clk_o = ~cpu_clk_o;
|
forever #5 cpu_clk_o = ~cpu_clk_o;
|
end
|
end
|
Line 106... |
Line 107... |
initial
|
initial
|
begin
|
begin
|
cpu_bp_o = 1'b0;
|
cpu_bp_o = 1'b0;
|
end
|
end
|
|
|
assign #200 cpu_ack_o = cpu_stall_i & cpu_stb_i;
|
assign #200 cpu_ack = cpu_stall_i & cpu_stb_i;
|
|
|
|
|
|
|
|
always @ (posedge cpu_clk_o or posedge cpu_rst_i)
|
|
begin
|
|
if (cpu_rst_i)
|
|
begin
|
|
cpu_ack_o <= #1 1'b0;
|
|
cpu_ack_q <= #1 1'b0;
|
|
end
|
|
else
|
|
begin
|
|
cpu_ack_o <= #1 cpu_ack;
|
|
cpu_ack_q <= #1 cpu_ack_o;
|
|
end
|
|
end
|
|
|
always @ (posedge cpu_clk_o or posedge cpu_rst_i)
|
always @ (posedge cpu_clk_o or posedge cpu_rst_i)
|
begin
|
begin
|
if (cpu_rst_i)
|
if (cpu_rst_i)
|
cpu_data_o <= #1 32'h11111111;
|
cpu_data_o <= #1 32'h12345678;
|
else if ((cpu_addr_i == 32'h32323232) & cpu_we_i & cpu_ack_o)
|
else if (cpu_ack_o && (!cpu_ack_q))
|
cpu_data_o <= #1 cpu_data_i + 1'd1;
|
cpu_data_o <= #1 cpu_data_o + 32'h11111111;
|
else if ((cpu_addr_i == 32'h08080808) & cpu_we_i & cpu_ack_o)
|
|
cpu_data_o <= #1 cpu_data_i + 2'd2;
|
|
end
|
end
|
|
|
|
|
|
|
|
|