Skip to content

Commit 97ac915

Browse files
author
Salvador Santoluctio
committed
updates to run on hdl shared testbench project
1 parent 211e355 commit 97ac915

File tree

2 files changed

+49
-45
lines changed

2 files changed

+49
-45
lines changed

labview_fpga_hdl_tools/common.py

Lines changed: 39 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -552,46 +552,48 @@ def process_constraints_template(config):
552552
"""
553553
# Define output directory
554554
output_folder = os.path.join(os.getcwd(), "objects", "xdc")
555-
window_constraints_path = os.path.join(
556-
config.the_window_folder_input, "TheWindowConstraints.xdc"
557-
)
558-
559-
# Create output directory if it doesn't exist
560-
os.makedirs(output_folder, exist_ok=True)
561-
562-
# Check if the window constraints file exists
563-
if os.path.exists(window_constraints_path):
564-
with open(window_constraints_path, "r", encoding="utf-8") as f:
565-
# Read the window constraints file
566-
constraints_content = f.read()
567-
568-
# Extract content between markers
569-
period_pattern = (
570-
r"# BEGIN_LV_FPGA_PERIOD_CONSTRAINTS(.*?)# END_LV_FPGA_PERIOD_CONSTRAINTS"
571-
)
572-
clip_pattern = r"# BEGIN_LV_FPGA_CLIP_CONSTRAINTS(.*?)# END_LV_FPGA_CLIP_CONSTRAINTS"
573-
from_to_pattern = (
574-
r"# BEGIN_LV_FPGA_FROM_TO_CONSTRAINTS(.*?)# END_LV_FPGA_FROM_TO_CONSTRAINTS"
575-
)
555+
if config.the_window_folder_input is None:
556+
print("TheWindowFolder input is not specified in the configuration.")
557+
else:
558+
window_constraints_path = os.path.join(
559+
config.the_window_folder_input, "TheWindowConstraints.xdc"
560+
)
561+
# Create output directory if it doesn't exist
562+
os.makedirs(output_folder, exist_ok=True)
563+
564+
# Check if the window constraints file exists
565+
if os.path.exists(window_constraints_path):
566+
with open(window_constraints_path, "r", encoding="utf-8") as f:
567+
# Read the window constraints file
568+
constraints_content = f.read()
569+
570+
# Extract content between markers
571+
period_pattern = (
572+
r"# BEGIN_LV_FPGA_PERIOD_CONSTRAINTS(.*?)# END_LV_FPGA_PERIOD_CONSTRAINTS"
573+
)
574+
clip_pattern = r"# BEGIN_LV_FPGA_CLIP_CONSTRAINTS(.*?)# END_LV_FPGA_CLIP_CONSTRAINTS"
575+
from_to_pattern = (
576+
r"# BEGIN_LV_FPGA_FROM_TO_CONSTRAINTS(.*?)# END_LV_FPGA_FROM_TO_CONSTRAINTS"
577+
)
576578

577-
period_match = re.search(period_pattern, constraints_content, re.DOTALL)
578-
clip_match = re.search(clip_pattern, constraints_content, re.DOTALL)
579-
from_to_match = re.search(from_to_pattern, constraints_content, re.DOTALL)
579+
period_match = re.search(period_pattern, constraints_content, re.DOTALL)
580+
clip_match = re.search(clip_pattern, constraints_content, re.DOTALL)
581+
from_to_match = re.search(from_to_pattern, constraints_content, re.DOTALL)
580582

581-
if not period_match or not clip_match or not from_to_match:
582-
print(
583-
"Error: Could not find one or more marker sections in TheWindowConstraints.xdc"
584-
)
585-
return
583+
if not period_match or not clip_match or not from_to_match:
584+
print(
585+
"Error: Could not find one or more marker sections in TheWindowConstraints.xdc"
586+
)
587+
return
586588

587-
period_content = period_match.group(1)
588-
clip_content = clip_match.group(1)
589-
from_to_content = from_to_match.group(1)
590-
else:
591-
print(f"TheWindowConstraints.xdc file not found at {window_constraints_path}")
592-
period_content = ""
593-
clip_content = ""
594-
from_to_content = ""
589+
period_content = period_match.group(1)
590+
clip_content = clip_match.group(1)
591+
from_to_content = from_to_match.group(1)
592+
else:
593+
print(f"TheWindowConstraints.xdc file not found at {window_constraints_path}")
594+
period_content = ""
595+
clip_content = ""
596+
from_to_content = ""
595597

596598
# Read custom constraints file if specified
597599
custom_constraints_content = ""

labview_fpga_hdl_tools/create_vivado_project.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -652,20 +652,22 @@ def create_project(overwrite=False, update=False, test=False):
652652
# Process the xdc_template to ensure that we have one for the Vivado project
653653
common.process_constraints_template(config)
654654

655+
655656
# Validate that all constraints files exist - do this after processing the templates
656657
try:
657658
_validate_constraints_files(config)
658659
except Exception as e:
659660
print(f"Error: {e}")
660661
return 1
661-
662-
# Run (or rerun) generate LV target support - this is needed to generate TheWindow.vhd that goes
663-
# into the objects directory and which gets used in the Vivado project
664-
try:
665-
gen_labview_target_plugin.gen_lv_target_support()
666-
except Exception as e:
667-
print(f"Error: {e}")
668-
return 1
662+
663+
if len(config.window_vhdl_templates) > 0:
664+
# Run (or rerun) generate LV target support - this is needed to generate TheWindow.vhd that goes
665+
# into the objects directory and which gets used in the Vivado project
666+
try:
667+
gen_labview_target_plugin.gen_lv_target_support()
668+
except Exception as e:
669+
print(f"Error: {e}")
670+
return 1
669671

670672
# Create or update the Vivado project based on the determined mode
671673
try:

0 commit comments

Comments
 (0)