1 /*************************************************************************************** 2 * Copyright (c) 2020-2021 Institute of Computing Technology, Chinese Academy of Sciences 3 * 4 * XiangShan is licensed under Mulan PSL v2. 5 * You can use this software according to the terms and conditions of the Mulan PSL v2. 6 * You may obtain a copy of Mulan PSL v2 at: 7 * http://license.coscl.org.cn/MulanPSL2 8 * 9 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 10 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 11 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 12 * 13 * See the Mulan PSL v2 for more details. 14 ***************************************************************************************/ 15 16 #include <stdio.h> 17 #include <assert.h> 18 #include <stdint.h> 19 20 int main(int argc, char *argv[]) { 21 assert(argc == 3); 22 23 FILE *in = fopen(argv[1], "rb"); 24 assert(in != NULL); 25 26 FILE *out = fopen(argv[2], "w"); 27 assert(out != NULL); 28 29 int i; 30 for (i = 0; i < 0x100000; i ++) { 31 fprintf(out, "00\n"); 32 } 33 34 uint8_t b; 35 int ret; 36 while ((ret = fread(&b, 1, 1, in)) != 0) { 37 fprintf(out, "%1x%1x\n", b >> 4, b & 0xf); 38 } 39 40 fclose(in); 41 fclose(out); 42 43 return 0; 44 } 45