Skip to content

Commit

Permalink
FABulous: Fix default project language (FPGA-Research#244)
Browse files Browse the repository at this point in the history
Verilog was still set as default project language for the commandline args, which could cause some problems.

Add warning when default project language is overwritten by commandline argument.

Add debug message, which language is set for the current project.

Add info message about project creation.

Signed-off-by: Jonas K. <[email protected]>
  • Loading branch information
EverythingElseWasAlreadyTaken authored and KelvinChung2000 committed Jan 6, 2025
1 parent aaf2fbc commit bb7ba65
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions FABulous/FABulous_CLI/FABulous.py
Original file line number Diff line number Diff line change
Expand Up @@ -1064,8 +1064,10 @@ def main():

if os.getenv("FAB_PROJ_LANG") == "vhdl":
writer = VHDLWriter()
logger.debug("VHDL writer selected")
elif os.getenv("FAB_PROJ_LANG") == "verilog":
writer = VerilogWriter()
logger.debug("Verilog writer selected")
else:
logger.error(
f"Invalid projct language specified: {os.getenv('FAB_PROJ_LANG')}"
Expand Down
11 changes: 10 additions & 1 deletion FABulous/FABulous_CLI/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@ def setup_project_env_vars(args: argparse.Namespace) -> None:
logger.warning("No project .env file found")

# Overwrite project language param, if writer is specified as command line argument
if args.writer:
if args.writer and args.writer != os.getenv("FAB_PROJ_LANG"):
logger.warning(
f"Overwriting project language for current run, from {os.getenv('FAB_PROJ_LANG')} to {args.writer}, which was specified as command line argument"
)
os.environ["FAB_PROJ_LANG"] = args.writer


Expand Down Expand Up @@ -163,6 +166,10 @@ def create_project(project_dir, type: Literal["verilog", "vhdl"] = "verilog"):
else:
os.mkdir(f"{project_dir}")

# set default type, since "None" overwrites the default value
if not type:
type = "verilog"

os.mkdir(f"{project_dir}/.FABulous")
fabulousRoot = os.getenv("FAB_ROOT")

Expand All @@ -182,6 +189,8 @@ def create_project(project_dir, type: Literal["verilog", "vhdl"] = "verilog"):

adjust_directory_in_verilog_tb(project_dir)

logger.info(f"New FABulous project created in {project_dir} with {type} language.")


def copy_verilog_files(src: Path, dst: Path):
"""Copies all Verilog files from source directory to the destination directory.
Expand Down

0 comments on commit bb7ba65

Please sign in to comment.