Verification Academy

Search form

My Account Menu

  • Register
  • Log In
  • Topics
  • Courses
  • Forums
  • Patterns Library
  • Cookbooks
  • Events
  • More
  • All Topics
    The Verification Academy offers users multiple entry points to find the information they need. One of these entry points is through Topic collections. These topics are industry standards that all design and verification engineers should recognize. While we continue to add new topics, users are encourage to further refine collection information to meet their specific interests.
    • Languages & Standards

      • Portable Test and Stimulus
      • Functional Safety
      • Design & Verification Languages
    • Methodologies

      • UVM - Universal Verification Methodology
      • UVM Framework
      • UVM Connect
      • FPGA Verification
      • Coverage
    • Techniques & Tools

      • Verification IP
      • Simulation-Based Techniques
      • Planning, Measurement, and Analysis
      • Formal-Based Techniques
      • Debug
      • Clock-Domain Crossing
      • Acceleration
  • All Courses
    The Verification Academy is organized into a collection of free online courses, focusing on various key aspects of advanced functional verification. Each course consists of multiple sessions—allowing the participant to pick and choose specific topics of interest, as well as revisit any specific topics for future reference. After completing a specific course, the participant should be armed with enough knowledge to then understand the necessary steps required for maturing their own organization’s skills and infrastructure on the specific topic of interest. The Verification Academy will provide you with a unique opportunity to develop an understanding of how to mature your organization’s processes so that you can then reap the benefits that advanced functional verification offers.
    • Universal Verification Methodology (UVM)

      • Advanced UVM
      • Basic UVM
      • Introduction to UVM
      • UVM Connect
      • UVM Debug
      • UVMF - One Bite at a Time
    • Featured Courses

      • Introduction to ISO 26262
      • Introduction to DO-254
      • Clock-Domain Crossing Verification
      • Portable Stimulus Basics
      • Power Aware CDC Verification
      • Power Aware Verification
      • SystemVerilog OOP for UVM Verification
    • Additional Courses

      • Assertion-Based Verification
      • An Introduction to Unit Testing with SVUnit
      • Evolving FPGA Verification Capabilities
      • Metrics in SoC Verification
      • SystemVerilog Testbench Acceleration
      • Testbench Co-Emulation: SystemC & TLM-2.0
      • Verification Planning and Management
      • VHDL-2008 Why It Matters
    • Formal-Based Techniques

      • Formal Assertion-Based Verification
      • Formal-Based Technology: Automatic Formal Solutions
      • Formal Coverage
      • Getting Started with Formal-Based Technology
      • Handling Inconclusive Assertions in Formal Verification
      • Sequential Logic Equivalence Checking
    • Analog/Mixed Signal

      • AMS Design Configuration Schemes
      • Improve AMS Verification Performance
      • Improve AMS Verification Quality
  • All Forum Topics
    The Verification Community is eager to answer your UVM, SystemVerilog and Coverage related questions. We encourage you to take an active role in the Forums by answering and commenting to any questions that you are able to.
    • UVM Forum

      • Active Questions
      • Solutions
      • Replies
      • No Replies
      • Search
      • UVM Forum
    • SystemVerilog Forum

      • Active Questions
      • Solutions
      • Replies
      • No Replies
      • Search
      • SystemVerilog Forum
    • Coverage Forum

      • Active Questions
      • Solutions
      • Replies
      • No Replies
      • Search
      • Coverage Forum
    • Additional Forums

      • Announcements
      • Downloads
      • OVM Forum
  • Patterns Library
    The Verification Academy Patterns Library contains a collection of solutions to many of today's verification problems. The patterns contained in the library span across the entire domain of verification (i.e., from specification to methodology to implementation—and across multiple verification engines such as formal, simulation, and emulation).
    • Implementation Patterns

      • Environment Patterns
      • Stimulus Patterns
      • Analysis Patterns
      • All Implementation Patterns
    • Specification Patterns

      • Occurrence Property Patterns
      • Order Property Patterns
      • All Specification Patterns
    • Pattern Resources

      • Start Here - Patterns Library Overview
      • Whitepaper - Taking Reuse to the Next Level
      • Verification Horizons - The Verification Academy Patterns Library
      • Contribute a Pattern to the Library
  • All Cookbooks
    Find all the methodology you need in this comprehensive and vast collection. The UVM and Coverage Cookbooks contain dozens of informative, executable articles covering all aspects of UVM and Coverage.
    • UVM Cookbook

      • UVM Basics
      • Testbench Architecture
      • DUT-Testbench Connections
      • Configuring a Test Environment
      • Analysis Components & Techniques
      • End Of Test Mechanisms
      • Sequences
      • The UVM Messaging System
      • Other Stimulus Techniques
      • Register Abstraction Layer
      • Testbench Acceleration through Co-Emulation
      • Debug of SV and UVM
      • UVM Connect - SV-SystemC interoperability
      • UVM Versions and Compatibility
      • UVM Cookbook
    • Coding Guidelines & Deployment

      • Code Examples
      • UVM Verification Component
      • Package/Organization
      • Questa/Compiling UVM
      • SystemVerilog Guidelines
      • SystemVerilog Performance Guidelines
      • UVM Guidelines
      • UVM Performance Guidelines
    • Coverage Cookbook

      • Introduction
      • What is Coverage?
      • Kinds of Coverage
      • Specification to Testplan
      • Testplan to Functional Coverage
      • Bus Protocol Coverage
      • Block Level Coverage
      • Datapath Coverage
      • SoC Coverage Example
      • Requirements Writing Guidelines
      • Coverage Cookbook
  • All Events
    No one argues that the challenges of verification are growing exponentially. What is needed to meet these challenges are tools, methodologies and processes that can help you transform your verification environment. These recorded seminars from Verification Academy trainers and users provide examples for adoption of new technologies and how to evolve your verification process.
    • Upcoming & Featured Events

      • The Digital Twin: An Aerospace and Defense Revolution - March 9th
      • VIP solutions for Protocol and Memory Verification  - March 11th
      • Advance your Designs with Advances in CDC and RDC - March 23rd
      • Webinar Calendar
    • On Demand Seminars

      • The ABC of Formal Verification
      • I'm Excited About Formal...
      • 2020 Functional Verification Study
      • All On-Demand Seminars
    • Recording Archive

      • Improving Your SystemVerilog & UVM Skills
      • Should I Kill My Formal Run?
      • Visualizer Debug Environment
      • All Recordings
    • Conferences

      • DVCon 2020
      • DAC 2019
      • All Conferences
    • Mentor Learning Center

      • SystemVerilog Fundamentals
      • SystemVerilog UVM
      • View all Learning Paths
  • About Verification Academy
    The Verification Academy will provide you with a unique opportunity to develop an understanding of how to mature your organization's processes so that you can then reap the benefits that advanced functional verification offers.
    • Blog & News

      • Verification Horizons Blog
      • Academy News
      • Academy Newsletter
      • Technical Resources
    • Verification Horizons Publication

      • Verification Horizons - November 2020
      • Verification Horizons - July 2020
      • Verification Horizons - March 2020
      • Issue Archive
    • About Us

      • Verification Academy Overview
      • Subject Matter Experts
      • Contact Us
    • Training

      • Questa® & ModelSim®
      • Questa® inFact
      • Functional Verification Library
Ask a Question
SystemVerilog
  • Home
  • Forums
  • SystemVerilog
  • SystemVerilog: unexpected behavior while dealing with fork/join_none

SystemVerilog: unexpected behavior while dealing with fork/join_none

SystemVerilog 4981
#systemverilog 428 #uvm 42 mailbox 14 #fork_joinnone 4
rubendah
rubendah
Full Access
5 posts
February 21, 2021 at 2:18 am

Hi everyone,

In the following code, my_mbx is an unbounded mailbox that can be populated from multiple sources at the same simulation time:

virtual task mbx_monitor();
 
    mbx_data_object mbx_data;
 
    forever begin
 
        my_mbx.get(mbx_data);
 
        if (mbx_data.decrement_counter) begin
 
            fork wait_and_decrement_counter(mbx_data.id); join_none
 
        end // if (mbx_data.decrement_counter)
 
    end // forever
 
endtask : mbx_monitor
 
virtual task wait_and_decrement_counter(int id);
 
    `uvm_info(get_name(), $sformatf("Decrementing counter due to item #%0d", id), verbosity)
 
    #50;
 
    counter--;
 
endtask : wait_and_decrement_counter

At time X, mailbox include two objects:
- object #0: decrement_counter == 1, id == 0
- object #1: decrement_counter == 0, id == 1

My expectation is that object #0 should call the wait_and_decrement_counter task while object 1 should not, i.e. I should see the following print:

UVM_INFO  |@ X ps | uvm_test_top | Decrementing counter due to item #0

Actually I am seeing this one:

UVM_INFO  |@ X ps | uvm_test_top | Decrementing counter due to item #1

After some GUI debug, it seems that I have an issue with passing the object.id as an argument to the wait_and_decrement_counter task.

Here the thread:
- Getting item 0 from mailbox
- Since item0.decrement_counter == 1, I'm getting into the if condition, calling the forked task
- Getting item 1 from mailbox
- Since item1.decrement_counter == 0, I'm not getting into the if condition
- Getting into the wait_and_decrement_counter task, seeing item1.id as passed argument

The trivial solution will be to add a #1 delay after the task call (i.e. into the if condition), but I would prefer to not add any delay there, can someone advise ?

Thanks in advance,
Ruben

Replies

Log In to Reply
mike_wang
mike_wang
Full Access
3 posts
February 21, 2021 at 4:04 am

Hi,Ruben

I think the fork join none will create a thread to carry the wait_and_decrement_counter if the mbx_data.decrement_counter = 1;
but it factly will carry this wait_and_decrement_counter task after the main thread counter a function or task,so the first wait_and_decrement_counter task will carried after the second my_mbx.get(mbx_data) function, so the mbx_data will be updated , i suggest you add a `uvm_info after the "none" key word

by the way, i want to know how long can get a full access account?
i am a student.
thanks so much

Solution

Solution

cgales
cgales
Forum Moderator
1577 posts
February 21, 2021 at 4:21 am

In reply to rubendah:

The forked task doesn't execute until the parent task blocks. By the time that this happens, mbx_data has changed and this is what is passed to the task. You want to use an automatic variable:

virtual task mbx_monitor();
 
    mbx_data_object mbx_data;
 
    forever begin
        my_mbx.get(mbx_data);
        if (mbx_data.decrement_counter) begin
          automatic int id = mbx_data.id;
          fork
            wait_and_decrement_counter(id);
          join_none 
        end // if (mbx_data.decrement_counter) 
    end // forever
endtask : mbx_monitor
 
virtual task wait_and_decrement_counter(int id);
    `uvm_info(get_name(), $sformatf("Decrementing counter due to item #%0d", id), verbosity)
    #50;
    counter--;
endtask : wait_and_decrement_counter
rubendah
rubendah
Full Access
5 posts
February 21, 2021 at 4:58 am

In reply to mike_wang:

Hi Mike,

I guess I got full access since I've registered myself with my work mail address.

rubendah
rubendah
Full Access
5 posts
February 21, 2021 at 4:58 am

In reply to cgales:

Indeed, it solved my issue, thanks !

mike_wang
mike_wang
Full Access
3 posts
February 21, 2021 at 5:17 am

In reply to rubendah:
thanks so much

Siemens Digital Industries Software

Siemens Digital Industries Software

##TodayMeetsTomorrow

Solutions

  • Cloud
  • Mendix
  • Siemens EDA
  • MindSphere
  • Siemens PLM
  • View all portfolio

Explore

  • Digital Journeys
  • Community
  • Blog
  • Online Store

Siemens

  • About Us
  • Careers
  • Events
  • News and Press
  • Newsletter
  • Customer Stories

Contact Us

USA:

phone-office +1 800 547 3000

See our Worldwide Directory

  • Contact Us
  • Support Center
  • Give us Feedback
©2021 Siemens Digital Industries Software. All Rights Reserved.
Terms of Use Privacy Cookie Policy