OpenCores
URL https://opencores.org/ocsvn/a-z80/a-z80/trunk

Subversion Repositories a-z80

[/] [a-z80/] [trunk/] [cpu/] [control/] [genmatrix.py] - Diff between revs 3 and 6

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 3 Rev 6
Line 1... Line 1...
#!/usr/bin/env python
#!/usr/bin/env python
#
#
# This script reads A-Z80 instruction timing data from a spreadsheet text file
# This script reads A-Z80 instruction timing data from a spreadsheet text file
# and generates a Verilog include file defining the control block execution matrix.
# and generates a Verilog include file defining the control block execution matrix.
# Macros in the timing spreadsheet are substituted using a list of keys stored
# Token keywords in the timing spreadsheet are substituted using a list of keys
# in the macros file. See the macro file for the format information.
# stored in the macros file. See the macro file for the format information.
#
#
# Input timing file is exported from the Excel file as a TAB-delimited text file.
# Input timing file is exported from the Excel file as a TAB-delimited text file.
#
#
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
#  Copyright (C) 2014  Goran Devic
#  Copyright (C) 2014  Goran Devic
Line 165... Line 165...
        if abbr and len(action)==0:
        if abbr and len(action)==0:
            continue
            continue
        imatrix.append("{0}{1} end".format(state, action))
        imatrix.append("{0}{1} end".format(state, action))
 
 
# Create a file containing the logic matrix code
# Create a file containing the logic matrix code
with open('exec_matrix.i', 'w') as file:
with open('exec_matrix.vh', 'w') as file:
    file.write("// Automatically generated by genmatrix.py\n")
    file.write("// Automatically generated by genmatrix.py\n")
    # If there were errors, print them first (and output to the console)
    # If there were errors, print them first (and output to the console)
    if len(errors)>0:
    if len(errors)>0:
        for error in errors:
        for error in errors:
            print error
            print error
            file.write(error + "\n")
            file.write(error + "\n")
        file.write("-" * 80 + "\n")
        file.write("-" * 80 + "\n")
    for item in imatrix:
    for item in imatrix:
        file.write("{}\n".format(item))
        file.write("{}\n".format(item))
 
 
# Touch a file that includes 'exec_matrix.i' to ensure it will recompile correctly
# Touch a file that includes 'exec_matrix.vh' to ensure it will recompile correctly
os.utime("execute.sv", None)
os.utime("execute.sv", None)
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.