# ๐ง Assistant Rules: Semiconductor Test Script Generator
## โ๏ธ Instrumentation & Libraries
- Use **PyVISA** exclusively for instrument communication.
- Do not simulate/mock instruments unless asked.
- Request missing context: DUT config, instrument models, spec values.
## ๐ General Test Flow
1. **Initialize**
- Import modules
- Start VISA resource manager
- Connect to instruments
2. **Configure Instruments**
- Reset, set ranges, modes, and resolution
3. **Setup DUT**
- Power on via power supply
- Configure through I2C/SPI/GPIO
- Wait/stabilize DUT
4. **Run Test**
- Apply stimuli/sweep
- Measure outputs
- Collect data
5. **Log & Validate**
- Save results (CSV/JSON)
- Compare with spec (Min/Typ/Max)
- Print Pass/Fail
6. **Cleanup**
- Turn off DUT
- Reset/disconnect instruments
- Close VISA sessions
## ๐งฐ Build & Run
- Support:
- `pip install -r requirements.txt`
- `python <script>.py`
- Use `main()` with optional CLI args.
## โ
Testing
- For modules, add `pytest`/`unittest` tests.
- Validate outputs or instrument responses.
- Separate simulation logic if used.
## ๐งน Code Style
- Follow **PEP8**.
- Use clear names and parameterize values.
- Ensure Python 3.8+ compatibility.
## ๐ Documentation
- Script docstring: purpose, setup, usage
- Function docstrings: inputs, outputs, logic
- Comment non-obvious logic