Thought Leadership

Verilog & VHDL Debug & Weeding


Automation in your Verilog and VHDL Debug

Verilog and VHDL Debug can get tedious trying to find causality. In this BLOG we discuss automation that can improve your productivity.

Weeding

Just off a weekend of weeding. Got me thinking about Debug and Weeding. I hate weeding. Debug not so much. Love debug. When I’m weeding I find bugs and spiders and sometimes California skinks. When I’m debugging, the same. Only nastier.

When I’m weeding, I always think…. I need a better tool.

First a screwdriver. Crude but effective. Then a better screwdriver – with a sharp edge and a hook. “Destruction” with a handle. Then a fancy sharpened short hoe – all the way from Japan. Really nice. Those weeds don’t stand a chance. But sometimes, when I run out of patience, the weed whacker. Total destruction.

As I gazed at the destruction on my lawn – all the drought tolerant plants amongst the weeds… I realize. Weeding is just like debug. Sharp tools to the rescue.

Verilog Debug

I always want a better tool. When the tools aren’t available, I resort to $display. As useful as $display is, it’s not really debug, so much as logging with correlation in your mind. Cause and Effect By Hand. There are much better tools. Sharper.

Over the next few blogs, we’ll work through some useful debug tools. Today we work on tracing backwards in time and space to find drivers.

Driver Tracing

  1. See an edge. Wonder WHO caused it? Double Click on the edge.
  2. See a variable in the source code window (when it is changing). Double Click on the variable name.

Waveform Edge

Chasing down the driver of an edge in the wave window. Double click the edge.

Tracing a Driver in the Wave window
Double Click the Edge to see the driver / cause

Active Driver and Driver List

Double clicking that edge in the waveform takes you right to the source code line that caused the change and shows a report.

Driver tracing results

Double click in the source code window. Go to the driver. Double click in again and keep tracing to find the cause.

Nice.

Logic Cone

What about seeing the driver tracing in a schematic or logic cone?

I can put a signal in the logic cone, and click, click, click. But that gets old quickly.

Logic Cone exploration by hand
Add a signal to Logic Cone and build the cone of influence by hand

Time Cone

Instead of going backwards in time by hand, and guessing which way to go, we can use our automation to trace back through time – moving back and showing cause – automatically. Just select a signal at a transition and Show Time Cone. It draws automatically. Here’s a picture zoomed in at the right side of the cone of influence.

Using automation with time cone tracing
A close up on the Time Cone

Or we can have a look at the whole chain by zooming out.

Entire time cone chain
Full cone of influence in the Time Cone

Clicking on the output signal of that red box on the left will highlight the “logic” that caused the transition.

Execution trace shows the code flow
Source code with Execution Trace – Hover over the ‘addr’ and continue debug

Nice. Debug can continue. The execution trace shows us the code that executed (back in time when that transition happened). That address used in line 31 may not be the right address, or the value in the memory at that address may be wrong. We can trace back from the memory – that’s a story for another day.

In debug, just like when you are weeding – use those sharp tools. Those weeding tools saved my sanity and weekend. I hope Visualizer Debug can save your sanity and weekend.

You can find more about Visualizer Debug Environment in the Verification Horizons article from our DVCON Edition at Verification Horizons DVCON 2022 EditionGetting To Know Visualizer (Part 1). That’s part 1. Part 2 will be available with the Verification Horizons DAC 2022 Edition.

Safe debugging.

And no one gets hurt. Not even a skink.

Backyard California Skink
Rich Edelman

Leave a Reply

This article first appeared on the Siemens Digital Industries Software blog at https://blogs.stage.sw.siemens.com/verificationhorizons/2022/05/18/verilog-vhdl-debug-weeding/