Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FABulous: Fix default project language #244

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions FABulous/FABulous.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,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 All @@ -180,6 +183,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 @@ -199,6 +206,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, dst):
"""Copies all Verilog files from source directory to the destination directory.
Expand Down Expand Up @@ -1672,7 +1681,6 @@ def main():
parser.add_argument(
"-w",
"--writer",
default="verilog",
choices=["verilog", "vhdl"],
help="Set the type of HDL code generated by the tool. Currently support Verilog and VHDL (Default using Verilog)",
)
Expand Down Expand Up @@ -1727,8 +1735,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
Loading