1 |
6 |
julius |
// ----------------------------------------------------------------------------
|
2 |
|
|
|
3 |
|
|
// Access functions for the ORPSoC Verilator model: definition
|
4 |
|
|
|
5 |
|
|
// Copyright (C) 2008 Embecosm Limited <info@embecosm.com>
|
6 |
|
|
|
7 |
|
|
// Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
|
8 |
|
|
|
9 |
|
|
// This file is part of the cycle accurate model of the OpenRISC 1000 based
|
10 |
|
|
// system-on-chip, ORPSoC, built using Verilator.
|
11 |
|
|
|
12 |
|
|
// This program is free software: you can redistribute it and/or modify it
|
13 |
|
|
// under the terms of the GNU Lesser General Public License as published by
|
14 |
|
|
// the Free Software Foundation, either version 3 of the License, or (at your
|
15 |
|
|
// option) any later version.
|
16 |
|
|
|
17 |
|
|
// This program is distributed in the hope that it will be useful, but WITHOUT
|
18 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
19 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
20 |
|
|
// License for more details.
|
21 |
|
|
|
22 |
|
|
// You should have received a copy of the GNU Lesser General Public License
|
23 |
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
24 |
|
|
|
25 |
|
|
// ----------------------------------------------------------------------------
|
26 |
|
|
|
27 |
|
|
// $Id: OrpsocAccess.h 303 2009-02-16 11:20:17Z jeremy $
|
28 |
|
|
|
29 |
|
|
#ifndef ORPSOC_ACCESS__H
|
30 |
|
|
#define ORPSOC_ACCESS__H
|
31 |
|
|
|
32 |
|
|
#include <stdint.h>
|
33 |
862 |
stekern |
#define wishbone_ram orpsoc_top->v->ram_wb0->ram_wb_b3_0
|
34 |
6 |
julius |
|
35 |
|
|
class Vorpsoc_top;
|
36 |
|
|
class Vorpsoc_top_orpsoc_top;
|
37 |
|
|
class Vorpsoc_top_or1200_ctrl;
|
38 |
44 |
julius |
class Vorpsoc_top_or1200_except;
|
39 |
|
|
class Vorpsoc_top_or1200_sprs;
|
40 |
6 |
julius |
class Vorpsoc_top_or1200_dpram;
|
41 |
353 |
julius |
// Main memory access class - will change if main memory size or other
|
42 |
|
|
// parameters change
|
43 |
|
|
//Old ram_wbclass: class Vorpsoc_top_ram_wb_sc_sw__D20_A19_M800000;
|
44 |
439 |
julius |
//class Vorpsoc_top_wb_ram_b3__D20_A17_M800000;
|
45 |
|
|
class Vorpsoc_top_ram_wb_b3__pi3;
|
46 |
63 |
julius |
// SoC Arbiter class - will also change if any modifications to bus architecture
|
47 |
362 |
julius |
//class Vorpsoc_top_wb_conbus_top__pi1;
|
48 |
6 |
julius |
|
49 |
|
|
//! Access functions to the Verilator model
|
50 |
|
|
|
51 |
|
|
//! This class encapsulates access to the Verilator model, allowing other
|
52 |
|
|
//! Classes to access model state, without needing to be built within the
|
53 |
|
|
//! Verilator environment.
|
54 |
462 |
julius |
class OrpsocAccess {
|
55 |
6 |
julius |
public:
|
56 |
|
|
|
57 |
462 |
julius |
// Constructor
|
58 |
|
|
OrpsocAccess(Vorpsoc_top * orpsoc_top);
|
59 |
6 |
julius |
|
60 |
462 |
julius |
// Accessor functions
|
61 |
|
|
bool getExFreeze();
|
62 |
|
|
bool getWbFreeze();
|
63 |
|
|
uint32_t getWbInsn();
|
64 |
|
|
uint32_t getIdInsn();
|
65 |
|
|
uint32_t getExInsn();
|
66 |
|
|
uint32_t getWbPC();
|
67 |
|
|
uint32_t getIdPC();
|
68 |
|
|
uint32_t getExPC();
|
69 |
|
|
bool getExceptFlushpipe();
|
70 |
|
|
bool getExDslot();
|
71 |
|
|
uint32_t getExceptType();
|
72 |
|
|
// Get a specific GPR from the register file
|
73 |
|
|
uint32_t getGpr(uint32_t regNum);
|
74 |
|
|
void setGpr(uint32_t regNum, uint32_t value);
|
75 |
|
|
//SPR accessessors
|
76 |
|
|
uint32_t getSprSr();
|
77 |
|
|
uint32_t getSprEpcr();
|
78 |
|
|
uint32_t getSprEear();
|
79 |
|
|
uint32_t getSprEsr();
|
80 |
6 |
julius |
|
81 |
462 |
julius |
// Wishbone SRAM accessor functions
|
82 |
|
|
uint32_t get_mem32(uint32_t addr);
|
83 |
|
|
uint8_t get_mem8(uint32_t addr);
|
84 |
66 |
julius |
|
85 |
462 |
julius |
void set_mem32(uint32_t addr, uint32_t data);
|
86 |
|
|
// Trigger a $readmemh for the RAM array
|
87 |
|
|
void do_ram_readmemh(void);
|
88 |
|
|
/*
|
89 |
|
|
// Arbiter access functions
|
90 |
|
|
uint8_t getWbArbGrant ();
|
91 |
|
|
// Master Signal Access functions
|
92 |
|
|
uint32_t getWbArbMastDatI (uint32_t mast_num);
|
93 |
|
|
uint32_t getWbArbMastDatO (uint32_t mast_num);
|
94 |
|
|
uint32_t getWbArbMastAdrI (uint32_t mast_num);
|
95 |
|
|
uint8_t getWbArbMastSelI (uint32_t mast_num);
|
96 |
|
|
uint8_t getWbArbMastSlaveSelDecoded (uint32_t mast_num);
|
97 |
|
|
bool getWbArbMastWeI (uint32_t mast_num);
|
98 |
|
|
bool getWbArbMastCycI (uint32_t mast_num);
|
99 |
|
|
bool getWbArbMastStbI (uint32_t mast_num);
|
100 |
|
|
bool getWbArbMastAckO (uint32_t mast_num);
|
101 |
|
|
bool getWbArbMastErrO (uint32_t mast_num);
|
102 |
|
|
*/
|
103 |
63 |
julius |
|
104 |
6 |
julius |
private:
|
105 |
|
|
|
106 |
462 |
julius |
// Pointers to modules with accessor functions
|
107 |
|
|
Vorpsoc_top_or1200_ctrl * or1200_ctrl;
|
108 |
|
|
Vorpsoc_top_or1200_except *or1200_except;
|
109 |
|
|
Vorpsoc_top_or1200_sprs *or1200_sprs;
|
110 |
|
|
Vorpsoc_top_or1200_dpram *rf_a;
|
111 |
862 |
stekern |
Vorpsoc_top *orpsoc_top;
|
112 |
462 |
julius |
}; // OrpsocAccess ()
|
113 |
6 |
julius |
|
114 |
462 |
julius |
#endif // ORPSOC_ACCESS__H
|