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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [bench/] [sysc/] [src/] [OrpsocAccess.cpp] - Blame information for rev 63

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

Line No. Rev Author Line
1 6 julius
// ----------------------------------------------------------------------------
2
 
3
// Access functions for the ORPSoC Verilator model: implementation
4
 
5
// Copyright (C) 2008  Embecosm Limited <info@embecosm.com>
6
 
7
// Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
8 44 julius
// Contributor Julius Baxter <jb@orsoc.se>
9 6 julius
 
10
// This file is part of the cycle accurate model of the OpenRISC 1000 based
11
// system-on-chip, ORPSoC, built using Verilator.
12
 
13
// This program is free software: you can redistribute it and/or modify it
14
// under the terms of the GNU Lesser General Public License as published by
15
// the Free Software Foundation, either version 3 of the License, or (at your
16
// option) any later version.
17
 
18
// This program is distributed in the hope that it will be useful, but WITHOUT
19
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
21
// License for more details.
22
 
23
// You should have received a copy of the GNU Lesser General Public License
24
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
25
 
26
// ----------------------------------------------------------------------------
27
 
28
// $Id: OrpsocAccess.cpp 303 2009-02-16 11:20:17Z jeremy $
29
 
30
#include "OrpsocAccess.h"
31
 
32
#include "Vorpsoc_top.h"
33
#include "Vorpsoc_top_orpsoc_top.h"
34
#include "Vorpsoc_top_or1k_top.h"
35
#include "Vorpsoc_top_or1200_top.h"
36
#include "Vorpsoc_top_or1200_cpu.h"
37
#include "Vorpsoc_top_or1200_ctrl.h"
38 44 julius
#include "Vorpsoc_top_or1200_except.h"
39
#include "Vorpsoc_top_or1200_sprs.h"
40 6 julius
#include "Vorpsoc_top_or1200_rf.h"
41
#include "Vorpsoc_top_or1200_dpram.h"
42 51 julius
//#include "Vorpsoc_top_ram_wb.h"
43
//#include "Vorpsoc_top_ram_wb_sc_sw.h"
44 63 julius
#include "Vorpsoc_top_ram_wb__D20_A19_M800000.h"
45
#include "Vorpsoc_top_ram_wb_sc_sw__D20_A19_M800000.h"
46
#include "Vorpsoc_top_wb_conbus_top__pi1.h"
47 6 julius
 
48
//! Constructor for the ORPSoC access class
49
 
50
//! Initializes the pointers to the various module instances of interest
51
//! within the Verilator model.
52
 
53
//! @param[in] orpsoc  The SystemC Verilated ORPSoC instance
54
 
55
OrpsocAccess::OrpsocAccess (Vorpsoc_top *orpsoc_top)
56
{
57 63 julius
  // Assign processor accessor objects
58 6 julius
  or1200_ctrl = orpsoc_top->v->i_or1k->i_or1200_top->or1200_cpu->or1200_ctrl;
59 44 julius
  or1200_except = orpsoc_top->v->i_or1k->i_or1200_top->or1200_cpu->or1200_except;
60
  or1200_sprs = orpsoc_top->v->i_or1k->i_or1200_top->or1200_cpu->or1200_sprs;
61 6 julius
  rf_a        = orpsoc_top->v->i_or1k->i_or1200_top->or1200_cpu->or1200_rf->rf_a;
62 63 julius
  // Assign main memory accessor objects
63 51 julius
  ram_wb_sc_sw = orpsoc_top->v->ram_wb0->ram0;
64 63 julius
  // Assign arbiter accessor object
65
  wb_arbiter = orpsoc_top->v->wb_conbus;
66 6 julius
 
67
}       // OrpsocAccess ()
68
 
69 51 julius
//! Access for the ex_freeze signal
70 6 julius
 
71 51 julius
//! @return  The value of the or1200_ctrl.ex_freeze signal
72
 
73
bool
74
OrpsocAccess::getExFreeze ()
75
{
76
  return  or1200_ctrl->ex_freeze;
77
 
78
}       // getExFreeze ()
79
 
80 6 julius
//! Access for the wb_freeze signal
81
 
82
//! @return  The value of the or1200_ctrl.wb_freeze signal
83
 
84
bool
85
OrpsocAccess::getWbFreeze ()
86
{
87
  return  or1200_ctrl->wb_freeze;
88
 
89
}       // getWbFreeze ()
90
 
91 44 julius
//! Access for the except_flushpipe signal
92 6 julius
 
93 44 julius
//! @return  The value of the or1200_except.except_flushpipe signal
94
 
95
bool
96
OrpsocAccess::getExceptFlushpipe ()
97
{
98
  return  or1200_except->except_flushpipe;
99
 
100
}       // getExceptFlushpipe ()
101
 
102
//! Access for the ex_dslot signal
103
 
104
//! @return  The value of the or1200_except.ex_dslot signalfac
105
 
106
bool
107
OrpsocAccess::getExDslot ()
108
{
109
  return  or1200_except->ex_dslot;
110
 
111
}       // getExDslot ()
112
 
113 51 julius
//! Access for the except_type value
114
 
115
//! @return  The value of the or1200_except.except_type register
116
 
117
uint32_t
118
OrpsocAccess::getExceptType ()
119
{
120
  return  (or1200_except->get_except_type) ();
121
 
122
}       // getExceptType ()
123
 
124
 
125 49 julius
//! Access for the id_pc register
126
 
127
//! @return  The value of the or1200_except.id_pc register
128
 
129
uint32_t
130
OrpsocAccess::getIdPC ()
131
{
132
  return  (or1200_except->get_id_pc) ();
133
 
134
}       // getIdPC ()
135
 
136 51 julius
//! Access for the ex_pc register
137
 
138
//! @return  The value of the or1200_except.id_ex register
139
 
140
uint32_t
141
OrpsocAccess::getExPC ()
142
{
143
  return  (or1200_except->get_ex_pc) ();
144
 
145
}       // getExPC ()
146
 
147 44 julius
//! Access for the wb_pc register
148
 
149 49 julius
//! @return  The value of the or1200_except.wb_pc register
150 44 julius
 
151
uint32_t
152
OrpsocAccess::getWbPC ()
153
{
154
  return  (or1200_except->get_wb_pc) ();
155
 
156
}       // getWbPC ()
157
 
158 51 julius
//! Access for the id_insn register
159
 
160
//! @return  The value of the or1200_ctrl.wb_insn register
161
 
162
uint32_t
163
OrpsocAccess::getIdInsn ()
164
{
165
  return  (or1200_ctrl->get_id_insn) ();
166
 
167
}       // getIdInsn ()
168
 
169
//! Access for the ex_insn register
170
 
171
//! @return  The value of the or1200_ctrl.ex_insn register
172
 
173
uint32_t
174
OrpsocAccess::getExInsn ()
175
{
176
  return  (or1200_ctrl->get_ex_insn) ();
177
 
178
}       // getExInsn ()
179
 
180
 
181 6 julius
//! Access for the wb_insn register
182
 
183
//! @return  The value of the or1200_ctrl.wb_insn register
184
 
185
uint32_t
186
OrpsocAccess::getWbInsn ()
187
{
188
  return  (or1200_ctrl->get_wb_insn) ();
189
 
190
}       // getWbInsn ()
191
 
192 51 julius
//! Access the Wishbone SRAM memory
193 6 julius
 
194 51 julius
//! @return  The value of the memory word at addr
195 49 julius
 
196
uint32_t
197 51 julius
OrpsocAccess::get_mem (uint32_t addr)
198 49 julius
{
199 51 julius
  return  (ram_wb_sc_sw->get_mem) (addr);
200 49 julius
 
201 51 julius
}       // get_mem ()
202 49 julius
 
203 51 julius
//! Write value to the Wishbone SRAM memory
204
 
205
void
206
OrpsocAccess::set_mem (uint32_t addr, uint32_t data)
207
{
208
  (ram_wb_sc_sw->set_mem) (addr, data);
209
 
210
}       // set_mem ()
211
 
212
//! Trigger the $readmemh() system call
213
 
214
void
215
OrpsocAccess::do_ram_readmemh (void)
216
{
217
  (ram_wb_sc_sw->do_readmemh) ();
218
 
219
}       // do_ram_readmemh ()
220
 
221 6 julius
//! Access for the OR1200 GPRs
222
 
223
//! These are extracted from memory using the Verilog function
224
 
225
//! @param[in] regNum  The GPR whose value is wanted
226
 
227
//! @return            The value of the GPR
228
 
229
uint32_t
230
OrpsocAccess::getGpr (uint32_t  regNum)
231
{
232
  return  (rf_a->get_gpr) (regNum);
233
 
234
}       // getGpr ()
235 44 julius
 
236
 
237
//! Access for the sr register
238
 
239
//! @return  The value of the or1200_sprs.sr register
240
 
241
uint32_t
242
OrpsocAccess::getSprSr ()
243
{
244
  return  (or1200_sprs->get_sr) ();
245
 
246
}       // getSprSr ()
247
 
248
//! Access for the epcr register
249
 
250
//! @return  The value of the or1200_sprs.epcr register
251
 
252
uint32_t
253
OrpsocAccess::getSprEpcr ()
254
{
255
  return  (or1200_sprs->get_epcr) ();
256
 
257
}       // getSprEpcr ()
258
 
259
//! Access for the eear register
260
 
261
//! @return  The value of the or1200_sprs.eear register
262
 
263
uint32_t
264
OrpsocAccess::getSprEear ()
265
{
266
  return  (or1200_sprs->get_eear) ();
267
 
268
}       // getSprEear ()
269
 
270
//! Access for the esr register
271
 
272
//! @return  The value of the or1200_sprs.esr register
273
 
274
uint32_t
275
OrpsocAccess::getSprEsr ()
276
{
277
  return  (or1200_sprs->get_esr) ();
278
 
279
}       // getSprEsr ()
280
 
281 63 julius
 
282
//! Access for the arbiter's grant signal
283
 
284
//! @return  The value of the wb_conmax_top.arb signal
285
 
286
uint8_t
287
OrpsocAccess::getWbArbGrant ()
288
{
289
  return  (wb_arbiter->get_gnt) ();
290
 
291
}       // getWbArbGrant ()
292
 
293
 
294
//! Arbiter master[mast_num] access functions
295
 
296
//! Access for the arbiter's master[mast_num] data in signal
297
 
298
//! @return  The value of the wb_conmax_top.m_dat_i[mast_num]
299
 
300
uint32_t
301
OrpsocAccess::getWbArbMastDatI (uint32_t mast_num)
302
{
303
  return  (wb_arbiter->get_m_dat_i) (mast_num);
304
 
305
}       // getWbArbMastDatI ()
306
 
307
//! Access for the arbiter's master[mast_num] data out signal
308
 
309
//! @return  The value of the wb_conmax_top.m_dat_o[mast_num]
310
 
311
uint32_t
312
OrpsocAccess::getWbArbMastDatO (uint32_t mast_num)
313
{
314
  return  (wb_arbiter->get_m_dat_o) (mast_num);
315
 
316
}       // getWbArbMastDatO ()
317
 
318
//! Access for the arbiter's master[mast_num] data out
319
 
320
//! @return  The value of the wb_conmax_top.m_adr_i[mast_num]
321
 
322
uint32_t
323
OrpsocAccess::getWbArbMastAdrI (uint32_t mast_num)
324
{
325
  return  (wb_arbiter->get_m_adr_i) (mast_num);
326
 
327
}       // getWbArbMastAdrI ()
328
 
329
 
330
//! Access for the arbiter's master[mast_num] select signal
331
 
332
//! @return  The value of the wb_conmax_top.m_sel_i[mast_num]
333
 
334
uint8_t
335
OrpsocAccess::getWbArbMastSelI (uint32_t mast_num)
336
{
337
  return  (wb_arbiter->get_m_sel_i) (mast_num);
338
 
339
}       // getWbArbMastSelI ()
340
 
341
//! Access for the arbiter's master[mast_num] decoded slave select signal
342
 
343
//! @return  The value of the wb_conmax_top.m_ssel_dec[mast_num]
344
 
345
uint8_t
346
OrpsocAccess::getWbArbMastSlaveSelDecoded (uint32_t mast_num)
347
{
348
  return  (wb_arbiter->get_m_ssel_dec) (mast_num);
349
 
350
}       // getWbArbMastSlaveSelDecoded ()
351
 
352
//! Access for the arbiter's master[mast_num] write enable signal
353
 
354
//! @return  The value of the wb_conmax_top.m_we_i[mast_num]
355
 
356
bool
357
OrpsocAccess::getWbArbMastWeI (uint32_t mast_num)
358
{
359
  return  (wb_arbiter->get_m_we_i) (mast_num);
360
 
361
}       // getWbArbMastWeI ()
362
 
363
//! Access for the arbiter's master[mast_num] cycle input signal
364
 
365
//! @return  The value of the wb_conmax_top.m_cyc_i[mast_num]
366
 
367
bool
368
OrpsocAccess::getWbArbMastCycI (uint32_t mast_num)
369
{
370
  return  (wb_arbiter->get_m_cyc_i) (mast_num);
371
 
372
}       // getWbArbMastCycI ()
373
 
374
//! Access for the arbiter's master[mast_num] strobe input signal
375
 
376
//! @return  The value of the wb_conmax_top.m_stb_i[mast_num]
377
 
378
bool
379
OrpsocAccess::getWbArbMastStbI (uint32_t mast_num)
380
{
381
  return  (wb_arbiter->get_m_stb_i) (mast_num);
382
 
383
}       // getWbArbMastStbI ()
384
 
385
//! Access for the arbiter's master[mast_num] ACK output signal
386
 
387
//! @return  The value of the wb_conmax_top.m_ack_o[mast_num]
388
 
389
bool
390
OrpsocAccess::getWbArbMastAckO (uint32_t mast_num)
391
{
392
  return  (wb_arbiter->get_m_ack_o) (mast_num);
393
 
394
}       // getWbArbMastAckO ()
395
 
396
//! Access for the arbiter's master[mast_num] error input signal
397
 
398
//! @return  The value of the wb_conmax_top.m_err_o[mast_num]
399
 
400
bool
401
OrpsocAccess::getWbArbMastErrO (uint32_t mast_num)
402
{
403
  return  (wb_arbiter->get_m_err_o) (mast_num);
404
 
405
}       // getWbArbMastErrO ()
406
 

powered by: WebSVN 2.1.0

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