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

Subversion Repositories or1k

[/] [or1k/] [branches/] [mp3_stable/] [mp3/] [bench/] [verilog/] [dbg_comm.v] - Blame information for rev 266

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

Line No. Rev Author Line
1 266 lampret
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  File_communication.v                                        ////
4
////                                                              ////
5
////                                                              ////
6
////  This file is part of the SoC/OpenRISC Development Interface ////
7
////  http://www.opencores.org/cores/DebugInterface/              ////
8
////                                                              ////
9
////                                                              ////
10
////  Author(s):                                                  ////
11
////       Igor Mohor                                             ////
12
////       igorm@opencores.org                                    ////
13
////                                                              ////
14
////                                                              ////
15
////  All additional information is avaliable in the README.txt   ////
16
////  file.                                                       ////
17
////                                                              ////
18
//////////////////////////////////////////////////////////////////////
19
////                                                              ////
20
//// Copyright (C) 2000,2001 Authors                              ////
21
////                                                              ////
22
//// This source file may be used and distributed without         ////
23
//// restriction provided that this copyright statement is not    ////
24
//// removed from the file and that any derivative work contains  ////
25
//// the original copyright notice and the associated disclaimer. ////
26
////                                                              ////
27
//// This source file is free software; you can redistribute it   ////
28
//// and/or modify it under the terms of the GNU Lesser General   ////
29
//// Public License as published by the Free Software Foundation; ////
30
//// either version 2.1 of the License, or (at your option) any   ////
31
//// later version.                                               ////
32
////                                                              ////
33
//// This source is distributed in the hope that it will be       ////
34
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
35
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
36
//// PURPOSE.  See the GNU Lesser General Public License for more ////
37
//// details.                                                     ////
38
////                                                              ////
39
//// You should have received a copy of the GNU Lesser General    ////
40
//// Public License along with this source; if not, download it   ////
41
//// from http://www.opencores.org/lgpl.shtml                     ////
42
////                                                              ////
43
//////////////////////////////////////////////////////////////////////
44
//
45
// CVS Revision History
46
//
47
// $Log: not supported by cvs2svn $
48
// Revision 1.3  2001/09/24 14:06:13  mohor
49
// Changes connected to the OpenRISC access (SPR read, SPR write).
50
//
51
// Revision 1.2  2001/09/20 10:10:30  mohor
52
// Working version. Few bugs fixed, comments added.
53
//
54
// Revision 1.1.1.1  2001/09/13 13:49:19  mohor
55
// Initial official release.
56
//
57
//
58
//
59
//
60
//
61
 
62
`ifdef DBG_IF_COMM
63
 
64
`include "timescale.v"
65
`include "dbg_defines.v"
66
`include "dbg_tb_defines.v"
67
 
68
`define GDB_IN  "/projects/xess-damjan/sim/run/gdb_in.dat"
69
`define GDB_OUT "/projects/xess-damjan/sim/run/gdb_out.dat"
70
//`define GDB_IN        "/tmp/gdb_in.dat"
71
//`define GDB_OUT       "/tmp/gdb_out.dat"
72
//`define GDB_IN        "../src/gdb_in.dat"
73
//`define GDB_OUT       "../src/gdb_out.dat"
74
 
75
module dbg_comm(P_TMS, P_TCK, P_TRST, P_TDI, P_TDO);
76
 
77
parameter Tp = 1;
78
 
79
output          P_TMS;
80
output          P_TCK;
81
output          P_TRST;
82
output          P_TDI;
83
input           P_TDO;
84
 
85
integer handle1, handle2;
86
reg [4:0] memory[0:0];
87
reg Mclk;
88
reg wb_rst_i;
89
 
90
reg alternator;
91
 
92
reg StartTesting;
93
wire P_TCK;
94
wire P_TRST;
95
wire P_TDI;
96
wire P_TMS;
97
wire P_TDO;
98
 
99
reg [3:0] in_word_r;
100
wire [4:0] in_word;
101
wire [3:0] Temp;
102
 
103
initial
104
begin
105
  alternator = 0;
106
  StartTesting = 0;
107
  wb_rst_i = 0;
108
  #500;
109
  wb_rst_i = 1;
110
  #500;
111
  wb_rst_i = 0;
112
 
113
  #2000;
114
  StartTesting = 1;
115
  $display("StartTesting = 1");
116
 
117
 
118
end
119
 
120
initial
121
begin
122
  wait(StartTesting);
123
  while(1)
124
  begin
125
    #1;
126
    $readmemh(`GDB_OUT, memory);
127
    //#1000;
128
    if(!(memory[0] & 5'b10000))
129
    begin
130
      handle1 = $fopen(`GDB_OUT);
131
      $fwrite(handle1, "%h", 5'b10000 | memory[0]);  // To ack to jp1 that we read dgb_out.dat
132
      $fclose(handle1);
133
    end
134
  end
135
end
136
 
137
assign in_word = memory[0];
138
assign Temp = in_word_r;
139
 
140
always @ (posedge in_word[4] or posedge wb_rst_i)
141
begin
142
  if(wb_rst_i)
143
    in_word_r<=#Tp 5'b0;
144
  else
145
    in_word_r<=#Tp in_word[3:0];
146
end
147
 
148
 
149
//always alternator = #100 ~alternator;
150
 
151
always @ (posedge P_TCK or alternator)
152
begin
153
  handle2 = $fopen(`GDB_IN);
154
  $fdisplay(handle2, "%b", P_TDO);  // Vriting output data to file (TDO)
155
  $fclose(handle2);
156
end
157
 
158
 
159
assign P_TCK  = Temp[0];
160
assign P_TRST = Temp[1];
161
assign P_TDI  = Temp[2];
162
assign P_TMS  = Temp[3];
163
 
164
 
165
 
166
// Generating master clock (RISC clock) 10 MHz
167
initial
168
begin
169
  Mclk<=#Tp 0;
170
  #1 forever #`RISC_CLOCK Mclk<=~Mclk;
171
end
172
 
173
// Generating random number for use in DATAOUT_RISC[31:0]
174
reg [31:0] RandNumb;
175
always @ (posedge Mclk or posedge wb_rst_i)
176
begin
177
  if(wb_rst_i)
178
    RandNumb[31:0]<=#Tp 0;
179
  else
180
    RandNumb[31:0]<=#Tp RandNumb[31:0] + 1;
181
end
182
 
183
wire [31:0] DataIn = RandNumb;
184
 
185
// Connecting dbgTAP module
186
`ifdef UNUSED
187
dbg_top dbg1  (.tms_pad_i(P_TMS), .tck_pad_i(P_TCK), .trst_pad_i(P_TRST), .tdi_pad_i(P_TDI), .tdo_pad_o(P_TDO),
188
               .wb_rst_i(wb_rst_i), .risc_clk_i(Mclk), .risc_addr_o(), .risc_data_i(DataIn),
189
               .risc_data_o(), .wp_i(11'h0), .bp_i(1'b0),
190
               .opselect_o(), .lsstatus_i(4'h0), .istatus_i(2'h0),
191
               .risc_stall_o(), .reset_o()
192
              );
193
`endif
194
 
195
endmodule // TAP
196
 
197
`endif

powered by: WebSVN 2.1.0

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