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

      • Creating an Optimal Safety Architecture  - February 9th
      • The ABC of Formal Verification - February 11th
      • Events Calendar
    • On Demand Seminars

      • I'm Excited About Formal...
      • Visualizer Coverage
      • Formal-based ‘X’ Verification
      • 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
    • Mentor Training Center

      • SystemVerilog for Verification
      • SystemVerilog UVM
      • UVM Framework
      • Instructor-led Training
    • Mentor Learning Center

      • SystemVerilog Fundamentals
      • SystemVerilog UVM
      • Questa Simulation Coverage Acceleration Apps with inFact
      • 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 /
  • randc solve after

randc solve after

SystemVerilog 4898
#randomization 33 randc 5
alexkidd84
alexkidd84
Full Access
37 posts
October 15, 2019 at 5:48 am

Hi,

i'm struggling with a tricky randomization issue.
With this example code

class rand_C
randc int rand_a;
rand int rand_b;
 
constraint a_c {rand_a inside {0,1,2,3,4,5,6,7,8,9,10};}
constraint b_c {rand_b inside {4, 8, 10};}
 
constraint a_b {rand_a < rand_b ; solve rand_b before rand_a]}
endclass : rand_C

This a wrong piece of code, I know, because randc variables are always solved before any other (LRM 18.5.10); but i was wondering if there's a way to avoid this LRM limitation.

Replies

Log In to Reply
dave_59
dave_59
Forum Moderator
8466 posts
October 15, 2019 at 12:07 pm

In reply to alexkidd84:

What are you trying to achieve with the solve before construct?

— Dave Rich, Verification Architect, Siemens EDA

alexkidd84
alexkidd84
Full Access
37 posts
October 15, 2019 at 11:42 pm

In reply to dave_59:

I just want to randomize rand_b to find the max value (1st step) for the rand_a randomization (2nd step).

dave_59
dave_59
Forum Moderator
8466 posts
October 16, 2019 at 11:57 am

In reply to alexkidd84:

You have conflicting requirements. You cannot cycle through all the values of rand_a if you choose rand_b first. In table below, after the 6th step, there is no number you can choose without repeating a value before exhausting other unused numbers.








Step rand_a rand_b
1 3 4
2 2 8
3 1 10
4 0 4
5 4 8
6 ??? 4

— Dave Rich, Verification Architect, Siemens EDA

alexkidd84
alexkidd84
Full Access
37 posts
October 16, 2019 at 11:49 pm

In reply to dave_59:

Quote:
In reply to alexkidd84:

You have conflicting requirements. You cannot cycle through all the values of rand_a if you choose rand_b first. In table below, after the 6th step, there is no number you can choose without repeating a value before exhausting other unused numbers.








Step rand_a rand_b
1 3 4
2 2 8
3 1 10
4 0 4
5 4 8
6 ??? 4

Ok, I forgot another requirement. The randomization of rand_b should be done only at first time of class randomization. So the table should be:






Step rand_a rand_b
1 3 4
2 2 4
3 0 4
6 1 4
dave_59
dave_59
Forum Moderator
8466 posts
October 17, 2019 at 1:39 pm

In reply to alexkidd84:

That's a significant piece of missing information.

Remove the solve before construct from your example

You can explicitly call randomize(rand_b), the subsequently call randomize(rand_a)

Or you can add a post_randomize() function to turn off rand_b.rand_mode(0).

— Dave Rich, Verification Architect, Siemens EDA

Solution

Solution

alexkidd84
alexkidd84
Full Access
37 posts
October 17, 2019 at 11:37 pm

In reply to dave_59:
I made something similiar to what you wrote, but I can't realize how it will be with post_randomize() function:

randC c1;
 
if( first iteration) begin
  c1.rand_b.rand_mode(1);
  c1.rand_a.constraint_mode(0);
  c1.randomize(rand_b)
end
 
c1.rand_b.rand_mode(0);
c1.rand_a.constraint_mode(1);
c1.randomize(rand_a);
AnPham
AnPham
Full Access
6 posts
October 22, 2019 at 2:50 am

Interesting prob, I want to give a try. Is this something you want?

Edit: just found this post, you two are having the same problem. Is it an interview question?
-An

alexkidd84
alexkidd84
Full Access
37 posts
October 22, 2019 at 3:17 am

In reply to AnPham:

Quote:
Interesting prob, I want to give a try. Is this something you want?

Edit: just found this post, you two are having the same problem. Is it an interview question?
-An

Yes you're right, we are working on the same issue

© Mentor, a Siemens Business, All rights reserved www.mentor.com

Footer Menu

  • Sitemap
  • Terms & Conditions
  • Verification Horizons Blog
  • LinkedIn Group
SiteLock