OpenCores
URL https://opencores.org/ocsvn/adv_debug_sys/adv_debug_sys/trunk

Subversion Repositories adv_debug_sys

[/] [adv_debug_sys/] [tags/] [ADS_RELEASE_2_5_0/] [Hardware/] [adv_dbg_if/] [bench/] [simulated_system/] [cpu_behavioral.v] - Blame information for rev 8

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 nyawn
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
//// cpu_behavioral.v                                             ////
4
////                                                              ////
5
////                                                              ////
6
////  This file is part of the SoC Debug Interface.               ////
7
////  http://www.opencores.org/projects/DebugInterface/           ////
8
////                                                              ////
9
////  Author(s):                                                  ////
10
////       Igor Mohor (igorm@opencores.org)                       ////
11
////                                                              ////
12
////                                                              ////
13
////  All additional information is avaliable in the README.txt   ////
14
////  file.                                                       ////
15
////                                                              ////
16
//////////////////////////////////////////////////////////////////////
17
////                                                              ////
18
//// Copyright (C) 2000 - 2004 Authors                            ////
19
////                                                              ////
20
//// This source file may be used and distributed without         ////
21
//// restriction provided that this copyright statement is not    ////
22
//// removed from the file and that any derivative work contains  ////
23
//// the original copyright notice and the associated disclaimer. ////
24
////                                                              ////
25
//// This source file is free software; you can redistribute it   ////
26
//// and/or modify it under the terms of the GNU Lesser General   ////
27
//// Public License as published by the Free Software Foundation; ////
28
//// either version 2.1 of the License, or (at your option) any   ////
29
//// later version.                                               ////
30
////                                                              ////
31
//// This source is distributed in the hope that it will be       ////
32
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
33
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
34
//// PURPOSE.  See the GNU Lesser General Public License for more ////
35
//// details.                                                     ////
36
////                                                              ////
37
//// You should have received a copy of the GNU Lesser General    ////
38
//// Public License along with this source; if not, download it   ////
39
//// from http://www.opencores.org/lgpl.shtml                     ////
40
////                                                              ////
41
//////////////////////////////////////////////////////////////////////
42
//
43
// CVS Revision History
44
//
45
// $Log: cpu_behavioral.v,v $
46
// Revision 1.1  2008/07/08 19:11:55  Nathan
47
// Added second testbench to simulate a complete system, including OR1200, wb_conbus, and onchipram.  Renamed sim-only testbench directory from verilog to simulated_system.
48
//
49
// Revision 1.1  2008/06/18 18:34:48  Nathan
50
// Initial working version.  Only Wishbone module implemented.  Simple testbench included, with CPU and Wishbone behavioral models from the old dbg_interface.
51
//
52
// Revision 1.1.1.1  2008/05/14 12:07:35  Nathan
53
// Original from OpenCores
54
//
55
// Revision 1.4  2004/03/28 20:27:40  igorm
56
// New release of the debug interface (3rd. release).
57
//
58
// Revision 1.3  2004/01/22 11:07:28  mohor
59
// test stall_test added.
60
//
61
// Revision 1.2  2004/01/17 18:01:31  mohor
62
// New version.
63
//
64
// Revision 1.1  2004/01/17 17:01:25  mohor
65
// Almost finished.
66
//
67
//
68
//
69
//
70
//
71
`include "timescale.v"
72
`include "dbg_cpu_defines.v"
73
 
74
 
75
 
76
module cpu_behavioral
77
                   (
78
                    // CPU signals
79
                    cpu_rst_i,
80
                    cpu_clk_o,
81
                    cpu_addr_i,
82
                    cpu_data_o,
83
                    cpu_data_i,
84
                    cpu_bp_o,
85
                    cpu_stall_i,
86
                    cpu_stb_i,
87
                    cpu_we_i,
88
                    cpu_ack_o,
89
                    cpu_rst_o
90
                   );
91
 
92
 
93
// CPU signals
94
input         cpu_rst_i;
95
output        cpu_clk_o;
96
input  [31:0] cpu_addr_i;
97
output [31:0] cpu_data_o;
98
input  [31:0] cpu_data_i;
99
output        cpu_bp_o;
100
input         cpu_stall_i;
101
input         cpu_stb_i;
102
input         cpu_we_i;
103
output        cpu_ack_o;
104
output        cpu_rst_o;
105
 
106
reg           cpu_clk_o;
107
reg    [31:0] cpu_data_o;
108
reg           cpu_bp_o;
109
reg           cpu_ack_o;
110
reg           cpu_ack_q;
111
wire          cpu_ack;
112
initial
113
begin
114
  cpu_clk_o = 1'b0;
115
  forever #5 cpu_clk_o = ~cpu_clk_o;
116
end
117
 
118
 
119
initial
120
begin
121
  cpu_bp_o = 1'b0;
122
end
123
 
124
assign #200 cpu_ack = cpu_stall_i & cpu_stb_i;
125
 
126
 
127
 
128
always @ (posedge cpu_clk_o or posedge cpu_rst_i)
129
begin
130
  if (cpu_rst_i)
131
    begin
132
      cpu_ack_o <= #1 1'b0;
133
      cpu_ack_q <= #1 1'b0;
134
    end
135
  else
136
    begin
137
      cpu_ack_o <= #1 cpu_ack;
138
      cpu_ack_q <= #1 cpu_ack_o;
139
    end
140
end
141
 
142
always @ (posedge cpu_clk_o or posedge cpu_rst_i)
143
begin
144
  if (cpu_rst_i)
145
    cpu_data_o <= #1 32'h12345678;
146
  else if (cpu_ack_o && (!cpu_ack_q))
147
    cpu_data_o <= #1 cpu_data_o + 32'h11111111;
148
end
149
 
150
 
151
 
152
 
153
endmodule
154
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.