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 IQ
      • Verification IP
      • Static-Based Techniques
      • Simulation-Based Techniques
      • Planning, Measurement, and Analysis
      • Formal-Based Techniques
      • Debug
      • 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)

      • Introduction to UVM
      • UVM Basics
      • Advanced 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.
    • Featured & On-Demand

      • Questa Verification IQ - April 11th
      • Continuous Integration
      • SystemVerilog Assertions
      • SoC Design & Functional Safety Flow
      • 2022 Functional Verification Study
      • Design Solutions as a Sleep Aid
      • CDC and RDC Assist
      • Formal and the Next Normal
      • Protocol and Memory Interface Verification
      • Webinar Calendar
    • On-Demand Library

      • Practical Flows for Continuous Integration
      • Lint vs Formal AutoCheck
      • The Three Pillars of Intent-Focused Insight
      • Formal Verification Made Easy
      • Fix FPGA Failures Faster
      • HPC Protocols & Memories
      • FPGA Design Challenges
      • High Defect Coverage
      • The Dog ate my RTL
      • Questa Lint & CDC
      • Complex Safety Architectures
      • Data Independence and Non-Determinism
      • Hierarchical CDC+RDC
      • All On-Demand Recordings
    • Recording Archive

      • Aerospace & Defense Tech Day
      • Exhaustive Scoreboarding
      • Improving Initial RTL Quality
      • CDC Philosophy
      • Hardware Emulation Productivity
      • Visualizer Debug Environment
      • Preparing for PCIe 6.0: Parts I & II
      • Automotive Functional Safety Forum
      • Siemens EDA Functional Verification
      • Improving Your SystemVerilog & UVM Skills
      • All Webinar Topics
    • Conferences & WRG

      • Industry Data & Surveys
      • DVCon 2023
      • DVCon 2022
      • DVCon 2021
      • Osmosis 2022
      • All Conferences
    • Siemens EDA Learning Center

      • SystemVerilog Fundamentals
      • SystemVerilog UVM
      • EDA Xcelerator Academy(Learning Services) Verification Training, Badging and Certification
      • 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 IQ
      • Verification Horizons Blog
      • Technical Resources
    • Verification Horizons Publication

      • Verification Horizons - March 2023
      • Verification Horizons - December 2022
      • Verification Horizons - July 2022
      • Issue Archive
    • About Us

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

      • Learning @OneGlance (PDF)
      • SystemVerilog & UVM Classes
      • Siemens EDA Classes
Ask a Question
UVM
  • Home
  • Forums
  • UVM
  • Race condition between write() in UVM scoreboard

Race condition between write() in UVM scoreboard

UVM 6670
#monitor 6 #uvm 278 #UVM #scoreboard 20
vignesh.kannan
vignesh.kannan
Full Access
6 posts
November 24, 2021 at 7:50 pm

Assume there is a memory DUT whose interface signals are like:
Rd interface: rden, rdaddr
Wr interface: wren, wraddr, wdata

If the DUT receives both wren and rden in the same clock cycle, it should service write first and then the read.

In TB, assuming that I have 2 agents/monitors, how do I ensure that the write() method for the write analysis port is executed first before the write() of the read analysis port?

One solution could be to make all the signals part of the same interface/monitor/agent. But let's say that the interfaces/monitors need to be separate for other reasons.
I'm looking for a solution where the scoreboard could synchronize between 2 write() implementations. Is there a way?

Replies

Log In to Reply
chr_sue
chr_sue
Full Access
3850 posts
November 25, 2021 at 2:42 am

In reply to vignesh.kannan:

The key question is: Does your DUT have really 1 interface for read and another one for write.
And does your DUT allow read and write at the same time.
The scoreboard can never have race condition, because it does not know anything about clock cycles etc. It knows only the order of your transactions.

vignesh.kannan
vignesh.kannan
Full Access
6 posts
November 25, 2021 at 6:25 am

In reply to chr_sue:

Hi Chr_sue,

Yes my DUT has 2 interfaces. 1 for read and 1 for write.
Yes, the DUT allows read and write at the same time. I've mentioned the DUT's behavior above when that happens.

In the case where both read and write happens at the same time/clk, my write_monitor and read_monitor will be calling their ap.write() concurrently. This COULD potentially cause the write_wr() and write_rd() implementations in the scoreboard to get executed in the wrong order. How do we prevent this? I'm open to any changes in my monitor(s) or scoreboard.

chr_sue
chr_sue
Full Access
3850 posts
November 25, 2021 at 7:15 am

In reply to vignesh.kannan:

What you are mentioning is not related to the monitor. It is related to the driver. If the write port is active befor the read port you get different results to the vice-versa order. You have to control your drivers. Then anything is OK.

vignesh.kannan
vignesh.kannan
Full Access
6 posts
November 25, 2021 at 8:06 am

In reply to chr_sue:

Sorry... Your solution is not clear to me. How do i control my drivers here?

Lets say I have 2 drivers/monitors and they are named as: rd_drv, wr_drv, rd_mon, wr_mon

rd_mon:

task run_phase();
  ...
  if(vif.rd_en) begin
    item.rd_addr = vif.rd_addr;
    ap.write(item);                //Writing sampled rd item to the scoreboard
  end
endtask

wr_mon:

task run_phase();
  ...
  if(vif.wr_en) begin
    item.wr_addr = vif.wr_addr;
    item.wr_data = vif.wr_data;
    ap.write(item);              //Writing sampled wr item to the scoreboard
  end
endtask

wr_drv:

task run_phase();
  ...
  seq_item_port.get_next_item(item);
  drive_if(item);
  seq_item_port.done();
endtask
 
task drive_if(wr_item item);
  @vif.cb;
  vif.wr_en <= 1'b1;
  vif.wr_data <= item.wr_data;
  vif.wr_addr <= item.wr_addr;
endtask

rd_drv:

task run_phase();
  ...
  seq_item_port.get_next_item(item);
  drive_if(item);
  seq_item_port.done();
endtask
 
task drive_if(rd_item item);
  @vif.cb;
  vif.rd_en <= 1'b1;
  vif.rd_addr <= item.rd_addr;
endtask

Lets say there is a virtual sequence which runs read sequences and writes sequences in parallel. When both drivers drive their corresponding pkts at the same time, my monitors sample them and send it to a single scoreboard which has a memory model.
The connection from monitors to scoreboard is like below:
rd_mon -> ap1 -> scbd
wr_mon -> ap2 -> scbd
My scoreboard implements 2 different write() implementations and acts accordingly.
How do i ensure correct order here? ie. When both write/read happens at the same time, the write operation should happen first and then the read operation.

Feel free to alter the driver/monitor code. And let me know if you need more code if my question is unclear.

chr_sue
chr_sue
Full Access
3850 posts
November 25, 2021 at 9:37 am

In reply to vignesh.kannan:

When you are running a virtual sequence with a fork/join of rd and wr sequence then it is randomly what is selected first, wr or rd. If you get the rd seq_item first you'll read first and wr later.
You can control this by setting a higher prio to the wr sequence. Then the wr is selected first anf the wr happens first. I believe this is what you want to do.

vignesh.kannan
vignesh.kannan
Full Access
6 posts
November 25, 2021 at 10:44 am

In reply to chr_sue:

Actually, no. I think we both are not on the same page here. Let's say the virtual sequence sends reads, writes with random delays in between such that for a given clock, you can hit any of the 4 scenarios:
1) only read
2) only write
3) write and read together.
4) neither read nor write

NOTE that i have 2 interfaces, not 1.

I want to use this virtual sequence because it's capable of doing ALL OF THE ABOVE.
Case 3) is a valid scenario, and I'm able to drive that.

My question here is, how do I change the monitor/driver/scoreboard for case 3) knowing that my DUT handles write -> read when both are presented during the same cycle. If I just use the code above, there is no guarantee that the ap.write() of rd_mon gets called after the ap.write() of wr_mon.

If ap.write() of rd_mon gets called before the ap.write() of wr_mon, then my scoreboard will return the data prior to the write, and DUT would return the data after the write. Do you see the problem I'm facing?

chr_sue
chr_sue
Full Access
3850 posts
November 25, 2021 at 10:59 am

In reply to vignesh.kannan:
It's useless to have delays in generating seq_items. Any timing will be done in the drivers. Your seq_items my have a data member defining the delays between the execution of read or writes.
I believe it is useless to do reads without doing writes prior to the reads. And do you share addresses between the read and the write port?

Back to your last statment: when you are executing reads and writes with the same clock cycle. This will end up in a bad situation. Inserting an additional clock cycle in the read access will delay this and you have a clear situation.

vignesh.kannan
vignesh.kannan
Full Access
6 posts
November 25, 2021 at 11:36 am

In reply to chr_sue:

Forget about the stimulus for a second. I'm driving a valid stimulus to the DUT where a read and a write CAN happen to my DUT at the same time. It's part of the spec for my DUT. If both happen at the same time, then my DUT is expected to handle both such that it writes the data into the address first and then reads out the memory. There is no issue/question with my stimulus.

Both of your previous suggestions are to drive write and read separately! That's not what I want. I want to test my DUT when both happen together.

Yes, they can share the addresses between the read port and write port.

I don't agree to your statement "when you are executing reads and writes with the same clock cycle. This will end up in a bad situation."

My DUT is intelligent enough to handle reads/writes together. You don't have to worry about that. Let's focus on the testbench!

What should I do in my monitor/scoreboard to ensure that my TB also handles these writes/reads together!

chr_sue
chr_sue
Full Access
3850 posts
November 26, 2021 at 12:24 am

In reply to vignesh.kannan:

OK, I try to summarize what I understood:
(1) you can read/write on the same clock cycle independently
(2) this is valid also when using the same addr for read and write
(3) when you write to a specific addr and read from the same addr you see on the read the data from the previous write and modifiying this content through the write
(4) if you read from an addr which was not written before you see 'x or any initial value
(5) When reading form and writing to the same addr you have an offset of 1 value in the transactions coing from the monitors.

Is my understanding correct?

Siemens Digital Industries Software

Siemens Digital Industries Software

#TodayMeetsTomorrow

Portfolio

  • Cloud
  • Mendix
  • Electronic Design Automation
  • MindSphere
  • Design, Manufacturing and PLM Software
  • View all Portfolio

Explore

  • Community
  • Blog
  • Online Store

Siemens

  • About Us
  • Careers
  • Events
  • News and Press
  • Customer Stories
  • Partners
  • Trust Center

Contact

  • VA - Contact Us
  • PLM - Contact Us
  • EDA - Contact Us
  • Worldwide Offices
  • Support Center
  • Give us Feedback
© Siemens 2023
Terms of Use Privacy Statement Cookie Statement DMCA