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