Thought Leadership

Bent Tools and other Horrors From the Garden and UVM Debug – or Are You Still Debugging with $display?

I can’t take credit for the great flowers in the garden. It’s the tremendous rain we’ve had in California this year – and anyhow, my wife is the gardener in the house.

But it’s my job to do some weeding. While meditative, it is disagreeable to me.

But back to UVM Debug and Visualizer.

I was using my “weeding tool” to get between some bricks and I needed a pry bar, push, push, got it! Oops. Bent the weeding tool. I got it unbent, but it has a kink in it which tells everyone who sees it – “my owner used the wrong tool”.

UVM Debug

For the UVM, I can’t tell you how many people I’ve heard say they use $display for their debug. “Too hard to bring up the GUI”. “I just have a couple things to debug”. “Real engineers don’t use GUIs”. “I’ve been working on this block or derivatives for many years – I know where the bugs are”.

But really.

It’s Better In the Waves

The waveform window in a GUI allows you to correlate things. You can even find causality. $display can’t do that. Just line after line after line of text and text and text.

Why would I use anything except $display or `uvm_info? I’ve been doing that forever…

Code that flips a coin to construct 1 of 3 types – polymorphism working for you

Use $display or `uvm_info…

    $display("DEBUG INFO: t=%p", t);
    `uvm_info({"DEBUG INFO: ", get_type_name()}, t.convert2string(), UVM_MEDIUM)

Get useful? information? Sort of useful. Sort of information.

    # DEBUG INFO: t='{m_leaf_name:"t1", m_inst_id:3458, use_uvm_seeding:1,    m_inst_count:3462, __m_uvm_status_container:@uvm_status_container@1, events:@uvm_object_string_pool__3@392, begin_event:@uvm_event@179, end_event:@uvm_event@180, m_transaction_id:-1, begin_time:18446744073709551615, end_time:18446744073709551615, accept_time:18446744073709551615, initiator:null, stream_handle:0, tr_handle:0, record_enable:0, m_recorder:null, m_sequence_id:-1, m_use_sequence_info:0, m_depth:-1, m_sequencer:null, m_parent_sequence:null, print_sequence_info:0, m_client_str:"", m_client:null, m_rh:null, issued1:0, issued2:0, rw:0, addr:0, data:0, bits:'{a:0, b:0, c:1}, sstruct:'{a:0, d:0}, id:33, delay:5, loop_count:0, static_array:'{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, dynamic_array:'{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, queue:'{}, color:"", type_name:"sequence_item_A", g_id:34}

    # UVM_INFO vip_a/agentA.sv(486) @ 2601: uvm_test_top.i2_agentA.sequencer@@ggp_seq_A2.gp_seq.p_seq.A_seq [DEBUG INFO: sequence_A] id=33:: WRITE(0, 0) <'{0, 0, 0, 0, 0, 0, 0, 0, 0, 0},'{0, 0, 0, 0, 0, 0, 0, 0, 0, 0},'{}>

Pretty, huh!?

What about hovering over values and exploring other variables? What about seeing all the values of ‘t’ throughout this loop (Hint: put it in the wave window)

Classes in the Waves

What if you wanted to know more? Go add more $display. What if you wanted to see this variable ‘t’ from that sequence in the wave window? What if you could put the variable ‘t’ – a class handle in the wave window?

Put the ‘t’ from a sequence object in the wave window

What if you wanted to put a handful of sequence objects in the wave window? They have a lifetime. They don’t exist. Then they are constructed. Then later, they are garbage collected.

Handful of “interesting” sequence objects in the wave window

Got Queues? Associative Arrays? Dynamic Arrays?

Simple code. A transaction class with an ‘id’ field. A container class ‘C’ which has a variety of dynamic structures – ‘incoming’ – an associative array; ‘output’ – a dynamic array; and ‘q’ – a queue.

Click, click, click. Add to Wave. See the Associative array filling and changing. Same for the Dynamic array. And the Queue. Pushing and popping.

Associative array, Dynamic Array and A queue in a class in the wave window

End

And did I mention? This is all postsim. You can do it in livesim too. But postsim. Yes.

What can $display do for you? It’s like that bent garden tool. Use the right tools and be more productive.

Try Visualizer. It won’t bite. You might even find that bug faster.

What tools have you bent in the garden? Or better – what have you invented to give you the visibility that you need for debug?

Safe debugging.

UVM Debug? Just nature doing what it does
Ceonothus ‘Dark Star’ (California Lilac) – In my front yard, never subject to any of my bent garden tools
Rich Edelman

Comments

One thought about “Bent Tools and other Horrors From the Garden and UVM Debug – or Are You Still Debugging with $display?
  • As mentioned above, UVM allows to bind a Reporting Severity with a particular valid Simulator Action. Usually its done inside the start_of_simulation() phase. Actions can be assigned using set_report_*_action() functions. These can be done for one or all in the priority order from lowest to highest.

Leave a Reply

This article first appeared on the Siemens Digital Industries Software blog at https://blogs.stage.sw.siemens.com/verificationhorizons/2023/05/24/bent-tools-and-other-horrors-from-the-garden-and-uvm-debug-or-are-you-still-debugging-with-display/