labview-fpga-hdl-tools 2.0.0.dev6__tar.gz → 2.0.0.dev8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. {labview_fpga_hdl_tools-2.0.0.dev6 → labview_fpga_hdl_tools-2.0.0.dev8}/PKG-INFO +1 -1
  2. {labview_fpga_hdl_tools-2.0.0.dev6 → labview_fpga_hdl_tools-2.0.0.dev8}/labview_fpga_hdl_tools/create_modelsim_project.py +62 -46
  3. {labview_fpga_hdl_tools-2.0.0.dev6 → labview_fpga_hdl_tools-2.0.0.dev8}/labview_fpga_hdl_tools/install_dependencies.py +41 -3
  4. {labview_fpga_hdl_tools-2.0.0.dev6 → labview_fpga_hdl_tools-2.0.0.dev8}/labview_fpga_hdl_tools/launch_modelsim.py +10 -9
  5. {labview_fpga_hdl_tools-2.0.0.dev6 → labview_fpga_hdl_tools-2.0.0.dev8}/labview_fpga_hdl_tools/sim_modelsim.py +10 -9
  6. {labview_fpga_hdl_tools-2.0.0.dev6 → labview_fpga_hdl_tools-2.0.0.dev8}/pyproject.toml +1 -1
  7. {labview_fpga_hdl_tools-2.0.0.dev6 → labview_fpga_hdl_tools-2.0.0.dev8}/LICENSE +0 -0
  8. {labview_fpga_hdl_tools-2.0.0.dev6 → labview_fpga_hdl_tools-2.0.0.dev8}/README.md +0 -0
  9. {labview_fpga_hdl_tools-2.0.0.dev6 → labview_fpga_hdl_tools-2.0.0.dev8}/labview_fpga_hdl_tools/.gitignore +0 -0
  10. {labview_fpga_hdl_tools-2.0.0.dev6 → labview_fpga_hdl_tools-2.0.0.dev8}/labview_fpga_hdl_tools/__init__.py +0 -0
  11. {labview_fpga_hdl_tools-2.0.0.dev6 → labview_fpga_hdl_tools-2.0.0.dev8}/labview_fpga_hdl_tools/__main__.py +0 -0
  12. {labview_fpga_hdl_tools-2.0.0.dev6 → labview_fpga_hdl_tools-2.0.0.dev8}/labview_fpga_hdl_tools/check_syntax.py +0 -0
  13. {labview_fpga_hdl_tools-2.0.0.dev6 → labview_fpga_hdl_tools-2.0.0.dev8}/labview_fpga_hdl_tools/command_config.py +0 -0
  14. {labview_fpga_hdl_tools-2.0.0.dev6 → labview_fpga_hdl_tools-2.0.0.dev8}/labview_fpga_hdl_tools/command_hooks.py +0 -0
  15. {labview_fpga_hdl_tools-2.0.0.dev6 → labview_fpga_hdl_tools-2.0.0.dev8}/labview_fpga_hdl_tools/common.py +0 -0
  16. {labview_fpga_hdl_tools-2.0.0.dev6 → labview_fpga_hdl_tools-2.0.0.dev8}/labview_fpga_hdl_tools/compile_modelsim_lib.py +0 -0
  17. {labview_fpga_hdl_tools-2.0.0.dev6 → labview_fpga_hdl_tools-2.0.0.dev8}/labview_fpga_hdl_tools/compile_project.py +0 -0
  18. {labview_fpga_hdl_tools-2.0.0.dev6 → labview_fpga_hdl_tools-2.0.0.dev8}/labview_fpga_hdl_tools/create_lvbitx.py +0 -0
  19. {labview_fpga_hdl_tools-2.0.0.dev6 → labview_fpga_hdl_tools-2.0.0.dev8}/labview_fpga_hdl_tools/create_vivado_project.py +0 -0
  20. {labview_fpga_hdl_tools-2.0.0.dev6 → labview_fpga_hdl_tools-2.0.0.dev8}/labview_fpga_hdl_tools/gen_labview_target_plugin.py +0 -0
  21. {labview_fpga_hdl_tools-2.0.0.dev6 → labview_fpga_hdl_tools-2.0.0.dev8}/labview_fpga_hdl_tools/generate_vhdl.py +0 -0
  22. {labview_fpga_hdl_tools-2.0.0.dev6 → labview_fpga_hdl_tools-2.0.0.dev8}/labview_fpga_hdl_tools/get_window_netlist.py +0 -0
  23. {labview_fpga_hdl_tools-2.0.0.dev6 → labview_fpga_hdl_tools-2.0.0.dev8}/labview_fpga_hdl_tools/install_labview_target_plugin.py +0 -0
  24. {labview_fpga_hdl_tools-2.0.0.dev6 → labview_fpga_hdl_tools-2.0.0.dev8}/labview_fpga_hdl_tools/launch_vivado.py +0 -0
  25. {labview_fpga_hdl_tools-2.0.0.dev6 → labview_fpga_hdl_tools-2.0.0.dev8}/labview_fpga_hdl_tools/migrate_clip.py +0 -0
  26. {labview_fpga_hdl_tools-2.0.0.dev6 → labview_fpga_hdl_tools-2.0.0.dev8}/labview_fpga_hdl_tools/nihdlsettings_default.py +0 -0
  27. {labview_fpga_hdl_tools-2.0.0.dev6 → labview_fpga_hdl_tools-2.0.0.dev8}/labview_fpga_hdl_tools/process_constraints.py +0 -0
  28. {labview_fpga_hdl_tools-2.0.0.dev6 → labview_fpga_hdl_tools-2.0.0.dev8}/labview_fpga_hdl_tools/reporting.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: labview-fpga-hdl-tools
3
- Version: 2.0.0.dev6
3
+ Version: 2.0.0.dev8
4
4
  Summary: LabVIEW FPGA HDL Tools
5
5
  License: MIT
6
6
  Author: Salvador Santolucito
@@ -472,51 +472,23 @@ def create_modelsim_project(overwrite=False, config=None):
472
472
 
473
473
  if config.skip_modelsim:
474
474
  reporter.detail(
475
- "\nSKIP MODELSIM: Validation successful, skipping ModelSim project creation"
475
+ "\nSKIP MODELSIM: skipping ModelSim compilation "
476
+ "(will still validate sources and generate scripts)"
476
477
  )
477
- return 0
478
478
 
479
- # Step 0: Generate all configured VHDL from Mako templates (the
479
+ # Step 1: Generate all configured VHDL from Mako templates (the
480
480
  # PkgNiHdlSettings single-source-of-truth package and any other generated
481
- # design sources). The simulation flow validates that every listed source
482
- # file exists, so this must run before gathering source files.
483
- reporter.detail("\nStep 0: Generating VHDL from templates...")
481
+ # design sources). These appear in the source lists validated below and need
482
+ # no ModelSim tools, so this runs in skip_modelsim (validation-only) mode too.
483
+ reporter.detail("\nStep 1: Generating VHDL from templates...")
484
484
  if generate_vhdl.gen_generated_vhdl(config=config) != 0:
485
485
  return 1
486
486
 
487
- modelsim_install = config.modelsim_tools_folder
488
- vlib_path = _get_modelsim_tool(modelsim_install, "vlib")
489
- vcom_path = _get_modelsim_tool(modelsim_install, "vcom")
490
-
491
- # Step 1: Create modelsim.ini
492
- reporter.detail("\nStep 1: Creating modelsim.ini...")
493
- ini_path = _create_modelsim_ini(modelsim_install, project_dir)
494
-
495
- # Step 2: Add Xilinx simulation library mappings
496
- xilinx_sim_lib = config.xilinx_sim_lib_folder
497
- if xilinx_sim_lib:
498
- reporter.detail("\nStep 2: Adding Xilinx simulation library mappings...")
499
- # Ensure the Xilinx libraries exist before mapping them into the .ini.
500
- # This is idempotent: once compiled it is a cheap no-op (and does not
501
- # even require Vivado). Imported locally to avoid a circular import,
502
- # since compile_modelsim_lib imports helpers from this module.
503
- from labview_fpga_hdl_tools import compile_modelsim_lib
504
-
505
- if compile_modelsim_lib.compile_modelsim_lib(config=config) != 0:
506
- return 1
507
- _add_xilinx_library_mappings(ini_path, xilinx_sim_lib)
508
- else:
509
- reporter.detail(
510
- "\nStep 2: Skipping Xilinx library mappings (XilinxSimLibFolder not configured)"
511
- )
512
-
513
- # Step 3: Create work library
514
- reporter.detail("\nStep 3: Creating work library...")
515
- _run_modelsim_tool(vlib_path, ["work"], cwd=project_dir)
516
- reporter.detail(" Created work library")
517
-
518
- # Step 4: Gather VHDL source files
519
- reporter.detail("\nStep 4: Gathering VHDL source files...")
487
+ # Step 2: Gather VHDL source files and validate that every listed file
488
+ # exists. Tool-independent, so this is the core project-integrity check that
489
+ # runs in skip_modelsim mode as well (it catches broken file lists / missing
490
+ # sources on a runner without ModelSim installed).
491
+ reporter.detail("\nStep 2: Gathering VHDL source files...")
520
492
 
521
493
  # ModelSim compiles its own file lists only (no fallback to the Vivado lists).
522
494
  file_lists = config.modelsim_file_lists
@@ -545,19 +517,63 @@ def create_modelsim_project(overwrite=False, config=None):
545
517
  reporter.detail(f" Found {len(std_files)} standard VHDL files")
546
518
  reporter.detail(f" Found {len(vhdl2008_files)} VHDL-2008 files")
547
519
 
548
- # Step 5: Compile with vcom -autoorder (automatic dependency resolution)
549
- reporter.detail("\nStep 5: Compiling VHDL files...")
520
+ # Step 3: Generate the load/sim .do scripts. These are static text scripts,
521
+ # so they are produced in skip_modelsim mode too. This is what lets a
522
+ # validation-only sim-modelsim confirm the project without ModelSim.
523
+ reporter.detail("\nStep 3: Generating simulation scripts...")
524
+ _generate_load_do_file(project_dir, entity_name)
525
+ _generate_sim_do_file(project_dir, entity_name)
526
+
527
+ # Everything below requires the ModelSim tools (vlib/vcom) and compiles the
528
+ # design. In skip_modelsim (validation-only) mode we stop here: settings,
529
+ # generated VHDL, source files, and .do scripts have all been validated or
530
+ # generated without needing ModelSim installed.
531
+ if config.skip_modelsim:
532
+ reporter.success(
533
+ "\nSKIP MODELSIM: Validation successful "
534
+ "(sources found, simulation scripts generated); skipping ModelSim compilation."
535
+ )
536
+ return 0
537
+
538
+ modelsim_install = config.modelsim_tools_folder
539
+ vlib_path = _get_modelsim_tool(modelsim_install, "vlib")
540
+ vcom_path = _get_modelsim_tool(modelsim_install, "vcom")
541
+
542
+ # Step 4: Create modelsim.ini
543
+ reporter.detail("\nStep 4: Creating modelsim.ini...")
544
+ ini_path = _create_modelsim_ini(modelsim_install, project_dir)
545
+
546
+ # Step 5: Add Xilinx simulation library mappings
547
+ xilinx_sim_lib = config.xilinx_sim_lib_folder
548
+ if xilinx_sim_lib:
549
+ reporter.detail("\nStep 5: Adding Xilinx simulation library mappings...")
550
+ # Ensure the Xilinx libraries exist before mapping them into the .ini.
551
+ # This is idempotent: once compiled it is a cheap no-op (and does not
552
+ # even require Vivado). Imported locally to avoid a circular import,
553
+ # since compile_modelsim_lib imports helpers from this module.
554
+ from labview_fpga_hdl_tools import compile_modelsim_lib
555
+
556
+ if compile_modelsim_lib.compile_modelsim_lib(config=config) != 0:
557
+ return 1
558
+ _add_xilinx_library_mappings(ini_path, xilinx_sim_lib)
559
+ else:
560
+ reporter.detail(
561
+ "\nStep 5: Skipping Xilinx library mappings (XilinxSimLibFolder not configured)"
562
+ )
563
+
564
+ # Step 6: Create work library
565
+ reporter.detail("\nStep 6: Creating work library...")
566
+ _run_modelsim_tool(vlib_path, ["work"], cwd=project_dir)
567
+ reporter.detail(" Created work library")
568
+
569
+ # Step 7: Compile with vcom -autoorder (automatic dependency resolution)
570
+ reporter.detail("\nStep 7: Compiling VHDL files...")
550
571
  try:
551
572
  _compile_vhdl_files(vcom_path, project_dir, std_files, vhdl2008_files, ini_path)
552
573
  except RuntimeError as e:
553
574
  reporter.error(f"\nCompilation failed: {e}")
554
575
  return 1
555
576
 
556
- # Step 6: Generate .do files
557
- reporter.detail("\nStep 6: Generating simulation scripts...")
558
- _generate_load_do_file(project_dir, entity_name)
559
- _generate_sim_do_file(project_dir, entity_name)
560
-
561
577
  total_files = len(std_files) + len(vhdl2008_files)
562
578
  reporter.success(f"\nModelSim project created successfully!")
563
579
  reporter.detail(f" Directory: {project_dir}")
@@ -80,6 +80,36 @@ def _get_commit_hash(repo_path):
80
80
  return None
81
81
 
82
82
 
83
+ def _get_installed_version(repo_name, repo_path, deps_dir):
84
+ """Return the currently installed version of a cloned dependency, or None.
85
+
86
+ Prefers the version recorded in the ``.dep-info`` marker file, falling back
87
+ to ``git describe`` for repos cloned before markers were introduced.
88
+ """
89
+ for marker in sorted(deps_dir.glob(f"{repo_name}-*{_DEP_INFO_SUFFIX}")):
90
+ try:
91
+ for line in marker.read_text(encoding="utf-8").splitlines():
92
+ if line.startswith("Version:"):
93
+ return line.split(":", 1)[1].strip()
94
+ except OSError:
95
+ continue
96
+
97
+ try:
98
+ result = subprocess.run(
99
+ ["git", "-C", str(repo_path), "describe", "--tags", "--always"],
100
+ capture_output=True,
101
+ text=True,
102
+ check=True,
103
+ )
104
+ described = result.stdout.strip()
105
+ if described:
106
+ return _normalize_tag(described)
107
+ except (subprocess.CalledProcessError, OSError):
108
+ pass
109
+
110
+ return None
111
+
112
+
83
113
  def _write_dep_marker(repo, repo_name, tag, requested, repo_url, repo_path, deps_dir):
84
114
  """Write a version marker file next to a cloned dependency.
85
115
 
@@ -354,14 +384,22 @@ def _clone_repo_at_tag(repo, tag_or_spec, base_dir, delete_allowed=False, allow_
354
384
 
355
385
  # Check if already exists and prompt user
356
386
  if repo_path.exists():
357
- reporter.detail(f" [INFO] Repository {repo_name} already exists at {repo_path}")
387
+ installed_version = _get_installed_version(repo_name, repo_path, base_dir)
388
+ present_desc = (
389
+ f"{repo_name} version {installed_version}" if installed_version else repo_name
390
+ )
391
+ reporter.detail(f" [INFO] {present_desc} already present at {repo_path}")
358
392
 
359
393
  if delete_allowed:
360
394
  response = "y"
361
395
  reporter.detail(f" Auto-deleting and re-cloning (--delete flag set)")
362
396
  else:
363
397
  try:
364
- response = input(f" Delete and re-clone? (y/N): ").strip().lower()
398
+ response = (
399
+ input(f" {present_desc} already present. Delete and re-clone? (y/N): ")
400
+ .strip()
401
+ .lower()
402
+ )
365
403
  except EOFError:
366
404
  # Non-interactive/CI run: there is no stdin to prompt on. Default
367
405
  # to the safe "keep existing clone" choice instead of crashing;
@@ -397,7 +435,7 @@ def _clone_repo_at_tag(repo, tag_or_spec, base_dir, delete_allowed=False, allow_
397
435
  text=True,
398
436
  check=True,
399
437
  )
400
- reporter.success(f" [OK] Successfully cloned {repo_name}")
438
+ reporter.success(f" [OK] Installed {repo_name} version {_normalize_tag(tag)}")
401
439
  _write_dep_marker(repo, repo_name, tag, tag_or_spec, repo_url, repo_path, base_dir)
402
440
  return True
403
441
 
@@ -20,15 +20,16 @@ def _validate_ini(config):
20
20
  missing_settings = []
21
21
  invalid_paths = []
22
22
 
23
- if not config.modelsim_tools_folder:
24
- missing_settings.append("ModelSimSettings.ModelSimToolsFolder")
25
- else:
26
- vsim_exe = _get_vsim_executable(config.modelsim_tools_folder)
27
- if not vsim_exe or not os.path.exists(vsim_exe):
28
- invalid_paths.append(
29
- f"ModelSimSettings.ModelSimToolsFolder - vsim not found under: "
30
- f"{config.modelsim_tools_folder}"
31
- )
23
+ if not config.skip_modelsim:
24
+ if not config.modelsim_tools_folder:
25
+ missing_settings.append("ModelSimSettings.ModelSimToolsFolder")
26
+ else:
27
+ vsim_exe = _get_vsim_executable(config.modelsim_tools_folder)
28
+ if not vsim_exe or not os.path.exists(vsim_exe):
29
+ invalid_paths.append(
30
+ f"ModelSimSettings.ModelSimToolsFolder - vsim not found under: "
31
+ f"{config.modelsim_tools_folder}"
32
+ )
32
33
 
33
34
  if not common.get_modelsim_entity(config):
34
35
  missing_settings.append("ModelSimSettings.ModelSimEntity (set via set_modelsim_top_entity)")
@@ -21,15 +21,16 @@ def _validate_ini(config):
21
21
  missing_settings = []
22
22
  invalid_paths = []
23
23
 
24
- if not config.modelsim_tools_folder:
25
- missing_settings.append("ModelSimSettings.ModelSimToolsFolder")
26
- else:
27
- vsim_exe = _get_vsim_executable(config.modelsim_tools_folder)
28
- if not vsim_exe or not os.path.exists(vsim_exe):
29
- invalid_paths.append(
30
- f"ModelSimSettings.ModelSimToolsFolder - vsim not found under: "
31
- f"{config.modelsim_tools_folder}"
32
- )
24
+ if not config.skip_modelsim:
25
+ if not config.modelsim_tools_folder:
26
+ missing_settings.append("ModelSimSettings.ModelSimToolsFolder")
27
+ else:
28
+ vsim_exe = _get_vsim_executable(config.modelsim_tools_folder)
29
+ if not vsim_exe or not os.path.exists(vsim_exe):
30
+ invalid_paths.append(
31
+ f"ModelSimSettings.ModelSimToolsFolder - vsim not found under: "
32
+ f"{config.modelsim_tools_folder}"
33
+ )
33
34
 
34
35
  if not common.get_modelsim_entity(config):
35
36
  missing_settings.append("ModelSimSettings.ModelSimEntity (set via set_modelsim_top_entity)")
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
4
4
 
5
5
  [tool.poetry]
6
6
  name = "labview-fpga-hdl-tools"
7
- version = "2.0.0.dev6"
7
+ version = "2.0.0.dev8"
8
8
  description = "LabVIEW FPGA HDL Tools"
9
9
  authors = [
10
10
  "Salvador Santolucito <salvador.santolucito@gmail.com>"