<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>aludesign &amp;mdash; csantosb</title>
    <link>https://infosec.press/csantosb/tag:aludesign</link>
    <description>Random thoughts</description>
    <pubDate>Fri, 22 May 2026 17:50:45 +0000</pubDate>
    <item>
      <title>on testing</title>
      <link>https://infosec.press/csantosb/on-testing</link>
      <description>&lt;![CDATA[img br/&#xA;Creating something new from scratch implies a certain ratio of unpredictable issues (loosely defined in the scope of this post: new errors, regressions, warnings, ... any unexpected behavior one may encounter).  Most important, a digital design developer needs to define somehow what he considers to be a project issue, before even thinking about how to react to it. Luckily, in #modernhw a few usual tools are available to ease the process as a whole. Let’s overview some of them. !--more-- br/&#xA;Here on the electronics digital design side of life, we have mainly three #freesoftware fine tools (among many others) to perform code checking to a large extent: osvvm, cocotb and vunit. They are all compatible with the ghdl compiler, and they are all available from my own #guix electronics channel (cocotb and vunit will hopefully get merged on guix upstream at some point). Each departs from the rest, adopting a different paradigm about how digital design testing should be understood: verification, cosimulation and unit testing are master keywords here. br/&#xA;They are all complementary, so you’ll be able to combine them to test your designs. However, you’ll need to be careful and check twice what you’re doing, as some of their features overlap (random treatment, for example). You’ve been warned. br/&#xA;&#xA;osvvm&#xA;&#xA;First, we have osvvm. #Osvvm is a modern verification #vhdl library using most up-to-date language constructs (by the main contributor to the vhdl standard), and I’ll mention it frequently in this #modernhw posts series. Well documented and being continuously improved, it provides a large set of features for natively verifying advanced designs, among them, a constrained random facility, transactions, logging, functional coverage, scoreboards, FIFOs, sophisticated memory models, etc. Even some co-simulation capabilities are included here. Refer to the documentation repository for up-to-date details about osvvm. br/&#xA;You’ll be able to install osvvm with br/&#xA;&#xA;guix search osvvm&#xA;guix install osvvm-uart osvvm-scripts&#xA;&#xA;You have a simple use of the osvvm vhdl library in the #aludesign, where the random feature is used to inject inputs to a dut unit. Testing runs for as long as every combination of two variables hasn’t been fully covered. This provides a means to be sure that all cases have been tested, regardless of random inputs. You’ll see an example simulation log here, using the remote ci builds facility of sourcehut. br/&#xA;&#xA;vunit&#xA;&#xA;Then, we have Vunit as a complete single point of failure framework. It complements traditional test benches with a software oriented approach, based on the &#34;test early and test often&#34; paradigm, a.k.a. unit testing.  Here, a pre-built library layer on top of the vhdl design scans, runs and logs unit test cases embedded in user test benches. This approach seeks for an early way to detect as soon as possible conception errors. It performs random testing, advanced checking, logging, advanced communication and an advanced api to access the whole from python. It may be called from the command line, adding custom flags, and configured from a python script file where one defines libraries, sources and test parameters. Simple, elegant and efficient as a testing framework, if you want my opinion. Check the documentation for details. br/&#xA;Install it as usual with br/&#xA;&#xA;guix install python-vunit&#xA;&#xA;A clever example of its use is provided by the fw-open-logic firmware package (also included in the electronics channel). When you install it, you’ll need to build the package once, which gets installed in the guix store for you to use. During the process, the whole testing of its constituent modules is performed. You may have an overview of how it goes with: br/&#xA;&#xA;guix build fw-open-logic:out&#xA;&#xA;By the way, if you need the simulation libraries, they are available too. br/&#xA;&#xA;guix install fw-open-logic:out&#xA;# guix install fw-open-logic:sim  # sim libraries&#xA;&#xA;Additionnaly, #vunit is compatible with running a testing #ci pipeline online, as explained here. br/&#xA;&#xA;cocotb&#xA;&#xA;Finally, we have the interesting and original cocotb. It groups several construct providing a set of facilities to implement coroutine-based cosimulation of vhdl designs. Cosimulation, you say ? Yes. It requests on demand #ghdl simulation time from software (python, in this case), dispatching actions as the time advances. Afterward, based on events’ triggers, you’ll stop simulation coming back to software. This forth and back dance goes on, giving access to advanced testing and verification capabilities. Flexible and customizable as much as needed, in my opinion. Go read the documentation to understand how powerful cosumulation approach can reveal. By the way, install it with br/&#xA;&#xA;guix install python-cocotb&#xA;&#xA;---&#xA;&#xA;From the previous, you’ll have understood that having access to verification, unit testing and cosimulation libraries is paramount in #modernhw digital design. Independly or combined (be careful!), they provide powerful tools to detect issues (of any kind) in your design. And yet, this is not enough, as the question arises about where, and when do we run these tests ? From the previous logs in the examples, you’ll have noticed that tests run online in #ci infrastructure. How it goes ? This is the topic of the ci posts in this series. br/]]&gt;</description>
      <content:encoded><![CDATA[<p><img src="https://git.sr.ht/~csantosb/csbwiki/blob/master/pics/testing.png" alt="img"> <br/>
Creating something new from scratch implies a certain ratio of unpredictable issues (loosely defined in the scope of this post: new errors, regressions, warnings, ... any unexpected behavior one may encounter).  Most important, a digital design developer needs to define somehow what he considers to be a project issue, before even thinking about how to react to it. Luckily, in <a href="/csantosb/tag:modernhw" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">modernhw</span></a> a few usual tools are available to ease the process as a whole. Let’s overview some of them.  <br/>
Here on the electronics digital design side of life, we have mainly three <a href="/csantosb/tag:freesoftware" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">freesoftware</span></a> fine tools (among many others) to perform code checking to a large extent: <strong>osvvm</strong>, <strong>cocotb</strong> and <strong>vunit</strong>. They are all compatible with the <a href="https://infosec.press/csantosb/ghdl" rel="nofollow">ghdl compiler</a>, and they are all available from my own <a href="/csantosb/tag:guix" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">guix</span></a> <a href="https://infosec.press/csantosb/guix-channels#electronics-channel" rel="nofollow">electronics channel</a> (<a href="https://issues.guix.gnu.org/68153" rel="nofollow">cocotb</a> and <a href="https://issues.guix.gnu.org/74242" rel="nofollow">vunit</a> will hopefully get merged on <a href="https://infosec.press/csantosb/guix" rel="nofollow">guix upstream</a> at some point). Each departs from the rest, adopting a different paradigm about how digital design testing should be understood: verification, cosimulation and unit testing are master keywords here. <br/>
They are all complementary, so you’ll be able to combine them to test your designs. However, you’ll need to be careful and check twice what you’re doing, as some of their features overlap (random treatment, for example). You’ve been warned. <br/></p>

<h1 id="osvvm">osvvm</h1>

<p>First, we have <a href="https://github.com/OSVVM" rel="nofollow">osvvm</a>. <a href="/csantosb/tag:Osvvm" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Osvvm</span></a> is a modern verification <a href="/csantosb/tag:vhdl" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">vhdl</span></a> library using most up-to-date language constructs (by the <a href="https://www.linkedin.com/in/jimwilliamlewis" rel="nofollow">main contributor</a> to the <a href="https://gitlab.com/IEEE-P1076" rel="nofollow">vhdl standard</a>), and I’ll mention it frequently in this <a href="/csantosb/tag:modernhw" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">modernhw</span></a> posts series. Well documented and being continuously improved, it provides a large set of features for natively verifying advanced designs, among them, a constrained random facility, transactions, logging, functional coverage, scoreboards, FIFOs, sophisticated memory models, etc. Even some co-simulation capabilities are included here. Refer to the <a href="https://github.com/OSVVM/Documentation#readme" rel="nofollow">documentation repository</a> for up-to-date details about osvvm. <br/>
You’ll be able to install osvvm with <br/></p>

<pre><code class="language-sh"># guix search osvvm
guix install osvvm-uart osvvm-scripts
</code></pre>

<p>You <a href="https://git.sr.ht/~csantosb/ip.alu/tree/test/sim/alu_tb.vhd#L30" rel="nofollow">have a simple use</a> of the osvvm vhdl library in the <a href="/csantosb/tag:aludesign" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">aludesign</span></a>, where the random feature is used to inject inputs to a dut unit. Testing runs for as long as every combination of two variables hasn’t been fully covered. This provides a means to be sure that all cases have been tested, regardless of random inputs. You’ll see an example simulation log <a href="https://builds.sr.ht/query/log/1380968/test_profile/log" rel="nofollow">here</a>, using the <a href="https://infosec.press/csantosb/ci-sourcehut" rel="nofollow">remote ci</a> <a href="https://infosec.press/csantosb/sourcehut-crash-course#builds" rel="nofollow">builds facility</a> of <a href="https://infosec.press/csantosb/sourcehut-crash-course" rel="nofollow">sourcehut</a>. <br/></p>

<h1 id="vunit">vunit</h1>

<p>Then, we have <a href="https://github.com/VUnit/vunit" rel="nofollow">Vunit</a> as a complete single point of failure framework. It complements traditional test benches with a software oriented approach, based on the “test early and test often” paradigm, a.k.a. unit testing.  Here, a pre-built library layer on top of the vhdl design scans, runs and logs unit test cases embedded in user test benches. This approach seeks for an early way to detect as soon as possible conception errors. It performs random testing, advanced checking, logging, advanced communication and an advanced api to access the whole from python. It may be called from the command line, adding custom flags, and configured from a python script file where one defines libraries, sources and test parameters. Simple, elegant and efficient as a testing framework, if you want my opinion. Check the <a href="https://vunit.github.io/" rel="nofollow">documentation</a> for details. <br/>
Install it as usual with <br/></p>

<pre><code class="language-sh">guix install python-vunit
</code></pre>

<p>A clever example of its use is provided by the <code>fw-open-logic</code> firmware package (also included in the <a href="https://infosec.press/csantosb/guix-channels#electronics-channel" rel="nofollow">electronics channel</a>). When you install it, you’ll need to <a href="https://infosec.press/csantosb/guix-crash-course#packages" rel="nofollow">build the package</a> once, which gets installed in the guix store for you to use. During the process, the whole testing of its constituent modules is performed. You may have an overview of how it goes with: <br/></p>

<pre><code class="language-sh">guix build fw-open-logic:out
</code></pre>

<p>By the way, if you need the simulation libraries, they are available too. <br/></p>

<pre><code class="language-sh">guix install fw-open-logic:out
# guix install fw-open-logic:sim  # sim libraries
</code></pre>

<p>Additionnaly, <a href="/csantosb/tag:vunit" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">vunit</span></a> is compatible with running a testing <a href="/csantosb/tag:ci" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">ci</span></a> pipeline online, as explained <a href="https://infosec.press/csantosb/ci-sourcehut" rel="nofollow">here</a>. <br/></p>

<h1 id="cocotb">cocotb</h1>

<p>Finally, we have the interesting and original <a href="https://www.cocotb.org/" rel="nofollow">cocotb</a>. It groups several construct providing a set of facilities to implement coroutine-based cosimulation of vhdl designs. Cosimulation, you say ? Yes. It requests on demand <a href="/csantosb/tag:ghdl" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">ghdl</span></a> simulation time from software (python, in this case), dispatching actions as the time advances. Afterward, based on events’ triggers, you’ll stop simulation coming back to software. This forth and back dance goes on, giving access to advanced testing and verification capabilities. Flexible and customizable as much as needed, in my opinion. Go read <a href="https://docs.cocotb.org/en/stable/index.html" rel="nofollow">the documentation</a> to understand how powerful cosumulation approach can reveal. By the way, install it with <br/></p>

<pre><code class="language-sh">guix install python-cocotb
</code></pre>

<hr>

<p>From the previous, you’ll have understood that having access to verification, unit testing and cosimulation libraries is paramount in <a href="/csantosb/tag:modernhw" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">modernhw</span></a> digital design. Independly or combined (be careful!), they provide powerful tools to detect issues (of any kind) in your design. And yet, this is not enough, as the question arises about where, and when do we run these tests ? From the previous logs in the examples, you’ll have noticed that tests run online in <a href="/csantosb/tag:ci" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">ci</span></a> infrastructure. How it goes ? This is the topic of the <a href="https://infosec.press/csantosb/ci" rel="nofollow">ci posts</a> in this series. <br/></p>
]]></content:encoded>
      <guid>https://infosec.press/csantosb/on-testing</guid>
      <pubDate>Fri, 06 Dec 2024 09:32:14 +0000</pubDate>
    </item>
  </channel>
</rss>