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

Subversion Repositories openrisc

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

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
//! Access for the wb_pc register
94
 
95
//! @return  The value of the or1200_except.wb_insn register
96
 
97
uint32_t
98
OrpsocAccess::getWbPC ()
99
{
100
  return  (or1200_except->get_wb_pc) ();
101
 
102
}       // getWbPC ()
103
 
104 6 julius
//! Access for the wb_insn register
105
 
106
//! @return  The value of the or1200_ctrl.wb_insn register
107
 
108
uint32_t
109
OrpsocAccess::getWbInsn ()
110
{
111
  return  (or1200_ctrl->get_wb_insn) ();
112
 
113
}       // getWbInsn ()
114
 
115
 
116
//! Access for the OR1200 GPRs
117
 
118
//! These are extracted from memory using the Verilog function
119
 
120
//! @param[in] regNum  The GPR whose value is wanted
121
 
122
//! @return            The value of the GPR
123
 
124
uint32_t
125
OrpsocAccess::getGpr (uint32_t  regNum)
126
{
127
  return  (rf_a->get_gpr) (regNum);
128
 
129
}       // getGpr ()
130 44 julius
 
131
 
132
//! Access for the sr register
133
 
134
//! @return  The value of the or1200_sprs.sr register
135
 
136
uint32_t
137
OrpsocAccess::getSprSr ()
138
{
139
  return  (or1200_sprs->get_sr) ();
140
 
141
}       // getSprSr ()
142
 
143
//! Access for the epcr register
144
 
145
//! @return  The value of the or1200_sprs.epcr register
146
 
147
uint32_t
148
OrpsocAccess::getSprEpcr ()
149
{
150
  return  (or1200_sprs->get_epcr) ();
151
 
152
}       // getSprEpcr ()
153
 
154
//! Access for the eear register
155
 
156
//! @return  The value of the or1200_sprs.eear register
157
 
158
uint32_t
159
OrpsocAccess::getSprEear ()
160
{
161
  return  (or1200_sprs->get_eear) ();
162
 
163
}       // getSprEear ()
164
 
165
//! Access for the esr register
166
 
167
//! @return  The value of the or1200_sprs.esr register
168
 
169
uint32_t
170
OrpsocAccess::getSprEsr ()
171
{
172
  return  (or1200_sprs->get_esr) ();
173
 
174
}       // getSprEsr ()
175
 

powered by: WebSVN 2.1.0

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