| 1 | #ifndef ENVIRONNEMENT_CACHE_CACHE_MULTILEVEL_PARAMETERS_H |
|---|
| 2 | #define ENVIRONNEMENT_CACHE_CACHE_MULTILEVEL_PARAMETERS_H |
|---|
| 3 | |
|---|
| 4 | #include <iostream> |
|---|
| 5 | #include <math.h> |
|---|
| 6 | |
|---|
| 7 | #include "Cache_OneLevel_Parameters.h" |
|---|
| 8 | |
|---|
| 9 | namespace environnement { |
|---|
| 10 | namespace cache { |
|---|
| 11 | namespace cache_multilevel { |
|---|
| 12 | |
|---|
| 13 | class Parameters |
|---|
| 14 | { |
|---|
| 15 | public : uint32_t nb_level ; |
|---|
| 16 | public : uint32_t nb_port ; |
|---|
| 17 | |
|---|
| 18 | public : cache_onelevel::Parameters ** param_cache; |
|---|
| 19 | |
|---|
| 20 | public : Parameters (uint32_t nb_level , |
|---|
| 21 | uint32_t nb_port , |
|---|
| 22 | uint32_t * nb_line , |
|---|
| 23 | uint32_t * size_line , |
|---|
| 24 | uint32_t * size_word , |
|---|
| 25 | uint32_t * associativity, |
|---|
| 26 | uint32_t * hit_latence , |
|---|
| 27 | uint32_t * miss_penality) |
|---|
| 28 | { |
|---|
| 29 | this->nb_level = nb_level; |
|---|
| 30 | this->nb_port = nb_port ; |
|---|
| 31 | |
|---|
| 32 | param_cache = new cache_onelevel::Parameters * [nb_level]; |
|---|
| 33 | for (uint32_t i=0; i<nb_level; i++) |
|---|
| 34 | param_cache [i] = new cache_onelevel::Parameters |
|---|
| 35 | (nb_port , |
|---|
| 36 | nb_line [i], |
|---|
| 37 | size_line [i], |
|---|
| 38 | size_word [i], |
|---|
| 39 | associativity [i], |
|---|
| 40 | hit_latence [i], |
|---|
| 41 | miss_penality [i]); |
|---|
| 42 | } |
|---|
| 43 | |
|---|
| 44 | public : ~Parameters (void) |
|---|
| 45 | { |
|---|
| 46 | for (uint32_t i=0; i<nb_level; i++) |
|---|
| 47 | delete param_cache [i]; |
|---|
| 48 | delete [] param_cache; |
|---|
| 49 | |
|---|
| 50 | } |
|---|
| 51 | |
|---|
| 52 | public : friend std::ostream& operator<< (std::ostream& output, const Parameters &x) |
|---|
| 53 | { |
|---|
| 54 | |
|---|
| 55 | return output; |
|---|
| 56 | } |
|---|
| 57 | |
|---|
| 58 | public : std::string print (uint32_t depth) |
|---|
| 59 | { |
|---|
| 60 | std::string tab (depth,'\t'); |
|---|
| 61 | std::stringstream str; |
|---|
| 62 | |
|---|
| 63 | str << tab << "* Nb Level : " << nb_level << std::endl; |
|---|
| 64 | |
|---|
| 65 | for (uint32_t i=0; i<nb_level; i++) |
|---|
| 66 | str << tab << " * Level " << "Level " << i << std::endl |
|---|
| 67 | << param_cache [i]->print(depth+1) << std::endl; |
|---|
| 68 | |
|---|
| 69 | return str.str(); |
|---|
| 70 | } |
|---|
| 71 | |
|---|
| 72 | |
|---|
| 73 | friend std::ostream& operator<< (std::ostream& output, Parameters &x) |
|---|
| 74 | { |
|---|
| 75 | output << x.print(0); |
|---|
| 76 | return output; |
|---|
| 77 | } |
|---|
| 78 | |
|---|
| 79 | }; |
|---|
| 80 | |
|---|
| 81 | }; |
|---|
| 82 | }; |
|---|
| 83 | }; |
|---|
| 84 | #endif |
|---|