<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Verilog-A - Basicão da Eletrônica</title>
	<atom:link href="https://basicaodaeletronica.com.br/tag/verilog-a/feed/" rel="self" type="application/rss+xml" />
	<link>https://basicaodaeletronica.com.br</link>
	<description>Eletrônica do Inicio ao Fim</description>
	<lastBuildDate>Sat, 26 Apr 2025 12:05:34 +0000</lastBuildDate>
	<language>pt-BR</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://basicaodaeletronica.com.br/wp-content/uploads/2024/07/cropped-logo-32x32.webp</url>
	<title>Verilog-A - Basicão da Eletrônica</title>
	<link>https://basicaodaeletronica.com.br</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Tutorial Completo: Simulação de Verilog-A com NGSpice e OpenVAF</title>
		<link>https://basicaodaeletronica.com.br/eletronica-intermediaria/tutorial-completo-simulacao-de-verilog-a-com-ngspice-e-openvaf/</link>
					<comments>https://basicaodaeletronica.com.br/eletronica-intermediaria/tutorial-completo-simulacao-de-verilog-a-com-ngspice-e-openvaf/#respond</comments>
		
		<dc:creator><![CDATA[Carlos Delfino]]></dc:creator>
		<pubDate>Thu, 26 Sep 2024 10:01:01 +0000</pubDate>
				<category><![CDATA[Eletrônica Intermediária]]></category>
		<category><![CDATA[Simulação]]></category>
		<category><![CDATA[circuitos analógicos]]></category>
		<category><![CDATA[circuitos com verilog-a]]></category>
		<category><![CDATA[compilação ngspice]]></category>
		<category><![CDATA[conversão verilog-a]]></category>
		<category><![CDATA[frontend verilog-a]]></category>
		<category><![CDATA[NGSpice]]></category>
		<category><![CDATA[ngspice com osdi]]></category>
		<category><![CDATA[ngspice tutorial]]></category>
		<category><![CDATA[open simulation data interface]]></category>
		<category><![CDATA[openvaf]]></category>
		<category><![CDATA[openvaf tutorial]]></category>
		<category><![CDATA[osdi]]></category>
		<category><![CDATA[simulação de circuitos]]></category>
		<category><![CDATA[simulação de circuitos mistos]]></category>
		<category><![CDATA[simulação de componentes analógicos]]></category>
		<category><![CDATA[simulação de resistor verilog-a]]></category>
		<category><![CDATA[simulação de verilog-a]]></category>
		<category><![CDATA[simulação mista]]></category>
		<category><![CDATA[Verilog-A]]></category>
		<category><![CDATA[verilog-a tutorial]]></category>
		<guid isPermaLink="false">https://basicaodaeletronica.com.br/?p=2505</guid>

					<description><![CDATA[<p><span class="span-reading-time rt-reading-time" style="display: block;"><span class="rt-label rt-prefix">Tempo de Leitura: </span> <span class="rt-time"> 8</span> <span class="rt-label rt-postfix">minutos</span></span>Aprenda a configurar NGSpice com suporte ao OSDI e a utilizar o OpenVAF para simular modelos Verilog-A. Tutorial passo a passo para conversão e simulação de circuitos analógicos.</p>
<p>The post <a href="https://basicaodaeletronica.com.br/eletronica-intermediaria/tutorial-completo-simulacao-de-verilog-a-com-ngspice-e-openvaf/">Tutorial Completo: Simulação de Verilog-A com NGSpice e OpenVAF</a> first appeared on <a href="https://basicaodaeletronica.com.br">Basicão da Eletrônica</a>.</p>]]></description>
										<content:encoded><![CDATA[<span class="span-reading-time rt-reading-time" style="display: block;"><span class="rt-label rt-prefix">Tempo de Leitura: </span> <span class="rt-time"> 8</span> <span class="rt-label rt-postfix">minutos</span></span>
<p class="wp-block-paragraph">Este tutorial detalhado aborda como configurar e usar o <strong>NGSpice</strong> em conjunto com o <strong>OpenVAF</strong> para simular componentes analógicos modelados em <strong>Verilog-A</strong>. Vamos explicar como configurar o ambiente, converter modelos <strong>Verilog-A</strong> para um formato que o <strong>NGSpice</strong> pode entender, além de explicar o papel e funcionamento de cada ferramenta, incluindo o <strong>OSDI</strong>.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading">Ferramentas Utilizadas</h3>



<ol class="wp-block-list">
<li><strong>NGSpice</strong>: Um simulador de circuitos analógicos, digitais e mistos baseado no <strong>SPICE</strong>. Ele simula circuitos elétricos descritos em linguagem <strong>SPICE</strong>. Para simular modelos <strong>Verilog-A</strong>, o <strong>NGSpice</strong> utiliza o <strong>OSDI</strong>.</li>



<li><strong>OpenVAF</strong>: O <strong>Open Verilog-A Frontend</strong> (<strong>OpenVAF</strong>) é uma ferramenta que converte arquivos <strong>Verilog-A</strong> em um formato especial (<strong>.osdi</strong>) que o <strong>NGSpice</strong> pode simular diretamente com o <strong>OSDI</strong> ativado.</li>



<li><strong>Verilog-A</strong>: Uma linguagem de descrição de hardware voltada para a modelagem de componentes analógicos, como resistores, capacitores, transistores, e outros dispositivos de circuitos elétricos contínuos.</li>
</ol>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading">O que é OSDI?</h3>



<p class="wp-block-paragraph"><strong>OSDI</strong> (<strong>Open Simulation Data Interface</strong>) é uma interface no <strong>NGSpice</strong> que permite simular modelos <strong>Verilog-A</strong> e outros componentes analógicos. O OSDI habilita o <strong>NGSpice</strong> a interpretar diretamente os modelos descritos em <strong>Verilog-A</strong>. Ele funciona como um intérprete para essas descrições, permitindo que os arquivos <strong><code>.osdi</code></strong> gerados pelo <strong>OpenVAF</strong> sejam usados diretamente nas simulações <strong>SPICE</strong>.</p>



<h4 class="wp-block-heading"><strong>Função do OSDI:</strong></h4>



<ul class="wp-block-list">
<li><strong>Integração de Modelos Verilog-A</strong>: O OSDI permite que modelos analógicos descritos em <strong>Verilog-A</strong> sejam integrados ao fluxo de simulação SPICE. O <strong>OpenVAF</strong> converte o código Verilog-A em um arquivo OSDI, e o <strong>NGSpice</strong> simula esse modelo através da interface OSDI.</li>



<li><strong>Processamento de Circuitos Mistos</strong>: O OSDI pode ser usado para combinar a simulação de circuitos analógicos (Verilog-A) com lógica digital e circuitos <strong>SPICE</strong>, permitindo simulações complexas de sistemas mistos.</li>
</ul>



<p class="wp-block-paragraph">O <strong>OSDI</strong> é ativado no <strong>NGSpice</strong> com a flag <strong><code>--enable-osdi</code></strong> durante a configuração e é uma parte crítica do processo para simular modelos <strong>Verilog-A</strong> gerados pelo <strong>OpenVAF</strong>.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading">Passo 1: Instalar Dependências</h3>



<p class="wp-block-paragraph">Primeiramente, instale as bibliotecas e ferramentas necessárias para compilar e configurar o <strong>NGSpice</strong> e o <strong>OpenVAF</strong>. Execute o seguinte comando no <strong>Ubuntu</strong>:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="sudo apt-get update
sudo apt-get install libxaw7-dev libtool automake autoconf bison flex libreadline-dev libreadline6-dev gperf cmake" style="color:#f6f6f4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dracula-soft" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #62E884">sudo</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">apt-get</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">update</span></span>
<span class="line"><span style="color: #62E884">sudo</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">apt-get</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">install</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">libxaw7-dev</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">libtool</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">automake</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">autoconf</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">bison</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">flex</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">libreadline-dev</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">libreadline6-dev</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">gperf</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">cmake</span></span></code></pre></div>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading">Passo 2: Baixar e Compilar o NGSpice com Suporte ao OSDI</h3>



<p class="wp-block-paragraph">Agora, vamos configurar e compilar o <strong>NGSpice</strong> com suporte ao <strong>OSDI</strong>, que permitirá a integração dos arquivos gerados pelo <strong>OpenVAF</strong>.</p>



<h4 class="wp-block-heading">a) Baixar o NGSpice</h4>



<p class="wp-block-paragraph">Baixe o código-fonte do <strong>NGSpice</strong>:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="git clone https://git.code.sf.net/p/ngspice/ngspice ngspice
cd ngspice" style="color:#f6f6f4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dracula-soft" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #62E884">git</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">clone</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">https://git.code.sf.net/p/ngspice/ngspice</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">ngspice</span></span>
<span class="line"><span style="color: #97E1F1">cd</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">ngspice</span></span></code></pre></div>



<h4 class="wp-block-heading">b) Configurar o NGSpice com Suporte ao OSDI</h4>



<p class="wp-block-paragraph">Para habilitar o <strong>OSDI</strong> no <strong>NGSpice</strong>, configure-o com o seguinte comando:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="./autogen.sh
mkdir release
cd release
../configure --with-x --enable-osdi" style="color:#f6f6f4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dracula-soft" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #62E884">./autogen.sh</span></span>
<span class="line"><span style="color: #62E884">mkdir</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">release</span></span>
<span class="line"><span style="color: #97E1F1">cd</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">release</span></span>
<span class="line"><span style="color: #97E1F1">.</span><span style="color: #F6F6F4">./configure </span><span style="color: #BF9EEE">--with-x</span><span style="color: #F6F6F4"> </span><span style="color: #BF9EEE">--enable-osdi</span></span></code></pre></div>



<ul class="wp-block-list">
<li><strong><code>--with-x</code></strong>: Habilita o suporte à interface gráfica (opcional).</li>



<li><strong><code>--enable-osdi</code></strong>: Ativa o <strong>OSDI</strong>, permitindo que o <strong>NGSpice</strong> simule arquivos <strong>Verilog-A</strong> convertidos para o formato <strong>OSDI</strong>.</li>
</ul>



<h4 class="wp-block-heading">c) Compilar o NGSpice</h4>



<p class="wp-block-paragraph">Compile o <strong>NGSpice</strong> com o seguinte comando:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="make -j$(nproc)" style="color:#f6f6f4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dracula-soft" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #62E884">make</span><span style="color: #F6F6F4"> </span><span style="color: #BF9EEE">-j</span><span style="color: #E7EE98">$(</span><span style="color: #62E884">nproc</span><span style="color: #E7EE98">)</span></span></code></pre></div>



<p class="wp-block-paragraph">Esse comando compila o NGSpice com todos os recursos ativados, incluindo o <strong>OSDI</strong>.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading">Passo 3: Baixar e Compilar o OpenVAF</h3>



<p class="wp-block-paragraph">Agora, precisamos baixar e compilar o <strong>OpenVAF</strong>, que converterá nossos arquivos <strong>Verilog-A</strong> para o formato <strong>OSDI</strong>.</p>



<h4 class="wp-block-heading">a) Baixar o OpenVAF</h4>



<p class="wp-block-paragraph">Baixe o <strong>OpenVAF</strong> usando o comando <code>wget</code>:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="wget https://openvaf.semimod.de/download/openvaf-v1.0.0.tar.gz" style="color:#f6f6f4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dracula-soft" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #62E884">wget</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">https://openvaf.semimod.de/download/openvaf-v1.0.0.tar.gz</span></span></code></pre></div>



<h4 class="wp-block-heading">b) Descompactar e Compilar o OpenVAF</h4>



<p class="wp-block-paragraph">Descompacte o arquivo baixado e compile o <strong>OpenVAF</strong> com os seguintes comandos:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="tar -xvzf openvaf-v1.0.0.tar.gz
cd openvaf-v1.0.0
mkdir build
cd build
cmake ..
make -j$(nproc)
sudo make install" style="color:#f6f6f4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dracula-soft" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #62E884">tar</span><span style="color: #F6F6F4"> </span><span style="color: #BF9EEE">-xvzf</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">openvaf-v1.0.0.tar.gz</span></span>
<span class="line"><span style="color: #97E1F1">cd</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">openvaf-v1.0.0</span></span>
<span class="line"><span style="color: #62E884">mkdir</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">build</span></span>
<span class="line"><span style="color: #97E1F1">cd</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">build</span></span>
<span class="line"><span style="color: #62E884">cmake</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">..</span></span>
<span class="line"><span style="color: #62E884">make</span><span style="color: #F6F6F4"> </span><span style="color: #BF9EEE">-j</span><span style="color: #E7EE98">$(</span><span style="color: #62E884">nproc</span><span style="color: #E7EE98">)</span></span>
<span class="line"><span style="color: #62E884">sudo</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">make</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">install</span></span></code></pre></div>



<p class="wp-block-paragraph">Isso instala o <strong>OpenVAF</strong> no sistema, permitindo que você o use para converter arquivos <strong>Verilog-A</strong>.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading">Passo 4: Criar e Converter um Arquivo Verilog-A com OpenVAF</h3>



<p class="wp-block-paragraph">Agora que o <strong>OpenVAF</strong> está instalado, vamos criar um arquivo <strong>Verilog-A</strong> e convertê-lo para o formato <strong>OSDI</strong> usando o <strong>OpenVAF</strong>.</p>



<h4 class="wp-block-heading">a) Criar o Arquivo Verilog-A</h4>



<p class="wp-block-paragraph">Crie um arquivo <strong>Verilog-A</strong> chamado <strong><code>res_model.va</code></strong> (evitando o uso de palavras reservadas como <strong><code>resistor</code></strong>) com o seguinte conteúdo:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="`include &quot;disciplines.vams&quot;

module res_model(p, n);
    inout p, n;
    electrical p, n;
    parameter real r = 1k;  // Resistência de 1k ohm

    analog begin
        V(p, n) <+ I(p, n) * r;  // Lei de Ohm: V = I * R
    end
endmodule" style="color:#f6f6f4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dracula-soft" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #E7EE98">`</span><span style="color: #62E884">include</span><span style="color: #E7EE98"> </span><span style="color: #DEE492">&quot;</span><span style="color: #E7EE98">disciplines.vams</span><span style="color: #DEE492">&quot;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #62E884">module</span><span style="color: #E7EE98"> res_model(</span><span style="color: #62E884">p,</span><span style="color: #E7EE98"> n);</span></span>
<span class="line"><span style="color: #E7EE98">    </span><span style="color: #62E884">inout</span><span style="color: #E7EE98"> p, n;</span></span>
<span class="line"><span style="color: #E7EE98">    </span><span style="color: #62E884">electrical</span><span style="color: #E7EE98"> p, n;</span></span>
<span class="line"><span style="color: #E7EE98">    </span><span style="color: #62E884">parameter</span><span style="color: #E7EE98"> real r = </span><span style="color: #BF9EEE">1</span><span style="color: #E7EE98">k;  </span><span style="color: #62E884">//</span><span style="color: #E7EE98"> Resistência de </span><span style="color: #BF9EEE">1</span><span style="color: #E7EE98">k ohm</span></span>
<span class="line"></span>
<span class="line"><span style="color: #E7EE98">    </span><span style="color: #62E884">analog</span><span style="color: #E7EE98"> begin</span></span>
<span class="line"><span style="color: #E7EE98">        </span><span style="color: #62E884">V(p,</span><span style="color: #E7EE98"> n) </span><span style="color: #F286C4">&lt;</span><span style="color: #E7EE98">+ I(</span><span style="color: #62E884">p,</span><span style="color: #E7EE98"> n) </span><span style="color: #F286C4">*</span><span style="color: #E7EE98"> r;  </span><span style="color: #62E884">//</span><span style="color: #E7EE98"> Lei de Ohm: V = I </span><span style="color: #BF9EEE; font-style: italic">*</span><span style="color: #E7EE98"> R</span></span>
<span class="line"><span style="color: #E7EE98">    </span><span style="color: #F286C4">end</span></span>
<span class="line"><span style="color: #62E884">endmodule</span></span></code></pre></div>



<h4 class="wp-block-heading">b) Converter o Arquivo Verilog-A com o OpenVAF</h4>



<p class="wp-block-paragraph">Agora, use o <strong>OpenVAF</strong> para converter o arquivo <strong>Verilog-A</strong> em um arquivo <strong><code>.osdi</code></strong>:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="openvaf res_model.va" style="color:#f6f6f4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dracula-soft" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #62E884">openvaf</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">res_model.va</span></span></code></pre></div>



<p class="wp-block-paragraph">O <strong>OpenVAF</strong> gera um arquivo <strong><code>.osdi</code></strong> (neste caso, <strong><code>res_model.osdi</code></strong>) no mesmo diretório.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading">Passo 5: Integrar o Arquivo <code>.osdi</code> no NGSpice</h3>



<p class="wp-block-paragraph">Agora que o arquivo <strong><code>.osdi</code></strong> foi gerado, podemos integrá-lo no <strong>NGSpice</strong> para simulação.</p>



<h4 class="wp-block-heading">a) Criar o Netlist SPICE</h4>



<p class="wp-block-paragraph">Crie um arquivo <strong><code>test.cir</code></strong> que utiliza o arquivo <strong><code>.osdi</code></strong> gerado:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="* Teste de modelo de resistor convertido pelo OpenVAF

osdi res_model.osdi  ; Incluir o arquivo OSDI gerado pelo OpenVAF

V1 p 0 dc 1          ; Fonte de 1V
X1 p 0 res_model     ; Instanciar o modelo convertido

.control
    tran 1n 10n      ; Simulação no domínio do tempo por 10ns
    print V(p)       ; Mostrar a tensão no nó p
.endc

.end" style="color:#f6f6f4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dracula-soft" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #F286C4">*</span><span style="color: #F6F6F4"> Teste de modelo de resistor convertido pelo OpenVAF</span></span>
<span class="line"></span>
<span class="line"><span style="color: #62E884">osdi</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">res_model.osdi</span><span style="color: #F6F6F4">  ; </span><span style="color: #62E884">Incluir</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">o</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">arquivo</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">OSDI</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">gerado</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">pelo</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">OpenVAF</span></span>
<span class="line"></span>
<span class="line"><span style="color: #62E884">V1</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">p</span><span style="color: #F6F6F4"> </span><span style="color: #BF9EEE">0</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">dc</span><span style="color: #F6F6F4"> </span><span style="color: #BF9EEE">1</span><span style="color: #F6F6F4">          ; </span><span style="color: #62E884">Fonte</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">de</span><span style="color: #F6F6F4"> </span><span style="color: #BF9EEE">1</span><span style="color: #E7EE98">V</span></span>
<span class="line"><span style="color: #62E884">X1</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">p</span><span style="color: #F6F6F4"> </span><span style="color: #BF9EEE">0</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">res_model</span><span style="color: #F6F6F4">     ; </span><span style="color: #62E884">Instanciar</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">o</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">modelo</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">convertido</span></span>
<span class="line"></span>
<span class="line"><span style="color: #62E884">.control</span></span>
<span class="line"><span style="color: #F6F6F4">    </span><span style="color: #62E884">tran</span><span style="color: #F6F6F4"> </span><span style="color: #BF9EEE">1</span><span style="color: #E7EE98">n</span><span style="color: #F6F6F4"> </span><span style="color: #BF9EEE">10</span><span style="color: #E7EE98">n</span><span style="color: #F6F6F4">      ; </span><span style="color: #62E884">Simulação</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">no</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">domínio</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">do</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">tempo</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">por</span><span style="color: #F6F6F4"> </span><span style="color: #BF9EEE">10</span><span style="color: #E7EE98">ns</span></span>
<span class="line"><span style="color: #F6F6F4">    </span><span style="color: #97E1F1">print</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">V</span><span style="color: #F6F6F4">(</span><span style="color: #62E884">p</span><span style="color: #F6F6F4">)       ; </span><span style="color: #62E884">Mostrar</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">a</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">tensão</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">no</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">nó</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">p</span></span>
<span class="line"><span style="color: #62E884">.endc</span></span>
<span class="line"></span>
<span class="line"><span style="color: #62E884">.end</span></span></code></pre></div>



<p class="wp-block-paragraph">Aqui, a diretiva <strong><code>osdi</code></strong> carrega o arquivo <strong><code>.osdi</code></strong> gerado pelo <strong>OpenVAF</strong>, e o modelo <strong><code>res_model</code></strong> é instanciado no circuito.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading">Passo 6: Executar a Simulação no NGSpice</h3>



<p class="wp-block-paragraph">Agora, execute a simulação no <strong>NGSpice</strong>:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="./src/ngspice test.cir" style="color:#f6f6f4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dracula-soft" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #62E884">./src/ngspice</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">test.cir</span></span></code></pre></div>



<p class="wp-block-paragraph">O <strong>NGSpice</strong> processará o arquivo <strong><code>.osdi</code></strong> gerado pelo <strong>OpenVAF</strong> e executará a simulação, mostrando a tensão no nó <code>p</code>, que será de 1V (de acordo com a <strong>Lei de Ohm</strong> para um resistor de 1kΩ).</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading">Explicações Adicionais</h3>



<ol class="wp-block-list">
<li><strong>Por que evitar palavras reservadas?</strong><br>Usar palavras como <strong><code>resistor</code></strong> pode causar conflitos, pois essas palavras podem já estar reservadas no <strong>Verilog-A</strong> ou no <strong>NGSpice</strong>. Para evitar problemas, optamos por um nome alternativo como <strong><code>res_model</code></strong>.</li>



<li><strong>O que é OpenVAF?</strong><br>O <strong>OpenVAF</strong> é um frontend que processa arquivos <strong>Verilog-A</strong> e os converte em um formato (<strong>.osdi</strong>) que o <strong>NGSpice</strong> pode simular diretamente. Ele elimina a necessidade de ferramentas de conversão externas.</li>



<li><strong>O que é OSDI?</strong><br><strong>OSDI</strong> (Open Simulation Data Interface) é uma interface no <strong>NGSpice</strong> que permite a simulação de componentes descritos em <strong>Verilog-A</strong>. Ele processa diretamente os arquivos <strong><code>.osdi</code></strong> gerados pelo <strong>OpenVAF</strong>, permitindo simulações analógicas e mistas.</li>
</ol>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading">Conclusão</h3>



<p class="wp-block-paragraph">Seguindo este tutorial, você agora pode usar o <strong>NGSpice</strong> com suporte ao <strong>OSDI</strong> e ao <strong>OpenVAF</strong> para simular diretamente componentes modelados em <strong>Verilog-A</strong>. Além disso, explicamos o papel do <strong>OSDI</strong> como a interface que integra a simulação de modelos <strong>Verilog-A</strong> ao fluxo <strong>SPICE</strong>, permitindo simulações mistas e complexas.</p>



<p class="wp-block-paragraph">Este tutorial detalhado aborda como configurar e usar o <strong>NGSpice</strong> em conjunto com o <strong>OpenVAF</strong> para simular componentes analógicos modelados em <strong>Verilog-A</strong>. Vamos explicar como configurar o ambiente, converter modelos <strong>Verilog-A</strong> para um formato que o <strong>NGSpice</strong> pode entender, além de explicar o papel e funcionamento de cada ferramenta, incluindo o <strong>OSDI</strong>.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading">Ferramentas Utilizadas</h3>



<ol class="wp-block-list">
<li><strong>NGSpice</strong>: Um simulador de circuitos analógicos, digitais e mistos baseado no <strong>SPICE</strong>. Ele simula circuitos elétricos descritos em linguagem <strong>SPICE</strong>. Para simular modelos <strong>Verilog-A</strong>, o <strong>NGSpice</strong> utiliza o <strong>OSDI</strong>.</li>



<li><strong>OpenVAF</strong>: O <strong>Open Verilog-A Frontend</strong> (<strong>OpenVAF</strong>) é uma ferramenta que converte arquivos <strong>Verilog-A</strong> em um formato especial (<strong>.osdi</strong>) que o <strong>NGSpice</strong> pode simular diretamente com o <strong>OSDI</strong> ativado.</li>



<li><strong>Verilog-A</strong>: Uma linguagem de descrição de hardware voltada para a modelagem de componentes analógicos, como resistores, capacitores, transistores, e outros dispositivos de circuitos elétricos contínuos.</li>
</ol>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading">O que é OSDI?</h3>



<p class="wp-block-paragraph"><strong>OSDI</strong> (<strong>Open Simulation Data Interface</strong>) é uma interface no <strong>NGSpice</strong> que permite simular modelos <strong>Verilog-A</strong> e outros componentes analógicos. O OSDI habilita o <strong>NGSpice</strong> a interpretar diretamente os modelos descritos em <strong>Verilog-A</strong>. Ele funciona como um intérprete para essas descrições, permitindo que os arquivos <strong><code>.osdi</code></strong> gerados pelo <strong>OpenVAF</strong> sejam usados diretamente nas simulações <strong>SPICE</strong>.</p>



<h4 class="wp-block-heading"><strong>Função do OSDI:</strong></h4>



<ul class="wp-block-list">
<li><strong>Integração de Modelos Verilog-A</strong>: O OSDI permite que modelos analógicos descritos em <strong>Verilog-A</strong> sejam integrados ao fluxo de simulação SPICE. O <strong>OpenVAF</strong> converte o código Verilog-A em um arquivo OSDI, e o <strong>NGSpice</strong> simula esse modelo através da interface OSDI.</li>



<li><strong>Processamento de Circuitos Mistos</strong>: O OSDI pode ser usado para combinar a simulação de circuitos analógicos (Verilog-A) com lógica digital e circuitos <strong>SPICE</strong>, permitindo simulações complexas de sistemas mistos.</li>
</ul>



<p class="wp-block-paragraph">O <strong>OSDI</strong> é ativado no <strong>NGSpice</strong> com a flag <strong><code>--enable-osdi</code></strong> durante a configuração e é uma parte crítica do processo para simular modelos <strong>Verilog-A</strong> gerados pelo <strong>OpenVAF</strong>.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading">Passo 1: Instalar Dependências</h3>



<p class="wp-block-paragraph">Primeiramente, instale as bibliotecas e ferramentas necessárias para compilar e configurar o <strong>NGSpice</strong> e o <strong>OpenVAF</strong>. Execute o seguinte comando no <strong>Ubuntu</strong>:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="sudo apt-get update
sudo apt-get install libxaw7-dev libtool automake autoconf bison flex libreadline-dev libreadline6-dev gperf cmake" style="color:#f6f6f4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dracula-soft" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #62E884">sudo</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">apt-get</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">update</span></span>
<span class="line"><span style="color: #62E884">sudo</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">apt-get</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">install</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">libxaw7-dev</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">libtool</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">automake</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">autoconf</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">bison</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">flex</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">libreadline-dev</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">libreadline6-dev</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">gperf</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">cmake</span></span></code></pre></div>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading">Passo 2: Baixar e Compilar o NGSpice com Suporte ao OSDI</h3>



<p class="wp-block-paragraph">Agora, vamos configurar e compilar o <strong>NGSpice</strong> com suporte ao <strong>OSDI</strong>, que permitirá a integração dos arquivos gerados pelo <strong>OpenVAF</strong>.</p>



<h4 class="wp-block-heading">a) Baixar o NGSpice</h4>



<p class="wp-block-paragraph">Baixe o código-fonte do <strong>NGSpice</strong>:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="git clone https://git.code.sf.net/p/ngspice/ngspice ngspice
cd ngspice" style="color:#f6f6f4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dracula-soft" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #62E884">git</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">clone</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">https://git.code.sf.net/p/ngspice/ngspice</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">ngspice</span></span>
<span class="line"><span style="color: #97E1F1">cd</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">ngspice</span></span></code></pre></div>



<h4 class="wp-block-heading">b) Configurar o NGSpice com Suporte ao OSDI</h4>



<p class="wp-block-paragraph">Para habilitar o <strong>OSDI</strong> no <strong>NGSpice</strong>, configure-o com o seguinte comando:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="./autogen.sh
mkdir release
cd release
../configure --with-x --enable-osdi" style="color:#f6f6f4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dracula-soft" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #62E884">./autogen.sh</span></span>
<span class="line"><span style="color: #62E884">mkdir</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">release</span></span>
<span class="line"><span style="color: #97E1F1">cd</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">release</span></span>
<span class="line"><span style="color: #97E1F1">.</span><span style="color: #F6F6F4">./configure </span><span style="color: #BF9EEE">--with-x</span><span style="color: #F6F6F4"> </span><span style="color: #BF9EEE">--enable-osdi</span></span></code></pre></div>



<ul class="wp-block-list">
<li><strong><code>--with-x</code></strong>: Habilita o suporte à interface gráfica (opcional).</li>



<li><strong><code>--enable-osdi</code></strong>: Ativa o <strong>OSDI</strong>, permitindo que o <strong>NGSpice</strong> simule arquivos <strong>Verilog-A</strong> convertidos para o formato <strong>OSDI</strong>.</li>
</ul>



<h4 class="wp-block-heading">c) Compilar o NGSpice</h4>



<p class="wp-block-paragraph">Compile o <strong>NGSpice</strong> com o seguinte comando:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="make -j$(nproc)" style="color:#f6f6f4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dracula-soft" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #62E884">make</span><span style="color: #F6F6F4"> </span><span style="color: #BF9EEE">-j</span><span style="color: #E7EE98">$(</span><span style="color: #62E884">nproc</span><span style="color: #E7EE98">)</span></span></code></pre></div>



<p class="wp-block-paragraph">Esse comando compila o NGSpice com todos os recursos ativados, incluindo o <strong>OSDI</strong>.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading">Passo 3: Baixar e Compilar o OpenVAF</h3>



<p class="wp-block-paragraph">Agora, precisamos baixar e compilar o <strong>OpenVAF</strong>, que converterá nossos arquivos <strong>Verilog-A</strong> para o formato <strong>OSDI</strong>.</p>



<h4 class="wp-block-heading">a) Baixar o OpenVAF</h4>



<p class="wp-block-paragraph">Baixe o <strong>OpenVAF</strong> usando o comando <code>wget</code>:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="wget https://openvaf.semimod.de/download/openvaf-v1.0.0.tar.gz" style="color:#f6f6f4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dracula-soft" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #62E884">wget</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">https://openvaf.semimod.de/download/openvaf-v1.0.0.tar.gz</span></span></code></pre></div>



<h4 class="wp-block-heading">b) Descompactar e Compilar o OpenVAF</h4>



<p class="wp-block-paragraph">Descompacte o arquivo baixado e compile o <strong>OpenVAF</strong> com os seguintes comandos:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="tar -xvzf openvaf-v1.0.0.tar.gz
cd openvaf-v1.0.0
mkdir build
cd build
cmake ..
make -j$(nproc)
sudo make install" style="color:#f6f6f4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dracula-soft" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #62E884">tar</span><span style="color: #F6F6F4"> </span><span style="color: #BF9EEE">-xvzf</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">openvaf-v1.0.0.tar.gz</span></span>
<span class="line"><span style="color: #97E1F1">cd</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">openvaf-v1.0.0</span></span>
<span class="line"><span style="color: #62E884">mkdir</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">build</span></span>
<span class="line"><span style="color: #97E1F1">cd</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">build</span></span>
<span class="line"><span style="color: #62E884">cmake</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">..</span></span>
<span class="line"><span style="color: #62E884">make</span><span style="color: #F6F6F4"> </span><span style="color: #BF9EEE">-j</span><span style="color: #E7EE98">$(</span><span style="color: #62E884">nproc</span><span style="color: #E7EE98">)</span></span>
<span class="line"><span style="color: #62E884">sudo</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">make</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">install</span></span></code></pre></div>



<p class="wp-block-paragraph">Isso instala o <strong>OpenVAF</strong> no sistema, permitindo que você o use para converter arquivos <strong>Verilog-A</strong>.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading">Passo 4: Criar e Converter um Arquivo Verilog-A com OpenVAF</h3>



<p class="wp-block-paragraph">Agora que o <strong>OpenVAF</strong> está instalado, vamos criar um arquivo <strong>Verilog-A</strong> e convertê-lo para o formato <strong>OSDI</strong> usando o <strong>OpenVAF</strong>.</p>



<h4 class="wp-block-heading">a) Criar o Arquivo Verilog-A</h4>



<p class="wp-block-paragraph">Crie um arquivo <strong>Verilog-A</strong> chamado <strong><code>res_model.va</code></strong> (evitando o uso de palavras reservadas como <strong><code>resistor</code></strong>) com o seguinte conteúdo:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="`include &quot;disciplines.vams&quot;

module res_model(p, n);
    inout p, n;
    electrical p, n;
    parameter real r = 1k;  // Resistência de 1k ohm

    analog begin
        V(p, n) <+ I(p, n) * r;  // Lei de Ohm: V = I * R
    end
endmodule" style="color:#f6f6f4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dracula-soft" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #E7EE98">`</span><span style="color: #62E884">include</span><span style="color: #E7EE98"> </span><span style="color: #DEE492">&quot;</span><span style="color: #E7EE98">disciplines.vams</span><span style="color: #DEE492">&quot;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #62E884">module</span><span style="color: #E7EE98"> res_model(</span><span style="color: #62E884">p,</span><span style="color: #E7EE98"> n);</span></span>
<span class="line"><span style="color: #E7EE98">    </span><span style="color: #62E884">inout</span><span style="color: #E7EE98"> p, n;</span></span>
<span class="line"><span style="color: #E7EE98">    </span><span style="color: #62E884">electrical</span><span style="color: #E7EE98"> p, n;</span></span>
<span class="line"><span style="color: #E7EE98">    </span><span style="color: #62E884">parameter</span><span style="color: #E7EE98"> real r = </span><span style="color: #BF9EEE">1</span><span style="color: #E7EE98">k;  </span><span style="color: #62E884">//</span><span style="color: #E7EE98"> Resistência de </span><span style="color: #BF9EEE">1</span><span style="color: #E7EE98">k ohm</span></span>
<span class="line"></span>
<span class="line"><span style="color: #E7EE98">    </span><span style="color: #62E884">analog</span><span style="color: #E7EE98"> begin</span></span>
<span class="line"><span style="color: #E7EE98">        </span><span style="color: #62E884">V(p,</span><span style="color: #E7EE98"> n) </span><span style="color: #F286C4">&lt;</span><span style="color: #E7EE98">+ I(</span><span style="color: #62E884">p,</span><span style="color: #E7EE98"> n) </span><span style="color: #F286C4">*</span><span style="color: #E7EE98"> r;  </span><span style="color: #62E884">//</span><span style="color: #E7EE98"> Lei de Ohm: V = I </span><span style="color: #BF9EEE; font-style: italic">*</span><span style="color: #E7EE98"> R</span></span>
<span class="line"><span style="color: #E7EE98">    </span><span style="color: #F286C4">end</span></span>
<span class="line"><span style="color: #62E884">endmodule</span></span></code></pre></div>



<h4 class="wp-block-heading">b) Converter o Arquivo Verilog-A com o OpenVAF</h4>



<p class="wp-block-paragraph">Agora, use o <strong>OpenVAF</strong> para converter o arquivo <strong>Verilog-A</strong> em um arquivo <strong><code>.osdi</code></strong>:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="openvaf res_model.va" style="color:#f6f6f4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dracula-soft" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #62E884">openvaf</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">res_model.va</span></span></code></pre></div>



<p class="wp-block-paragraph">O <strong>OpenVAF</strong> gera um arquivo <strong><code>.osdi</code></strong> (neste caso, <strong><code>res_model.osdi</code></strong>) no mesmo diretório.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading">Passo 5: Integrar o Arquivo <code>.osdi</code> no NGSpice</h3>



<p class="wp-block-paragraph">Agora que o arquivo <strong><code>.osdi</code></strong> foi gerado, podemos integrá-lo no <strong>NGSpice</strong> para simulação.</p>



<h4 class="wp-block-heading">a) Criar o Netlist SPICE</h4>



<p class="wp-block-paragraph">Crie um arquivo <strong><code>test.cir</code></strong> que utiliza o arquivo <strong><code>.osdi</code></strong> gerado:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="* Teste de modelo de resistor convertido pelo OpenVAF

osdi res_model.osdi  ; Incluir o arquivo OSDI gerado pelo OpenVAF

V1 p 0 dc 1          ; Fonte de 1V
X1 p 0 res_model     ; Instanciar o modelo convertido

.control
    tran 1n 10n      ; Simulação no domínio do tempo por 10ns
    print V(p)       ; Mostrar a tensão no nó p
.endc

.end" style="color:#f6f6f4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dracula-soft" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #F286C4">*</span><span style="color: #F6F6F4"> Teste de modelo de resistor convertido pelo OpenVAF</span></span>
<span class="line"></span>
<span class="line"><span style="color: #62E884">osdi</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">res_model.osdi</span><span style="color: #F6F6F4">  ; </span><span style="color: #62E884">Incluir</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">o</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">arquivo</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">OSDI</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">gerado</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">pelo</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">OpenVAF</span></span>
<span class="line"></span>
<span class="line"><span style="color: #62E884">V1</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">p</span><span style="color: #F6F6F4"> </span><span style="color: #BF9EEE">0</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">dc</span><span style="color: #F6F6F4"> </span><span style="color: #BF9EEE">1</span><span style="color: #F6F6F4">          ; </span><span style="color: #62E884">Fonte</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">de</span><span style="color: #F6F6F4"> </span><span style="color: #BF9EEE">1</span><span style="color: #E7EE98">V</span></span>
<span class="line"><span style="color: #62E884">X1</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">p</span><span style="color: #F6F6F4"> </span><span style="color: #BF9EEE">0</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">res_model</span><span style="color: #F6F6F4">     ; </span><span style="color: #62E884">Instanciar</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">o</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">modelo</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">convertido</span></span>
<span class="line"></span>
<span class="line"><span style="color: #62E884">.control</span></span>
<span class="line"><span style="color: #F6F6F4">    </span><span style="color: #62E884">tran</span><span style="color: #F6F6F4"> </span><span style="color: #BF9EEE">1</span><span style="color: #E7EE98">n</span><span style="color: #F6F6F4"> </span><span style="color: #BF9EEE">10</span><span style="color: #E7EE98">n</span><span style="color: #F6F6F4">      ; </span><span style="color: #62E884">Simulação</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">no</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">domínio</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">do</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">tempo</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">por</span><span style="color: #F6F6F4"> </span><span style="color: #BF9EEE">10</span><span style="color: #E7EE98">ns</span></span>
<span class="line"><span style="color: #F6F6F4">    </span><span style="color: #97E1F1">print</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">V</span><span style="color: #F6F6F4">(</span><span style="color: #62E884">p</span><span style="color: #F6F6F4">)       ; </span><span style="color: #62E884">Mostrar</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">a</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">tensão</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">no</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">nó</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">p</span></span>
<span class="line"><span style="color: #62E884">.endc</span></span>
<span class="line"></span>
<span class="line"><span style="color: #62E884">.end</span></span></code></pre></div>



<p class="wp-block-paragraph">Aqui, a diretiva <strong><code>osdi</code></strong> carrega o arquivo <strong><code>.osdi</code></strong> gerado pelo <strong>OpenVAF</strong>, e o modelo <strong><code>res_model</code></strong> é instanciado no circuito.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading">Passo 6: Executar a Simulação no NGSpice</h3>



<p class="wp-block-paragraph">Agora, execute a simulação no <strong>NGSpice</strong>:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="./src/ngspice test.cir" style="color:#f6f6f4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dracula-soft" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #62E884">./src/ngspice</span><span style="color: #F6F6F4"> </span><span style="color: #E7EE98">test.cir</span></span></code></pre></div>



<p class="wp-block-paragraph">O <strong>NGSpice</strong> processará o arquivo <strong><code>.osdi</code></strong> gerado pelo <strong>OpenVAF</strong> e executará a simulação, mostrando a tensão no nó <code>p</code>, que será de 1V (de acordo com a <strong>Lei de Ohm</strong> para um resistor de 1kΩ).</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading">Explicações Adicionais</h3>



<ol class="wp-block-list">
<li><strong>Por que evitar palavras reservadas?</strong><br>Usar palavras como <strong><code>resistor</code></strong> pode causar conflitos, pois essas palavras podem já estar reservadas no <strong>Verilog-A</strong> ou no <strong>NGSpice</strong>. Para evitar problemas, optamos por um nome alternativo como <strong><code>res_model</code></strong>.</li>



<li><strong>O que é OpenVAF?</strong><br>O <strong>OpenVAF</strong> é um frontend que processa arquivos <strong>Verilog-A</strong> e os converte em um formato (<strong>.osdi</strong>) que o <strong>NGSpice</strong> pode simular diretamente. Ele elimina a necessidade de ferramentas de conversão externas.</li>



<li><strong>O que é OSDI?</strong><br><strong>OSDI</strong> (Open Simulation Data Interface) é uma interface no <strong>NGSpice</strong> que permite a simulação de componentes descritos em <strong>Verilog-A</strong>. Ele processa diretamente os arquivos <strong><code>.osdi</code></strong> gerados pelo <strong>OpenVAF</strong>, permitindo simulações analógicas e mistas.</li>
</ol>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading">Conclusão</h3>



<p class="wp-block-paragraph">Seguindo este tutorial, você agora pode usar o <strong>NGSpice</strong> com suporte ao <strong>OSDI</strong> e ao <strong>OpenVAF</strong> para simular diretamente componentes modelados em <strong>Verilog-A</strong>. Além disso, explicamos o papel do <strong>OSDI</strong> como a interface que integra a simulação de modelos <strong>Verilog-A</strong> ao fluxo <strong>SPICE</strong>, permitindo simulações mistas e complexas.</p>
<div style='clear:both'></div><div  class='the_champ_counter_container the_champ_horizontal_counter'><div class='the_champ_counter_title' style="font-weight:bold"></div><ul class="the_champ_sharing_ul"><li style="padding:7.35px 0 !important" class="the_champ_facebook_share"><div class="fb-share-button" data-href="https://basicaodaeletronica.com.br/eletronica-intermediaria/tutorial-completo-simulacao-de-verilog-a-com-ngspice-e-openvaf/" data-layout="button_count"></div></li><li style="padding:7.35px 0 !important" class="the_champ_facebook_like"><div class="fb-like" data-href="https://basicaodaeletronica.com.br/eletronica-intermediaria/tutorial-completo-simulacao-de-verilog-a-com-ngspice-e-openvaf/" data-layout="button_count" data-action="like" data-show-faces="false" data-share="false"></div></li><li style="padding:7.35px 0 !important" class="the_champ_facebook_recommend"><div class="fb-like" data-href="https://basicaodaeletronica.com.br/eletronica-intermediaria/tutorial-completo-simulacao-de-verilog-a-com-ngspice-e-openvaf/" data-layout="button_count" data-action="recommend" data-show-faces="false" data-share="false"></div></li><li style="padding:7.35px 0 !important" class="the_champ_twitter_tweet" data-super-socializer-href="https://basicaodaeletronica.com.br/eletronica-intermediaria/tutorial-completo-simulacao-de-verilog-a-com-ngspice-e-openvaf/"><a href="https://twitter.com/share" class="twitter-share-button" data-url="https://basicaodaeletronica.com.br/eletronica-intermediaria/tutorial-completo-simulacao-de-verilog-a-com-ngspice-e-openvaf/" data-counturl="https://basicaodaeletronica.com.br/eletronica-intermediaria/tutorial-completo-simulacao-de-verilog-a-com-ngspice-e-openvaf/" data-text="Tutorial+Completo:+Simula%C3%A7%C3%A3o+de+Verilog-A+com+NGSpice+e+OpenVAF" data-via="" data-lang="" >Tweet</a><script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?"http":"https";if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document, "script", "twitter-wjs");</script></li><li style="padding:7.35px 0!important;margin-top:-2px!important" class="the_champ_linkedin_share"><script src="//platform.linkedin.com/in.js" type="text/javascript">lang: </script><script type="IN/Share" data-url="https://basicaodaeletronica.com.br/eletronica-intermediaria/tutorial-completo-simulacao-de-verilog-a-com-ngspice-e-openvaf/" data-counter="right"></script></li><li style="padding:7.35px 0 !important" class="the_champ_reddit"><script type="text/javascript" src="//www.reddit.com/static/button/button1.js"></script></li></ul><div style="clear:both"></div></div><div style='clear:both'></div><div class='the_champ_sharing_container the_champ_vertical_sharing the_champ_hide_sharing the_champ_bottom_sharing' style='width:44px;left: -10px;top: 100px;-webkit-box-shadow:none;box-shadow:none;' data-super-socializer-href="https://basicaodaeletronica.com.br/tag/verilog-a/feed/"data-super-socializer-no-counts="1"><div class="the_champ_sharing_ul"><a aria-label="Facebook" class="the_champ_facebook" href="https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fbasicaodaeletronica.com.br%2Ftag%2Fverilog-a%2Ffeed%2F" title="Facebook" rel="nofollow noopener" target="_blank" style="font-size:24px!important;box-shadow:none;display:inline-block;vertical-align:middle"><span class="the_champ_svg" style="background-color:#0765FE;width:40px;height:40px;margin:0;display:inline-block;opacity:1;float:left;font-size:24px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;box-sizing:content-box"><span class="the_champ_square_count the_champ_facebook_count">&nbsp;</span><svg style="display:block;" focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 32 32"><path fill="#fff" d="M28 16c0-6.627-5.373-12-12-12S4 9.373 4 16c0 5.628 3.875 10.35 9.101 11.647v-7.98h-2.474V16H13.1v-1.58c0-4.085 1.849-5.978 5.859-5.978.76 0 2.072.15 2.608.298v3.325c-.283-.03-.775-.045-1.386-.045-1.967 0-2.728.745-2.728 2.683V16h3.92l-.673 3.667h-3.247v8.245C23.395 27.195 28 22.135 28 16Z"></path></svg></span></a><a aria-label="X" class="the_champ_button_x" href="https://twitter.com/intent/tweet?text=Verilog-A&url=https%3A%2F%2Fbasicaodaeletronica.com.br%2Ftag%2Fverilog-a%2Ffeed%2F" title="X" rel="nofollow noopener" target="_blank" style="font-size:24px!important;box-shadow:none;display:inline-block;vertical-align:middle"><span class="the_champ_svg the_champ_s__default the_champ_s_x" style="background-color:#2a2a2a;width:40px;height:40px;margin:0;display:inline-block;opacity:1;float:left;font-size:24px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;box-sizing:content-box"><span class="the_champ_square_count the_champ_X_count">&nbsp;</span><svg width="100%" height="100%" style="display:block;" focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#fff" d="M21.751 7h3.067l-6.7 7.658L26 25.078h-6.172l-4.833-6.32-5.531 6.32h-3.07l7.167-8.19L6 7h6.328l4.37 5.777L21.75 7Zm-1.076 16.242h1.7L11.404 8.74H9.58l11.094 14.503Z"></path></svg></span></a><a aria-label="Linkedin" class="the_champ_button_linkedin" href="https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fbasicaodaeletronica.com.br%2Ftag%2Fverilog-a%2Ffeed%2F" title="Linkedin" rel="nofollow noopener" target="_blank" style="font-size:24px!important;box-shadow:none;display:inline-block;vertical-align:middle"><span class="the_champ_svg the_champ_s__default the_champ_s_linkedin" style="background-color:#0077b5;width:40px;height:40px;margin:0;display:inline-block;opacity:1;float:left;font-size:24px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;box-sizing:content-box"><span class="the_champ_square_count the_champ_linkedin_count">&nbsp;</span><svg style="display:block;" focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 32 32"><path d="M6.227 12.61h4.19v13.48h-4.19V12.61zm2.095-6.7a2.43 2.43 0 0 1 0 4.86c-1.344 0-2.428-1.09-2.428-2.43s1.084-2.43 2.428-2.43m4.72 6.7h4.02v1.84h.058c.56-1.058 1.927-2.176 3.965-2.176 4.238 0 5.02 2.792 5.02 6.42v7.395h-4.183v-6.56c0-1.564-.03-3.574-2.178-3.574-2.18 0-2.514 1.7-2.514 3.46v6.668h-4.187V12.61z" fill="#fff"></path></svg></span></a><a aria-label="Reddit" class="the_champ_button_reddit" href="https://reddit.com/submit?url=https%3A%2F%2Fbasicaodaeletronica.com.br%2Ftag%2Fverilog-a%2Ffeed%2F&title=Verilog-A" title="Reddit" rel="nofollow noopener" target="_blank" style="font-size:24px!important;box-shadow:none;display:inline-block;vertical-align:middle"><span class="the_champ_svg the_champ_s__default the_champ_s_reddit" style="background-color:#ff5700;width:40px;height:40px;margin:0;display:inline-block;opacity:1;float:left;font-size:24px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;box-sizing:content-box"><span class="the_champ_square_count the_champ_reddit_count">&nbsp;</span><svg style="display:block;" focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="-3.5 -3.5 39 39"><path d="M28.543 15.774a2.953 2.953 0 0 0-2.951-2.949 2.882 2.882 0 0 0-1.9.713 14.075 14.075 0 0 0-6.85-2.044l1.38-4.349 3.768.884a2.452 2.452 0 1 0 .24-1.176l-4.274-1a.6.6 0 0 0-.709.4l-1.659 5.224a14.314 14.314 0 0 0-7.316 2.029 2.908 2.908 0 0 0-1.872-.681 2.942 2.942 0 0 0-1.618 5.4 5.109 5.109 0 0 0-.062.765c0 4.158 5.037 7.541 11.229 7.541s11.22-3.383 11.22-7.541a5.2 5.2 0 0 0-.053-.706 2.963 2.963 0 0 0 1.427-2.51zm-18.008 1.88a1.753 1.753 0 0 1 1.73-1.74 1.73 1.73 0 0 1 1.709 1.74 1.709 1.709 0 0 1-1.709 1.711 1.733 1.733 0 0 1-1.73-1.711zm9.565 4.968a5.573 5.573 0 0 1-4.081 1.272h-.032a5.576 5.576 0 0 1-4.087-1.272.6.6 0 0 1 .844-.854 4.5 4.5 0 0 0 3.238.927h.032a4.5 4.5 0 0 0 3.237-.927.6.6 0 1 1 .844.854zm-.331-3.256a1.726 1.726 0 1 1 1.709-1.712 1.717 1.717 0 0 1-1.712 1.712z" fill="#fff"/></svg></span></a><a aria-label="Whatsapp" class="the_champ_whatsapp" href="https://api.whatsapp.com/send?text=Verilog-A https%3A%2F%2Fbasicaodaeletronica.com.br%2Ftag%2Fverilog-a%2Ffeed%2F" title="Whatsapp" rel="nofollow noopener" target="_blank" style="font-size:24px!important;box-shadow:none;display:inline-block;vertical-align:middle"><span class="the_champ_svg" style="background-color:#55eb4c;width:40px;height:40px;margin:0;display:inline-block;opacity:1;float:left;font-size:24px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;box-sizing:content-box"><span class="the_champ_square_count the_champ_whatsapp_count">&nbsp;</span><svg style="display:block;" focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="-6 -5 40 40"><path class="the_champ_svg_stroke the_champ_no_fill" stroke="#fff" stroke-width="2" fill="none" d="M 11.579798566743314 24.396926207859085 A 10 10 0 1 0 6.808479557110079 20.73576436351046"></path><path d="M 7 19 l -1 6 l 6 -1" class="the_champ_no_fill the_champ_svg_stroke" stroke="#fff" stroke-width="2" fill="none"></path><path d="M 10 10 q -1 8 8 11 c 5 -1 0 -6 -1 -3 q -4 -3 -5 -5 c 4 -2 -1 -5 -1 -4" fill="#fff"></path></svg></span></a><a aria-label="Twitter" class="the_champ_button_twitter" href="https://twitter.com/intent/tweet?text=Verilog-A&url=https%3A%2F%2Fbasicaodaeletronica.com.br%2Ftag%2Fverilog-a%2Ffeed%2F" title="Twitter" rel="nofollow noopener" target="_blank" style="font-size:24px!important;box-shadow:none;display:inline-block;vertical-align:middle"><span class="the_champ_svg the_champ_s__default the_champ_s_twitter" style="background-color:#55acee;width:40px;height:40px;margin:0;display:inline-block;opacity:1;float:left;font-size:24px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;box-sizing:content-box"><span class="the_champ_square_count the_champ_twitter_count">&nbsp;</span><svg style="display:block;" focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="-4 -4 39 39"><path d="M28 8.557a9.913 9.913 0 0 1-2.828.775 4.93 4.93 0 0 0 2.166-2.725 9.738 9.738 0 0 1-3.13 1.194 4.92 4.92 0 0 0-3.593-1.55 4.924 4.924 0 0 0-4.794 6.049c-4.09-.21-7.72-2.17-10.15-5.15a4.942 4.942 0 0 0-.665 2.477c0 1.71.87 3.214 2.19 4.1a4.968 4.968 0 0 1-2.23-.616v.06c0 2.39 1.7 4.38 3.952 4.83-.414.115-.85.174-1.297.174-.318 0-.626-.03-.928-.086a4.935 4.935 0 0 0 4.6 3.42 9.893 9.893 0 0 1-6.114 2.107c-.398 0-.79-.023-1.175-.068a13.953 13.953 0 0 0 7.55 2.213c9.056 0 14.01-7.507 14.01-14.013 0-.213-.005-.426-.015-.637.96-.695 1.795-1.56 2.455-2.55z" fill="#fff"></path></svg></span></a><a aria-label="Instagram" class="the_champ_button_instagram" href="https://www.instagram.com/" title="Instagram" rel="nofollow noopener" target="_blank" style="font-size:24px!important;box-shadow:none;display:inline-block;vertical-align:middle"><span class="the_champ_svg" style="background-color:#53beee;width:40px;height:40px;margin:0;display:inline-block;opacity:1;float:left;font-size:24px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;box-sizing:content-box"><span class="the_champ_square_count the_champ_instagram_count">&nbsp;</span><svg style="display:block;" version="1.1" viewBox="-10 -10 148 148" width="100%" height="100%" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g><g><path d="M86,112H42c-14.336,0-26-11.663-26-26V42c0-14.337,11.664-26,26-26h44c14.337,0,26,11.663,26,26v44 C112,100.337,100.337,112,86,112z M42,24c-9.925,0-18,8.074-18,18v44c0,9.925,8.075,18,18,18h44c9.926,0,18-8.075,18-18V42 c0-9.926-8.074-18-18-18H42z" fill="#fff"></path></g><g><path d="M64,88c-13.234,0-24-10.767-24-24c0-13.234,10.766-24,24-24s24,10.766,24,24C88,77.233,77.234,88,64,88z M64,48c-8.822,0-16,7.178-16,16s7.178,16,16,16c8.822,0,16-7.178,16-16S72.822,48,64,48z" fill="#fff"></path></g><g><circle cx="89.5" cy="38.5" fill="#fff" r="5.5"></circle></g></g></svg></span></a><a class="the_champ_more" title="More" rel="nofollow noopener" style="font-size:24px!important;border:0;box-shadow:none;display:inline-block!important;font-size:16px;padding:0 4px;vertical-align: middle;display:inline;" href="https://basicaodaeletronica.com.br/tag/verilog-a/feed/" onclick="event.preventDefault()"><span class="the_champ_square_count">&nbsp;</span><span class="the_champ_svg" style="background-color:#ee8e2d;width:40px;height:40px;margin:0;display:inline-block!important;opacity:1;float:left;font-size:32px!important;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;display:inline;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;box-sizing:content-box;" onclick="theChampMoreSharingPopup(this, 'https://basicaodaeletronica.com.br/tag/verilog-a/feed/', 'Verilog-A', '' )"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-.3 0 32 32" version="1.1" width="100%" height="100%" style="display:block;" xml:space="preserve"><g><path fill="#fff" d="M18 14V8h-4v6H8v4h6v6h4v-6h6v-4h-6z" fill-rule="evenodd"></path></g></svg></span></a></div></div><p>The post <a href="https://basicaodaeletronica.com.br/eletronica-intermediaria/tutorial-completo-simulacao-de-verilog-a-com-ngspice-e-openvaf/">Tutorial Completo: Simulação de Verilog-A com NGSpice e OpenVAF</a> first appeared on <a href="https://basicaodaeletronica.com.br">Basicão da Eletrônica</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://basicaodaeletronica.com.br/eletronica-intermediaria/tutorial-completo-simulacao-de-verilog-a-com-ngspice-e-openvaf/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Tutorial: Integrando C++ e Verilog-A em Simulações no QSpice</title>
		<link>https://basicaodaeletronica.com.br/simulacao/tutorial-integrando-c-e-verilog-a-em-simulacoes-no-qspice/</link>
					<comments>https://basicaodaeletronica.com.br/simulacao/tutorial-integrando-c-e-verilog-a-em-simulacoes-no-qspice/#respond</comments>
		
		<dc:creator><![CDATA[Carlos Delfino]]></dc:creator>
		<pubDate>Thu, 15 Aug 2024 23:49:00 +0000</pubDate>
				<category><![CDATA[Simulação]]></category>
		<category><![CDATA[blocos QSpice]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[circuitos analógicos.]]></category>
		<category><![CDATA[circuitos digitais]]></category>
		<category><![CDATA[desenvolvimento de circuitos]]></category>
		<category><![CDATA[integração C++ Verilog]]></category>
		<category><![CDATA[programação em C++]]></category>
		<category><![CDATA[QSpice]]></category>
		<category><![CDATA[simulação analógica]]></category>
		<category><![CDATA[simulação de circuitos]]></category>
		<category><![CDATA[simulação digital]]></category>
		<category><![CDATA[SPICE]]></category>
		<category><![CDATA[tutorial QSpice]]></category>
		<category><![CDATA[Verilog-A]]></category>
		<guid isPermaLink="false">https://basicaodaeletronica.com.br/?p=1763</guid>

					<description><![CDATA[<p><span class="span-reading-time rt-reading-time" style="display: block;"><span class="rt-label rt-prefix">Tempo de Leitura: </span> <span class="rt-time"> 7</span> <span class="rt-label rt-postfix">minutos</span></span>Aprenda a integrar código C++ e Verilog-A em simulações no QSpice, desde a criação de blocos até a execução, permitindo simulações complexas de circuitos digitais e analógicos.</p>
<p>The post <a href="https://basicaodaeletronica.com.br/simulacao/tutorial-integrando-c-e-verilog-a-em-simulacoes-no-qspice/">Tutorial: Integrando C++ e Verilog-A em Simulações no QSpice</a> first appeared on <a href="https://basicaodaeletronica.com.br">Basicão da Eletrônica</a>.</p>]]></description>
										<content:encoded><![CDATA[<span class="span-reading-time rt-reading-time" style="display: block;"><span class="rt-label rt-prefix">Tempo de Leitura: </span> <span class="rt-time"> 7</span> <span class="rt-label rt-postfix">minutos</span></span>
<p class="wp-block-paragraph">Este tutorial ensina como incluir código C++ e Verilog-A em simulações no QSpice, abordando desde a criação dos blocos até a execução das simulações. Você aprenderá a integrar funcionalidades complexas, permitindo simulações de circuitos digitais e analógicos, independentemente da complexidade.</p>



<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="1024" height="390" src="https://basicaodaeletronica.com.br/wp-content/uploads/2024/08/fbfc5e0688d683cef9cb312fe0bb1bbe-1024x390.jpg" alt="" class="wp-image-1834" srcset="https://basicaodaeletronica.com.br/wp-content/uploads/2024/08/fbfc5e0688d683cef9cb312fe0bb1bbe-1024x390.jpg 1024w, https://basicaodaeletronica.com.br/wp-content/uploads/2024/08/fbfc5e0688d683cef9cb312fe0bb1bbe-300x114.jpg 300w, https://basicaodaeletronica.com.br/wp-content/uploads/2024/08/fbfc5e0688d683cef9cb312fe0bb1bbe-768x292.jpg 768w, https://basicaodaeletronica.com.br/wp-content/uploads/2024/08/fbfc5e0688d683cef9cb312fe0bb1bbe.jpg 1200w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<h2 class="wp-block-heading">Objetivo</h2>



<p class="wp-block-paragraph">Instruir engenheiros e desenvolvedores na integração de módulos de código C++ e Verilog-A em simulações no QSpice, facilitando a criação de modelos de circuitos digitais e analógicos complexos.</p>



<h2 class="wp-block-heading">Requisitos</h2>



<ul class="wp-block-list">
<li><strong>QSpice</strong> instalado.</li>



<li>Conhecimento básico de programação em C++ e Verilog-A. </li>
</ul>



<div class="wp-block-media-text is-stacked-on-mobile" style="grid-template-columns:40% auto"><figure class="wp-block-media-text__media"><img decoding="async" width="397" height="522" src="https://basicaodaeletronica.com.br/wp-content/uploads/2024/08/Captura-de-tela-2024-08-14-180531.png" alt="" class="wp-image-1773 size-full" srcset="https://basicaodaeletronica.com.br/wp-content/uploads/2024/08/Captura-de-tela-2024-08-14-180531.png 397w, https://basicaodaeletronica.com.br/wp-content/uploads/2024/08/Captura-de-tela-2024-08-14-180531-228x300.png 228w" sizes="(max-width: 397px) 100vw, 397px" /></figure><div class="wp-block-media-text__content">
<h2 class="wp-block-heading">Passo 1: Desenhar o Bloco Inicial</h2>



<h3 class="wp-block-heading"><strong>Desenhe o Bloco Inicial:</strong></h3>



<p class="wp-block-paragraph">Este bloco será configurado para representar uma DLL, com suporte a funções digitais e analógicas.</p>



<p class="wp-block-paragraph">No QSpice, desenhe um bloco que conterá o código usando <code>Draw Hierarchical Entry</code>.</p>
</div></div>



<div class="wp-block-media-text is-stacked-on-mobile" style="grid-template-columns:35% auto"><figure class="wp-block-media-text__media"><img decoding="async" width="281" height="253" src="https://basicaodaeletronica.com.br/wp-content/uploads/2024/08/Captura-de-tela-2024-08-14-180928-edited.png" alt="" class="wp-image-1789 size-full"/></figure><div class="wp-block-media-text__content">
<h2 class="wp-block-heading">Passo 2: Configuração do Bloco</h2>



<h3 class="wp-block-heading"><strong>Configuração do Bloco:</strong></h3>



<p class="wp-block-paragraph">Clique com o botão direito no bloco desenhado no QSpice e selecione <code>Show Symbol Properties</code>.</p>



<p class="wp-block-paragraph">No campo <code>Symbol Type</code>, altere para <code>∅</code>, indicando que o bloco será tratado como uma DLL.</p>
</div></div>



<div class="wp-block-media-text is-stacked-on-mobile" style="grid-template-columns:28% auto"><figure class="wp-block-media-text__media"><img loading="lazy" decoding="async" width="238" height="216" src="https://basicaodaeletronica.com.br/wp-content/uploads/2024/08/Captura-de-tela-2024-08-14-181424-edited.png" alt="" class="wp-image-1790 size-full"/></figure><div class="wp-block-media-text__content">
<h3 class="wp-block-heading"><strong>Adicionar Portas</strong></h3>



<p class="wp-block-paragraph">Identifique o tipo de dado da porta, como iremos lidar com valores analógicos selecione Float 64 bits.</p>



<p class="wp-block-paragraph">Adicione as portas de entrada e saída organize de forma a ficar coerente com suas funções.</p>



<p class="wp-block-paragraph">Nomeie cada porta, Entrada e Saída.</p>



<p class="wp-block-paragraph">Selecione o tipo de porta.</p>



<p class="wp-block-paragraph">É importante a ordem que se adiciona as portas, portanto comecei pela porta de entrada, e então a de saída.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="395" height="209" src="https://basicaodaeletronica.com.br/wp-content/uploads/2024/08/Captura-de-tela-2024-08-14-181648-edited.png" alt="" class="wp-image-1777" style="width:356px;height:auto" srcset="https://basicaodaeletronica.com.br/wp-content/uploads/2024/08/Captura-de-tela-2024-08-14-181648-edited.png 395w, https://basicaodaeletronica.com.br/wp-content/uploads/2024/08/Captura-de-tela-2024-08-14-181648-edited-300x159.png 300w" sizes="(max-width: 395px) 100vw, 395px" /></figure>
</div></div></div>



<h3 class="wp-block-heading"><strong>Nomeação:</strong></h3>



<ul class="wp-block-list">
<li>Nomeie o bloco de forma clara, como &#8220;ModuloAnalise&#8221;.</li>
</ul>



<div class="wp-block-media-text has-media-on-the-right is-stacked-on-mobile" style="grid-template-columns:auto 59%"><div class="wp-block-media-text__content">
<h2 class="wp-block-heading">Passo 3: Escrever e Compilar Código C++</h2>



<h3 class="wp-block-heading">Abertura da Interface C++</h3>



<p class="wp-block-paragraph">Se necessário, crie um template.</p>



<p class="wp-block-paragraph">Clique com o botão direito no bloco e selecione <code>C++ Interface &gt; Open C++ Source</code>.</p>



<p class="wp-block-paragraph">Ele irá te perguntar se deseja criar o arquivo com base num template padrão, neste caso responda sim.</p>



<h3 class="wp-block-heading">Selecionando as Estruturas de código</h3>



<p class="wp-block-paragraph">Selecione as três primeiras opções.</p>


<div class="wp-block-image">
<figure class="alignright size-full is-resized"><img loading="lazy" decoding="async" width="509" height="301" src="https://basicaodaeletronica.com.br/wp-content/uploads/2024/08/Captura-de-tela-2024-08-14-182235.png" alt="" class="wp-image-1765" style="width:416px;height:auto" srcset="https://basicaodaeletronica.com.br/wp-content/uploads/2024/08/Captura-de-tela-2024-08-14-182235.png 509w, https://basicaodaeletronica.com.br/wp-content/uploads/2024/08/Captura-de-tela-2024-08-14-182235-300x177.png 300w" sizes="(max-width: 509px) 100vw, 509px" /></figure>
</div></div><figure class="wp-block-media-text__media"><img loading="lazy" decoding="async" width="568" height="285" src="https://basicaodaeletronica.com.br/wp-content/uploads/2024/08/Captura-de-tela-2024-08-14-182112.png" alt="" class="wp-image-1767 size-full" srcset="https://basicaodaeletronica.com.br/wp-content/uploads/2024/08/Captura-de-tela-2024-08-14-182112.png 568w, https://basicaodaeletronica.com.br/wp-content/uploads/2024/08/Captura-de-tela-2024-08-14-182112-300x151.png 300w" sizes="(max-width: 568px) 100vw, 568px" /></figure></div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="232" src="https://basicaodaeletronica.com.br/wp-content/uploads/2024/08/Captura-de-tela-2024-08-14-185510-1024x232.png" alt="" class="wp-image-1764" style="width:971px;height:auto" srcset="https://basicaodaeletronica.com.br/wp-content/uploads/2024/08/Captura-de-tela-2024-08-14-185510-1024x232.png 1024w, https://basicaodaeletronica.com.br/wp-content/uploads/2024/08/Captura-de-tela-2024-08-14-185510-300x68.png 300w, https://basicaodaeletronica.com.br/wp-content/uploads/2024/08/Captura-de-tela-2024-08-14-185510-768x174.png 768w, https://basicaodaeletronica.com.br/wp-content/uploads/2024/08/Captura-de-tela-2024-08-14-185510.png 1331w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<h3 class="wp-block-heading">Explicando o Código C++</h3>



<p class="wp-block-paragraph">Vamos explicar a estrutura do código C++ gerado para o QSpice e como ele interage com o circuito simulado.</p>



<ul class="wp-block-list">
<li><strong>Struct <code>sMEUPRIMEIROCOMPONENTE</code>:</strong> O <code>struct sMEUPRIMEIROCOMPONENTE</code> é uma estrutura de dados que serve como um contêiner para armazenar o estado interno do componente durante a simulação. Ele é usado para preservar informações entre as diferentes chamadas da função <code>meuprimeirocomponente</code>. O <code>opaque</code>, que é um ponteiro para esta estrutura, permite que a função mantenha e manipule o estado do componente entre as simulações.</li>



<li><strong>Union <code>uData</code>:</strong> A <code>union</code> <code>uData</code> permite acessar diferentes tipos de dados usando a mesma área de memória. No QSpice, <code>uData</code> mapeia as variáveis de simulação para os tipos corretos, como <code>double</code> para valores de Entrada e Saída.</li>



<li><strong>Função <code>meuprimeirocomponente</code>:</strong> Esta função avalia o módulo de simulação, recebendo um ponteiro para <code>sMEUPRIMEIROCOMPONENTE</code>, o tempo <code>t</code>, e um array <code>data</code> de tipo <code>uData</code>, que mapeia as portas:<br>cpp extern &#8220;C&#8221; __declspec(dllexport) void meuprimeirocomponente(struct sMEUPRIMEIROCOMPONENTE **opaque, double t, union uData *data) { double Entrada = data[0].d; double &amp;Saida = data[1].d;</li>



<li><strong>Uso de <code>uData</code>:</strong> Permite que o código C++ acesse as portas do componente independentemente do tipo de dado subjacente.</li>



<li><strong>Inicialização de <code>opaque</code>:</strong> Se <code>opaque</code> não estiver inicializado, ele é alocado e zerado usando a função <code>bzero: </code><br><code>if(!*opaque) {</code><br><code>  *opaque = (struct sMEUPRIMEIROCOMPONENTE *) malloc(sizeof(struct sMEUPRIMEIROCOMPONENTE)); </code><br>    <code>bzero(*opaque, sizeof(struct sMEUPRIMEIROCOMPONENTE)); </code><br><code>}</code></li>



<li><strong>Bloco de Inicialização com <code>bzero</code>:</strong> A função <code>bzero</code> zera a memória alocada para <code>sMEUPRIMEIROCOMPONENTE</code>, garantindo que todos os campos comecem com valores definidos.</li>
</ul>



<h3 class="wp-block-heading">Escrever o Código C++</h3>



<p class="wp-block-paragraph">Após a inicialização do ponteiro <code>opaque</code>, o código que implementa a lógica do componente deve ser inserido logo após essa verificação e alocação. Este código representa a função principal do módulo, onde a lógica de simulação é implementada.</p>



<p class="wp-block-paragraph">Por exemplo, se o módulo deve aplicar um ganho a um sinal de entrada, o código seria inserido da seguinte forma:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="const float gain = 2.3;  // Definindo o ganho internamente
Saida = Entrada * gain;  // Aplicando o ganho à entrada" style="color:#f6f6f4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dracula-soft" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #F6F6F4">const float gain </span><span style="color: #F286C4">=</span><span style="color: #F6F6F4"> </span><span style="color: #BF9EEE">2</span><span style="color: #F6F6F4">.</span><span style="color: #BF9EEE">3</span><span style="color: #F6F6F4">;  </span><span style="color: #7B7F8B">// Definindo o ganho internamente</span></span>
<span class="line"><span style="color: #F6F6F4">Saida </span><span style="color: #F286C4">=</span><span style="color: #F6F6F4"> Entrada </span><span style="color: #F286C4">*</span><span style="color: #F6F6F4"> gain;  </span><span style="color: #7B7F8B">// Aplicando o ganho à entrada</span></span></code></pre></div>



<p class="wp-block-paragraph">Neste trecho, o sinal de <strong>Entrada</strong> é multiplicado pelo valor fixo de <strong>gain</strong> para produzir o sinal de <strong>Saída</strong>. Esse código deve ser colocado logo após a inicialização do ponteiro <code>opaque</code>, dentro da função <code>meuprimeirocomponente</code>.</p>



<h3 class="wp-block-heading">Compilar o Código</h3>



<ul class="wp-block-list">
<li>Compile o código clicando com o botão direito no bloco e selecionando <code>Compile</code>.</li>
</ul>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="454" height="252" src="https://basicaodaeletronica.com.br/wp-content/uploads/2024/08/image-4.png" alt="" class="wp-image-1837" srcset="https://basicaodaeletronica.com.br/wp-content/uploads/2024/08/image-4.png 454w, https://basicaodaeletronica.com.br/wp-content/uploads/2024/08/image-4-300x167.png 300w" sizes="(max-width: 454px) 100vw, 454px" /></figure>
</div>


<h2 class="wp-block-heading">Passo 4: Escrever e Compilar Código Verilog-A</h2>



<h3 class="wp-block-heading"><strong>Duplicar o Bloco:</strong></h3>



<ul class="wp-block-list">
<li>Copie o bloco criado no Passo 1 e renomeie-o para usá-lo com código Verilog-A.</li>
</ul>



<h3 class="wp-block-heading"><strong>Abertura da Interface Verilog-A:</strong></h3>



<ul class="wp-block-list">
<li>Clique com o botão direito no novo bloco e selecione <code>Verilog Interface &gt; Open Verilog Source</code>.</li>



<li>Crie um template Verilog-A se necessário.</li>
</ul>



<h3 class="wp-block-heading"><strong>Declarar Parâmetros e Portas no Verilog-A:</strong></h3>



<ul class="wp-block-list">
<li><strong>Ordem das Portas e Parâmetros:</strong> A ordem das portas no código Verilog-A deve coincidir com a ordem no esquemático do QSpice para garantir o correto mapeamento dos sinais.</li>



<li><strong>Parâmetros Internos:</strong> Parâmetros como <code>threshold</code>, <code>high_value</code>, e <code>low_value</code> são fixos durante a simulação. Para modificá-los, pare a simulação, ajuste os valores no código, recompile e reinicie: <br><code>module analog_module(input real vin, output real vout); <br>    parameter real threshold = 0.5; <br>    parameter real high_value = 1.0; <br>    parameter real low_value = 0.0; <br><br>    always @(vin) <br>        vout = (vin &gt; threshold) ? high_value : low_value; </code><br><code>endmodule</code></li>



<li><strong>Ajuste dos Parâmetros em Tempo de Simulação:</strong> Para ajustar os parâmetros durante a simulação, externalize-os através de portas: <br><code>module analog_module(input real vin, input real vthresh, output real vout); </code><br>    <code>real high_value = 1.0; </code><br>    <code>real low_value = 0.0; </code><br><code>  always @(vin)</code><br>      <code> vout = (vin &gt; vthresh) ? high_value : low_value; endmodule</code></li>
</ul>



<h3 class="wp-block-heading"><strong>Compilar o Código:</strong></h3>



<ul class="wp-block-list">
<li>Compile o código Verilog-A. Após corrigir eventuais erros, o QSpice confirmará a criação da DLL.</li>
</ul>



<h2 class="wp-block-heading">Passo 5: Configurar e Executar a Simulação</h2>



<h3 class="wp-block-heading"><strong>Configuração da Simulação:</strong></h3>



<ul class="wp-block-list">
<li><strong>Conhecimento em SPICE:</strong> Para configurar a simulação corretamente, é necessário um entendimento básico do SPICE, pois o processo envolve a construção de um circuito utilizando fontes de tensão e elementos de interconexão, como resistores e capacitores.</li>



<li><strong>Adicionar Fontes de Tensão:</strong> Insira uma fonte de tensão no circuito, de preferência uma senoidal, arbitrária ou exponencial, que forneça um sinal variável. Este sinal deve ser conectado à porta de <strong>Entrada</strong> de cada bloco X1 e X2.</li>



<li><strong>Adicionar Ground:</strong> Conecte o terminal negativo da fonte de tensão a um nó de ground (terra). Este passo é fundamental, pois o SPICE exige a presença de um nó de ground como referência para realizar as simulações.</li>



<li><strong>Conexão das Portas de Saída:</strong> A porta de <strong>Saída</strong> de cada bloco deve ser conectada a um fio (wire) que não se conecta a lugar algum. Isso é necessário para que, durante a simulação, os valores nas portas de saída possam ser medidos corretamente.</li>
</ul>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="390" src="https://basicaodaeletronica.com.br/wp-content/uploads/2024/08/Captura-de-tela-2024-08-15-205917-1024x390.png" alt="" class="wp-image-1818" srcset="https://basicaodaeletronica.com.br/wp-content/uploads/2024/08/Captura-de-tela-2024-08-15-205917-1024x390.png 1024w, https://basicaodaeletronica.com.br/wp-content/uploads/2024/08/Captura-de-tela-2024-08-15-205917-300x114.png 300w, https://basicaodaeletronica.com.br/wp-content/uploads/2024/08/Captura-de-tela-2024-08-15-205917-768x292.png 768w, https://basicaodaeletronica.com.br/wp-content/uploads/2024/08/Captura-de-tela-2024-08-15-205917.png 1166w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<h3 class="wp-block-heading"><strong>Execução da Simulação:</strong></h3>



<ul class="wp-block-list">
<li>Execute a simulação e observe as formas de onda na <strong>Entrada</strong> e <strong>Saída</strong> dos blocos. Verifique se os resultados obtidos estão de acordo com o comportamento esperado do circuito.</li>
</ul>



<h3 class="wp-block-heading"><strong>Análise dos Resultados:</strong></h3>



<ul class="wp-block-list">
<li>Verifique se o comportamento do circuito está de acordo com as expectativas. Ajuste parâmetros e recompile, se necessário.</li>
</ul>



<h2 class="wp-block-heading">Exemplos Avançados</h2>



<p class="wp-block-paragraph">Explore o exemplo <code>Practical Switch Mode Power Supply</code> no QSpice:</p>



<ul class="wp-block-list">
<li>Navegue até <code>File &gt; Open Demo</code>.</li>



<li>Estude o exemplo para aprender como integrar modelos complexos com C++ e Verilog-A.</li>
</ul>



<h2 class="wp-block-heading">Dicas Avançadas</h2>



<ul class="wp-block-list">
<li><strong>Simulação Mista:</strong> Combine circuitos analógicos e digitais dentro do QSpice para criar simulações complexas.</li>



<li><strong>Automatização com Scripts:</strong> Use C++ para automatizar processos dentro das simulações, como detectar estados específicos e ajustar parâmetros dinamicamente.</li>
</ul>



<h2 class="wp-block-heading">Referências</h2>



<ul class="wp-block-list">
<li>Engelhardt, M. (2023). <em>How to Include C++ and Verilog in QSpice Simulations</em>. <a href="https://www.youtube.com/watch?v=GPA6FIYPa3E">YouTube</a>.</li>



<li>Accellera Systems Initiative. (2019). <em>Verilog-AMS Language Reference Manual Version 2.4</em>. <a href="https://www.accellera.org/images/downloads/standards/v-ams/VAMS-LRM-2-4.pdf">Accellera</a>.</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<p class="wp-block-paragraph">Este tutorial foi elaborado para guiá-lo na integração de C++ e Verilog-A em suas simulações no QSpice. Se você quiser ver este tutorial em ação, convido você a assistir ao vídeo no YouTube. Não deixe de visitar o canal, inscrever-se, curtir o vídeo e comentar com suas dúvidas e sugestões. Sua participação é muito importante!</p>


<p><iframe title="Tutorial Como produzir novos componentes usando C++ e Verilog no Qspice" width="800" height="600" src="https://www.youtube.com/embed/qR8RtP-VNl8?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></p><div style='clear:both'></div><div  class='the_champ_counter_container the_champ_horizontal_counter'><div class='the_champ_counter_title' style="font-weight:bold"></div><ul class="the_champ_sharing_ul"><li style="padding:7.35px 0 !important" class="the_champ_facebook_share"><div class="fb-share-button" data-href="https://basicaodaeletronica.com.br/simulacao/tutorial-integrando-c-e-verilog-a-em-simulacoes-no-qspice/" data-layout="button_count"></div></li><li style="padding:7.35px 0 !important" class="the_champ_facebook_like"><div class="fb-like" data-href="https://basicaodaeletronica.com.br/simulacao/tutorial-integrando-c-e-verilog-a-em-simulacoes-no-qspice/" data-layout="button_count" data-action="like" data-show-faces="false" data-share="false"></div></li><li style="padding:7.35px 0 !important" class="the_champ_facebook_recommend"><div class="fb-like" data-href="https://basicaodaeletronica.com.br/simulacao/tutorial-integrando-c-e-verilog-a-em-simulacoes-no-qspice/" data-layout="button_count" data-action="recommend" data-show-faces="false" data-share="false"></div></li><li style="padding:7.35px 0 !important" class="the_champ_twitter_tweet" data-super-socializer-href="https://basicaodaeletronica.com.br/simulacao/tutorial-integrando-c-e-verilog-a-em-simulacoes-no-qspice/"><a href="https://twitter.com/share" class="twitter-share-button" data-url="https://basicaodaeletronica.com.br/simulacao/tutorial-integrando-c-e-verilog-a-em-simulacoes-no-qspice/" data-counturl="https://basicaodaeletronica.com.br/simulacao/tutorial-integrando-c-e-verilog-a-em-simulacoes-no-qspice/" data-text="Tutorial:+Integrando+C%2B%2B+e+Verilog-A+em+Simula%C3%A7%C3%B5es+no+QSpice" data-via="" data-lang="" >Tweet</a><script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?"http":"https";if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document, "script", "twitter-wjs");</script></li><li style="padding:7.35px 0!important;margin-top:-2px!important" class="the_champ_linkedin_share"><script src="//platform.linkedin.com/in.js" type="text/javascript">lang: </script><script type="IN/Share" data-url="https://basicaodaeletronica.com.br/simulacao/tutorial-integrando-c-e-verilog-a-em-simulacoes-no-qspice/" data-counter="right"></script></li><li style="padding:7.35px 0 !important" class="the_champ_reddit"><script type="text/javascript" src="//www.reddit.com/static/button/button1.js"></script></li></ul><div style="clear:both"></div></div><div style='clear:both'></div><div class='the_champ_sharing_container the_champ_vertical_sharing the_champ_hide_sharing the_champ_bottom_sharing' style='width:44px;left: -10px;top: 100px;-webkit-box-shadow:none;box-shadow:none;' data-super-socializer-href="https://basicaodaeletronica.com.br/tag/verilog-a/feed/"data-super-socializer-no-counts="1"><div class="the_champ_sharing_ul"><a aria-label="Facebook" class="the_champ_facebook" href="https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fbasicaodaeletronica.com.br%2Ftag%2Fverilog-a%2Ffeed%2F" title="Facebook" rel="nofollow noopener" target="_blank" style="font-size:24px!important;box-shadow:none;display:inline-block;vertical-align:middle"><span class="the_champ_svg" style="background-color:#0765FE;width:40px;height:40px;margin:0;display:inline-block;opacity:1;float:left;font-size:24px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;box-sizing:content-box"><span class="the_champ_square_count the_champ_facebook_count">&nbsp;</span><svg style="display:block;" focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 32 32"><path fill="#fff" d="M28 16c0-6.627-5.373-12-12-12S4 9.373 4 16c0 5.628 3.875 10.35 9.101 11.647v-7.98h-2.474V16H13.1v-1.58c0-4.085 1.849-5.978 5.859-5.978.76 0 2.072.15 2.608.298v3.325c-.283-.03-.775-.045-1.386-.045-1.967 0-2.728.745-2.728 2.683V16h3.92l-.673 3.667h-3.247v8.245C23.395 27.195 28 22.135 28 16Z"></path></svg></span></a><a aria-label="X" class="the_champ_button_x" href="https://twitter.com/intent/tweet?text=Verilog-A&url=https%3A%2F%2Fbasicaodaeletronica.com.br%2Ftag%2Fverilog-a%2Ffeed%2F" title="X" rel="nofollow noopener" target="_blank" style="font-size:24px!important;box-shadow:none;display:inline-block;vertical-align:middle"><span class="the_champ_svg the_champ_s__default the_champ_s_x" style="background-color:#2a2a2a;width:40px;height:40px;margin:0;display:inline-block;opacity:1;float:left;font-size:24px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;box-sizing:content-box"><span class="the_champ_square_count the_champ_X_count">&nbsp;</span><svg width="100%" height="100%" style="display:block;" focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#fff" d="M21.751 7h3.067l-6.7 7.658L26 25.078h-6.172l-4.833-6.32-5.531 6.32h-3.07l7.167-8.19L6 7h6.328l4.37 5.777L21.75 7Zm-1.076 16.242h1.7L11.404 8.74H9.58l11.094 14.503Z"></path></svg></span></a><a aria-label="Linkedin" class="the_champ_button_linkedin" href="https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fbasicaodaeletronica.com.br%2Ftag%2Fverilog-a%2Ffeed%2F" title="Linkedin" rel="nofollow noopener" target="_blank" style="font-size:24px!important;box-shadow:none;display:inline-block;vertical-align:middle"><span class="the_champ_svg the_champ_s__default the_champ_s_linkedin" style="background-color:#0077b5;width:40px;height:40px;margin:0;display:inline-block;opacity:1;float:left;font-size:24px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;box-sizing:content-box"><span class="the_champ_square_count the_champ_linkedin_count">&nbsp;</span><svg style="display:block;" focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 32 32"><path d="M6.227 12.61h4.19v13.48h-4.19V12.61zm2.095-6.7a2.43 2.43 0 0 1 0 4.86c-1.344 0-2.428-1.09-2.428-2.43s1.084-2.43 2.428-2.43m4.72 6.7h4.02v1.84h.058c.56-1.058 1.927-2.176 3.965-2.176 4.238 0 5.02 2.792 5.02 6.42v7.395h-4.183v-6.56c0-1.564-.03-3.574-2.178-3.574-2.18 0-2.514 1.7-2.514 3.46v6.668h-4.187V12.61z" fill="#fff"></path></svg></span></a><a aria-label="Reddit" class="the_champ_button_reddit" href="https://reddit.com/submit?url=https%3A%2F%2Fbasicaodaeletronica.com.br%2Ftag%2Fverilog-a%2Ffeed%2F&title=Verilog-A" title="Reddit" rel="nofollow noopener" target="_blank" style="font-size:24px!important;box-shadow:none;display:inline-block;vertical-align:middle"><span class="the_champ_svg the_champ_s__default the_champ_s_reddit" style="background-color:#ff5700;width:40px;height:40px;margin:0;display:inline-block;opacity:1;float:left;font-size:24px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;box-sizing:content-box"><span class="the_champ_square_count the_champ_reddit_count">&nbsp;</span><svg style="display:block;" focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="-3.5 -3.5 39 39"><path d="M28.543 15.774a2.953 2.953 0 0 0-2.951-2.949 2.882 2.882 0 0 0-1.9.713 14.075 14.075 0 0 0-6.85-2.044l1.38-4.349 3.768.884a2.452 2.452 0 1 0 .24-1.176l-4.274-1a.6.6 0 0 0-.709.4l-1.659 5.224a14.314 14.314 0 0 0-7.316 2.029 2.908 2.908 0 0 0-1.872-.681 2.942 2.942 0 0 0-1.618 5.4 5.109 5.109 0 0 0-.062.765c0 4.158 5.037 7.541 11.229 7.541s11.22-3.383 11.22-7.541a5.2 5.2 0 0 0-.053-.706 2.963 2.963 0 0 0 1.427-2.51zm-18.008 1.88a1.753 1.753 0 0 1 1.73-1.74 1.73 1.73 0 0 1 1.709 1.74 1.709 1.709 0 0 1-1.709 1.711 1.733 1.733 0 0 1-1.73-1.711zm9.565 4.968a5.573 5.573 0 0 1-4.081 1.272h-.032a5.576 5.576 0 0 1-4.087-1.272.6.6 0 0 1 .844-.854 4.5 4.5 0 0 0 3.238.927h.032a4.5 4.5 0 0 0 3.237-.927.6.6 0 1 1 .844.854zm-.331-3.256a1.726 1.726 0 1 1 1.709-1.712 1.717 1.717 0 0 1-1.712 1.712z" fill="#fff"/></svg></span></a><a aria-label="Whatsapp" class="the_champ_whatsapp" href="https://api.whatsapp.com/send?text=Verilog-A https%3A%2F%2Fbasicaodaeletronica.com.br%2Ftag%2Fverilog-a%2Ffeed%2F" title="Whatsapp" rel="nofollow noopener" target="_blank" style="font-size:24px!important;box-shadow:none;display:inline-block;vertical-align:middle"><span class="the_champ_svg" style="background-color:#55eb4c;width:40px;height:40px;margin:0;display:inline-block;opacity:1;float:left;font-size:24px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;box-sizing:content-box"><span class="the_champ_square_count the_champ_whatsapp_count">&nbsp;</span><svg style="display:block;" focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="-6 -5 40 40"><path class="the_champ_svg_stroke the_champ_no_fill" stroke="#fff" stroke-width="2" fill="none" d="M 11.579798566743314 24.396926207859085 A 10 10 0 1 0 6.808479557110079 20.73576436351046"></path><path d="M 7 19 l -1 6 l 6 -1" class="the_champ_no_fill the_champ_svg_stroke" stroke="#fff" stroke-width="2" fill="none"></path><path d="M 10 10 q -1 8 8 11 c 5 -1 0 -6 -1 -3 q -4 -3 -5 -5 c 4 -2 -1 -5 -1 -4" fill="#fff"></path></svg></span></a><a aria-label="Twitter" class="the_champ_button_twitter" href="https://twitter.com/intent/tweet?text=Verilog-A&url=https%3A%2F%2Fbasicaodaeletronica.com.br%2Ftag%2Fverilog-a%2Ffeed%2F" title="Twitter" rel="nofollow noopener" target="_blank" style="font-size:24px!important;box-shadow:none;display:inline-block;vertical-align:middle"><span class="the_champ_svg the_champ_s__default the_champ_s_twitter" style="background-color:#55acee;width:40px;height:40px;margin:0;display:inline-block;opacity:1;float:left;font-size:24px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;box-sizing:content-box"><span class="the_champ_square_count the_champ_twitter_count">&nbsp;</span><svg style="display:block;" focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="-4 -4 39 39"><path d="M28 8.557a9.913 9.913 0 0 1-2.828.775 4.93 4.93 0 0 0 2.166-2.725 9.738 9.738 0 0 1-3.13 1.194 4.92 4.92 0 0 0-3.593-1.55 4.924 4.924 0 0 0-4.794 6.049c-4.09-.21-7.72-2.17-10.15-5.15a4.942 4.942 0 0 0-.665 2.477c0 1.71.87 3.214 2.19 4.1a4.968 4.968 0 0 1-2.23-.616v.06c0 2.39 1.7 4.38 3.952 4.83-.414.115-.85.174-1.297.174-.318 0-.626-.03-.928-.086a4.935 4.935 0 0 0 4.6 3.42 9.893 9.893 0 0 1-6.114 2.107c-.398 0-.79-.023-1.175-.068a13.953 13.953 0 0 0 7.55 2.213c9.056 0 14.01-7.507 14.01-14.013 0-.213-.005-.426-.015-.637.96-.695 1.795-1.56 2.455-2.55z" fill="#fff"></path></svg></span></a><a aria-label="Instagram" class="the_champ_button_instagram" href="https://www.instagram.com/" title="Instagram" rel="nofollow noopener" target="_blank" style="font-size:24px!important;box-shadow:none;display:inline-block;vertical-align:middle"><span class="the_champ_svg" style="background-color:#53beee;width:40px;height:40px;margin:0;display:inline-block;opacity:1;float:left;font-size:24px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;box-sizing:content-box"><span class="the_champ_square_count the_champ_instagram_count">&nbsp;</span><svg style="display:block;" version="1.1" viewBox="-10 -10 148 148" width="100%" height="100%" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g><g><path d="M86,112H42c-14.336,0-26-11.663-26-26V42c0-14.337,11.664-26,26-26h44c14.337,0,26,11.663,26,26v44 C112,100.337,100.337,112,86,112z M42,24c-9.925,0-18,8.074-18,18v44c0,9.925,8.075,18,18,18h44c9.926,0,18-8.075,18-18V42 c0-9.926-8.074-18-18-18H42z" fill="#fff"></path></g><g><path d="M64,88c-13.234,0-24-10.767-24-24c0-13.234,10.766-24,24-24s24,10.766,24,24C88,77.233,77.234,88,64,88z M64,48c-8.822,0-16,7.178-16,16s7.178,16,16,16c8.822,0,16-7.178,16-16S72.822,48,64,48z" fill="#fff"></path></g><g><circle cx="89.5" cy="38.5" fill="#fff" r="5.5"></circle></g></g></svg></span></a><a class="the_champ_more" title="More" rel="nofollow noopener" style="font-size:24px!important;border:0;box-shadow:none;display:inline-block!important;font-size:16px;padding:0 4px;vertical-align: middle;display:inline;" href="https://basicaodaeletronica.com.br/tag/verilog-a/feed/" onclick="event.preventDefault()"><span class="the_champ_square_count">&nbsp;</span><span class="the_champ_svg" style="background-color:#ee8e2d;width:40px;height:40px;margin:0;display:inline-block!important;opacity:1;float:left;font-size:32px!important;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;display:inline;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;box-sizing:content-box;" onclick="theChampMoreSharingPopup(this, 'https://basicaodaeletronica.com.br/tag/verilog-a/feed/', 'Verilog-A', '' )"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-.3 0 32 32" version="1.1" width="100%" height="100%" style="display:block;" xml:space="preserve"><g><path fill="#fff" d="M18 14V8h-4v6H8v4h6v6h4v-6h6v-4h-6z" fill-rule="evenodd"></path></g></svg></span></a></div></div><p>The post <a href="https://basicaodaeletronica.com.br/simulacao/tutorial-integrando-c-e-verilog-a-em-simulacoes-no-qspice/">Tutorial: Integrando C++ e Verilog-A em Simulações no QSpice</a> first appeared on <a href="https://basicaodaeletronica.com.br">Basicão da Eletrônica</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://basicaodaeletronica.com.br/simulacao/tutorial-integrando-c-e-verilog-a-em-simulacoes-no-qspice/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
