| # Copyright lowRISC contributors. |
| # Licensed under the Apache License, Version 2.0, see LICENSE for details. |
| # SPDX-License-Identifier: Apache-2.0 |
| Handles linear addresses generated from srec_cat to suit with fpga BRAM |
| architecture which need word addressing.. Example |
| DESC = """addr4x.py script handles the address generated in mem file from |
| srec_cat to suit with BRAM memory architecture which need word addressing""" |
| parser = argparse.ArgumentParser(prog="addr4x.py", description=DESC) |
| parser.add_argument('--infile', |
| type=argparse.FileType('r', encoding='UTF-8'), |
| parser.add_argument('--outfile', |
| type=argparse.FileType('w', encoding='UTF-8'), |
| args = parser.parse_args() |
| in_file_path = Path(args.inputfile.name).resolve() |
| with open(in_file_path) as file: |
| if "sourceforge" not in line: |
| final = "@" + hex(mult * 4)[2:] + " " + b[1] |
| args.outputfile.write(final) |
| if __name__ == "__main__": |