VirtualComponentInterface.h
7.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
//=========================================================
// Copyright 2001 VAutomation Inc. Nashua NH USA. All rights reserved.
// This software is provided under license and contains proprietary
// and confidential material which is the property of VAutomation Inc.
// HTTP://www.vautomation.com
//==========================================================
//
// Class Name: CVirtualComponentInterface
// Author:
// Company: VAutomation An Arc Cores Company
// Date created: 2/01/2001 at 9:46
//
//
//==========================================================
//
// Notes: This file should not modified. It is designed to
// compile under a wide range of compilers and any addtional
// dependencies may defeat the purpose of its structure.
//
//
//
//==========================================================
#ifndef __CVIRTUALCOMPONENTINTERFACE__
#define __CVIRTUALCOMPONENTINTERFACE__
//=========================================================
// Member Varible Includes
//=========================================================
//=========================================================
// HEADER INCLUDE FILE SECTION
//=========================================================
#include "DataTypes.h"
//=========================================================
// TYPES
//=========================================================
//=========================================================
//These device types are used to direct the BFM signal connections in the simulation.
//The BFM will use these types to figure out what types of signals need to be connected to
//to send and receive data from the CVirtualComponentInterface object and/or if memory will
//with a slave interface will need to be modeled.
//
// Note 1) When this is used with an embedded processor implementation the bus types are ignored since
// the software typically has no concept of underlying bus architecture. That is, when
// this CVirtualComponentInterface wrapper is implemented for an embedded processor
// this type is ignored for the most part.
//=========================================================
enum VCDeviceType{
BVCI_INITIATOR,
BVCI_TARGET, //Should not be used for embedded processor code
BVCI_TARGET_CONNECTED_TO_HOST_MEMORY_DEVICE,
BVCI_TARGET_CONNECTED_TO_DMA_DEVICE,
AMBA_AHB_MASTER,
AMBA_AHB_SLAVE, //Should not be used for embedded processor code
AMBA_AHB_SLAVE_CONNECTED_TO_HOST_MEMORY_DEVICE,
AMBA_AHB_SLAVE_CONNECTED_TO_DMA_DEVICE,
AMBA_APB_MASTER,
AMBA_APB_SLAVE, //Should not be used for embedded processor code
AMBA_APB_SLAVE_CONNECTED_TO_HOST_MEMORY_DEVICE,
AMBA_APB_SLAVE_CONNECTED_TO_DMA_DEVICE,
DIGITAL_OUTPUT_32BIT,
DIGITAL_INPUT_32BIT, //Should not be used for embedded processor code
DIGITAL_OUTPUT_8BIT,
DIGITAL_INPUT_8BIT //Should not be used for embedded processor code
};
//=========================================================
// FUNCTIONS TYPES
//=========================================================
//=========================================================
// These functions are used to handle slave or target accesses in the absence of a memory model typically.
// These callbacks should not be used for embedded processor code since an embedded processor has no
// concept of memory access detection. These function types are used strictly for BFM simulations where the
// concept of a memory is absent. For example, these functions may do data score boarding for read and write
// operations.
//=========================================================
typedef bool ReadOperationCallbackType( const char* source_id_str, const AddressType& address, UnSignedLong &data );
typedef bool WriteOperationCallbackType( const char* source_id_str, const AddressType& address, const UnSignedLong &data );
//=========================================================
//
// Class Comments:
//
// This class is used as a wrapper for memory accesses to a particular interface in a system. The intent of
// the implementation is to segment accesses for a particular peripheral in the system. The wrapper provides
// an interface that will direct traffic to another hardware interface in the system. For example, an object
// of this class type might implement an interface for accesses to a BVCI target on a particular device in
// the system using a BVCI_INITIATOR as a device type.
//
// The separation of the interfaces allows the use of bus functional models in simulation. The abstract
// concept of a connection to a remote interface is made using a class interface. The implementation
// of this class provides a connection to another interface in the system.
//
//
//
// Public function comments:
//
// Create - This must be call before any other function is called.
//
// WriteBuffer - Transfers data from the source location to the destination location like memcpy,
// destination address is typically an address of a device interface when writing emmbeded processor code.
//
// ReadBuffer - Transfers data from the source location to the destination location like memcpy,
// source addressis typically an address of a device interface when writing emmbeded processor code.
//
// DeviceGetName - Get the device name passed in at creation time. This name is useful for error and status messages.
//
// SetCallbacks, SetAttribute, GetAttribute are functions used for code that will not be re-hosted to a processor.
//
// Private function comments:
//
//
// Protected function comments:
//
//
//=========================================================
class CVirtualComponentInterface
{
public:
// Member functions used in both simulation and embedded prcessor implimentations.
bool Create( char *device_name, VCDeviceType device_type );
bool WriteBuffer( const AddressType& dest_address, const AddressType& src_address, const UnSignedLong& byte_count , const bool asynchronous_operation=false);
bool ReadBuffer( const AddressType& dest_address, const AddressType& src_address, const UnSignedLong& byte_count, const bool asynchronous_operation=false);
const char *DeviceGetName();
//Member functions used when embedded processor re-hosting is not needed.
bool SetCallbacks( ReadOperationCallbackType *read_func, WriteOperationCallbackType *write_func );
bool SetAttribute( char* attribute_name, char* value );
bool GetAttribute( char* attribute_name, char* value );
// Member functions default overrides
CVirtualComponentInterface( ); // Default constructor
virtual ~CVirtualComponentInterface( ); // Destructor
// Operator Members
// GetCopy Member Functions
// Set Member Functions
public:
// Member varibles
private:
// Member functions
private:
// Member varibles
VCDeviceType m_device_type; // The type of interface this object will impliment.
void *m_internal_info_pointer; //Internal information that is hidden in the implimentation.
protected:
// Member functions
protected:
// Member varibles
public:
// Friend functions
};
#endif
//=========================================================