//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//// ////
|
//// ////
|
//// cpu_behavioral.v ////
|
//// cpu_behavioral.v ////
|
//// ////
|
//// ////
|
//// ////
|
//// ////
|
//// This file is part of the SoC/OpenRISC Development Interface ////
|
//// This file is part of the SoC/OpenRISC Development 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) ////
|
//// ////
|
//// ////
|
//// ////
|
//// ////
|
//// All additional information is avaliable in the README.txt ////
|
//// All additional information is avaliable in the README.txt ////
|
//// file. ////
|
//// file. ////
|
//// ////
|
//// ////
|
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//// ////
|
//// ////
|
//// Copyright (C) 2000 - 2004 Authors ////
|
//// Copyright (C) 2000 - 2004 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. ////
|
//// ////
|
//// ////
|
//// This source file is free software; you can redistribute it ////
|
//// This source file is free software; you can redistribute it ////
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
//// Public License as published by the Free Software Foundation; ////
|
//// Public License as published by the Free Software Foundation; ////
|
//// either version 2.1 of the License, or (at your option) any ////
|
//// either version 2.1 of the License, or (at your option) any ////
|
//// later version. ////
|
//// later version. ////
|
//// ////
|
//// ////
|
//// This source is distributed in the hope that it will be ////
|
//// This source is distributed in the hope that it will be ////
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
//// details. ////
|
//// details. ////
|
//// ////
|
//// ////
|
//// You should have received a copy of the GNU Lesser General ////
|
//// You should have received a copy of the GNU Lesser General ////
|
//// Public License along with this source; if not, download it ////
|
//// Public License along with this source; if not, download it ////
|
//// from http://www.opencores.org/lgpl.shtml ////
|
//// from http://www.opencores.org/lgpl.shtml ////
|
//// ////
|
//// ////
|
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//
|
//
|
// CVS Revision History
|
// CVS Revision History
|
//
|
//
|
// $Log: not supported by cvs2svn $
|
// $Log: not supported by cvs2svn $
|
|
// Revision 1.2 2004/01/17 18:01:31 mohor
|
|
// 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.
|
//
|
//
|
//
|
//
|
//
|
//
|
//
|
//
|
//
|
//
|
`include "timescale.v"
|
`include "timescale.v"
|
`include "dbg_cpu_defines.v"
|
`include "dbg_cpu_defines.v"
|
|
|
|
|
|
|
module cpu_behavioral
|
module cpu_behavioral
|
(
|
(
|
// CPU signals
|
// CPU signals
|
cpu_rst_i,
|
cpu_rst_i,
|
cpu_clk_o,
|
cpu_clk_o,
|
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_stall_all_i,
|
cpu_stb_i,
|
cpu_stb_i,
|
cpu_sel_i,
|
cpu_sel_i,
|
cpu_we_i,
|
cpu_we_i,
|
cpu_ack_o,
|
cpu_ack_o,
|
cpu_rst_o
|
cpu_rst_o
|
);
|
);
|
|
|
|
|
// CPU signals
|
// CPU signals
|
input cpu_rst_i;
|
input cpu_rst_i;
|
output cpu_clk_o;
|
output cpu_clk_o;
|
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_stall_all_i;
|
input cpu_stb_i;
|
input cpu_stb_i;
|
input [`CPU_NUM -1:0] cpu_sel_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;
|
|
|
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
|
|
|
|
|
assign cpu_bp_o = 1'b0;
|
initial
|
|
begin
|
|
cpu_bp_o = 1'b0;
|
|
end
|
|
|
assign #200 cpu_ack_o = cpu_stall_i & cpu_stb_i;
|
assign #200 cpu_ack_o = cpu_stall_i & cpu_stb_i;
|
|
|
|
|
|
|
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'h11111111;
|
else if ((cpu_addr_i == 32'h32323232) & cpu_we_i & cpu_ack_o)
|
else if ((cpu_addr_i == 32'h32323232) & cpu_we_i & cpu_ack_o)
|
cpu_data_o <= #1 cpu_data_i + 1'd1;
|
cpu_data_o <= #1 cpu_data_i + 1'd1;
|
else if ((cpu_addr_i == 32'h08080808) & cpu_we_i & cpu_ack_o)
|
else if ((cpu_addr_i == 32'h08080808) & cpu_we_i & cpu_ack_o)
|
cpu_data_o <= #1 cpu_data_i + 2'd2;
|
cpu_data_o <= #1 cpu_data_i + 2'd2;
|
end
|
end
|
|
|
|
|
|
|
|
|
endmodule
|
endmodule
|
|
|
|
|