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

Subversion Repositories openrisc

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

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
 
43
//! Constructor for the ORPSoC access class
44
 
45
//! Initializes the pointers to the various module instances of interest
46
//! within the Verilator model.
47
 
48
//! @param[in] orpsoc  The SystemC Verilated ORPSoC instance
49
 
50
OrpsocAccess::OrpsocAccess (Vorpsoc_top *orpsoc_top)
51
{
52
  or1200_ctrl = orpsoc_top->v->i_or1k->i_or1200_top->or1200_cpu->or1200_ctrl;
53 44 julius
  or1200_except = orpsoc_top->v->i_or1k->i_or1200_top->or1200_cpu->or1200_except;
54
  or1200_sprs = orpsoc_top->v->i_or1k->i_or1200_top->or1200_cpu->or1200_sprs;
55 6 julius
  rf_a        = orpsoc_top->v->i_or1k->i_or1200_top->or1200_cpu->or1200_rf->rf_a;
56
 
57
}       // OrpsocAccess ()
58
 
59
 
60
//! Access for the wb_freeze signal
61
 
62
//! @return  The value of the or1200_ctrl.wb_freeze signal
63
 
64
bool
65
OrpsocAccess::getWbFreeze ()
66
{
67
  return  or1200_ctrl->wb_freeze;
68
 
69
}       // getWbFreeze ()
70
 
71 44 julius
//! Access for the except_flushpipe signal
72 6 julius
 
73 44 julius
//! @return  The value of the or1200_except.except_flushpipe signal
74
 
75
bool
76
OrpsocAccess::getExceptFlushpipe ()
77
{
78
  return  or1200_except->except_flushpipe;
79
 
80
}       // getExceptFlushpipe ()
81
 
82
//! Access for the ex_dslot signal
83
 
84
//! @return  The value of the or1200_except.ex_dslot signalfac
85
 
86
bool
87
OrpsocAccess::getExDslot ()
88
{
89
  return  or1200_except->ex_dslot;
90
 
91
}       // getExDslot ()
92
 
93 49 julius
//! Access for the id_pc register
94
 
95
//! @return  The value of the or1200_except.id_pc register
96
 
97
uint32_t
98
OrpsocAccess::getIdPC ()
99
{
100
  return  (or1200_except->get_id_pc) ();
101
 
102
}       // getIdPC ()
103
 
104 44 julius
//! Access for the wb_pc register
105
 
106 49 julius
//! @return  The value of the or1200_except.wb_pc register
107 44 julius
 
108
uint32_t
109
OrpsocAccess::getWbPC ()
110
{
111
  return  (or1200_except->get_wb_pc) ();
112
 
113
}       // getWbPC ()
114
 
115 6 julius
//! Access for the wb_insn register
116
 
117
//! @return  The value of the or1200_ctrl.wb_insn register
118
 
119
uint32_t
120
OrpsocAccess::getWbInsn ()
121
{
122
  return  (or1200_ctrl->get_wb_insn) ();
123
 
124
}       // getWbInsn ()
125
 
126 49 julius
//! Access for the id_insn register
127 6 julius
 
128 49 julius
//! @return  The value of the or1200_ctrl.wb_insn register
129
 
130
uint32_t
131
OrpsocAccess::getIdInsn ()
132
{
133
  return  (or1200_ctrl->get_id_insn) ();
134
 
135
}       // getIdInsn ()
136
 
137 6 julius
//! Access for the OR1200 GPRs
138
 
139
//! These are extracted from memory using the Verilog function
140
 
141
//! @param[in] regNum  The GPR whose value is wanted
142
 
143
//! @return            The value of the GPR
144
 
145
uint32_t
146
OrpsocAccess::getGpr (uint32_t  regNum)
147
{
148
  return  (rf_a->get_gpr) (regNum);
149
 
150
}       // getGpr ()
151 44 julius
 
152
 
153
//! Access for the sr register
154
 
155
//! @return  The value of the or1200_sprs.sr register
156
 
157
uint32_t
158
OrpsocAccess::getSprSr ()
159
{
160
  return  (or1200_sprs->get_sr) ();
161
 
162
}       // getSprSr ()
163
 
164
//! Access for the epcr register
165
 
166
//! @return  The value of the or1200_sprs.epcr register
167
 
168
uint32_t
169
OrpsocAccess::getSprEpcr ()
170
{
171
  return  (or1200_sprs->get_epcr) ();
172
 
173
}       // getSprEpcr ()
174
 
175
//! Access for the eear register
176
 
177
//! @return  The value of the or1200_sprs.eear register
178
 
179
uint32_t
180
OrpsocAccess::getSprEear ()
181
{
182
  return  (or1200_sprs->get_eear) ();
183
 
184
}       // getSprEear ()
185
 
186
//! Access for the esr register
187
 
188
//! @return  The value of the or1200_sprs.esr register
189
 
190
uint32_t
191
OrpsocAccess::getSprEsr ()
192
{
193
  return  (or1200_sprs->get_esr) ();
194
 
195
}       // getSprEsr ()
196
 

powered by: WebSVN 2.1.0

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