Changeset 420
- Timestamp:
- Jun 25, 2013, 5:16:29 PM (11 years ago)
- Location:
- branches/v4/platforms/tsarv4_mono_mmu_ioc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/v4/platforms/tsarv4_mono_mmu_ioc/Makefile
r419 r420 12 12 soclib-cc $(SOCLIB_CC_ARGS) -P -p $(SOCLIB_DESC) -o $(SIMULATOR_BINARY) 13 13 14 run_tsar_boot: all tsar_boot.bin disk.img 15 $(SIMULATOR_CMD) --rom tsar_boot.bin --dsk disk.img 16 17 run_dummy_boot: all vmlinux disk.img 18 $(SIMULATOR_CMD) --rom vmlinux --dsk disk.img --dummy-boot 19 14 20 cscope.out: 15 21 soclib-cc -p $(SOCLIB_DESC) --tags -
branches/v4/platforms/tsarv4_mono_mmu_ioc/top.cpp
r410 r420 86 86 */ 87 87 88 char *soft_path = NULL; 89 char *bd_path = NULL; 90 bool trace_enabled = false; 91 size_t trace_start_cycle = 0; 92 93 /* 94 * arguments parsing 95 */ 96 97 void args_parse(unsigned int argc, char *argv[]) 88 struct param_s { 89 char *rom_path; 90 char *dsk_path; 91 bool dummy_boot; 92 bool trace_enabled; 93 size_t trace_start_cycle; 94 }; 95 96 #define PARAM_INITIALIZER \ 97 { \ 98 .rom_path = NULL, \ 99 .dsk_path = NULL, \ 100 .dummy_boot = false, \ 101 .trace_enabled = false, \ 102 .trace_start_cycle = 0 \ 103 } 104 105 static inline void print_param(const struct param_s ¶m) 98 106 { 99 if (argc > 1)100 {101 for (size_t n = 1; n < argc; n = n + 2)102 {103 if ((strcmp(argv[n], "-soft") == 0) && ((n + 1) < argc))104 {105 assert((soft_path = strdup(argv[n + 1]))106 && "insufficient memory");107 }108 else if ((strcmp(argv[n], "-img") == 0) && ((n + 1) < argc))109 {110 assert((bd_path = strdup(argv[n + 1]))111 && "insufficient memory");112 }113 else if ((strcmp(argv[n], "-trace") == 0) && ((n + 1) < argc))114 {115 trace_enabled = true;116 trace_start_cycle = atoi(argv[n + 1]);117 }118 else119 {120 std::cout << "Error: don't understand option " << argv[n] << std::endl;121 std::cout << "Accepted arguments are :" << std::endl;122 std::cout << "-soft pathname" << std::endl;123 std::cout << "-img pathname" << std::endl;124 std::cout << "[-trace trace_start_cycle]" << std::endl;125 exit(0);126 }127 }128 }129 130 assert(soft_path && "-soft is not optional");131 assert(bd_path && "-img is not optional");132 107 std::cout << std::endl; 133 108 std::cout << "simulation parameters:" << std::endl; 134 std::cout << " soft = " << soft_path << std::endl; 135 std::cout << " img = " << bd_path << std::endl; 136 std::cout << " trace = " << trace_enabled << std::endl; 109 std::cout << " rom = " << param.rom_path << std::endl; 110 std::cout << " dummy boot = " << param.dummy_boot << std::endl; 111 std::cout << " dsk = " << param.dsk_path << std::endl; 112 std::cout << " trace = " << param.trace_enabled << std::endl; 113 if (param.trace_enabled) 114 std::cout << " start cyc = " << param.trace_start_cycle << std::endl; 115 137 116 std::cout << std::endl; 117 } 118 119 120 /* 121 * arguments parsing 122 */ 123 124 void args_parse(unsigned int argc, char *argv[], struct param_s ¶m) 125 { 126 for (size_t n = 1; n < argc; n = n + 2) 127 { 128 if ((strcmp(argv[n], "--rom") == 0) && ((n + 1) < argc)) 129 { 130 assert((param.rom_path = strdup(argv[n + 1])) 131 && "insufficient memory"); 132 } 133 else if ((strcmp(argv[n], "--dsk") == 0) && ((n + 1) < argc)) 134 { 135 assert((param.dsk_path = strdup(argv[n + 1])) 136 && "insufficient memory"); 137 } 138 else if (strcmp(argv[n], "--dummy-boot") == 0) 139 { 140 param.dummy_boot = true; 141 /* we don't have an extra argument */ 142 n = n - 1; 143 } 144 else if ((strcmp(argv[n], "--trace") == 0) && ((n + 1) < argc)) 145 { 146 param.trace_enabled = true; 147 param.trace_start_cycle = atoi(argv[n + 1]); 148 } 149 else 150 { 151 std::cout << "Error: don't understand option " << argv[n] << std::endl; 152 std::cout << "Accepted arguments are :" << std::endl; 153 std::cout << "--rom pathname" << std::endl; 154 std::cout << "--dsk pathname" << std::endl; 155 std::cout << "[--dummy-boot]" << std::endl; 156 std::cout << "[-trace trace_start_cycle]" << std::endl; 157 exit(0); 158 } 159 } 160 161 /* check parameters */ 162 assert(param.rom_path && "--rom is not optional"); 163 assert(param.dsk_path && "--dsk is not optional"); 164 165 print_param(param); 138 166 } 139 167 … … 151 179 #endif 152 180 181 struct param_s param = PARAM_INITIALIZER; 182 153 183 /* parse arguments */ 154 args_parse(argc, argv );184 args_parse(argc, argv, param); 155 185 156 186 /* … … 181 211 182 212 Loader loader; 183 loader.load_file( soft_path);213 loader.load_file(param.rom_path); 184 214 185 215 #ifdef CONFIG_GDB_SERVER … … 189 219 typedef Mips32ElIss proc_iss; 190 220 #endif 221 222 if (param.dummy_boot == true) 223 { 224 /* boot linux image directly */ 225 const BinaryFileSymbol *bfs = loader.get_symbol_by_name("kernel_entry"); 226 std::cout << "setResetAdress: " << std::hex << bfs->address() << std::endl; 227 proc_iss::setResetAddress(bfs->address()); 228 } 191 229 192 230 VciCcVCacheWrapperV4<vci_param, proc_iss > proc("ccvcache", … … 205 243 1, // memory cache local id 206 244 1000, // max frozen cycles 207 trace_start_cycle,208 trace_enabled);245 param.trace_start_cycle, 246 param.trace_enabled); 209 247 210 248 VciSimpleRam<vci_param> xram("xram", IntTab(0), maptabd, loader); … … 217 255 16, 256, 16, // cache size 218 256 1024, 4, 4, // HEAP size, TRT size, UPT size 219 trace_start_cycle,trace_enabled);257 param.trace_start_cycle, param.trace_enabled); 220 258 221 259 VciSimhelper<vci_param> vciexit("vciexit", IntTab(2), maptabd); … … 227 265 228 266 VciBlockDeviceTsarV4<vci_param> iobd("iobd", maptabd, IntTab(1), IntTab(5), 229 bd_path); // mapped_file[, block_size=512, latency=0]267 param.dsk_path); // mapped_file[, block_size=512, latency=0] 230 268 231 269 VciVgmn<vci_param> ringd("ringd", maptabd, 232 2, 6, // #initiators, #targets 233 2, 8); // min_latency, FIFO depth 270 2, 6, // #initiators, #targets 271 2, 8, // min_latency, FIFO depth 272 IntTab(1)); // default target 234 273 235 274 VciVgmn<vci_param> ringc("ringc", maptabc, … … 350 389 signal_resetn = true; 351 390 352 if ( trace_enabled)391 if (param.trace_enabled) 353 392 { 354 if ( trace_start_cycle > 1)393 if (param.trace_start_cycle > 1) 355 394 // simulate without output until trace_start_cycle 356 sc_start(sc_time( trace_start_cycle, SC_NS));395 sc_start(sc_time(param.trace_start_cycle, SC_NS)); 357 396 358 397 // enable debugging output 359 for (size_t n = trace_start_cycle ;; n++)398 for (size_t n = param.trace_start_cycle ;; n++) 360 399 { 361 400 std::cout << "****************** cycle " << std::dec << n
Note: See TracChangeset
for help on using the changeset viewer.