Composites of Protected 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

Language Change Specification Link

LCS2016_014

Requirement Summary

Allow composites to have elements that are protected types.

If a composite contains a protected type, a composite of a protected type, or an access type to a protected type or a composite of a protected type [will need a proposal for this if we want it], then all elements of the composite shall be either a protected type, a composites of a protected type, or an access type to a protected type or to composites of a protected type.

Applications

Arrays of Scoreboards, Arrays of Coverage Models, Arrays of Interfaces, ....

Related and/or Competing Issues

Adding Generics to protected types

Impact where the array type declaration is needed and raises the importance of being able to use "array" as a constraint in the declaration.

Bugzilla 291

RichardHead suggests allowing arrays of protected types.

Basic Capability (LCS_2016_14)

Protected Types

Current Situation

When using a protected type, we cannot create arrays of the the protected type. As a result, in situations where they are needed, instead we are obligated to use individually declared shared variables.

shared variable enet1 :  ScoreboardPType ; 
shared variable enet2 :  ScoreboardPType ; 
shared variable enet3 :  ScoreboardPType ; 
shared variable enet4 :  ScoreboardPType ; 
shared variable enet5 :  ScoreboardPType ; 

Within the code it is natural to dispatch a transaction to a scoreboard using an integer reference (1, 2, 3, 4, 5).

process 
...
  Get_Next_Stim (EnetCov, PortNum, TVal, ...) ; 
  case PortNum is 
    when 1 =>  enet1.push(TVal) ; 
    when 2 =>  enet2.push(Tval) ; 
    when 3 =>  enet3.push(TVal) ; 
    when 4 =>  enet4.push(Tval) ; 
    when 5 =>  enet5.push(TVal) ; 
    when others  =>  report "Unknown port" severity failure ; 
  end case ;
  DoTransaction(TRec, PortNum, TVal, ...) ; 

Use Model 1: Basic Arrays

Creating the array type. Potentially done in a package:

type ScoreboardArrayPType is array (natural range <>) of ScoreboardPType ; 

Declaring the shared variable - typically in an architecture declarative region.

shared variable enet :  ScoreboardArrayPType (1 to 5); 

Within the testbench stimulus creation code:

process 
...
  Get_Next_Stim (EnetCov, TVal, PortNum....) ; 
  enet(PortNum).push(TVal) ; 
  DoTransaction(TRec, PortNum, TVal, ...) ; 

FileTypes

Example using an array of files. Note that the array of files cannot be opened in the file declaration and instead need to be opened using file_open.

...
type text_array is array (integer range <>) of text ; 
...
-- Note array of files cannot be opened in the declaration
file TranscriptChannel : text_array(1 to 6) ;

...
TestSetup: Process
begin 
  file_open(TranscriptChannel (1), "./Test1_general.txt", WRITE_MODE) ; 
  file_open(TranscriptChannel (2), "./Test1_cpumodel.txt", WRITE_MODE) ; 
  file_open(TranscriptChannel (3), "./Test1_uarttxtlm.txt", WRITE_MODE) ; 
  . . . 

Pointers to Protected Types (LCS_2016_14A)

-- To be added

Pointers to File Types (LCS_2016_14A)

-- To be added

Advanced Capability - not in current LCS

Use Model 2: Arrays Created in Declaration

Protected types are not used in an assignment. As a result, it is uncommon to need one array to be subtype related to another. As a result, it would be nice to be able to use "array" as a subtype constraint:

shared variable enet:  array (1 to 5) of ScoreboardPType ; 

For a protected type that places generics on the type (see proposal Generics to protected types), the type declaration for ScoreboardArrayPType is no longer part of the type, and hence, would either need to be locally created (as in part 1), or use that array as a constraint on the type declaration. This is shown in the following example:

shared variable enet:  array (1 to 5) of ScoreboardPType (std_logic_vector, std_logic_vector, "=", to_hstring, to_hstring) ; 

Use Model 3: PT as an Interface

If we use a PT as an interface and we have multiple instances of a design, allowing arrays will allow the design to be instanced using generate.

-- Example of PT as an interface to be developed or referenced -- 

Questions

Proposal

Issues

Need more developed on records of protected types.

General Comments

I don't see any implementation issues with that. Of course, you cannot assign arrays and record if one of its subelements is a protected type. Of course such composite types are passed by reference in interfaces. And of course you cannot declare signals of such composite types. -- TristanGingold - 2014-10-21

Essential/required for testbenches with advanced structures (scoreboards, ...).

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-18

-- TorstenMeissner - 2016-05-25

-- SharadSinha - 2016-12-22

Topic revision: r16 - 2020-02-17 - 15:34:28 - 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