Otawa  0.10
CacheConfiguration.h
Go to the documentation of this file.
1 /*
2  * $Id$
3  * CacheConfiguration class interface
4  *
5  * This file is part of OTAWA
6  * Copyright (c) 2005-10, IRIT UPS.
7  *
8  * OTAWA is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * OTAWA is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with OTAWA; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 #ifndef OTAWA_HARD_CONFIGURATION_CACHE_H
23 #define OTAWA_HARD_CONFIGURATION_CACHE_H
24 
25 #include <otawa/hard/Cache.h>
26 #include <elm/system/Path.h>
28 #include <otawa/proc/Accessor.h>
29 
30 namespace elm { namespace xom {
31  class Element;
32 } } // elm::xom
33 
34 namespace otawa { namespace hard {
35 
36 // CacheConfiguration class
38  SERIALIZABLE(CacheConfiguration, FIELD(icache) & FIELD(dcache));
39 public:
41  static CacheConfiguration *load(elm::xom::Element *element);
42  static CacheConfiguration *load(const elm::system::Path& path);
43 
44  inline CacheConfiguration(const Cache *inst_cache = 0, const Cache *data_cache = 0);
45  virtual ~CacheConfiguration(void);
46 
47  inline const Cache *instCache(void) const { return icache; }
48  inline const Cache *dataCache(void) const { return dcache; }
49  inline bool hasInstCache(void) const { return icache != 0; }
50  inline bool hasDataCache(void) const { return dcache != 0; }
51  inline bool isUnified(void) const { return icache == dcache; }
52  inline bool isHarvard(void) const { return icache != dcache; }
53  string cacheName(const Cache *cache) const;
54 
55 protected:
56  const Cache *icache, *dcache;
57 
58 };
59 
60 
61 // features
66 
67 } } // otawa::hard
68 
69 #endif // OTAWA_HARD_CONFIGURATION_CACHE_H
The usual Feature class has as drawback to exhibit completely the processing of the feature and there...
Definition: SilentFeature.h:32
const Cache * dcache
Definition: CacheConfiguration.h:56
SERIALIZABLE(CacheConfiguration, FIELD(icache)&FIELD(dcache))
const Cache * icache
Definition: CacheConfiguration.h:56
static const CacheConfiguration NO_CACHE
Useful constant representing a configuration without cache.
Definition: CacheConfiguration.h:40
SilentFeature CACHE_CONFIGURATION_FEATURE
This feature ensures we have obtained the cache configuration of the system.
bool isHarvard(void) const
Check if the cache follows the Harvard architecture.
Definition: CacheConfiguration.h:52
This class contains the configuration of a level of cache of processor.
Definition: Cache.h:34
virtual ~CacheConfiguration(void)
Definition: hardware_CacheConfiguration.cpp:132
const Cache * dataCache(void) const
Get the data cache.
Definition: CacheConfiguration.h:48
CacheConfiguration(const Cache *inst_cache=0, const Cache *data_cache=0)
Build a new configuration from the passed cache.
Definition: hardware_CacheConfiguration.cpp:126
StringOption cache(command, 'c',"cache","used cache","path","")
string cacheName(const Cache *cache) const
Compute name of the cache.
Definition: hardware_CacheConfiguration.cpp:141
bool isUnified(void) const
Check if the cache ois unified.
Definition: CacheConfiguration.h:51
const Cache * instCache(void) const
Get the instruction cache.
Definition: CacheConfiguration.h:47
This class represents identifier with a typed associated value.
Definition: Identifier.h:51
static CacheConfiguration * load(elm::xom::Element *element)
Load a cache configuration from the given element.
Definition: hardware_CacheConfiguration.cpp:87
FunAccessor< const Cache * > L1_ICACHE
Accessor on the instruction cache L1.
bool hasInstCache(void) const
Check if some instruction is available (in a harvard or an unified architecture). ...
Definition: CacheConfiguration.h:49
Identifier< const CacheConfiguration * > CACHE_CONFIGURATION
Current configuration.
Definition: Accessor.h:44
FunAccessor< const Cache * > L1_DCACHE
Accessor on the data cache L1.
This class represents the full configuration of caches of a processor.
Definition: CacheConfiguration.h:37
bool hasDataCache(void) const
Check if some data is available (in a harvard or an unified architecture).
Definition: CacheConfiguration.h:50