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 /
  • question about the formal arguments of sequence and property

question about the formal arguments of sequence and property

SystemVerilog 4901
puranik.sunil@tcs.com
puranik.sunil@tcs.com
Full Access
95 posts
November 24, 2020 at 8:54 am

Hello,

I have a question on formal arguments of sequence and property - based on description given in SVA Assertions Handbook (Ben Cohen), the formal arguments of sequence and property can be local or non-local. Can someone explain what is the significance of "local" attribute here? What is the difference in local and non-local formal arguments of a sequence and a property?
(The SVA Assertions handbook (Ben Cohen) states that local variable formal arguments behave in the same way as local variables declared in an assertion_variable_declaration region of sequence or property. The book says terms local variable formal argument and local variable declared in assertion_variable_declaration are used interchangeably and mean same thing.)

Also formal arguments of sequence can be of the type input, output or inout but for the property they can be only input. Now if sequences are used in properties, what will be the use of output and inout arguments of sequences?

thanks and regards,
-sunil puranik

Replies

Log In to Reply
ben@SystemVerilog.us
ben@SystemVerilog.us
Full Access
1916 posts
November 24, 2020 at 3:39 pm

[b]In reply to puranik.sunil@tcs.com:[/b] My book has some 16 pages on local variables with examples.

Quote:

I have a question on formal arguments of sequence and property - based on description given in SVA Assertions Handbook (Ben Cohen), the formal arguments of sequence and property can be local or non-local. Can someone explain what is the significance of "local" attribute here? What is the difference in local and non-local formal arguments of a sequence and a property?
(The SVA Assertions handbook (Ben Cohen) states that local variable formal arguments behave in the same way as local variables declared in an assertion_variable_declaration region of sequence or property. The book says terms local variable formal argument and local variable declared in assertion_variable_declaration are used interchangeably and mean same thing.)

What I wrote in the book is based on 1800'2017. In the Amazon review of my book I was criticized for defining things that did not work. The reality though is that NOT EVERYTHING THAT IS IN 1800'17 IS IMPLEMENTED!.
Per 1800'17 the following should work because in section 16.8.2 Local variable formal arguments in sequence declarations it states: a local variable formal argument behaves in the same way as a local variable declared in an assertion_variable_declaration.
Thus, the following should work if the tool implements this feature:
     sequence  q_x(local int v); 
      ($rose(a), v=bus1) ##3 bus1=v+1'b1;
     endsequence 
 
    ap: assert property(a |-> q_x);  
 
    property p_x(local int v); 
      ($rose(a), v=bus1) |-> ##3 bus1=v+1'b1;
    endproperty 
    ap: assert property(p_x);  

Unfortunately, it seems that tools have not implemented this feature. I get something like near "=": syntax error, unexpected '=', expecting ++ or --.
In your reviews, please do not blame the messenger :)

Quote:
Also formal arguments of sequence can be of the type input, output or inout but for the property they can be only input. Now if sequences are used in properties, what will be the use of output and inout arguments of sequences?

I provided the following example in the book
sequence q_test ( // ch2/2.7/auto_var.sv 
        local inout int lv_count);
         (a, lv_count+= 1); //
    endsequence : q_test
 
      property p_test_OK;
      int v_c;
      (1, v_c=0) ##0 q_test(v_c) //  v_c is uninitialized, value read in q_test
      endproperty : p_test_OK
      ap: assert property(p_test_OK);  

Curiously, the above example compiles and elaborates, but the example above fails.
My guess is that not all features of what is in 1800 are implemented. They could be selectively implemented.
Throughout all of my applications and examples and responses to users' questions, I never felt a need to use those special variable features (e.g., local, inout). I try to KISS (Keep It Simple Stupid).

Ben Cohen
http://www.systemverilog.us/
For training, consulting, services: contact http://cvcblr.com/home

** SVA Handbook 4th Edition, 2016 ISBN 978-1518681448
...
1) SVA Package: Dynamic and range delays and repeats https://rb.gy/a89jlh
2) Free books: Component Design by Example https://rb.gy/9tcbhl
Real Chip Design and Verification Using Verilog and VHDL($3) https://rb.gy/cwy7nb
3) Papers:
- SVA Alternative for Complex Assertions
https://verificationacademy.com/news/verification-horizons-march-2018-issue
- SVA in a UVM Class-based Environment
https://verificationacademy.com/verification-horizons/february-2013-volume-9-issue-1/SVA-in-a-UVM-Class-based-Environment
- Understanding the SVA Engine,
https://verificationacademy.com/verification-horizons/july-2020-volume-16-issue-2

puranik.sunil@tcs.com
puranik.sunil@tcs.com
Full Access
95 posts
November 25, 2020 at 8:00 am

HI Ben,
thanks for immediate reply.
I am still not clear about the use of local formal arguments in properties and sequences. For example, in sequence q_x above, if we make the property non local what difference would it make? On Page no 63, section 2.7 of your SVA assertions handbook, 4th edition, it is said that non local argument is by default of direction input and cannot be written into. Is this true for both sequence and property? Does this mean, in a sequence, if we declare v as non local (remove local attribute), we will not be able to write to it even if its direction is output?
Also in property p_x example you have given above, you are assigning to argument v (statement v = bus1). However, according to the book, formal arguments direction can be only input for a property (for a sequence it could be output, input or inout). Can you please explain.

Also your book says that for untyped formal arguments can be treated as local local formal argument of direction input or output depending upon how it is used in sequence or property. Is this true for property also where formal arguments are always supposed to be of type input?

thanks and regargs,
-sunil puranik

ben@SystemVerilog.us
ben@SystemVerilog.us
Full Access
1916 posts
November 25, 2020 at 10:43 am

In reply to puranik.sunil@tcs.com:
I rarely used local variables being passed from a property to a sequence and back to the property. Below is an example that does that to see what the compiler and simulation does. I'll admit that often in learning design languages (VHDL, PSL, SV, SVA)and when the LRM is unclear, I often refer to simulating a model (hoping that the vendor understands the issue).

// This is a straight forward model without passing local variables around
property p_eq; 
      int v_c;
      @ (posedge clk) $rose(a) |-> (1, v_c=0) ##1  (1, v_c=v_c+1'b1) ##1 v_c==1; 
endproperty   
ap_eq: assert property(@ (posedge clk) p_eq );
 
// In this model, a property local variable (v_c) is passed to a sequence, 
// it is modified there and is then passed back to the property 
// where v_c is compared to a value 
sequence q_test ( // ch2/2.7/auto_var.sv
   // inout int lv_count); // syntax error, unexpected inout, expecting ')'
   local inout int lv_count);
   (1, lv_count+= 1); //
endsequence : q_test
 
property p_test_OK;
  int v_c;
  $rose(a) |-> (1, v_c=0) ##1 q_test(v_c) ##1 v_c==1; //  
endproperty : p_test_OK
ap_test_OK: assert property(p_test_OK);  

1800'2017 16.8.2 Local variable formal arguments in sequence declarations
A formal argument of a named sequence may be designated as a local variable argument by specifying the keyword local in the port item, followed optionally by one of the directions input, inout, or output.
Thus, without the identifier local the actual argument being passed is by value.
However, with the word local that is being passed is the actual local variable of the calling party. In the example above, in the sequence q_test the actual argument passed to lv_count is a local variable from the calling party. It is not just its value. This explains why
 ( inout int lv_count); // syntax error, unexpected inout, expecting ')'
// is in error because it is an inout.  Without the "local" identifier, 
// only the value is v=passed, but then it cannot act like the calling variable;  
// that is illegal.  
// With the "local", the sequence formal argument acts like a local variable of a sequence 
 local inout int lv_count); // IS LEGAL 


Ben Cohen
http://www.systemverilog.us/
For training, consulting, services: contact http://cvcblr.com/home

** SVA Handbook 4th Edition, 2016 ISBN 978-1518681448
...
1) SVA Package: Dynamic and range delays and repeats https://rb.gy/a89jlh
2) Free books: Component Design by Example https://rb.gy/9tcbhl
Real Chip Design and Verification Using Verilog and VHDL($3) https://rb.gy/cwy7nb
3) Papers:
- SVA Alternative for Complex Assertions
https://verificationacademy.com/news/verification-horizons-march-2018-issue
- SVA in a UVM Class-based Environment
https://verificationacademy.com/verification-horizons/february-2013-volume-9-issue-1/SVA-in-a-UVM-Class-based-Environment
- Understanding the SVA Engine,
https://verificationacademy.com/verification-horizons/july-2020-volume-16-issue-2

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

Footer Menu

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