diff options
author | Afonso Oliveira <Afonso.Oliveira@synopsys.com> | 2024-09-30 21:18:49 +0100 |
---|---|---|
committer | Afonso Oliveira <Afonso.Oliveira@synopsys.com> | 2024-09-30 21:18:49 +0100 |
commit | d07ade8085ef98679af95ae6c53f5ea6dd591fdc (patch) | |
tree | 61a092219f855cd26f1eb77c872ce4299634a20f | |
parent | 6a1be96c8238d603a50d956ff1f91defa264785b (diff) | |
download | riscv-opcodes-d07ade8085ef98679af95ae6c53f5ea6dd591fdc.zip riscv-opcodes-d07ade8085ef98679af95ae6c53f5ea6dd591fdc.tar.gz riscv-opcodes-d07ade8085ef98679af95ae6c53f5ea6dd591fdc.tar.bz2 |
Solve issue #284
-rwxr-xr-x | parse.py | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -954,8 +954,9 @@ def make_c(instr_dict): enc_header = file.read() commit = os.popen('git log -1 --format="format:%h"').read() - enc_file = open('encoding.out.h','w') - enc_file.write(f'''/* SPDX-License-Identifier: BSD-3-Clause */ + + # Generate the output as a string + output_str = f'''/* SPDX-License-Identifier: BSD-3-Clause */ /* Copyright (c) 2023 RISC-V International */ @@ -978,8 +979,14 @@ def make_c(instr_dict): {declare_csr_str}#endif #ifdef DECLARE_CAUSE {declare_cause_str}#endif -''') - enc_file.close() +''' + + # Replace '=rs' with 'equrs' in the output + output_str = output_str.replace('=RS', '_EQU_RS') + + # Write the modified output to the file + with open('encoding.out.h', 'w') as enc_file: + enc_file.write(output_str) def make_go(instr_dict): |