Posts

Gain performance with your DPI - understand nuances of SystemVerilog DPI Pure Functions

Is your DPI-enabled SystemVerilog simulation running slow? Are you looking for ways to improve performance? Sometimes, a small remodelling of your DPI functions and using pure functions can help significantly. The Direct Programming Interface (DPI) allows SystemVerilog to interact with C code. Among the DPI constructs, pure functions are special because they are side-effect free and predictable. Using them correctly can improve simulation speed and reliability. However, SystemVerilog LRM imposes several subtle restrictions on imported pure  functions. Let's delve into one such nuance today a bit deeper! Referential Transparency Referential transparency is a concept from programming. An expression is referentially transparent if it can always be replaced by its value without changing the behaviour of the program. For example: The expression 2 + 3 can always be replaced with 5 . The expression rand() cannot, since each call may give a different result. In SystemVer...

Clear, Correct, and Traceable: SPI SVA Best Practices

Ensuring Correctness and Observability in SPI Signal Assertions In SPI verification, a fundamental requirement is that all active signals— SCLK , MOSI , and MISO —must be fully defined whenever chip-select is asserted . Any unknown or high-impedance state ( X or Z ) can compromise data integrity and lead to subtle bugs. SystemVerilog Assertions (SVA) offer a natural mechanism to codify this requirement. When applied thoughtfully, they enforce correctness and enhance diagnostic clarity. Clear, modular assertions make failures immediately understandable, particularly in larger testbenches, which aligns well with style-aware analysis tools. Issue 1: Functional Correctness A common misstep is to combine multiple signals in a single $isunknown call with a logical AND: // INCORRECT $isunknown(spiclk && mosi && miso) The problem: logical AND short-circuits evaluation, potentially masking unknown states. Example: spiclk = X, mosi = 0, miso = 1 spiclk ...

Catching Extra Semicolons After UVM Macros with UVMLint

A solution‑first guide to preventing the classic dangling else error caused by UVM reporting macros. UVMLint Rule: No Trailing Semicolon After UVM Reporting Macros Define a lint rule that flags any UVM reporting macro invocation immediately followed by a semicolon. Implementation detail: This rule should be parser‑aware . Avoid pure regex; require an AST/token stream so comments, strings, and macro line breaks are handled correctly. Why This Rule Exists Consider a simple user code as below:  // Buggy code if (debug_on) `uvm_info("DEBUG", "state info", UVM_LOW); // semicolon here else $display("Doing something else"); The UVM BCL defines  `uvm_info  as a  complete  begin...end  block . Adding a semicolon after the macro turns into a null statement that terminates the  if  prematurely, leaving the  else  orphaned. // UVM BCL (abridged) `define uvm_info(I...

Why Regex-Based Linters Fall Short for SystemVerilog/UVM — A Case for Parser-Based Tools

Image
Linting SystemVerilog and UVM testbench code is crucial to maintain quality and compatibility. Many teams start by writing quick regex or string-search scripts to catch problematic patterns—like deprecated variables, disallowed constructs, or outdated API usage. While regex-based linting can be tempting due to its simplicity, it often leads to false failures and missed issues because SystemVerilog’s syntax and preprocessing are too complex for simple text matching. In this series, we will explore common linting scenarios, we introduced this in an earlier post here:   https://asfigo.blogspot.com/2025/02/linting-systemverilog-testbench-code.html  Below is the next one in this series with a concrete example - detecting deprecated UVM constructs like uvm_top , and demonstrate why a proper parser-based approach using tools like Google’s Verible is superior. A Quick, regex style lint example When maintaining UVM code for compatibility, one common check is to detect the use of u...

From Guesswork to Metrics: Measuring Constraint Complexity in SystemVerilog (Part 1)

πŸš€ Why Care About Constraint Complexity? In SystemVerilog, constraint blocks are a core part of constrained-random verification. As your testbenches scale up, these blocks can become: Hard to read Difficult to debug Slow to solve Prone to over- or under-constraining Yet most teams rely on intuition or manual review to judge constraint quality. What if we could measure complexity more objectively? This is where Halstead Complexity Metrics come in. πŸ“ What Are Halstead Metrics? Originally developed by Maurice Halstead in the 1970s for software code analysis, these metrics: Count operators and operands Compute values like: Volume (how much information the code conveys) Difficulty (how hard it is to understand) Effort (how much mental work is required) Estimated bugs (how likely the code is to be error-prone) They’ve been applied in languages like C/C++, Java, and P...

Driving UVM Quality: Join Our Next UVMLint Meetup in Newbury - Jul 18, 2025

Following the positive reception and thoughtful engagement at our recent technical meetups in Reading and Cambridge , AsFigo is pleased to invite you to our next UVMLint Technical Meetup , taking place in Newbury — a region with a strong footprint in semiconductor design and verification. This free, hybrid event offers a focused technical forum for engineers seeking to enhance the quality and maintainability of their UVM environments through structured linting , metrics analysis , and practical methodology insights . πŸ“ Event Details Date: Friday, 18th July 2025 Time: 14:00 – 16:00 BST Venue: Oxford House, 12–20 Oxford Street, Newbury, Berkshire, RG14 1JB Meeting Room: Donnington Register at:   https://forms.gle/VCiVEiKgzKJgPiAD8  Remote Access:   Join the meeting now: https://teams.microsoft.com/l/meetup-join/19%3ameeting_OGNiY2RjYzEtNGI0OC00MDg3LTk2OGYtZGZiZWMzNTQyMGQ1%40thread.v2/0?context=%7b%22Tid%22%3a%22ce8c6d03-7521-4120-aa04-...

Got SystemVerilog Testbench Code with UVM, SVA ? Let’s Lint It – For Free!

We're inviting all SystemVerilog developers to share their testbench code using #UVM and/or #SVA for a free lint-check as part of our upcoming technical meetup. ✅ Submit your repo path or URL ✅ We’ll run our lint tools on it ✅ Get a detailed report ✅ Your code might be featured in a live demo! πŸ—“️ Event: #UVMLint and #SVALint Meetup πŸ“ Location: Cambridge, UK (remote attendance available) πŸ‘₯ 113+ engineers already registered , and counting! Don’t miss the chance to get valuable insights into your testbench quality — from syntax to assertions to methodology compliance. Register now: https://lnkd.in/dW3nX_KC Join via:  UVMLint meetup - Cambridge, June 27 | Meeting-Join | Microsoft Teams   Special thanks to our collaborators: Ajeetha Kumari, Ben Cohen, Hemamalini Sundaram and the #AsFigo team. #SystemVerilog #UVM #SVA #Lint #EDA #Verification #OpenSource #Meetup