chipfoundry-cli 1.3.0__tar.gz → 1.4.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: chipfoundry-cli
3
- Version: 1.3.0
3
+ Version: 1.4.1
4
4
  Summary: CLI tool to automate ChipFoundry project submission to SFTP server
5
5
  Home-page: https://chipfoundry.io
6
6
  License: Apache-2.0
@@ -1915,6 +1915,19 @@ def setup(project_root, repo_owner, repo_name, branch, pdk, caravel_lite,
1915
1915
  # Check if project is initialized (allow dry-run to proceed)
1916
1916
  check_project_initialized(project_root_path, 'setup', dry_run=dry_run)
1917
1917
 
1918
+ # Read project type from project.json
1919
+ project_json_path = project_root_path / '.cf' / 'project.json'
1920
+ project_type = 'digital' # default
1921
+ if project_json_path.exists():
1922
+ try:
1923
+ with open(project_json_path, 'r') as f:
1924
+ project_data = json.load(f)
1925
+ project_type = project_data.get('project', {}).get('type', 'digital')
1926
+ except (json.JSONDecodeError, IOError):
1927
+ pass # Use default if we can't read it
1928
+
1929
+ is_openframe = project_type == 'openframe'
1930
+
1918
1931
  had_errors = False
1919
1932
 
1920
1933
  def _error_text(err):
@@ -1943,7 +1956,8 @@ def setup(project_root, repo_owner, repo_name, branch, pdk, caravel_lite,
1943
1956
  # If in "only" mode, only install what's specified
1944
1957
  # If not in "only" mode, install everything
1945
1958
  install_caravel = only_caravel or not only_mode
1946
- install_mcw = only_mcw or not only_mode
1959
+ # MCW is not used for openframe projects
1960
+ install_mcw = (only_mcw or not only_mode) and not is_openframe
1947
1961
  install_openlane = only_openlane or not only_mode
1948
1962
  install_pdk = only_pdk or not only_mode
1949
1963
  install_timing = only_timing or not only_mode
@@ -1956,9 +1970,13 @@ def setup(project_root, repo_owner, repo_name, branch, pdk, caravel_lite,
1956
1970
  f"Project directory: [yellow]{project_root}[/yellow]",
1957
1971
  f"Repository: [yellow]{repo_owner}/{repo_name}@{branch}[/yellow]",
1958
1972
  f"PDK: [yellow]{pdk}[/yellow]",
1973
+ f"Project type: [yellow]{project_type}[/yellow]",
1959
1974
  f"Caravel variant: [yellow]{'caravel-lite' if caravel_lite else 'caravel'}[/yellow]",
1960
1975
  ]
1961
1976
 
1977
+ if is_openframe:
1978
+ config_lines.append("[dim]MCW not needed for openframe projects[/dim]")
1979
+
1962
1980
  if only_mode:
1963
1981
  installing = []
1964
1982
  if only_caravel: installing.append("caravel")
@@ -2057,7 +2075,11 @@ def setup(project_root, repo_owner, repo_name, branch, pdk, caravel_lite,
2057
2075
  console.print(f"[dim]{e.stderr}[/dim]")
2058
2076
 
2059
2077
  # Step 3: Install Management Core Wrapper
2060
- if install_mcw:
2078
+ # Show message if user explicitly requested MCW but project is openframe
2079
+ if only_mcw and is_openframe:
2080
+ console.print("\n[bold]Step 3:[/bold] Installing Management Core Wrapper...")
2081
+ console.print("[yellow]⚠[/yellow] MCW is not used for openframe projects, skipping...")
2082
+ elif install_mcw:
2061
2083
  console.print("\n[bold]Step 3:[/bold] Installing Management Core Wrapper...")
2062
2084
  mcw_dir = project_root_path / 'mgmt_core_wrapper'
2063
2085
 
@@ -2352,8 +2374,8 @@ def setup(project_root, repo_owner, repo_name, branch, pdk, caravel_lite,
2352
2374
  console.print(f"\n[bold]Step {step_num}:[/bold] Setting up Cocotb...")
2353
2375
  venv_cocotb = project_root_path / 'venv-cocotb'
2354
2376
 
2355
- # Check if already installed
2356
- is_installed = check_python_package_installed(venv_cocotb, 'caravel-cocotb')
2377
+ # Check if already installed (package name is caravel_cocotb in pyproject.toml)
2378
+ is_installed = check_python_package_installed(venv_cocotb, 'caravel_cocotb')
2357
2379
 
2358
2380
  if is_installed and not overwrite:
2359
2381
  console.print("[green]✓[/green] Cocotb already installed")
@@ -2380,14 +2402,18 @@ def setup(project_root, repo_owner, repo_name, branch, pdk, caravel_lite,
2380
2402
  # Determine the python executable path in venv
2381
2403
  venv_python = str(venv_cocotb / 'bin' / 'python3')
2382
2404
 
2383
- console.print("[cyan]Installing caravel-cocotb...[/cyan]")
2405
+ console.print("[cyan]Installing caravel-cocotb from source (chipfoundry/caravel-sim-infrastructure)...[/cyan]")
2384
2406
  subprocess.run(
2385
2407
  [venv_python, '-m', 'pip', 'install', '--upgrade', '--no-cache-dir', 'pip'],
2386
2408
  check=True,
2387
2409
  capture_output=True
2388
2410
  )
2411
+ # Install from GitHub source (workaround: PyPI package is under efabless, we use chipfoundry repo)
2389
2412
  subprocess.run(
2390
- [venv_python, '-m', 'pip', 'install', '--upgrade', '--no-cache-dir', 'caravel-cocotb'],
2413
+ [
2414
+ venv_python, '-m', 'pip', 'install', '--upgrade', '--no-cache-dir',
2415
+ 'git+https://github.com/chipfoundry/caravel-sim-infrastructure.git@main#subdirectory=cocotb'
2416
+ ],
2391
2417
  check=True,
2392
2418
  capture_output=True
2393
2419
  )
@@ -3084,7 +3110,7 @@ def precheck(project_root, disable_lvs, checks, dry_run):
3084
3110
  @click.option('--sim', type=click.Choice(['rtl', 'gl'], case_sensitive=False), default='rtl', help='Simulation type: rtl or gl (gate-level)')
3085
3111
  @click.option('--list', 'list_tests', is_flag=True, help='List all available cocotb tests')
3086
3112
  @click.option('--all', 'run_all', is_flag=True, help='Run all tests')
3087
- @click.option('--tag', help='Test list tag/yaml file (e.g., user_proj_tests)')
3113
+ @click.option('--tag', help='Test list tag/yaml file (e.g., all_tests or user_proj_tests)')
3088
3114
  @click.option('--dry-run', is_flag=True, help='Show the configuration without running')
3089
3115
  def verify(test, project_root, sim, list_tests, run_all, tag, dry_run):
3090
3116
  """Run cocotb verification tests.
@@ -3094,7 +3120,7 @@ def verify(test, project_root, sim, list_tests, run_all, tag, dry_run):
3094
3120
  cf verify counter_la # Run a specific test (RTL)
3095
3121
  cf verify counter_la --sim gl # Run gate-level simulation
3096
3122
  cf verify --all # Run all tests
3097
- cf verify --tag user_proj_tests # Run tests from a yaml list
3123
+ cf verify --tag all_tests # Run tests from a yaml list
3098
3124
  """
3099
3125
  # If .cf/project.json exists in cwd, use it as default project_root
3100
3126
  cwd_root, _ = get_project_json_from_cwd()
@@ -3114,13 +3140,13 @@ def verify(test, project_root, sim, list_tests, run_all, tag, dry_run):
3114
3140
 
3115
3141
  project_json_path = project_root_path / '.cf' / 'project.json'
3116
3142
 
3143
+ # Get project type (needed for openframe flag)
3144
+ with open(project_json_path, 'r') as f:
3145
+ project_data = json.load(f)
3146
+ project_type = project_data.get('project', {}).get('type', 'digital')
3147
+
3117
3148
  # Check if GPIO configuration exists (skip check if just listing tests or openframe)
3118
3149
  if not list_tests:
3119
- # Check project type - GPIO config not needed for openframe
3120
- with open(project_json_path, 'r') as f:
3121
- project_data = json.load(f)
3122
- project_type = project_data.get('project', {}).get('type', 'digital')
3123
-
3124
3150
  if project_type != 'openframe':
3125
3151
  gpio_config = get_gpio_config_from_project_json(str(project_json_path))
3126
3152
  if not gpio_config or len(gpio_config) == 0:
@@ -3221,13 +3247,19 @@ def verify(test, project_root, sim, list_tests, run_all, tag, dry_run):
3221
3247
 
3222
3248
  if dry_run:
3223
3249
  console.print("[bold yellow]Dry run - configuration ready[/bold yellow]\n")
3250
+ openframe_flag = " --openframe" if project_type == 'openframe' else ""
3224
3251
  if test:
3225
- console.print(f"Would run: {caravel_cocotb_bin} -t {test} -sim {sim_arg}")
3252
+ console.print(f"Would run: {caravel_cocotb_bin} -t {test} -sim {sim_arg}{openframe_flag}")
3226
3253
  elif run_all:
3227
- yaml_file = 'user_proj_tests_gl.yaml' if sim.lower() == 'gl' else 'user_proj_tests.yaml'
3228
- console.print(f"Would run: {caravel_cocotb_bin} -tl user_proj_tests/{yaml_file} -sim {sim_arg}")
3254
+ all_tests_yaml = cocotb_dir / ('all_tests_gl.yaml' if sim.lower() == 'gl' else 'all_tests.yaml')
3255
+ if all_tests_yaml.exists():
3256
+ yaml_path = all_tests_yaml.name
3257
+ else:
3258
+ yaml_file = 'user_proj_tests_gl.yaml' if sim.lower() == 'gl' else 'user_proj_tests.yaml'
3259
+ yaml_path = f'user_proj_tests/{yaml_file}'
3260
+ console.print(f"Would run: {caravel_cocotb_bin} -tl {yaml_path} -sim {sim_arg}{openframe_flag}")
3229
3261
  elif tag:
3230
- console.print(f"Would run: {caravel_cocotb_bin} -tl {tag} -sim {sim_arg}")
3262
+ console.print(f"Would run: {caravel_cocotb_bin} -tl {tag} -sim {sim_arg}{openframe_flag}")
3231
3263
  return
3232
3264
 
3233
3265
  # Prepare environment
@@ -3244,9 +3276,14 @@ def verify(test, project_root, sim, list_tests, run_all, tag, dry_run):
3244
3276
  if test:
3245
3277
  cmd.extend(['-t', test])
3246
3278
  elif run_all:
3247
- # Use the appropriate test list yaml
3248
- yaml_file = 'user_proj_tests_gl.yaml' if sim.lower() == 'gl' else 'user_proj_tests.yaml'
3249
- yaml_path = f'user_proj_tests/{yaml_file}'
3279
+ # Look for test list yaml - prefer all_tests.yaml, fall back to user_proj_tests/
3280
+ all_tests_yaml = cocotb_dir / ('all_tests_gl.yaml' if sim.lower() == 'gl' else 'all_tests.yaml')
3281
+ if all_tests_yaml.exists():
3282
+ yaml_path = all_tests_yaml.name
3283
+ else:
3284
+ # Fall back to legacy user_proj_tests directory
3285
+ yaml_file = 'user_proj_tests_gl.yaml' if sim.lower() == 'gl' else 'user_proj_tests.yaml'
3286
+ yaml_path = f'user_proj_tests/{yaml_file}'
3250
3287
  cmd.extend(['-tl', yaml_path])
3251
3288
  elif tag:
3252
3289
  # User specified a custom test list
@@ -3270,6 +3307,13 @@ def verify(test, project_root, sim, list_tests, run_all, tag, dry_run):
3270
3307
  if sim.lower() == 'gl':
3271
3308
  cmd.extend(['-sim', 'GL'])
3272
3309
 
3310
+ # Add openframe flag for openframe projects
3311
+ if project_type == 'openframe':
3312
+ cmd.append('--openframe')
3313
+
3314
+ # Add CI flag to disable Docker interactive mode (required when not running in a terminal)
3315
+ cmd.append('--CI')
3316
+
3273
3317
  # Run cocotb tests
3274
3318
  console.print(f"[cyan]Running cocotb verification...[/cyan]")
3275
3319
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "chipfoundry-cli"
3
- version = "1.3.0"
3
+ version = "1.4.1"
4
4
  description = "CLI tool to automate ChipFoundry project submission to SFTP server"
5
5
  authors = ["ChipFoundry <marwan.abbas@chipfoundry.io>"]
6
6
  readme = "README.md"
File without changes