CPLD: Tool argument parsing.

This commit is contained in:
Jared Boone
2019-02-22 13:23:48 -08:00
parent d60389445d
commit 20975e9313

View File

@ -7,13 +7,12 @@ from xsvf import XSVFParser
# Command line argument parsing. # Command line argument parsing.
####################################################################### #######################################################################
import sys import argparse
if len(sys.argv) != 2: parser = argparse.ArgumentParser()
print("Usage: cpld_crc.py <HackRF CPLD XSVF file)") parser.add_argument('--debug', action='store_true')
sys.exit(-1) parser.add_argument('hackrf_xc2c_cpld_xsvf', type=str)
args = parser.parse_args()
path_xsvf = sys.argv[1]
####################################################################### #######################################################################
# Generic XSVF parsing phase, produces a tree of commands performed # Generic XSVF parsing phase, produces a tree of commands performed
@ -21,8 +20,8 @@ path_xsvf = sys.argv[1]
####################################################################### #######################################################################
parser = XSVFParser() parser = XSVFParser()
with open(path_xsvf, "rb") as f: with open(args.hackrf_xc2c_cpld_xsvf, "rb") as f:
commands = parser.parse(f) #, debug=True) commands = parser.parse(f, debug=args.debug)
####################################################################### #######################################################################
# Extraction of verify row addresses and data/masks. # Extraction of verify row addresses and data/masks.