mirror of https://github.com/openXC7/prjxray.git
Add optional bits output for debugging.
Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com>
This commit is contained in:
parent
3aa8c77ad6
commit
111ad4bacc
|
|
@ -3,6 +3,7 @@
|
|||
Take bitstream .bit files and decode them to FASM.
|
||||
'''
|
||||
|
||||
import contextlib
|
||||
import os
|
||||
import fasm
|
||||
import fasm.output
|
||||
|
|
@ -87,6 +88,7 @@ def main():
|
|||
default_bitread = os.path.join(os.getenv("XRAY_TOOLS_DIR"), 'bitread')
|
||||
|
||||
parser.add_argument('--db-root', help="Database root.", **db_root_kwargs)
|
||||
parser.add_argument('--bits-file', help="Output filename for bitread output, default is deleted tempfile.", default=None)
|
||||
parser.add_argument(
|
||||
'--part', help="Name of part being targetted.", **part_kwargs)
|
||||
parser.add_argument(
|
||||
|
|
@ -104,7 +106,12 @@ def main():
|
|||
'--canonical', help='Output canonical bitstream.', action='store_true')
|
||||
args = parser.parse_args()
|
||||
|
||||
with tempfile.NamedTemporaryFile() as bits_file:
|
||||
with contextlib.ExitStack() as stack:
|
||||
if args.bits_file:
|
||||
bits_file = stack.enter_context(open(args.bits_file, 'wb'))
|
||||
else:
|
||||
bits_file = stack.enter_context(tempfile.NamedTemporaryFile())
|
||||
|
||||
bit_to_bits(
|
||||
bitread=args.bitread,
|
||||
part_yaml=os.path.join(args.db_root, '{}.yaml'.format(args.part)),
|
||||
|
|
|
|||
Loading…
Reference in New Issue