fossi-foundation / fossi-foundation/cace

[Bug/Feature Request] Netlist generation fails for hierarchical designs using sibling directories: Subcircuits reported as "MISSING" despite valid xschemrc

Open
#29 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
14
Forks
5
PR merge metrics
No merged PRs in 30d

Description

I dare to label this issue as BUG but is more like an user consult as this is not documented at [Official readthedocs](https://cace.readthedocs.io/en/latest/index.html)

### Description
I am encountering an issue when running CACE characterization on a design that instantiates a subcircuit located in a sibling directory within a custom library structure. While the design simulates correctly in Xschem (interactive mode), CACE fails during the netlisting/simulation phase, reporting the subcircuit as missing in the generated `.spice` file.

It appears that when CACE runs the netlisting process in its temporary run directory, it fails to correctly resolve the paths defined in the project's `xschemrc`, specifically when pointing to parent/sibling directories for libraries.

### Project Structure
I have a library structure with two levels of hierarchy:
* `circuit_down`: Lower hierarchy block (Subcircuit).
* `circuit_up`: Top hierarchy block (DUT). `circuit_up` instantiates `circuit_down`.

The directory structure is as follows:
```text
lib/
├── circuit_down/
│ ├── xschem/
│ │ ├── circuit_down.sym
│ │ ├── circuit_down.sch
│ │ └── xschemrc
│ └── cace/
└── circuit_up/
├── xschem/
│ ├── circuit_up.sch (Instantiates circuit_down.sym)
│ └── xschemrc (Sources the PDK and appends lib path)
└── cace/
└── circuit_up.yaml
```

### Configuration
To make `circuit_up` find `circuit_down`, the `circuit_up/xschem/xschemrc` file includes the parent directory (`lib/`) to the `XSCHEM_LIBRARY_PATH`. The configuration used is:

```tcl
# Append the 'lib' directory (two levels up) to the library path
append XSCHEM_LIBRARY_PATH :[file dirname [info script]]/../../
```

### Current Behavior
1. **Xschem Interactive:** Opening circuit_up.sch in Xschem works perfectly. The symbol circuit_down is found, and descending into the hierarchy works. Simulations run successfully.

2. **CACE Execution:** When running CACE on circuit_up, the process fails during the simulation step (Error code 10 or similar).

3. **The Error:** Upon inspecting the generated netlist in the run directory (e.g., runs/RUN_DATE/parameters/param_name/run_00/template.spice), the subcircuit instantiation fails. The netlist contains comments indicating the failure:

```text
* x1 - circuit_down IS MISSING!!!
```
Consequently, the nodes are undriven, and the simulation crashes.

### Expected behavior:
CACE should honor the `XSCHEM_LIBRARY_PATH` modifications defined in the project's `xschemrc` (sourced via the testbench templates) and correctly resolve symbols located in sibling directories, mirroring the behavior of Xschem interactive mode.

### Workaround Found:
I managed to bypass this issue by flattening the file access structure:

1. I created symbolic links inside `circuit_up/xschem/` pointing directly to `circuit_down.sym` and `circuit_down.sch`.

2. I modified the `xschemrc` to look only in the local directory instead of appending `../../`.

With this workaround (local symlinks), CACE runs successfully. This suggests the issue lies strictly in how CACE/Xschem handles relative paths to external libraries during the batch netlisting process in the temporary run folders. However, I don't think this is the expected implementation of hierarchical verification with CACE. If there is a expected way to manage this, I would appreciate if you can refer me to it.

### Environment:
* **OS:** Ubuntu 24.04.3 LTS
* **CACE Version:** 2.8.3
* **Xschem Version:** V3.4.8RC
* **Ngspice Version:** 45.2

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the hierarchy using circuit_up/xschem/circuit_up.sch, circuit_up/xschem/xschemrc, and the circuit_down files, then inspect the generated template.spice under the temporary run directory. Compare batch CACE netlisting with interactive Xschem resolution and verify that the sibling subcircuit no longer appears as MISSING while the documented configuration remains in use.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.