[81] | 1 | #include <iostream> |
---|
| 2 | #include "../include/Environment.h" |
---|
| 3 | |
---|
| 4 | using namespace std; |
---|
| 5 | using namespace environment; |
---|
[88] | 6 | using namespace morpheo; |
---|
[81] | 7 | |
---|
| 8 | #define _TEST_IMEMORY_ true |
---|
| 9 | #define _TEST_DMEMORY_ true |
---|
| 10 | #define _TEST_TTY_ true |
---|
| 11 | #define _TEST_RAMLOCK_ true |
---|
| 12 | #define _TEST_SIM2OS_ true |
---|
| 13 | |
---|
| 14 | #define TEST(x,y) \ |
---|
| 15 | { \ |
---|
| 16 | cout << "Line " << __LINE__ << " : "; \ |
---|
| 17 | if (x==y) \ |
---|
| 18 | { \ |
---|
| 19 | cout << "Test OK" << endl; \ |
---|
| 20 | } \ |
---|
| 21 | else \ |
---|
| 22 | { \ |
---|
| 23 | cout << "Test KO" << endl; \ |
---|
| 24 | exit (EXIT_FAILURE); \ |
---|
| 25 | } \ |
---|
| 26 | } while (0) |
---|
| 27 | |
---|
| 28 | int sc_main (int argc, char * argv[]) |
---|
| 29 | { |
---|
| 30 | cout << "<main> Begin" << endl; |
---|
| 31 | |
---|
| 32 | { |
---|
| 33 | uint32_t nb_entity = 2; |
---|
| 34 | |
---|
| 35 | uint32_t * iaccess_nb_context = new uint32_t [nb_entity]; |
---|
| 36 | uint32_t * iaccess_nb_instruction= new uint32_t [nb_entity]; |
---|
| 37 | uint32_t * iaccess_nb_packet = new uint32_t [nb_entity]; |
---|
| 38 | uint32_t * iaccess_size_address = new uint32_t [nb_entity]; |
---|
| 39 | uint32_t * iaccess_size_data = new uint32_t [nb_entity]; |
---|
| 40 | |
---|
| 41 | uint32_t * daccess_nb_context = new uint32_t [nb_entity]; |
---|
| 42 | uint32_t * daccess_nb_packet = new uint32_t [nb_entity]; |
---|
| 43 | uint32_t * daccess_size_address = new uint32_t [nb_entity]; |
---|
| 44 | uint32_t * daccess_size_data = new uint32_t [nb_entity]; |
---|
| 45 | |
---|
| 46 | uint32_t * buffer_irsp_size = new uint32_t [nb_entity]; |
---|
| 47 | uint32_t * buffer_drsp_size = new uint32_t [nb_entity]; |
---|
| 48 | |
---|
| 49 | for (uint32_t i=0; i<nb_entity; i++) |
---|
| 50 | { |
---|
| 51 | iaccess_nb_context [i] = 4; |
---|
| 52 | iaccess_nb_instruction [i] = 4; |
---|
| 53 | iaccess_nb_packet [i] = 4; |
---|
| 54 | iaccess_size_address [i] = 32; |
---|
| 55 | iaccess_size_data [i] = 32; |
---|
| 56 | |
---|
| 57 | daccess_nb_context [i] = 4; |
---|
| 58 | daccess_nb_packet [i] = 4; |
---|
| 59 | daccess_size_address [i] = 32; |
---|
| 60 | daccess_size_data [i] = 32; |
---|
| 61 | |
---|
| 62 | buffer_irsp_size [i] = 8; |
---|
| 63 | buffer_drsp_size [i] = 8; |
---|
| 64 | } |
---|
| 65 | |
---|
| 66 | uint32_t * cache_shared_nb_line = new uint32_t [1]; |
---|
| 67 | uint32_t * cache_shared_size_line = new uint32_t [1]; |
---|
| 68 | uint32_t * cache_shared_size_word = new uint32_t [1]; |
---|
| 69 | uint32_t * cache_shared_associativity = new uint32_t [1]; |
---|
| 70 | uint32_t * cache_shared_hit_latence = new uint32_t [1]; |
---|
| 71 | uint32_t * cache_shared_miss_penality = new uint32_t [1]; |
---|
| 72 | |
---|
| 73 | cache_shared_nb_line [0] = 8 ; |
---|
| 74 | cache_shared_size_line [0] = 8 ; |
---|
| 75 | cache_shared_size_word [0] = 4 ; |
---|
| 76 | cache_shared_associativity [0] = 4 ; |
---|
| 77 | cache_shared_hit_latence [0] = 2 ; |
---|
| 78 | cache_shared_miss_penality [0] = 5 ; |
---|
| 79 | |
---|
| 80 | uint32_t * icache_nb_level = new uint32_t [nb_entity]; |
---|
| 81 | uint32_t * icache_nb_port = new uint32_t [nb_entity]; |
---|
| 82 | uint32_t ** icache_nb_line = new uint32_t * [nb_entity]; |
---|
| 83 | uint32_t ** icache_size_line = new uint32_t * [nb_entity]; |
---|
| 84 | uint32_t ** icache_size_word = new uint32_t * [nb_entity]; |
---|
| 85 | uint32_t ** icache_associativity = new uint32_t * [nb_entity]; |
---|
| 86 | uint32_t ** icache_hit_latence = new uint32_t * [nb_entity]; |
---|
| 87 | uint32_t ** icache_miss_penality = new uint32_t * [nb_entity]; |
---|
| 88 | |
---|
| 89 | for (uint32_t i=0; i<nb_entity; i++) |
---|
| 90 | { |
---|
| 91 | icache_nb_level [i] = 1; |
---|
| 92 | icache_nb_port [i] = 2; |
---|
| 93 | icache_nb_line [i] = new uint32_t [1]; |
---|
| 94 | icache_size_line [i] = new uint32_t [1]; |
---|
| 95 | icache_size_word [i] = new uint32_t [1]; |
---|
| 96 | icache_associativity [i] = new uint32_t [1]; |
---|
| 97 | icache_hit_latence [i] = new uint32_t [1]; |
---|
| 98 | icache_miss_penality [i] = new uint32_t [1]; |
---|
| 99 | |
---|
| 100 | icache_nb_line [i][0] = 8; |
---|
| 101 | icache_size_line [i][0] = 8; |
---|
| 102 | icache_size_word [i][0] = 4; |
---|
| 103 | icache_associativity [i][0] = 1; |
---|
| 104 | icache_hit_latence [i][0] = 1; |
---|
| 105 | icache_miss_penality [i][0] = 3; |
---|
| 106 | } |
---|
| 107 | |
---|
| 108 | uint32_t * dcache_nb_level = new uint32_t [nb_entity]; |
---|
| 109 | uint32_t * dcache_nb_port = new uint32_t [nb_entity]; |
---|
| 110 | uint32_t ** dcache_nb_line = new uint32_t * [nb_entity]; |
---|
| 111 | uint32_t ** dcache_size_line = new uint32_t * [nb_entity]; |
---|
| 112 | uint32_t ** dcache_size_word = new uint32_t * [nb_entity]; |
---|
| 113 | uint32_t ** dcache_associativity = new uint32_t * [nb_entity]; |
---|
| 114 | uint32_t ** dcache_hit_latence = new uint32_t * [nb_entity]; |
---|
| 115 | uint32_t ** dcache_miss_penality = new uint32_t * [nb_entity]; |
---|
| 116 | |
---|
| 117 | for (uint32_t i=0; i<nb_entity; i++) |
---|
| 118 | { |
---|
| 119 | dcache_nb_level [i] = 1; |
---|
| 120 | dcache_nb_port [i] = 2; |
---|
| 121 | dcache_nb_line [i] = new uint32_t [1]; |
---|
| 122 | dcache_size_line [i] = new uint32_t [1]; |
---|
| 123 | dcache_size_word [i] = new uint32_t [1]; |
---|
| 124 | dcache_associativity [i] = new uint32_t [1]; |
---|
| 125 | dcache_hit_latence [i] = new uint32_t [1]; |
---|
| 126 | dcache_miss_penality [i] = new uint32_t [1]; |
---|
| 127 | |
---|
| 128 | dcache_nb_line [i][0] = 8; |
---|
| 129 | dcache_size_line [i][0] = 8; |
---|
| 130 | dcache_size_word [i][0] = 4; |
---|
| 131 | dcache_associativity [i][0] = 1; |
---|
| 132 | dcache_hit_latence [i][0] = 1; |
---|
| 133 | dcache_miss_penality [i][0] = 3; |
---|
| 134 | } |
---|
| 135 | |
---|
| 136 | uint32_t nb_component_tty = 1; |
---|
| 137 | uint32_t * tty_address = new uint32_t [nb_component_tty]; |
---|
| 138 | uint32_t * nb_tty = new uint32_t [nb_component_tty]; |
---|
| 139 | tty_address [0] = 0xa0000000; |
---|
| 140 | nb_tty [0] = 4; |
---|
| 141 | string ** name_tty = new string * [nb_component_tty]; |
---|
| 142 | name_tty [0] = new string [nb_tty[0]]; |
---|
| 143 | name_tty [0][0] = "tty_0_0"; |
---|
| 144 | name_tty [0][1] = "tty_0_1"; |
---|
| 145 | name_tty [0][2] = "tty_0_2"; |
---|
| 146 | name_tty [0][3] = "tty_0_3"; |
---|
| 147 | |
---|
| 148 | uint32_t nb_component_ramlock = 1; |
---|
| 149 | uint32_t * ramlock_address = new uint32_t [nb_component_ramlock]; |
---|
| 150 | uint32_t * nb_lock = new uint32_t [nb_component_ramlock]; |
---|
| 151 | ramlock_address [0] = 0xb0000000; |
---|
| 152 | nb_lock [0] = 10; |
---|
| 153 | |
---|
| 154 | uint32_t sim2os_address = 0xc0000000; |
---|
| 155 | uint32_t sim2os_size = 0x00001000; |
---|
| 156 | SOCLIB_SEGMENT_TABLE * segtable = new SOCLIB_SEGMENT_TABLE; |
---|
| 157 | segtable->setMSBNumber (8); |
---|
| 158 | segtable->setDefaultTarget(0,0); |
---|
| 159 | |
---|
| 160 | //shared data segment |
---|
| 161 | const int TEXT_BASE = 0x00000000; |
---|
| 162 | const int DATA_CACHED_BASE = 0x10000000; |
---|
| 163 | const int DATA_UNCACHED_BASE = 0x40000000; |
---|
| 164 | |
---|
| 165 | const int TEXT_SIZE = 0x4000; |
---|
| 166 | const int DATA_CACHED_SIZE = 0x4000; |
---|
| 167 | const int DATA_UNCACHED_SIZE = 0x4000; |
---|
| 168 | |
---|
| 169 | // Add a segment ,name ,address of base ,size ,global index,local index,uncache |
---|
| 170 | segtable->addSegment("text" ,TEXT_BASE ,TEXT_SIZE ,0 ,0 ,false); |
---|
| 171 | segtable->addSegment("data" ,DATA_CACHED_BASE ,DATA_CACHED_SIZE ,0 ,0 ,false); |
---|
| 172 | segtable->addSegment("data_unc",DATA_UNCACHED_BASE,DATA_UNCACHED_SIZE,0 ,0 ,true ); |
---|
| 173 | |
---|
| 174 | |
---|
| 175 | Parameters * param = new Parameters |
---|
| 176 | (nb_entity, |
---|
| 177 | |
---|
| 178 | iaccess_nb_context, |
---|
| 179 | iaccess_nb_instruction, |
---|
| 180 | iaccess_nb_packet, |
---|
| 181 | iaccess_size_address, |
---|
| 182 | iaccess_size_data, |
---|
| 183 | |
---|
| 184 | daccess_nb_context, |
---|
| 185 | daccess_nb_packet, |
---|
| 186 | daccess_size_address, |
---|
| 187 | daccess_size_data, |
---|
| 188 | |
---|
| 189 | buffer_irsp_size, |
---|
| 190 | buffer_drsp_size, |
---|
| 191 | |
---|
| 192 | icache_nb_level , |
---|
| 193 | icache_nb_port , |
---|
| 194 | icache_nb_line , |
---|
| 195 | icache_size_line , |
---|
| 196 | icache_size_word , |
---|
| 197 | icache_associativity, |
---|
| 198 | icache_hit_latence , |
---|
| 199 | icache_miss_penality, |
---|
| 200 | dcache_nb_level , |
---|
| 201 | dcache_nb_port , |
---|
| 202 | dcache_nb_line , |
---|
| 203 | dcache_size_line , |
---|
| 204 | dcache_size_word , |
---|
| 205 | dcache_associativity, |
---|
| 206 | dcache_hit_latence , |
---|
| 207 | dcache_miss_penality, |
---|
| 208 | 1 , |
---|
[88] | 209 | // cache_shared_nb_port , |
---|
[81] | 210 | cache_shared_nb_line , |
---|
| 211 | cache_shared_size_line , |
---|
| 212 | cache_shared_size_word , |
---|
| 213 | cache_shared_associativity , |
---|
| 214 | cache_shared_hit_latence , |
---|
| 215 | cache_shared_miss_penality , |
---|
| 216 | |
---|
| 217 | nb_component_tty, |
---|
| 218 | tty_address, |
---|
| 219 | nb_tty, |
---|
| 220 | name_tty, |
---|
[88] | 221 | false, // don't execute xtty |
---|
[81] | 222 | |
---|
| 223 | nb_component_ramlock, |
---|
| 224 | ramlock_address, |
---|
| 225 | nb_lock, |
---|
| 226 | |
---|
| 227 | sim2os_address, |
---|
| 228 | sim2os_size, |
---|
| 229 | segtable |
---|
| 230 | ); |
---|
| 231 | |
---|
| 232 | segtable->print(); |
---|
| 233 | |
---|
| 234 | Environment * env = new Environment ("environment",param); |
---|
| 235 | |
---|
| 236 | const char * filename = "Data/selftest/data/soft.x"; |
---|
| 237 | const char * sections_text [] = {".text",NULL}; |
---|
| 238 | const char * sections_data [] = {".data",".rodata",".bss",".sdata",".sbss", NULL}; |
---|
| 239 | |
---|
| 240 | env->init("text" , filename, sections_text); |
---|
| 241 | env->init("data" , filename, sections_data); |
---|
| 242 | |
---|
| 243 | // cout << "<main> Press <Enter> to stop the test" << endl; |
---|
| 244 | // getchar(); |
---|
| 245 | |
---|
| 246 | //============================================================================== |
---|
| 247 | //===== [ DECLARATION ]========================================================= |
---|
| 248 | //============================================================================== |
---|
| 249 | |
---|
| 250 | sc_clock * CLOCK = new sc_clock ("clock", 1.0, 0.5); |
---|
| 251 | sc_signal<bool> * NRESET = new sc_signal<bool> ("NRESET"); |
---|
| 252 | |
---|
| 253 | sc_signal<Tcontrol_t > *** ICACHE_REQ_VAL = new sc_signal<Tcontrol_t > ** [nb_entity]; |
---|
| 254 | sc_signal<Tcontrol_t > *** ICACHE_REQ_ACK = new sc_signal<Tcontrol_t > ** [nb_entity]; |
---|
| 255 | sc_signal<Ticache_context_t > *** ICACHE_REQ_CONTEXT_ID = new sc_signal<Ticache_context_t > ** [nb_entity]; |
---|
| 256 | sc_signal<Ticache_packet_t > *** ICACHE_REQ_PACKET_ID = new sc_signal<Ticache_packet_t > ** [nb_entity]; |
---|
| 257 | sc_signal<Ticache_address_t > *** ICACHE_REQ_ADDRESS = new sc_signal<Ticache_address_t > ** [nb_entity]; |
---|
| 258 | sc_signal<Ticache_type_t > *** ICACHE_REQ_TYPE = new sc_signal<Ticache_type_t > ** [nb_entity]; |
---|
| 259 | |
---|
| 260 | sc_signal<Tcontrol_t > *** ICACHE_RSP_VAL = new sc_signal<Tcontrol_t > ** [nb_entity]; |
---|
| 261 | sc_signal<Tcontrol_t > *** ICACHE_RSP_ACK = new sc_signal<Tcontrol_t > ** [nb_entity]; |
---|
| 262 | sc_signal<Ticache_context_t > *** ICACHE_RSP_CONTEXT_ID = new sc_signal<Ticache_context_t > ** [nb_entity]; |
---|
| 263 | sc_signal<Ticache_packet_t > *** ICACHE_RSP_PACKET_ID = new sc_signal<Ticache_packet_t > ** [nb_entity]; |
---|
| 264 | sc_signal<Ticache_instruction_t> **** ICACHE_RSP_INSTRUCTION= new sc_signal<Ticache_instruction_t> *** [nb_entity];//[nb_instruction] |
---|
| 265 | sc_signal<Ticache_error_t > *** ICACHE_RSP_ERROR = new sc_signal<Ticache_error_t > ** [nb_entity]; |
---|
| 266 | |
---|
| 267 | sc_signal<Tcontrol_t > *** DCACHE_REQ_VAL = new sc_signal<Tcontrol_t > ** [nb_entity]; |
---|
| 268 | sc_signal<Tcontrol_t > *** DCACHE_REQ_ACK = new sc_signal<Tcontrol_t > ** [nb_entity]; |
---|
| 269 | sc_signal<Tdcache_context_t > *** DCACHE_REQ_CONTEXT_ID = new sc_signal<Tdcache_context_t > ** [nb_entity]; |
---|
| 270 | sc_signal<Tdcache_packet_t > *** DCACHE_REQ_PACKET_ID = new sc_signal<Tdcache_packet_t > ** [nb_entity]; |
---|
| 271 | sc_signal<Tdcache_address_t > *** DCACHE_REQ_ADDRESS = new sc_signal<Tdcache_address_t > ** [nb_entity]; |
---|
| 272 | sc_signal<Tdcache_type_t > *** DCACHE_REQ_TYPE = new sc_signal<Tdcache_type_t > ** [nb_entity]; |
---|
| 273 | sc_signal<Tdcache_data_t > *** DCACHE_REQ_WDATA = new sc_signal<Tdcache_data_t > ** [nb_entity]; |
---|
| 274 | |
---|
| 275 | sc_signal<Tcontrol_t > *** DCACHE_RSP_VAL = new sc_signal<Tcontrol_t > ** [nb_entity]; |
---|
| 276 | sc_signal<Tcontrol_t > *** DCACHE_RSP_ACK = new sc_signal<Tcontrol_t > ** [nb_entity]; |
---|
| 277 | sc_signal<Tdcache_context_t > *** DCACHE_RSP_CONTEXT_ID = new sc_signal<Tdcache_context_t > ** [nb_entity]; |
---|
| 278 | sc_signal<Tdcache_packet_t > *** DCACHE_RSP_PACKET_ID = new sc_signal<Tdcache_packet_t > ** [nb_entity]; |
---|
| 279 | sc_signal<Tdcache_data_t > *** DCACHE_RSP_RDATA = new sc_signal<Tdcache_data_t > ** [nb_entity]; |
---|
| 280 | sc_signal<Tdcache_error_t > *** DCACHE_RSP_ERROR = new sc_signal<Tdcache_error_t > ** [nb_entity]; |
---|
| 281 | |
---|
| 282 | for (uint32_t i=0; i<nb_entity; i++) |
---|
| 283 | { |
---|
| 284 | ICACHE_REQ_VAL [i] = new sc_signal<Tcontrol_t > * [icache_nb_port[i]]; |
---|
| 285 | ICACHE_REQ_ACK [i] = new sc_signal<Tcontrol_t > * [icache_nb_port[i]]; |
---|
| 286 | ICACHE_REQ_CONTEXT_ID [i] = new sc_signal<Ticache_context_t > * [icache_nb_port[i]]; |
---|
| 287 | ICACHE_REQ_PACKET_ID [i] = new sc_signal<Ticache_packet_t > * [icache_nb_port[i]]; |
---|
| 288 | ICACHE_REQ_ADDRESS [i] = new sc_signal<Ticache_address_t > * [icache_nb_port[i]]; |
---|
| 289 | ICACHE_REQ_TYPE [i] = new sc_signal<Ticache_type_t > * [icache_nb_port[i]]; |
---|
| 290 | |
---|
| 291 | ICACHE_RSP_VAL [i] = new sc_signal<Tcontrol_t > * [icache_nb_port[i]]; |
---|
| 292 | ICACHE_RSP_ACK [i] = new sc_signal<Tcontrol_t > * [icache_nb_port[i]]; |
---|
| 293 | ICACHE_RSP_CONTEXT_ID [i] = new sc_signal<Ticache_context_t > * [icache_nb_port[i]]; |
---|
| 294 | ICACHE_RSP_PACKET_ID [i] = new sc_signal<Ticache_packet_t > * [icache_nb_port[i]]; |
---|
| 295 | ICACHE_RSP_INSTRUCTION[i] = new sc_signal<Ticache_instruction_t> ** [icache_nb_port[i]];//[nb_instruction] |
---|
| 296 | ICACHE_RSP_ERROR [i] = new sc_signal<Ticache_error_t > * [icache_nb_port[i]]; |
---|
| 297 | |
---|
| 298 | for (uint32_t j=0; j<icache_nb_port[i]; j++) |
---|
| 299 | { |
---|
| 300 | ICACHE_REQ_VAL [i][j] = new sc_signal<Tcontrol_t > (""); |
---|
| 301 | ICACHE_REQ_ACK [i][j] = new sc_signal<Tcontrol_t > (""); |
---|
| 302 | ICACHE_REQ_CONTEXT_ID [i][j] = new sc_signal<Ticache_context_t > (""); |
---|
| 303 | ICACHE_REQ_PACKET_ID [i][j] = new sc_signal<Ticache_packet_t > (""); |
---|
| 304 | ICACHE_REQ_ADDRESS [i][j] = new sc_signal<Ticache_address_t > (""); |
---|
| 305 | ICACHE_REQ_TYPE [i][j] = new sc_signal<Ticache_type_t > (""); |
---|
| 306 | |
---|
| 307 | ICACHE_RSP_VAL [i][j] = new sc_signal<Tcontrol_t > (""); |
---|
| 308 | ICACHE_RSP_ACK [i][j] = new sc_signal<Tcontrol_t > (""); |
---|
| 309 | ICACHE_RSP_CONTEXT_ID [i][j] = new sc_signal<Ticache_context_t > (""); |
---|
| 310 | ICACHE_RSP_PACKET_ID [i][j] = new sc_signal<Ticache_packet_t > (""); |
---|
| 311 | ICACHE_RSP_ERROR [i][j] = new sc_signal<Ticache_error_t > (""); |
---|
| 312 | |
---|
| 313 | ICACHE_RSP_INSTRUCTION [i][j] = new sc_signal<Ticache_instruction_t> * [iaccess_nb_instruction[i]]; |
---|
| 314 | |
---|
| 315 | for (uint32_t k=0; k<iaccess_nb_instruction[i]; k++) |
---|
| 316 | ICACHE_RSP_INSTRUCTION [i][j][k] = new sc_signal<Ticache_instruction_t> (""); |
---|
| 317 | |
---|
| 318 | } |
---|
| 319 | |
---|
| 320 | DCACHE_REQ_VAL [i] = new sc_signal<Tcontrol_t > * [dcache_nb_port[i]]; |
---|
| 321 | DCACHE_REQ_ACK [i] = new sc_signal<Tcontrol_t > * [dcache_nb_port[i]]; |
---|
| 322 | DCACHE_REQ_CONTEXT_ID [i] = new sc_signal<Tdcache_context_t > * [dcache_nb_port[i]]; |
---|
| 323 | DCACHE_REQ_PACKET_ID [i] = new sc_signal<Tdcache_packet_t > * [dcache_nb_port[i]]; |
---|
| 324 | DCACHE_REQ_ADDRESS [i] = new sc_signal<Tdcache_address_t > * [dcache_nb_port[i]]; |
---|
| 325 | DCACHE_REQ_TYPE [i] = new sc_signal<Tdcache_type_t > * [dcache_nb_port[i]]; |
---|
| 326 | DCACHE_REQ_WDATA [i] = new sc_signal<Tdcache_data_t > * [dcache_nb_port[i]]; |
---|
| 327 | |
---|
| 328 | DCACHE_RSP_VAL [i] = new sc_signal<Tcontrol_t > * [dcache_nb_port[i]]; |
---|
| 329 | DCACHE_RSP_ACK [i] = new sc_signal<Tcontrol_t > * [dcache_nb_port[i]]; |
---|
| 330 | DCACHE_RSP_CONTEXT_ID [i] = new sc_signal<Tdcache_context_t > * [dcache_nb_port[i]]; |
---|
| 331 | DCACHE_RSP_PACKET_ID [i] = new sc_signal<Tdcache_packet_t > * [dcache_nb_port[i]]; |
---|
| 332 | DCACHE_RSP_RDATA [i] = new sc_signal<Tdcache_data_t > * [dcache_nb_port[i]]; |
---|
| 333 | DCACHE_RSP_ERROR [i] = new sc_signal<Tdcache_error_t > * [dcache_nb_port[i]]; |
---|
| 334 | |
---|
| 335 | for (uint32_t j=0; j<dcache_nb_port[i]; j++) |
---|
| 336 | { |
---|
| 337 | DCACHE_REQ_VAL [i][j] = new sc_signal<Tcontrol_t > (""); |
---|
| 338 | DCACHE_REQ_ACK [i][j] = new sc_signal<Tcontrol_t > (""); |
---|
| 339 | DCACHE_REQ_CONTEXT_ID [i][j] = new sc_signal<Tdcache_context_t > (""); |
---|
| 340 | DCACHE_REQ_PACKET_ID [i][j] = new sc_signal<Tdcache_packet_t > (""); |
---|
| 341 | DCACHE_REQ_ADDRESS [i][j] = new sc_signal<Tdcache_address_t > (""); |
---|
| 342 | DCACHE_REQ_TYPE [i][j] = new sc_signal<Tdcache_type_t > (""); |
---|
| 343 | DCACHE_REQ_WDATA [i][j] = new sc_signal<Tdcache_data_t > (""); |
---|
| 344 | |
---|
| 345 | DCACHE_RSP_VAL [i][j] = new sc_signal<Tcontrol_t > (""); |
---|
| 346 | DCACHE_RSP_ACK [i][j] = new sc_signal<Tcontrol_t > (""); |
---|
| 347 | DCACHE_RSP_CONTEXT_ID [i][j] = new sc_signal<Tdcache_context_t > (""); |
---|
| 348 | DCACHE_RSP_PACKET_ID [i][j] = new sc_signal<Tdcache_packet_t > (""); |
---|
| 349 | DCACHE_RSP_RDATA [i][j] = new sc_signal<Tdcache_data_t > (""); |
---|
| 350 | DCACHE_RSP_ERROR [i][j] = new sc_signal<Tdcache_error_t > (""); |
---|
| 351 | } |
---|
| 352 | } |
---|
| 353 | |
---|
| 354 | //============================================================================== |
---|
| 355 | //===== [ INSTANCE ]============================================================ |
---|
| 356 | //============================================================================== |
---|
| 357 | |
---|
| 358 | // instance |
---|
| 359 | (*(env->CLOCK )) (*(CLOCK )); |
---|
| 360 | (*(env->NRESET)) (*(NRESET)); |
---|
| 361 | |
---|
| 362 | for (uint32_t i=0; i<nb_entity; i++) |
---|
| 363 | { |
---|
| 364 | for (uint32_t j=0; j<icache_nb_port[i]; j++) |
---|
| 365 | { |
---|
| 366 | (*(env->ICACHE_REQ_VAL [i][j])) (*(ICACHE_REQ_VAL [i][j])); |
---|
| 367 | (*(env->ICACHE_REQ_ACK [i][j])) (*(ICACHE_REQ_ACK [i][j])); |
---|
| 368 | (*(env->ICACHE_REQ_CONTEXT_ID [i][j])) (*(ICACHE_REQ_CONTEXT_ID [i][j])); |
---|
| 369 | (*(env->ICACHE_REQ_PACKET_ID [i][j])) (*(ICACHE_REQ_PACKET_ID [i][j])); |
---|
| 370 | (*(env->ICACHE_REQ_ADDRESS [i][j])) (*(ICACHE_REQ_ADDRESS [i][j])); |
---|
| 371 | (*(env->ICACHE_REQ_TYPE [i][j])) (*(ICACHE_REQ_TYPE [i][j])); |
---|
| 372 | |
---|
| 373 | (*(env->ICACHE_RSP_VAL [i][j])) (*(ICACHE_RSP_VAL [i][j])); |
---|
| 374 | (*(env->ICACHE_RSP_ACK [i][j])) (*(ICACHE_RSP_ACK [i][j])); |
---|
| 375 | (*(env->ICACHE_RSP_CONTEXT_ID [i][j])) (*(ICACHE_RSP_CONTEXT_ID [i][j])); |
---|
| 376 | (*(env->ICACHE_RSP_PACKET_ID [i][j])) (*(ICACHE_RSP_PACKET_ID [i][j])); |
---|
| 377 | (*(env->ICACHE_RSP_ERROR [i][j])) (*(ICACHE_RSP_ERROR [i][j])); |
---|
| 378 | |
---|
| 379 | for (uint32_t k=0; k<iaccess_nb_instruction[i]; k++) |
---|
| 380 | (*(env->ICACHE_RSP_INSTRUCTION [i][j][k])) (*(ICACHE_RSP_INSTRUCTION [i][j][k])); |
---|
| 381 | |
---|
| 382 | } |
---|
| 383 | |
---|
| 384 | for (uint32_t j=0; j<dcache_nb_port[i]; j++) |
---|
| 385 | { |
---|
| 386 | (*(env->DCACHE_REQ_VAL [i][j])) (*(DCACHE_REQ_VAL [i][j])); |
---|
| 387 | (*(env->DCACHE_REQ_ACK [i][j])) (*(DCACHE_REQ_ACK [i][j])); |
---|
| 388 | (*(env->DCACHE_REQ_CONTEXT_ID [i][j])) (*(DCACHE_REQ_CONTEXT_ID [i][j])); |
---|
| 389 | (*(env->DCACHE_REQ_PACKET_ID [i][j])) (*(DCACHE_REQ_PACKET_ID [i][j])); |
---|
| 390 | (*(env->DCACHE_REQ_ADDRESS [i][j])) (*(DCACHE_REQ_ADDRESS [i][j])); |
---|
| 391 | (*(env->DCACHE_REQ_TYPE [i][j])) (*(DCACHE_REQ_TYPE [i][j])); |
---|
| 392 | (*(env->DCACHE_REQ_WDATA [i][j])) (*(DCACHE_REQ_WDATA [i][j])); |
---|
| 393 | |
---|
| 394 | (*(env->DCACHE_RSP_VAL [i][j])) (*(DCACHE_RSP_VAL [i][j])); |
---|
| 395 | (*(env->DCACHE_RSP_ACK [i][j])) (*(DCACHE_RSP_ACK [i][j])); |
---|
| 396 | (*(env->DCACHE_RSP_CONTEXT_ID [i][j])) (*(DCACHE_RSP_CONTEXT_ID [i][j])); |
---|
| 397 | (*(env->DCACHE_RSP_PACKET_ID [i][j])) (*(DCACHE_RSP_PACKET_ID [i][j])); |
---|
| 398 | (*(env->DCACHE_RSP_RDATA [i][j])) (*(DCACHE_RSP_RDATA [i][j])); |
---|
| 399 | (*(env->DCACHE_RSP_ERROR [i][j])) (*(DCACHE_RSP_ERROR [i][j])); |
---|
| 400 | } |
---|
| 401 | } |
---|
| 402 | |
---|
| 403 | //============================================================================== |
---|
| 404 | //===== [ INIT ]================================================================ |
---|
| 405 | //============================================================================== |
---|
| 406 | |
---|
| 407 | const uint32_t seed = 0; |
---|
| 408 | // const uint32_t seed = static_cast<uint32_t>(time(NULL)); |
---|
| 409 | srand(seed); |
---|
| 410 | |
---|
| 411 | sc_start(0); |
---|
| 412 | // reset |
---|
| 413 | NRESET->write(0); |
---|
| 414 | sc_start(5); |
---|
| 415 | NRESET->write(1); |
---|
| 416 | sc_start(1); |
---|
| 417 | |
---|
| 418 | // cout << *env << endl; |
---|
| 419 | |
---|
| 420 | //============================================================================== |
---|
| 421 | //===== [ ICACHE ]============================================================== |
---|
| 422 | //============================================================================== |
---|
| 423 | |
---|
| 424 | if (_TEST_IMEMORY_) |
---|
| 425 | { |
---|
| 426 | cout << "Test : ICACHE" << endl; |
---|
| 427 | // Test no respons |
---|
| 428 | |
---|
| 429 | for (uint32_t i = 0; i < param->nb_entity; i++) |
---|
| 430 | for (uint32_t j=0; j<param->icache_dedicated_nb_port [i]; j++) |
---|
| 431 | { |
---|
| 432 | TEST(ICACHE_RSP_VAL [i][j]->read(), 0); |
---|
| 433 | ICACHE_RSP_ACK [i][j]->write(0); |
---|
| 434 | } |
---|
| 435 | |
---|
| 436 | for (uint32_t i = 0; i < param->nb_entity; i++) |
---|
| 437 | for (uint32_t j=0; j<param->dcache_dedicated_nb_port [i]; j++) |
---|
| 438 | { |
---|
| 439 | TEST(DCACHE_RSP_VAL [i][j]->read(), 0); |
---|
| 440 | DCACHE_RSP_ACK [i][j]->write(0); |
---|
| 441 | } |
---|
| 442 | |
---|
| 443 | const int32_t percent_transaction_icache_req = 75; |
---|
| 444 | const int32_t percent_transaction_icache_rsp = 75; |
---|
| 445 | |
---|
| 446 | uint32_t packet_req = 0; |
---|
| 447 | uint32_t packet_rsp = 0; |
---|
| 448 | |
---|
| 449 | Ticache_address_t addr_max = 0xf0; |
---|
| 450 | |
---|
| 451 | do |
---|
| 452 | { |
---|
| 453 | Ticache_packet_t packet_req_next = packet_req; |
---|
| 454 | |
---|
| 455 | Ticache_address_t addr = (packet_req_next << 2); |
---|
| 456 | for (uint32_t i=0; i<param->nb_entity; i++) |
---|
| 457 | for (uint32_t j=0; j<param->icache_dedicated_nb_port [i]; j++) |
---|
| 458 | { |
---|
| 459 | ICACHE_REQ_VAL [i][j]->write((addr < addr_max) and ((rand()%100)<percent_transaction_icache_req)); |
---|
| 460 | ICACHE_REQ_CONTEXT_ID [i][j]->write(0); |
---|
[88] | 461 | ICACHE_REQ_ADDRESS [i][j]->write(addr>>2); |
---|
[81] | 462 | ICACHE_REQ_PACKET_ID [i][j]->write(addr>>2); |
---|
| 463 | ICACHE_REQ_TYPE [i][j]->write(ICACHE_TYPE_LOAD); |
---|
| 464 | |
---|
| 465 | packet_req_next++; |
---|
| 466 | addr += (param->iaccess_nb_instruction[i]<<2); |
---|
| 467 | } |
---|
| 468 | |
---|
| 469 | for (uint32_t i=0; i<param->nb_entity; i++) |
---|
| 470 | for (uint32_t j=0; j<param->icache_dedicated_nb_port [i]; j++) |
---|
| 471 | { |
---|
| 472 | ICACHE_RSP_ACK [i][j]->write((rand()%100)<percent_transaction_icache_rsp) ; |
---|
| 473 | } |
---|
| 474 | |
---|
| 475 | sc_start(1); |
---|
| 476 | |
---|
| 477 | for (uint32_t i=0; i<param->nb_entity; i++) |
---|
| 478 | for (uint32_t j=0; j<param->icache_dedicated_nb_port [i]; j++) |
---|
| 479 | { |
---|
| 480 | cout << "ICACHE_REQ_VALACK (" << ICACHE_REQ_VAL [i][j]->read() << "," << ICACHE_REQ_ACK [i][j]->read() << ")" << endl; |
---|
| 481 | if (ICACHE_REQ_VAL [i][j]->read() and |
---|
| 482 | ICACHE_REQ_ACK [i][j]->read()) |
---|
| 483 | { |
---|
| 484 | cout << "packet_req : " << packet_req << endl; |
---|
| 485 | packet_req ++; |
---|
| 486 | } |
---|
| 487 | } |
---|
| 488 | |
---|
| 489 | for (uint32_t i=0; i<param->nb_entity; i++) |
---|
| 490 | for (uint32_t j=0; j<param->icache_dedicated_nb_port [i]; j++) |
---|
| 491 | { |
---|
| 492 | cout << "ICACHE_RSP_VALACK (" << ICACHE_RSP_VAL [i][j]->read() << "," << ICACHE_RSP_ACK [i][j]->read() << ")" << endl; |
---|
| 493 | if (ICACHE_RSP_VAL [i][j]->read() and |
---|
| 494 | ICACHE_RSP_ACK [i][j]->read()) |
---|
| 495 | { |
---|
| 496 | cout << "packet_rsp : " << packet_rsp << endl; |
---|
| 497 | packet_rsp ++; |
---|
| 498 | |
---|
| 499 | TEST(ICACHE_RSP_ERROR [i][j]->read(),ICACHE_ERROR_NONE); |
---|
| 500 | TEST(ICACHE_RSP_CONTEXT_ID[i][j]->read(),0); |
---|
| 501 | |
---|
| 502 | Ticache_packet_t packet = ICACHE_RSP_PACKET_ID [i][j]->read(); |
---|
| 503 | |
---|
| 504 | for (unsigned int k=0; k<param->iaccess_nb_instruction[i]; k++) |
---|
| 505 | { |
---|
| 506 | Ticache_instruction_t inst = ICACHE_RSP_INSTRUCTION[i][j][k]->read(); |
---|
| 507 | cout << "instruction [" << k << "] : " << std::hex << inst << std::dec << endl; |
---|
| 508 | |
---|
| 509 | TEST((inst>>16) , 0x1500); // copdop nop |
---|
| 510 | TEST((inst&0xffff) , ((0xffff ^ (packet+k))+1)); // packet in CA2 |
---|
| 511 | } |
---|
| 512 | |
---|
| 513 | } |
---|
| 514 | } |
---|
| 515 | |
---|
| 516 | } while (((packet_req<<2)< addr_max) or |
---|
| 517 | ((packet_rsp<<2)< addr_max)); |
---|
| 518 | |
---|
| 519 | for (uint32_t i=0; i<param->nb_entity; i++) |
---|
| 520 | { |
---|
| 521 | for (uint32_t j=0; j<param->icache_dedicated_nb_port [i]; j++) |
---|
| 522 | ICACHE_REQ_VAL [i][j]->write(0); |
---|
| 523 | for (uint32_t j=0; j<param->icache_dedicated_nb_port [i]; j++) |
---|
| 524 | ICACHE_RSP_ACK [i][j]->write(1); |
---|
| 525 | } |
---|
| 526 | |
---|
| 527 | sc_start(50); |
---|
| 528 | |
---|
| 529 | for (uint32_t i=0; i<param->nb_entity; i++) |
---|
| 530 | for (uint32_t j=0; j<param->icache_dedicated_nb_port [i]; j++) |
---|
| 531 | ICACHE_RSP_ACK [i][j]->write(0); |
---|
| 532 | |
---|
| 533 | cout << "Test : icache - bus error" << endl; |
---|
| 534 | |
---|
| 535 | // 1) in not valid segment |
---|
| 536 | ICACHE_REQ_VAL [0][0]->write(1); |
---|
| 537 | ICACHE_REQ_CONTEXT_ID [0][0]->write(0); |
---|
[88] | 538 | ICACHE_REQ_ADDRESS [0][0]->write(0xe0000000>>2); |
---|
[81] | 539 | ICACHE_REQ_PACKET_ID [0][0]->write(21); |
---|
| 540 | ICACHE_REQ_TYPE [0][0]->write(ICACHE_TYPE_LOAD); |
---|
| 541 | ICACHE_RSP_ACK [0][0]->write(1); |
---|
| 542 | do |
---|
| 543 | { |
---|
| 544 | sc_start(1); |
---|
| 545 | } while (ICACHE_REQ_ACK [0][0]->read() == 0); |
---|
| 546 | ICACHE_REQ_VAL [0][0]->write(0); |
---|
| 547 | |
---|
| 548 | sc_start (9); |
---|
| 549 | TEST(ICACHE_RSP_VAL [0][0]->read(), 0); |
---|
| 550 | sc_start (1); |
---|
| 551 | TEST(ICACHE_RSP_VAL [0][0]->read(), 1); |
---|
| 552 | TEST(ICACHE_RSP_CONTEXT_ID [0][0] ->read(), 0); |
---|
| 553 | TEST(ICACHE_RSP_PACKET_ID [0][0] ->read(), 21); |
---|
| 554 | TEST(ICACHE_RSP_INSTRUCTION [0][0][0]->read(), 0xe0000000); |
---|
| 555 | TEST(ICACHE_RSP_ERROR [0][0] ->read(), ICACHE_ERROR_BUS_ERROR); |
---|
| 556 | sc_start (1); |
---|
| 557 | TEST(ICACHE_RSP_VAL [0][0]->read(), 0); |
---|
| 558 | |
---|
| 559 | sc_start (10); |
---|
| 560 | |
---|
| 561 | // 2) in valid segment but not memory |
---|
| 562 | ICACHE_REQ_VAL [0][0]->write(1); |
---|
| 563 | ICACHE_REQ_CONTEXT_ID [0][0]->write(0); |
---|
[88] | 564 | ICACHE_REQ_ADDRESS [0][0]->write(0xa0000000>>2); |
---|
[81] | 565 | ICACHE_REQ_PACKET_ID [0][0]->write(21); |
---|
| 566 | ICACHE_REQ_TYPE [0][0]->write(ICACHE_TYPE_LOAD); |
---|
| 567 | ICACHE_RSP_ACK [0][0]->write(1); |
---|
| 568 | do |
---|
| 569 | { |
---|
| 570 | sc_start(1); |
---|
| 571 | } while (ICACHE_REQ_ACK [0][0]->read() == 0); |
---|
| 572 | ICACHE_REQ_VAL [0][0]->write(0); |
---|
| 573 | |
---|
| 574 | sc_start (9); |
---|
| 575 | TEST(ICACHE_RSP_VAL [0][0]->read(), 0); |
---|
| 576 | sc_start (1); |
---|
| 577 | TEST(ICACHE_RSP_VAL [0][0]->read(), 1); |
---|
| 578 | TEST(ICACHE_RSP_CONTEXT_ID [0][0] ->read(), 0); |
---|
| 579 | TEST(ICACHE_RSP_PACKET_ID [0][0] ->read(), 21); |
---|
| 580 | TEST(ICACHE_RSP_INSTRUCTION [0][0][0]->read(), 0xa0000000); |
---|
| 581 | TEST(ICACHE_RSP_ERROR [0][0] ->read(), ICACHE_ERROR_BUS_ERROR); |
---|
| 582 | sc_start (1); |
---|
| 583 | TEST(ICACHE_RSP_VAL [0][0]->read(), 0); |
---|
| 584 | ICACHE_RSP_ACK [0][0]->write(0); |
---|
| 585 | } |
---|
| 586 | |
---|
| 587 | //============================================================================== |
---|
| 588 | //===== [ TTY ]================================================================= |
---|
| 589 | //============================================================================== |
---|
| 590 | if (_TEST_TTY_) |
---|
| 591 | { |
---|
| 592 | cout << "Test : TTY" << endl; |
---|
| 593 | |
---|
| 594 | for (uint32_t i=0; i<param->nb_entity; i++) |
---|
| 595 | for (uint32_t j=0; j<param->icache_dedicated_nb_port [i]; j++) |
---|
| 596 | { |
---|
| 597 | DCACHE_REQ_VAL [i][j]->write(1); |
---|
| 598 | DCACHE_REQ_CONTEXT_ID [i][j]->write(0); |
---|
| 599 | DCACHE_REQ_PACKET_ID [i][j]->write(0); |
---|
| 600 | DCACHE_REQ_ADDRESS [i][j]->write(tty_address[0]+(2<<2)); |
---|
| 601 | DCACHE_REQ_TYPE [i][j]->write(DCACHE_TYPE_STORE_32); |
---|
| 602 | DCACHE_REQ_WDATA [i][j]->write(0xdeadbeef); |
---|
| 603 | } |
---|
| 604 | |
---|
| 605 | sc_start(1); |
---|
| 606 | for (uint32_t i=0; i<param->nb_entity; i++) |
---|
| 607 | for (uint32_t j=0; j<param->icache_dedicated_nb_port [i]; j++) |
---|
| 608 | DCACHE_REQ_VAL [i][j]->write(0); |
---|
| 609 | |
---|
| 610 | DCACHE_REQ_VAL [0][0]->write(1); |
---|
| 611 | DCACHE_REQ_TYPE [0][0]->write(DCACHE_TYPE_STORE_8); |
---|
| 612 | DCACHE_REQ_ADDRESS [0][0]->write(tty_address[0]); |
---|
| 613 | |
---|
| 614 | char msg1 [] = "kane is back\n"; |
---|
| 615 | |
---|
| 616 | for (uint32_t i=0; i<strlen(msg1); i++) |
---|
| 617 | do |
---|
| 618 | { |
---|
| 619 | DCACHE_REQ_WDATA [0][0]->write(msg1[i]); |
---|
| 620 | sc_start(1); |
---|
| 621 | } while (not DCACHE_REQ_ACK [0][0]->read()); |
---|
| 622 | |
---|
| 623 | |
---|
| 624 | DCACHE_REQ_ADDRESS [0][0]->write(tty_address[0]+(2<<4)); |
---|
| 625 | char msg2 [] = "La Technologie au service de la paix\nEt au nom de kane !!!!!!!!!"; |
---|
| 626 | |
---|
| 627 | for (uint32_t i=0; i<strlen(msg2); i++) |
---|
| 628 | do |
---|
| 629 | { |
---|
| 630 | DCACHE_REQ_WDATA [0][0]->write(msg2[i]); |
---|
| 631 | sc_start(1); |
---|
| 632 | } while (not DCACHE_REQ_ACK [0][0]->read()); |
---|
| 633 | |
---|
| 634 | DCACHE_REQ_VAL [0][0]->write(0); |
---|
| 635 | |
---|
| 636 | cout << "Test : TTY - bus error" << endl; |
---|
| 637 | |
---|
| 638 | // 1) bad access : load |
---|
| 639 | DCACHE_REQ_VAL [0][0]->write(1); |
---|
| 640 | DCACHE_REQ_CONTEXT_ID [0][0]->write(0); |
---|
| 641 | DCACHE_REQ_ADDRESS [0][0]->write(0xa0000000); |
---|
| 642 | DCACHE_REQ_PACKET_ID [0][0]->write(21); |
---|
| 643 | DCACHE_REQ_TYPE [0][0]->write(DCACHE_TYPE_LOAD_32); |
---|
| 644 | DCACHE_REQ_WDATA [0][0]->write(0xdeadbeef); |
---|
| 645 | DCACHE_RSP_ACK [0][0]->write(1); |
---|
| 646 | do |
---|
| 647 | { |
---|
| 648 | sc_start(1); |
---|
| 649 | } while (DCACHE_REQ_ACK [0][0]->read() == 0); |
---|
| 650 | DCACHE_REQ_VAL [0][0]->write(0); |
---|
| 651 | |
---|
| 652 | sc_start (9); |
---|
| 653 | TEST(DCACHE_RSP_VAL [0][0]->read(), 0); |
---|
| 654 | sc_start (1); |
---|
| 655 | TEST(DCACHE_RSP_VAL [0][0]->read(), 1); |
---|
| 656 | TEST(DCACHE_RSP_CONTEXT_ID [0][0]->read(), 0); |
---|
| 657 | TEST(DCACHE_RSP_PACKET_ID [0][0]->read(), 21); |
---|
| 658 | TEST(DCACHE_RSP_RDATA [0][0]->read(), 0xa0000000); |
---|
| 659 | TEST(DCACHE_RSP_ERROR [0][0]->read(), DCACHE_ERROR_BUS_ERROR); |
---|
| 660 | sc_start (1); |
---|
| 661 | TEST(DCACHE_RSP_VAL [0][0]->read(), 0); |
---|
| 662 | DCACHE_RSP_ACK [0][0]->write(0); |
---|
| 663 | |
---|
| 664 | // 2) bad register |
---|
| 665 | DCACHE_REQ_VAL [0][0]->write(1); |
---|
| 666 | DCACHE_REQ_CONTEXT_ID [0][0]->write(0); |
---|
| 667 | DCACHE_REQ_ADDRESS [0][0]->write(0xa000000c); |
---|
| 668 | DCACHE_REQ_PACKET_ID [0][0]->write(21); |
---|
| 669 | DCACHE_REQ_TYPE [0][0]->write(DCACHE_TYPE_STORE_8); |
---|
| 670 | DCACHE_REQ_WDATA [0][0]->write(0xdeadbeef); |
---|
| 671 | DCACHE_RSP_ACK [0][0]->write(1); |
---|
| 672 | do |
---|
| 673 | { |
---|
| 674 | sc_start(1); |
---|
| 675 | } while (DCACHE_REQ_ACK [0][0]->read() == 0); |
---|
| 676 | DCACHE_REQ_VAL [0][0]->write(0); |
---|
| 677 | |
---|
| 678 | sc_start (9); |
---|
| 679 | TEST(DCACHE_RSP_VAL [0][0]->read(), 0); |
---|
| 680 | sc_start (1); |
---|
| 681 | TEST(DCACHE_RSP_VAL [0][0]->read(), 1); |
---|
| 682 | TEST(DCACHE_RSP_CONTEXT_ID [0][0]->read(), 0); |
---|
| 683 | TEST(DCACHE_RSP_PACKET_ID [0][0]->read(), 21); |
---|
| 684 | TEST(DCACHE_RSP_RDATA [0][0]->read(), 0xa000000c); |
---|
| 685 | TEST(DCACHE_RSP_ERROR [0][0]->read(), DCACHE_ERROR_BUS_ERROR); |
---|
| 686 | sc_start (1); |
---|
| 687 | TEST(DCACHE_RSP_VAL [0][0]->read(), 0); |
---|
| 688 | DCACHE_RSP_ACK [0][0]->write(0); |
---|
| 689 | |
---|
| 690 | |
---|
| 691 | // 3) bad tty number |
---|
| 692 | DCACHE_REQ_VAL [0][0]->write(1); |
---|
| 693 | DCACHE_REQ_CONTEXT_ID [0][0]->write(0); |
---|
| 694 | DCACHE_REQ_ADDRESS [0][0]->write(0xa0000040); |
---|
| 695 | DCACHE_REQ_PACKET_ID [0][0]->write(21); |
---|
| 696 | DCACHE_REQ_TYPE [0][0]->write(DCACHE_TYPE_STORE_8); |
---|
| 697 | DCACHE_REQ_WDATA [0][0]->write(0xdeadbeef); |
---|
| 698 | DCACHE_RSP_ACK [0][0]->write(1); |
---|
| 699 | do |
---|
| 700 | { |
---|
| 701 | sc_start(1); |
---|
| 702 | } while (DCACHE_REQ_ACK [0][0]->read() == 0); |
---|
| 703 | DCACHE_REQ_VAL [0][0]->write(0); |
---|
| 704 | |
---|
| 705 | sc_start (9); |
---|
| 706 | TEST(DCACHE_RSP_VAL [0][0]->read(), 0); |
---|
| 707 | sc_start (1); |
---|
| 708 | TEST(DCACHE_RSP_VAL [0][0]->read(), 1); |
---|
| 709 | TEST(DCACHE_RSP_CONTEXT_ID [0][0]->read(), 0); |
---|
| 710 | TEST(DCACHE_RSP_PACKET_ID [0][0]->read(), 21); |
---|
| 711 | TEST(DCACHE_RSP_RDATA [0][0]->read(), 0xa0000040); |
---|
| 712 | TEST(DCACHE_RSP_ERROR [0][0]->read(), DCACHE_ERROR_BUS_ERROR); |
---|
| 713 | sc_start (1); |
---|
| 714 | TEST(DCACHE_RSP_VAL [0][0]->read(), 0); |
---|
| 715 | DCACHE_RSP_ACK [0][0]->write(0); |
---|
| 716 | } |
---|
| 717 | |
---|
| 718 | //============================================================================== |
---|
| 719 | //===== [ RAMLOCK ]============================================================= |
---|
| 720 | //============================================================================== |
---|
| 721 | if (_TEST_RAMLOCK_) |
---|
| 722 | { |
---|
| 723 | cout << "Test : RAMLOCK" << endl; |
---|
| 724 | |
---|
| 725 | // Test if lock : no |
---|
| 726 | DCACHE_REQ_VAL [0][0]->write(1); |
---|
| 727 | DCACHE_REQ_CONTEXT_ID [0][0]->write(0); |
---|
| 728 | DCACHE_REQ_PACKET_ID [0][0]->write(21); |
---|
| 729 | DCACHE_REQ_ADDRESS [0][0]->write(0xb0000003); |
---|
| 730 | DCACHE_REQ_TYPE [0][0]->write(DCACHE_TYPE_LOAD_8); |
---|
| 731 | DCACHE_REQ_WDATA [0][0]->write(0xdeadbeef); |
---|
| 732 | DCACHE_RSP_ACK [0][0]->write(1); |
---|
| 733 | // Wait ack |
---|
| 734 | do |
---|
| 735 | { |
---|
| 736 | sc_start(1); |
---|
| 737 | } while (DCACHE_REQ_ACK [0][0]->read() == 0); |
---|
| 738 | DCACHE_REQ_VAL [0][0]->write(0); |
---|
| 739 | |
---|
| 740 | sc_start (9); |
---|
| 741 | TEST(DCACHE_RSP_VAL [0][0]->read(), 0); |
---|
| 742 | sc_start (1); |
---|
| 743 | TEST(DCACHE_RSP_VAL [0][0]->read(), 1); |
---|
| 744 | TEST(DCACHE_RSP_CONTEXT_ID [0][0]->read(), 0); |
---|
| 745 | TEST(DCACHE_RSP_PACKET_ID [0][0]->read(), 21); |
---|
| 746 | TEST(DCACHE_RSP_RDATA [0][0]->read(), 0x00000000); |
---|
| 747 | TEST(DCACHE_RSP_ERROR [0][0]->read(), DCACHE_ERROR_NONE); |
---|
| 748 | sc_start (1); |
---|
| 749 | TEST(DCACHE_RSP_VAL [0][0]->read(), 0); |
---|
| 750 | DCACHE_RSP_ACK [0][0]->write(0); |
---|
| 751 | |
---|
| 752 | // Test if lock : yes |
---|
| 753 | DCACHE_REQ_VAL [0][0]->write(1); |
---|
| 754 | DCACHE_REQ_CONTEXT_ID [0][0]->write(0); |
---|
| 755 | DCACHE_REQ_PACKET_ID [0][0]->write(21); |
---|
| 756 | DCACHE_REQ_ADDRESS [0][0]->write(0xb0000003); |
---|
| 757 | DCACHE_REQ_TYPE [0][0]->write(DCACHE_TYPE_LOAD_8); |
---|
| 758 | DCACHE_REQ_WDATA [0][0]->write(0xdeadbeef); |
---|
| 759 | DCACHE_RSP_ACK [0][0]->write(1); |
---|
| 760 | // Wait ack |
---|
| 761 | do |
---|
| 762 | { |
---|
| 763 | sc_start(1); |
---|
| 764 | } while (DCACHE_REQ_ACK [0][0]->read() == 0); |
---|
| 765 | DCACHE_REQ_VAL [0][0]->write(0); |
---|
| 766 | |
---|
| 767 | sc_start (9); |
---|
| 768 | TEST(DCACHE_RSP_VAL [0][0]->read(), 0); |
---|
| 769 | sc_start (1); |
---|
| 770 | TEST(DCACHE_RSP_VAL [0][0]->read(), 1); |
---|
| 771 | TEST(DCACHE_RSP_CONTEXT_ID [0][0]->read(), 0); |
---|
| 772 | TEST(DCACHE_RSP_PACKET_ID [0][0]->read(), 21); |
---|
| 773 | TEST(DCACHE_RSP_RDATA [0][0]->read(), 0x00000001); |
---|
| 774 | TEST(DCACHE_RSP_ERROR [0][0]->read(), DCACHE_ERROR_NONE); |
---|
| 775 | sc_start (1); |
---|
| 776 | TEST(DCACHE_RSP_VAL [0][0]->read(), 0); |
---|
| 777 | DCACHE_RSP_ACK [0][0]->write(0); |
---|
| 778 | |
---|
| 779 | // Test if lock : no |
---|
| 780 | DCACHE_REQ_VAL [0][0]->write(1); |
---|
| 781 | DCACHE_REQ_CONTEXT_ID [0][0]->write(0); |
---|
| 782 | DCACHE_REQ_PACKET_ID [0][0]->write(21); |
---|
| 783 | DCACHE_REQ_ADDRESS [0][0]->write(0xb0000004); |
---|
| 784 | DCACHE_REQ_TYPE [0][0]->write(DCACHE_TYPE_LOAD_8); |
---|
| 785 | DCACHE_REQ_WDATA [0][0]->write(0xdeadbeef); |
---|
| 786 | DCACHE_RSP_ACK [0][0]->write(1); |
---|
| 787 | // Wait ack |
---|
| 788 | do |
---|
| 789 | { |
---|
| 790 | sc_start(1); |
---|
| 791 | } while (DCACHE_REQ_ACK [0][0]->read() == 0); |
---|
| 792 | DCACHE_REQ_VAL [0][0]->write(0); |
---|
| 793 | |
---|
| 794 | sc_start (9); |
---|
| 795 | TEST(DCACHE_RSP_VAL [0][0]->read(), 0); |
---|
| 796 | sc_start (1); |
---|
| 797 | TEST(DCACHE_RSP_VAL [0][0]->read(), 1); |
---|
| 798 | TEST(DCACHE_RSP_CONTEXT_ID [0][0]->read(), 0); |
---|
| 799 | TEST(DCACHE_RSP_PACKET_ID [0][0]->read(), 21); |
---|
| 800 | TEST(DCACHE_RSP_RDATA [0][0]->read(), 0x00000000); |
---|
| 801 | TEST(DCACHE_RSP_ERROR [0][0]->read(), DCACHE_ERROR_NONE); |
---|
| 802 | sc_start (1); |
---|
| 803 | TEST(DCACHE_RSP_VAL [0][0]->read(), 0); |
---|
| 804 | DCACHE_RSP_ACK [0][0]->write(0); |
---|
| 805 | |
---|
| 806 | // Test if lock : yes |
---|
| 807 | DCACHE_REQ_VAL [0][0]->write(1); |
---|
| 808 | DCACHE_REQ_CONTEXT_ID [0][0]->write(0); |
---|
| 809 | DCACHE_REQ_PACKET_ID [0][0]->write(21); |
---|
| 810 | DCACHE_REQ_ADDRESS [0][0]->write(0xb0000004); |
---|
| 811 | DCACHE_REQ_TYPE [0][0]->write(DCACHE_TYPE_LOAD_8); |
---|
| 812 | DCACHE_REQ_WDATA [0][0]->write(0xdeadbeef); |
---|
| 813 | DCACHE_RSP_ACK [0][0]->write(1); |
---|
| 814 | // Wait ack |
---|
| 815 | do |
---|
| 816 | { |
---|
| 817 | sc_start(1); |
---|
| 818 | } while (DCACHE_REQ_ACK [0][0]->read() == 0); |
---|
| 819 | DCACHE_REQ_VAL [0][0]->write(0); |
---|
| 820 | |
---|
| 821 | sc_start (9); |
---|
| 822 | TEST(DCACHE_RSP_VAL [0][0]->read(), 0); |
---|
| 823 | sc_start (1); |
---|
| 824 | TEST(DCACHE_RSP_VAL [0][0]->read(), 1); |
---|
| 825 | TEST(DCACHE_RSP_CONTEXT_ID [0][0]->read(), 0); |
---|
| 826 | TEST(DCACHE_RSP_PACKET_ID [0][0]->read(), 21); |
---|
| 827 | TEST(DCACHE_RSP_RDATA [0][0]->read(), 0x00000001); |
---|
| 828 | TEST(DCACHE_RSP_ERROR [0][0]->read(), DCACHE_ERROR_NONE); |
---|
| 829 | sc_start (1); |
---|
| 830 | TEST(DCACHE_RSP_VAL [0][0]->read(), 0); |
---|
| 831 | DCACHE_RSP_ACK [0][0]->write(0); |
---|
| 832 | |
---|
| 833 | |
---|
| 834 | DCACHE_REQ_VAL [0][0]->write(1); |
---|
| 835 | DCACHE_REQ_CONTEXT_ID [0][0]->write(0); |
---|
| 836 | DCACHE_REQ_PACKET_ID [0][0]->write(21); |
---|
| 837 | DCACHE_REQ_ADDRESS [0][0]->write(0xb0000003); |
---|
| 838 | DCACHE_REQ_TYPE [0][0]->write(DCACHE_TYPE_STORE_8); |
---|
| 839 | DCACHE_REQ_WDATA [0][0]->write(0xdeadbeef); |
---|
| 840 | |
---|
| 841 | sc_start (1); |
---|
| 842 | |
---|
| 843 | // Test if lock : no |
---|
| 844 | DCACHE_REQ_VAL [0][0]->write(1); |
---|
| 845 | DCACHE_REQ_CONTEXT_ID [0][0]->write(0); |
---|
| 846 | DCACHE_REQ_PACKET_ID [0][0]->write(21); |
---|
| 847 | DCACHE_REQ_ADDRESS [0][0]->write(0xb0000003); |
---|
| 848 | DCACHE_REQ_TYPE [0][0]->write(DCACHE_TYPE_LOAD_8); |
---|
| 849 | DCACHE_REQ_WDATA [0][0]->write(0xdeadbeef); |
---|
| 850 | DCACHE_RSP_ACK [0][0]->write(1); |
---|
| 851 | // Wait ack |
---|
| 852 | do |
---|
| 853 | { |
---|
| 854 | sc_start(1); |
---|
| 855 | } while (DCACHE_REQ_ACK [0][0]->read() == 0); |
---|
| 856 | DCACHE_REQ_VAL [0][0]->write(0); |
---|
| 857 | |
---|
| 858 | sc_start (9); |
---|
| 859 | TEST(DCACHE_RSP_VAL [0][0]->read(), 0); |
---|
| 860 | sc_start (1); |
---|
| 861 | TEST(DCACHE_RSP_VAL [0][0]->read(), 1); |
---|
| 862 | TEST(DCACHE_RSP_CONTEXT_ID [0][0]->read(), 0); |
---|
| 863 | TEST(DCACHE_RSP_PACKET_ID [0][0]->read(), 21); |
---|
| 864 | TEST(DCACHE_RSP_RDATA [0][0]->read(), 0x00000000); |
---|
| 865 | TEST(DCACHE_RSP_ERROR [0][0]->read(), DCACHE_ERROR_NONE); |
---|
| 866 | sc_start (1); |
---|
| 867 | TEST(DCACHE_RSP_VAL [0][0]->read(), 0); |
---|
| 868 | DCACHE_RSP_ACK [0][0]->write(0); |
---|
| 869 | |
---|
| 870 | // Test if lock : yes |
---|
| 871 | DCACHE_REQ_VAL [0][0]->write(1); |
---|
| 872 | DCACHE_REQ_CONTEXT_ID [0][0]->write(0); |
---|
| 873 | DCACHE_REQ_PACKET_ID [0][0]->write(21); |
---|
| 874 | DCACHE_REQ_ADDRESS [0][0]->write(0xb0000003); |
---|
| 875 | DCACHE_REQ_TYPE [0][0]->write(DCACHE_TYPE_LOAD_8); |
---|
| 876 | DCACHE_REQ_WDATA [0][0]->write(0xdeadbeef); |
---|
| 877 | DCACHE_RSP_ACK [0][0]->write(1); |
---|
| 878 | // Wait ack |
---|
| 879 | do |
---|
| 880 | { |
---|
| 881 | sc_start(1); |
---|
| 882 | } while (DCACHE_REQ_ACK [0][0]->read() == 0); |
---|
| 883 | DCACHE_REQ_VAL [0][0]->write(0); |
---|
| 884 | |
---|
| 885 | sc_start (9); |
---|
| 886 | TEST(DCACHE_RSP_VAL [0][0]->read(), 0); |
---|
| 887 | sc_start (1); |
---|
| 888 | TEST(DCACHE_RSP_VAL [0][0]->read(), 1); |
---|
| 889 | TEST(DCACHE_RSP_CONTEXT_ID [0][0]->read(), 0); |
---|
| 890 | TEST(DCACHE_RSP_PACKET_ID [0][0]->read(), 21); |
---|
| 891 | TEST(DCACHE_RSP_RDATA [0][0]->read(), 0x00000001); |
---|
| 892 | TEST(DCACHE_RSP_ERROR [0][0]->read(), DCACHE_ERROR_NONE); |
---|
| 893 | sc_start (1); |
---|
| 894 | TEST(DCACHE_RSP_VAL [0][0]->read(), 0); |
---|
| 895 | DCACHE_RSP_ACK [0][0]->write(0); |
---|
| 896 | |
---|
| 897 | |
---|
| 898 | sc_start (5); |
---|
| 899 | // Bus Error |
---|
| 900 | |
---|
| 901 | // 1) size access |
---|
| 902 | // Test if lock : yes |
---|
| 903 | DCACHE_REQ_VAL [0][0]->write(1); |
---|
| 904 | DCACHE_REQ_CONTEXT_ID [0][0]->write(0); |
---|
| 905 | DCACHE_REQ_PACKET_ID [0][0]->write(21); |
---|
| 906 | DCACHE_REQ_ADDRESS [0][0]->write(0xb0000003); |
---|
| 907 | DCACHE_REQ_TYPE [0][0]->write(DCACHE_TYPE_LOAD_16); |
---|
| 908 | DCACHE_REQ_WDATA [0][0]->write(0xdeadbeef); |
---|
| 909 | DCACHE_RSP_ACK [0][0]->write(1); |
---|
| 910 | // Wait ack |
---|
| 911 | do |
---|
| 912 | { |
---|
| 913 | sc_start(1); |
---|
| 914 | } while (DCACHE_REQ_ACK [0][0]->read() == 0); |
---|
| 915 | DCACHE_REQ_VAL [0][0]->write(0); |
---|
| 916 | |
---|
| 917 | sc_start (9); |
---|
| 918 | TEST(DCACHE_RSP_VAL [0][0]->read(), 0); |
---|
| 919 | sc_start (1); |
---|
| 920 | TEST(DCACHE_RSP_VAL [0][0]->read(), 1); |
---|
| 921 | TEST(DCACHE_RSP_CONTEXT_ID [0][0]->read(), 0); |
---|
| 922 | TEST(DCACHE_RSP_PACKET_ID [0][0]->read(), 21); |
---|
| 923 | TEST(DCACHE_RSP_RDATA [0][0]->read(), 0xb0000003); |
---|
| 924 | TEST(DCACHE_RSP_ERROR [0][0]->read(), DCACHE_ERROR_BUS_ERROR); |
---|
| 925 | sc_start (1); |
---|
| 926 | TEST(DCACHE_RSP_VAL [0][0]->read(), 0); |
---|
| 927 | DCACHE_RSP_ACK [0][0]->write(0); |
---|
| 928 | |
---|
| 929 | } |
---|
| 930 | |
---|
| 931 | //============================================================================== |
---|
| 932 | //===== [ MEMORY ]============================================================== |
---|
| 933 | //============================================================================== |
---|
| 934 | if (_TEST_DMEMORY_) |
---|
| 935 | { |
---|
| 936 | cout << "Test : MEMORY" << endl; |
---|
| 937 | |
---|
| 938 | DCACHE_REQ_VAL [0][0]->write(1); |
---|
| 939 | DCACHE_REQ_CONTEXT_ID [0][0]->write(0); |
---|
| 940 | DCACHE_REQ_PACKET_ID [0][0]->write(21); |
---|
| 941 | DCACHE_REQ_ADDRESS [0][0]->write(0x10000100); |
---|
| 942 | DCACHE_REQ_TYPE [0][0]->write(DCACHE_TYPE_STORE_32); |
---|
| 943 | DCACHE_REQ_WDATA [0][0]->write(0xdeadbeef); |
---|
| 944 | DCACHE_RSP_ACK [0][0]->write(0); |
---|
| 945 | // Wait ack |
---|
| 946 | do |
---|
| 947 | { |
---|
| 948 | sc_start(1); |
---|
| 949 | } while (DCACHE_REQ_ACK [0][0]->read() == 0); |
---|
| 950 | DCACHE_REQ_VAL [0][0]->write(0); |
---|
| 951 | |
---|
| 952 | |
---|
| 953 | |
---|
| 954 | DCACHE_REQ_VAL [0][0]->write(1); |
---|
| 955 | DCACHE_REQ_CONTEXT_ID [0][0]->write(0); |
---|
| 956 | DCACHE_REQ_PACKET_ID [0][0]->write(21); |
---|
| 957 | DCACHE_REQ_ADDRESS [0][0]->write(0x10000100); |
---|
| 958 | DCACHE_REQ_TYPE [0][0]->write(DCACHE_TYPE_LOAD_32); |
---|
| 959 | DCACHE_REQ_WDATA [0][0]->write(0x77777777); |
---|
| 960 | DCACHE_RSP_ACK [0][0]->write(1); |
---|
| 961 | // Wait ack |
---|
| 962 | do |
---|
| 963 | { |
---|
| 964 | sc_start(1); |
---|
| 965 | } while (DCACHE_REQ_ACK [0][0]->read() == 0); |
---|
| 966 | DCACHE_REQ_VAL [0][0]->write(0); |
---|
| 967 | |
---|
| 968 | while (DCACHE_RSP_VAL [0][0]->read() == 0) |
---|
| 969 | sc_start (1); |
---|
| 970 | |
---|
| 971 | TEST(DCACHE_RSP_CONTEXT_ID [0][0]->read(), 0); |
---|
| 972 | TEST(DCACHE_RSP_PACKET_ID [0][0]->read(), 21); |
---|
| 973 | TEST(DCACHE_RSP_RDATA [0][0]->read(), 0xdeadbeef); |
---|
| 974 | TEST(DCACHE_RSP_ERROR [0][0]->read(), DCACHE_ERROR_NONE); |
---|
| 975 | sc_start (1); |
---|
| 976 | TEST(DCACHE_RSP_VAL [0][0]->read(), 0); |
---|
| 977 | DCACHE_RSP_ACK [0][0]->write(0); |
---|
| 978 | |
---|
| 979 | |
---|
| 980 | |
---|
| 981 | DCACHE_REQ_VAL [0][0]->write(1); |
---|
| 982 | DCACHE_REQ_CONTEXT_ID [0][0]->write(0); |
---|
| 983 | DCACHE_REQ_PACKET_ID [0][0]->write(21); |
---|
| 984 | DCACHE_REQ_ADDRESS [0][0]->write(0x10000100); |
---|
| 985 | DCACHE_REQ_TYPE [0][0]->write(DCACHE_TYPE_LOAD_16); |
---|
| 986 | DCACHE_REQ_WDATA [0][0]->write(0x77777777); |
---|
| 987 | DCACHE_RSP_ACK [0][0]->write(1); |
---|
| 988 | // Wait ack |
---|
| 989 | do |
---|
| 990 | { |
---|
| 991 | sc_start(1); |
---|
| 992 | } while (DCACHE_REQ_ACK [0][0]->read() == 0); |
---|
| 993 | DCACHE_REQ_VAL [0][0]->write(0); |
---|
| 994 | |
---|
| 995 | while (DCACHE_RSP_VAL [0][0]->read() == 0) |
---|
| 996 | sc_start (1); |
---|
| 997 | |
---|
| 998 | TEST(DCACHE_RSP_CONTEXT_ID [0][0]->read(), 0); |
---|
| 999 | TEST(DCACHE_RSP_PACKET_ID [0][0]->read(), 21); |
---|
| 1000 | TEST(DCACHE_RSP_RDATA [0][0]->read(), 0xdeaddead); |
---|
| 1001 | TEST(DCACHE_RSP_ERROR [0][0]->read(), DCACHE_ERROR_NONE); |
---|
| 1002 | sc_start (1); |
---|
| 1003 | TEST(DCACHE_RSP_VAL [0][0]->read(), 0); |
---|
| 1004 | DCACHE_RSP_ACK [0][0]->write(0); |
---|
| 1005 | |
---|
| 1006 | DCACHE_REQ_VAL [0][0]->write(1); |
---|
| 1007 | DCACHE_REQ_CONTEXT_ID [0][0]->write(0); |
---|
| 1008 | DCACHE_REQ_PACKET_ID [0][0]->write(21); |
---|
| 1009 | DCACHE_REQ_ADDRESS [0][0]->write(0x10000102); |
---|
| 1010 | DCACHE_REQ_TYPE [0][0]->write(DCACHE_TYPE_LOAD_16); |
---|
| 1011 | DCACHE_REQ_WDATA [0][0]->write(0x77777777); |
---|
| 1012 | DCACHE_RSP_ACK [0][0]->write(1); |
---|
| 1013 | // Wait ack |
---|
| 1014 | do |
---|
| 1015 | { |
---|
| 1016 | sc_start(1); |
---|
| 1017 | } while (DCACHE_REQ_ACK [0][0]->read() == 0); |
---|
| 1018 | DCACHE_REQ_VAL [0][0]->write(0); |
---|
| 1019 | |
---|
| 1020 | while (DCACHE_RSP_VAL [0][0]->read() == 0) |
---|
| 1021 | sc_start (1); |
---|
| 1022 | |
---|
| 1023 | TEST(DCACHE_RSP_CONTEXT_ID [0][0]->read(), 0); |
---|
| 1024 | TEST(DCACHE_RSP_PACKET_ID [0][0]->read(), 21); |
---|
| 1025 | TEST(DCACHE_RSP_RDATA [0][0]->read(), 0xbeefbeef); |
---|
| 1026 | TEST(DCACHE_RSP_ERROR [0][0]->read(), DCACHE_ERROR_NONE); |
---|
| 1027 | sc_start (1); |
---|
| 1028 | TEST(DCACHE_RSP_VAL [0][0]->read(), 0); |
---|
| 1029 | DCACHE_RSP_ACK [0][0]->write(0); |
---|
| 1030 | |
---|
| 1031 | } |
---|
| 1032 | |
---|
| 1033 | //============================================================================== |
---|
| 1034 | //===== [ SIM2OS ]============================================================== |
---|
| 1035 | //============================================================================== |
---|
| 1036 | if (_TEST_SIM2OS_) |
---|
| 1037 | { |
---|
| 1038 | cout << "Test : SIM2OS" << endl; |
---|
| 1039 | |
---|
| 1040 | DCACHE_REQ_VAL [0][0]->write(1); |
---|
| 1041 | DCACHE_REQ_CONTEXT_ID [0][0]->write(0); |
---|
| 1042 | DCACHE_REQ_PACKET_ID [0][0]->write(21); |
---|
| 1043 | DCACHE_REQ_ADDRESS [0][0]->write(0xc0000000); |
---|
| 1044 | DCACHE_REQ_TYPE [0][0]->write(DCACHE_TYPE_STORE_32); |
---|
| 1045 | DCACHE_REQ_WDATA [0][0]->write(SERVICE_CLOCK); |
---|
| 1046 | DCACHE_RSP_ACK [0][0]->write(0); |
---|
| 1047 | // Wait ack |
---|
| 1048 | do |
---|
| 1049 | { |
---|
| 1050 | sc_start(1); |
---|
| 1051 | } while (DCACHE_REQ_ACK [0][0]->read() == 0); |
---|
| 1052 | DCACHE_REQ_VAL [0][0]->write(0); |
---|
| 1053 | |
---|
| 1054 | |
---|
| 1055 | |
---|
| 1056 | DCACHE_REQ_VAL [0][0]->write(1); |
---|
| 1057 | DCACHE_REQ_CONTEXT_ID [0][0]->write(0); |
---|
| 1058 | DCACHE_REQ_PACKET_ID [0][0]->write(21); |
---|
| 1059 | DCACHE_REQ_ADDRESS [0][0]->write(0xc0000004); |
---|
| 1060 | DCACHE_REQ_TYPE [0][0]->write(DCACHE_TYPE_LOAD_32); |
---|
| 1061 | DCACHE_REQ_WDATA [0][0]->write(0x77777777); |
---|
| 1062 | DCACHE_RSP_ACK [0][0]->write(1); |
---|
| 1063 | // Wait ack |
---|
| 1064 | do |
---|
| 1065 | { |
---|
| 1066 | sc_start(1); |
---|
| 1067 | } while (DCACHE_REQ_ACK [0][0]->read() == 0); |
---|
| 1068 | DCACHE_REQ_VAL [0][0]->write(0); |
---|
| 1069 | |
---|
| 1070 | while (DCACHE_RSP_VAL [0][0]->read() == 0) |
---|
| 1071 | sc_start (1); |
---|
| 1072 | |
---|
| 1073 | TEST(DCACHE_RSP_CONTEXT_ID [0][0]->read(), 0); |
---|
| 1074 | TEST(DCACHE_RSP_PACKET_ID [0][0]->read(), 21); |
---|
| 1075 | TEST(DCACHE_RSP_RDATA [0][0]->read(), 354); // if all test is activate |
---|
| 1076 | TEST(DCACHE_RSP_ERROR [0][0]->read(), DCACHE_ERROR_NONE); |
---|
| 1077 | sc_start (1); |
---|
| 1078 | TEST(DCACHE_RSP_VAL [0][0]->read(), 0); |
---|
| 1079 | DCACHE_RSP_ACK [0][0]->write(0); |
---|
| 1080 | |
---|
| 1081 | |
---|
| 1082 | } |
---|
| 1083 | |
---|
| 1084 | //============================================================================== |
---|
| 1085 | //===== [ END TEST ]============================================================ |
---|
| 1086 | //============================================================================== |
---|
| 1087 | |
---|
| 1088 | cout << "<main> Press <Enter> to stop the test" << endl; |
---|
| 1089 | getchar(); |
---|
| 1090 | |
---|
| 1091 | delete CLOCK ; |
---|
| 1092 | delete NRESET; |
---|
| 1093 | |
---|
| 1094 | for (uint32_t i=0; i<nb_entity; i++) |
---|
| 1095 | { |
---|
| 1096 | for (uint32_t j=0; j<icache_nb_port[i]; j++) |
---|
| 1097 | { |
---|
| 1098 | delete ICACHE_REQ_VAL [i][j]; |
---|
| 1099 | delete ICACHE_REQ_ACK [i][j]; |
---|
| 1100 | delete ICACHE_REQ_CONTEXT_ID [i][j]; |
---|
| 1101 | delete ICACHE_REQ_PACKET_ID [i][j]; |
---|
| 1102 | delete ICACHE_REQ_ADDRESS [i][j]; |
---|
| 1103 | delete ICACHE_REQ_TYPE [i][j]; |
---|
| 1104 | delete ICACHE_RSP_VAL [i][j]; |
---|
| 1105 | delete ICACHE_RSP_ACK [i][j]; |
---|
| 1106 | delete ICACHE_RSP_CONTEXT_ID [i][j]; |
---|
| 1107 | delete ICACHE_RSP_PACKET_ID [i][j]; |
---|
| 1108 | delete ICACHE_RSP_ERROR [i][j]; |
---|
| 1109 | |
---|
| 1110 | for (uint32_t k=0; k<iaccess_nb_instruction[i]; k++) |
---|
| 1111 | delete ICACHE_RSP_INSTRUCTION [i][j][k]; |
---|
| 1112 | |
---|
| 1113 | delete [] ICACHE_RSP_INSTRUCTION [i][j]; |
---|
| 1114 | } |
---|
| 1115 | delete [] ICACHE_REQ_VAL [i]; |
---|
| 1116 | delete [] ICACHE_REQ_ACK [i]; |
---|
| 1117 | delete [] ICACHE_REQ_CONTEXT_ID [i]; |
---|
| 1118 | delete [] ICACHE_REQ_PACKET_ID [i]; |
---|
| 1119 | delete [] ICACHE_REQ_ADDRESS [i]; |
---|
| 1120 | delete [] ICACHE_REQ_TYPE [i]; |
---|
| 1121 | delete [] ICACHE_RSP_VAL [i]; |
---|
| 1122 | delete [] ICACHE_RSP_ACK [i]; |
---|
| 1123 | delete [] ICACHE_RSP_CONTEXT_ID [i]; |
---|
| 1124 | delete [] ICACHE_RSP_PACKET_ID [i]; |
---|
| 1125 | delete [] ICACHE_RSP_ERROR [i]; |
---|
| 1126 | delete [] ICACHE_RSP_INSTRUCTION [i]; |
---|
| 1127 | } |
---|
| 1128 | |
---|
| 1129 | delete [] ICACHE_REQ_VAL ; |
---|
| 1130 | delete [] ICACHE_REQ_ACK ; |
---|
| 1131 | delete [] ICACHE_REQ_CONTEXT_ID ; |
---|
| 1132 | delete [] ICACHE_REQ_PACKET_ID ; |
---|
| 1133 | delete [] ICACHE_REQ_ADDRESS ; |
---|
| 1134 | delete [] ICACHE_REQ_TYPE ; |
---|
| 1135 | delete [] ICACHE_RSP_VAL ; |
---|
| 1136 | delete [] ICACHE_RSP_ACK ; |
---|
| 1137 | delete [] ICACHE_RSP_CONTEXT_ID ; |
---|
| 1138 | delete [] ICACHE_RSP_PACKET_ID ; |
---|
| 1139 | delete [] ICACHE_RSP_INSTRUCTION; |
---|
| 1140 | delete [] ICACHE_RSP_ERROR ; |
---|
| 1141 | |
---|
| 1142 | for (uint32_t i=0; i<nb_entity; i++) |
---|
| 1143 | { |
---|
| 1144 | for (uint32_t j=0; j<icache_nb_port[i]; j++) |
---|
| 1145 | { |
---|
| 1146 | delete DCACHE_REQ_VAL [i][j]; |
---|
| 1147 | delete DCACHE_REQ_ACK [i][j]; |
---|
| 1148 | delete DCACHE_REQ_CONTEXT_ID [i][j]; |
---|
| 1149 | delete DCACHE_REQ_PACKET_ID [i][j]; |
---|
| 1150 | delete DCACHE_REQ_ADDRESS [i][j]; |
---|
| 1151 | delete DCACHE_REQ_TYPE [i][j]; |
---|
| 1152 | delete DCACHE_REQ_WDATA [i][j]; |
---|
| 1153 | delete DCACHE_RSP_VAL [i][j]; |
---|
| 1154 | delete DCACHE_RSP_ACK [i][j]; |
---|
| 1155 | delete DCACHE_RSP_CONTEXT_ID [i][j]; |
---|
| 1156 | delete DCACHE_RSP_PACKET_ID [i][j]; |
---|
| 1157 | delete DCACHE_RSP_RDATA [i][j]; |
---|
| 1158 | delete DCACHE_RSP_ERROR [i][j]; |
---|
| 1159 | } |
---|
| 1160 | |
---|
| 1161 | delete [] DCACHE_REQ_VAL [i]; |
---|
| 1162 | delete [] DCACHE_REQ_ACK [i]; |
---|
| 1163 | delete [] DCACHE_REQ_CONTEXT_ID [i]; |
---|
| 1164 | delete [] DCACHE_REQ_PACKET_ID [i]; |
---|
| 1165 | delete [] DCACHE_REQ_ADDRESS [i]; |
---|
| 1166 | delete [] DCACHE_REQ_TYPE [i]; |
---|
| 1167 | delete [] DCACHE_REQ_WDATA [i]; |
---|
| 1168 | delete [] DCACHE_RSP_VAL [i]; |
---|
| 1169 | delete [] DCACHE_RSP_ACK [i]; |
---|
| 1170 | delete [] DCACHE_RSP_CONTEXT_ID [i]; |
---|
| 1171 | delete [] DCACHE_RSP_PACKET_ID [i]; |
---|
| 1172 | delete [] DCACHE_RSP_RDATA [i]; |
---|
| 1173 | delete [] DCACHE_RSP_ERROR [i]; |
---|
| 1174 | } |
---|
| 1175 | |
---|
| 1176 | delete [] DCACHE_REQ_VAL ; |
---|
| 1177 | delete [] DCACHE_REQ_ACK ; |
---|
| 1178 | delete [] DCACHE_REQ_CONTEXT_ID ; |
---|
| 1179 | delete [] DCACHE_REQ_PACKET_ID ; |
---|
| 1180 | delete [] DCACHE_REQ_ADDRESS ; |
---|
| 1181 | delete [] DCACHE_REQ_TYPE ; |
---|
| 1182 | delete [] DCACHE_REQ_WDATA ; |
---|
| 1183 | delete [] DCACHE_RSP_VAL ; |
---|
| 1184 | delete [] DCACHE_RSP_ACK ; |
---|
| 1185 | delete [] DCACHE_RSP_CONTEXT_ID ; |
---|
| 1186 | delete [] DCACHE_RSP_PACKET_ID ; |
---|
| 1187 | delete [] DCACHE_RSP_RDATA ; |
---|
| 1188 | delete [] DCACHE_RSP_ERROR ; |
---|
| 1189 | |
---|
| 1190 | delete env; |
---|
| 1191 | |
---|
| 1192 | delete param; |
---|
| 1193 | delete segtable; |
---|
| 1194 | |
---|
| 1195 | delete [] ramlock_address; |
---|
| 1196 | delete [] nb_lock; |
---|
| 1197 | |
---|
| 1198 | delete [] name_tty [0]; |
---|
| 1199 | delete [] name_tty; |
---|
| 1200 | delete [] tty_address; |
---|
| 1201 | delete [] nb_tty; |
---|
| 1202 | |
---|
| 1203 | delete [] cache_shared_nb_line ; |
---|
| 1204 | delete [] cache_shared_size_line ; |
---|
| 1205 | delete [] cache_shared_size_word ; |
---|
| 1206 | delete [] cache_shared_associativity; |
---|
| 1207 | delete [] cache_shared_hit_latence ; |
---|
| 1208 | delete [] cache_shared_miss_penality; |
---|
| 1209 | delete [] icache_nb_level ; |
---|
| 1210 | delete [] icache_nb_port ; |
---|
| 1211 | delete [] icache_nb_line [0]; |
---|
| 1212 | delete [] icache_size_line [0]; |
---|
| 1213 | delete [] icache_size_word [0]; |
---|
| 1214 | delete [] icache_associativity [0]; |
---|
| 1215 | delete [] icache_hit_latence [0]; |
---|
| 1216 | delete [] icache_miss_penality [0]; |
---|
| 1217 | delete [] icache_nb_line [1]; |
---|
| 1218 | delete [] icache_size_line [1]; |
---|
| 1219 | delete [] icache_size_word [1]; |
---|
| 1220 | delete [] icache_associativity [1]; |
---|
| 1221 | delete [] icache_hit_latence [1]; |
---|
| 1222 | delete [] icache_miss_penality [1]; |
---|
| 1223 | delete [] icache_nb_line ; |
---|
| 1224 | delete [] icache_size_line ; |
---|
| 1225 | delete [] icache_size_word ; |
---|
| 1226 | delete [] icache_associativity ; |
---|
| 1227 | delete [] icache_hit_latence ; |
---|
| 1228 | delete [] icache_miss_penality ; |
---|
| 1229 | delete [] dcache_nb_level ; |
---|
| 1230 | delete [] dcache_nb_port ; |
---|
| 1231 | delete [] dcache_nb_line [0]; |
---|
| 1232 | delete [] dcache_size_line [0]; |
---|
| 1233 | delete [] dcache_size_word [0]; |
---|
| 1234 | delete [] dcache_associativity [0]; |
---|
| 1235 | delete [] dcache_hit_latence [0]; |
---|
| 1236 | delete [] dcache_miss_penality [0]; |
---|
| 1237 | delete [] dcache_nb_line [1]; |
---|
| 1238 | delete [] dcache_size_line [1]; |
---|
| 1239 | delete [] dcache_size_word [1]; |
---|
| 1240 | delete [] dcache_associativity [1]; |
---|
| 1241 | delete [] dcache_hit_latence [1]; |
---|
| 1242 | delete [] dcache_miss_penality [1]; |
---|
| 1243 | delete [] dcache_nb_line ; |
---|
| 1244 | delete [] dcache_size_line ; |
---|
| 1245 | delete [] dcache_size_word ; |
---|
| 1246 | delete [] dcache_associativity ; |
---|
| 1247 | delete [] dcache_hit_latence ; |
---|
| 1248 | delete [] dcache_miss_penality ; |
---|
| 1249 | |
---|
| 1250 | delete [] iaccess_nb_context ; |
---|
| 1251 | delete [] iaccess_nb_instruction; |
---|
| 1252 | delete [] iaccess_nb_packet ; |
---|
| 1253 | delete [] iaccess_size_address ; |
---|
| 1254 | delete [] iaccess_size_data ; |
---|
| 1255 | delete [] daccess_nb_context ; |
---|
| 1256 | delete [] daccess_nb_packet ; |
---|
| 1257 | delete [] daccess_size_address ; |
---|
| 1258 | delete [] daccess_size_data ; |
---|
| 1259 | |
---|
| 1260 | delete [] buffer_irsp_size; |
---|
| 1261 | delete [] buffer_drsp_size; |
---|
| 1262 | } |
---|
| 1263 | cout << "<main> End" << endl; |
---|
| 1264 | |
---|
| 1265 | return EXIT_SUCCESS; |
---|
| 1266 | } |
---|