Allow Protected Type Method Parameters to be Access Types, Protected Types (functions), and File Types

Proposal Information

  • State of this Proposal: Raw / Stream of Conscious
  • Current Owner: JimLewis, ...
  • Contributors: JimLewis, ...
  • Date Proposed: 2012-Jan-05
  • Date Last Updated: 2013-October-27
  • Priority:
  • Complexity:
  • Focus: Testbench
  • Related Issues: None
  • Competing Issues: None

Requirement Summary

Allow method parameters to be of an access type, protected type, or file type.

Related: Bugzilla 290

RichardHead suggests allowing method parameters to be of an access types.

Use Model: Access Types

TextIO inside of a Protected Type

Textio builds up strings up into a write buffer that is of type line, which is access to string. As a result, textio is not feasible.

shared variable PtObject : AProtectedType ; 
. . .
PtObject.write(WriteBuf) ; 

Data Structure Creation

OSVVM coverage modeling uses protected type methods to create the coverage model. Currently a coverage bin is allowed to consist of a single range. SystemVerilog allows a point bin to be a collection of ranges. To implement this and keep OSVVM's simplified method for modeling cross coverage requires a ragged array structure - an array of arrays where the inner array of different indicies has a different number of elements.

-- place holder for example of write

Issues with Access Types

Permitting access type parmeters is both practical and extremely dangerous.

It is dangerous since it potentially allows an application to hand out pointers to internal data structures, and hence, we loose atomicity and exclusive access to an object.

On the other hand, disallowing it prevents simple things like a textio write procedure and more complex things like building complex irregular shaped data structures (ie: a coverage model). The things that it is preventing that are safe can be classed as handing off pointers that are to copies of objects. Currently the OSVVM coverage modeling limits a coverage bin to have only a single range. To be able to handle a bin that is a collection of ranges (and values) requires passing an array of pointers as each set of bins may have a different number of elements.

In past discussions about extensions of this sort, it was suggested that protected type usage then give up on atomicity and exclusive access and only allow usage of regular types. This unfortunately would not satisfy the need for OSVVM as coverage models need to be accessed from separate processes (concurrent threads).

Use Model: Protected Type

To Be supplied. See Protected Types and regular functions.

shared variable PtObject : AProtectedType ; 
. . .
PtObject.write(WriteBuf) ; 

Use Model: File Type

Motivation: Creating write methods for file io.

Currently disallowed by the language. Anyone know why?

In Coverage Modeling, we would like to be able to have the following as a public method:

procedure WriteBin ( file f : text ) is
  variable PrintItemName : boolean := FALSE ;
begin
   WriteBinName(f, "WriteBin: ") ;
   for i in 1 to NumBins loop   -- CovBinPtr.all'range
       if CovBinPtr(i).count < 0 then
           write(f, "%%Illegal Bin:") ;
           write(f, CovBinPtr(i).BinVal.all) ;
      ... 
end procedure WriteBin ;

Questions

Proposal

Issues

General Comments

Essential to improve testbench utility capabilities.

Supporters

Add your signature here to indicate your support for the proposal

-- JimLewis - 2014-12-03

-- Brent Hayhoe - 2014-12-23

-- MortenZilmer - 2015-01-21

-- PatrickLehmann - 2016-02-19

-- TorstenMeissner - 2016-05-18

Topic revision: r11 - 2020-02-17 - 15:34:35 - JimLewis
 
Copyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback