From 2654e2782181ad130c4a5f8af06ffde235436053 Mon Sep 17 00:00:00 2001 From: umarcor Date: Sun, 21 Apr 2019 11:55:03 +0200 Subject: [PATCH] ghdl_interface: with ghdl_e, save runtime args to JSON file --- vunit/sim_if/ghdl.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/vunit/sim_if/ghdl.py b/vunit/sim_if/ghdl.py index 489558b19..c733f7033 100644 --- a/vunit/sim_if/ghdl.py +++ b/vunit/sim_if/ghdl.py @@ -8,11 +8,13 @@ Interface for GHDL simulator """ +from pathlib import Path from os.path import exists, join, abspath import os import logging import subprocess import shlex +from json import dump from sys import stdout # To avoid output catched in non-verbose mode from warnings import warn from ..exceptions import CompileError @@ -277,6 +279,23 @@ def _get_command(self, config, output_path, elaborate_only, ghdl_e, wave_file): cmd += sim if elaborate_only: cmd += ["--no-run"] + else: + try: + os.makedirs(output_path, mode=0o777) + except OSError: + pass + with open(join(output_path, "args.json"), "w") as fname: + dump( + { + "bin": str( + Path(output_path) + / ("%s-%s" % (config.entity_name, config.architecture_name)) + ), + "build": cmd[1:], + "sim": sim, + }, + fname, + ) return cmd