شعار Openvaf

Openvaf

المجتمع
Arcadia-1
openvaf

Compile Verilog-A device models with OpenVAF and simulate them in ngspice via OSDI. Use this skill whenever the user wants to: compile a .va file, run a Verilog-A model in ngspice, use OpenVAF, load an OSDI model, test a compact device model, or set up the OpenVAF + ngspice toolchain. Also use when the user mentions OSDI, compact models, BSIM, PSP, HICUM, or wants to simulate custom MOSFET/BJT/diode/varactor models written in Verilog-A. Complements the `veriloga` writing skill and the `ngspice` simulation skill.

نظرة عامة

الناشرArcadia-1
المستودعveriloga-skills
اسم المهارةopenvaf
النجوم
39
التفريعات
13
الملفات المرفقة
18
الروابط
  • تعليمات بصيغة Markdown

    ملف SKILL.md يُحمّله النموذج عند الحاجة، فلا يستهلك توكنات إلا عندما يَرِد طلب ذو صلة فعلًا.

  • تعمل مع أي نموذج لغوي كبير

    مهارات الذكاء الاصطناعي مكتوبة بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا تعمل مع GPT أو Claude أو Gemini أو Grok أو نموذج محلي.

  • الملفات المرفقة: 18

    نصوص برمجية وقوالب ومراجع يمكن للنموذج قراءتها أثناء عمله. الملفات للقراءة فقط ولا تُنفّذ أبدًا.

  • مفتوحة المصدر

    نشرها Arcadia-1 على GitHub. اطّلع على المصدر قبل تثبيتها.

التثبيت

ثبّت مهارة الذكاء الاصطناعي Openvaf في TypingMind لاستخدامها مع أي نموذج لغوي كبير، أو أضفها إلى وكيل ذكاء اصطناعي آخر يقرأ SKILL.md.

1

التثبيت في TypingMind

يُثبّت TypingMind المهارة مباشرةً من مجلدها على GitHub — فيقرأ SKILL.md، ويجمع ملفات الموارد في حزمة، ويحفظ النتيجة محليًا.

  1. افتح التطبيق وانتقل إلى الإضافات → المهارات.
  2. اختر «تثبيت من GitHub».
  3. الصق رابط مجلد المهارة الموضّح أدناه وأكّد التثبيت.
    https://github.com/Arcadia-1/veriloga-skills/tree/main/openvaf
  4. فعّل المهارة في كل محادثة تريد إتاحتها فيها.
الإضافات → المهارات → إضافة مهارة → من رابط GitHub، ثم الصق رابط المجلد واضغط على «متابعة».
2

التثبيت في وكيل ذكاء اصطناعي آخر

يمكن لأي وكيل ذكاء اصطناعي يقرأ تنسيق Agent Skills استخدام هذه المهارة — انسخ المجلد إلى مجلد المهارات الخاص بذلك الوكيل.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Arcadia-1/veriloga-skills.git /tmp/veriloga-skills
mkdir -p .claude/skills
cp -r /tmp/veriloga-skills/openvaf .claude/skills/openvaf
أعد تشغيل Claude Code بعد النسخ ليتعرّف على المهارة الجديدة.

استخدمها في TypingMind

فعّل Openvaf في أي محادثة على TypingMind وسيتولى النموذج الباقي. تتضمن مطالبة النظام اسمها ووصفها، وبمجرد ورود طلب ذي صلة، يُحمّل النموذج التعليمات الكاملة تلقائيًا — فلا تحتاج إلى استدعائها يدويًا، ولا تستهلك أي توكنات حتى تُستخدم فعليًا.

يُحمّل النموذج Openvaf تلقائيًا بمجرد ورود طلب ذي صلة بها.

تعمل مع أي نموذج ذكاء اصطناعي

مهارات الذكاء الاصطناعي هي تعليمات بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا لا ترتبط Openvaf بالنموذج الذي كُتبت له. ثبّتها مرة واحدة في TypingMind واستخدمها مع GPT-5 أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو نموذج محلي تشغّله بنفسك — كل ذلك باستخدام مفاتيح API الخاصة بك.

  • تُحمَّل عند الحاجة فقط

    تتضمن مطالبة النظام الاسم والوصف فقط. وتُجلب التعليمات عند أول طلب ذي صلة، لذا لا تترتب أي تكلفة على المهارة غير المستخدمة.

  • بدّل النماذج أثناء المحادثة

    لأن المهارة تعليمات وليست شيفرة، فإن تغيير النموذج لا يعطّلها — فالنموذج التالي يقرأ ملف SKILL.md نفسه.

تعليمات المهارة

هذا هو محتوى SKILL.md الذي يُحمّله النموذج. اقرأه قبل التثبيت — فالمهارة عبارة عن تعليمات سيتبعها نموذجك.

OpenVAF + ngspice: Compile and Simulate Verilog-A Models

This skill covers the full flow: write a Verilog-A compact model → compile it with OpenVAF → load the compiled .osdi plugin in ngspice → run simulations.

Scope: What OpenVAF Can and Cannot Compile

OpenVAF implements the analog subset of the Verilog-AMS LRM 2.4.0. It is designed for compact device models (MOSFETs, BJTs, diodes, varactors, resistors, capacitors) — the kind of models that define I-V and C-V relationships.

Supported features

  • analog begin / end blocks
  • I(), V() branch access, <+ contributions
  • ddt(), idt(), idtmod(), ddx()
  • $vt, $temperature, $abstime
  • @(initial_step), @(final_step)
  • $strobe, $display, $bound_step
  • limexp(), ln(), exp(), sqrt(), pow(), abs(), min(), max()
  • $param_given(), parameter ranges
  • Noise: white_noise(), flicker_noise()
  • All math from constants.vams

NOT supported (will cause compile errors)

FeatureWhy
@(cross(...))Event monitoring — behavioral, not compact-model
@(above(...))Same reason
Named events, or-combined eventsSame reason
Arrays inside modules (integer A[0:7])Not implemented
genvar / generate loopsNot implemented
Arithmetic shift (<<<, >>>)Not implemented, no plans to add
Digital / mixed-signal constructsAnalog subset only

Bottom line: If your .va file uses @(cross), arrays, or genvar, it is a behavioral model and cannot be compiled with OpenVAF. Use a full Verilog-AMS simulator (Cadence AMS, Synopsys HSPICE, Mentor AFS) instead. The veriloga skill covers writing both behavioral blocks and compact models; this skill covers compiling and simulating the compact-model subset.


1. Installation

OpenVAF (the compiler)

Read references/install.md for detailed step-by-step instructions for Windows and Linux. The short version:

  1. Download the prebuilt binary from https://openvaf.semimod.de/download/
    • Windows: rename the downloaded file to openvaf.exe
    • Linux: make executable with chmod +x
  2. Place on PATH (e.g., C:\tools\ on Windows, /usr/local/bin/ on Linux)
  3. Windows only: install Microsoft Visual C++ Build Tools ("Desktop development with C++" workload) — OpenVAF needs the MSVC linker
  4. Verify: openvaf --help should print usage info

ngspice (the simulator)

Requires ngspice 39 or later for OSDI support. Read the ngspice skill for general ngspice setup, or see references/install.md for the OSDI-specific parts.


2. The Workflow

  .va file ──→ openvaf ──→ .osdi file ──→ ngspice loads it ──→ simulation

Step 1: Compile

On Linux (or if MSVC is in PATH):

bash
openvaf mymodel.va

On Windows, the MSVC linker environment must be loaded first. Use this one-liner from any shell:

bash
cmd.exe /c "call \"C:\Program Files (x86)\Microsoft Visual Studio\<ver>\BuildTools\VC\Auxiliary\Build\vcvarsall.bat\" x64 >nul 2>&1 & openvaf.exe mymodel.va"

Replace <ver> with your VS version (e.g., 18, 2022). Without this, OpenVAF crashes because it can't find the MSVC link.exe.

Produces mymodel.osdi in the same directory. Compilation typically takes under 1 second for simple models.

Step 2: Write an ngspice netlist that loads the model

spice
* Test circuit for mymodel
V1 in 0 DC 1.0

.control
pre_osdi mymodel.osdi
dc V1 0 5 0.01
plot -i(V1)
.endc

.model m1 mymodel paramA=1.0 paramB=2.0
Nr1 in 0 m1

.end

Step 3: Run

bash
ngspice test.spice

3. Netlist Rules for OSDI Models

These rules are specific to OSDI-loaded models in ngspice. Getting any of them wrong causes cryptic errors.

Rule 1: Use pre_osdi, not osdi

The pre_ prefix tells ngspice to load the model before parsing the netlist. Without it, ngspice won't recognize the model type and will fail.

spice
.control
pre_osdi mymodel.osdi
.endc

Rule 2: Instance names start with N

All OSDI device instances must have names beginning with the letter N:

spice
Nr1 in out mymod            ✓ correct
Nq1 col base emit sub mymod ✓ correct
R1  in out mymod            ✗ wrong — ngspice treats it as a built-in resistor
M1  d g s b mymod           ✗ wrong — ngspice treats it as a built-in MOSFET

Rule 3: .model uses the exact Verilog-A module name

The .model statement must reference the exact module name from the .va source:

verilog
// In myresistor.va:
module myresistor(p, n);    // ← this name
spice
.model r1k myresistor r=1000    ✓ matches module name
.model r1k resistor r=1000      ✗ wrong — conflicts with ngspice built-in

Rule 4: Avoid module names that clash with ngspice built-ins

Do NOT name your module resistor, capacitor, inductor, diode, nmos, pmos, npn, pnp, or other ngspice built-in type names. Use a unique name like myresistor, custom_diode, nmos_sq, etc.

Rule 5: Path resolution for .osdi files

Path styleResolves from
pre_osdi mymodel.osdingspice's lib/ngspice/ directory
pre_osdi ./mymodel.osdiNetlist directory
pre_osdi /abs/path/mymodel.osdiAbsolute path

For portable projects, keep the .osdi file next to the netlist and use ./.


4. Complete Examples

Example A: Simple resistor

See assets/example_resistor.va and assets/test_resistor.spice for the complete files. This is the simplest possible round-trip: a two-terminal resistor model.

Example B: Square-law MOSFET

See assets/example_mosfet.va and assets/test_mosfet.spice for a basic MOSFET with linear/saturation regions and body effect — demonstrates a 4-terminal device.

Example C: Voltage-dependent capacitor (varactor)

See assets/example_varactor.va and assets/test_varactor.spice for a C(V) model using ddt() — demonstrates dynamic (charge-based) modeling.


5. Troubleshooting

Read references/troubleshooting.md for a comprehensive list. The most common issues:

SymptomCauseFix
Library couldn't be loadedWrong path to .osdiUse ./mymodel.osdi for relative path
unrecognized parameterpre_osdi missing or after netlistMove pre_osdi into .control block
Instance ignored silentlyName doesn't start with NRename to N... prefix
LINK: fatal error on compileMissing MSVC Build Tools (Windows)Install "Desktop development with C++"
Crash / Illegal instructionMissing VC++ runtimeInstall "Microsoft Visual C++ Redistributable"
Module name conflictModule named resistor etc.Rename to unique name

6. Pre-compiled Model Library

The VA-Models repository provides pre-compiled .osdi files for standard compact models (BSIM-CMG, PSP, HICUM, EKV, MEXTRAM, etc.) for both Windows and Linux, ready for ngspice 39+. Consider using these instead of compiling from source when working with standard models.


Further Reading

  • references/install.md — Detailed installation instructions
  • references/troubleshooting.md — Extended troubleshooting guide
  • references/supported_features.md — Full feature support table
  • assets/ — Complete example files ready to compile and run

الملفات المرفقة

يقرأ النموذج هذه الملفات عند الحاجة أثناء تحميل المهارة. وهي متاحة للقراءة ولا تُنفّذ أبدًا.

الأسئلة الشائعة

ماذا تفعل مهارة الذكاء الاصطناعي Openvaf؟

Compile Verilog-A device models with OpenVAF and simulate them in ngspice via OSDI. Use this skill whenever the user wants to: compile a .va file, run a Verilog-A model in ngspice, use OpenVAF, load an OSDI model, test a compact device model, or set up the OpenVAF + ngspice toolchain. Also use when the user mentions OSDI, compact models, BSIM, PSP, HICUM, or wants to simulate custom MOSFET/BJT/diode/varactor models written in Verilog-A. Complements the `veriloga` writing skill and the `ngspice` simulation skill.

لماذا تستخدم Openvaf على TypingMind؟

لأنك تثبّتها مرة واحدة وتستخدمها مع أي نموذج. مهارة Openvaf عبارة عن نص Markdown وليست شيفرة خاصة بمزود بعينه، لذا تعمل المهارة نفسها مع GPT-5 أو Claude أو Gemini أو Grok أو نموذج محلي، ويمكنك تبديل النموذج أثناء المحادثة دون تعطّل المهارة. يعمل TypingMind بمفاتيح API الخاصة بك، فتدفع للمزودين مباشرةً بدلًا من اشتراك لكل مقعد، وتبقى مهاراتك ومحادثاتك في مساحة التخزين الخاصة بك.

كيف أثبّت Openvaf في TypingMind؟

افتح الإضافات → المهارات → التثبيت من GitHub في TypingMind والصق https://github.com/Arcadia-1/veriloga-skills/tree/main/openvaf. يقرأ TypingMind ملف SKILL.md الخاص بها، ويجمع ملفاتها ويثبّتها كمهارة يمكنك تفعيلها لكل محادثة على حدة.

ما نماذج الذكاء الاصطناعي التي يمكنها استخدام Openvaf؟

أي نموذج تربطه في TypingMind. مهارات الذكاء الاصطناعي عبارة عن تعليمات Markdown وليست شيفرة خاصة بمزود بعينه، لذا يمكن لكل من GPT وClaude وGemini وGrok والنماذج المحلية تحميل هذه المهارة عندما يتوافق الطلب معها.

كم نموذج ذكاء اصطناعي يمكنني استخدامه مع Openvaf؟

أي عدد تريده. ما دام النموذج يدعم المهارات، يمكنك استخدام Openvaf معه، سواء كان GPT أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو غيرها، وكل ذلك على TypingMind باستخدام مفاتيح API الخاصة بك.

هل مهارة الذكاء الاصطناعي Openvaf مجانية؟

نشرها Arcadia-1 على GitHub. راجع المستودع للاطلاع على شروط الترخيص. لا تدفع إلا لمزود الذكاء الاصطناعي الخاص بك مقابل التوكنات التي تستخدمها.

ما هي مهارات الذكاء الاصطناعي؟

مهارة الذكاء الاصطناعي حزمة تعليمات قابلة لإعادة الاستخدام تعلّم نموذج الذكاء الاصطناعي كيفية تنفيذ مهمة محددة. وتتبع تنسيق Agent Skills المفتوح: ملف SKILL.md يتضمن اسمًا ووصفًا، إلى جانب أي نصوص برمجية أو قوالب أو ملفات مرجعية قد يحتاج إليها النموذج. لا يقرأ النموذج التعليمات إلا عندما يتوافق طلبك مع المهارة، لذا لا تترتب على المهارة المثبتة أي تكلفة حتى تُستخدم.

كيف تختلف مهارات الذكاء الاصطناعي عن الإضافات أو موصلات MCP؟

تمنح الإضافة أو موصل MCP النموذج أدوات جديدة يمكنه استدعاؤها، وهي شيفرة تُنفَّذ في مكان ما وتُرجع نتيجة. أما مهارة الذكاء الاصطناعي فتزوّد النموذج بالمعرفة ومنهجية العمل: كيفية التعامل مع مهمة، والخطوات التي ينبغي اتباعها، وما ينبغي أن تكون عليه المخرجات الجيدة. المهارات عبارة عن نصوص Markdown، لذا لا تحتاج إلى خادم أو مفتاح API أو بيئة تشغيل، وتعمل مع أي نموذج.

عرض الكل

أنشئ مساحة عملك للذكاء الاصطناعي الآن

اشترك في نشرتنا البريدية لتصلك أخبار الميزات الجديدة والهدايا القادمة 👇