Files
PipelineProcessorTests/create_verilog_from_asm.py
2024-07-11 15:21:49 +08:00

8 lines
344 B
Python

file_name = input("File name: ")
with open(file_name + "_mars.txt") as fl:
file_content = fl.readlines()
with open(file_name + ".txt", "w") as fl:
for idx, inst in enumerate(file_content):
# print("20'd%d: instruction <= 32'h%s;" % (idx, inst.strip()))
fl.write("20'd%d: instruction <= 32'h%s;\n" % (idx, inst.strip()))