Jump to content

Could the interface be the type of another parameterized interface class?


sep_com
 Share

Recommended Posts

The code is :

 

interface block_if_wrapper #(type T=j_interface) (input clk, input rst_n);

    T j_if(clk, rst_n);

endinterface

 

Then there will be an syntax error, but I read the section of 8.25 parameterized classes of the IEEE_Std_1800-2012 Systemverilog, there is no description to show that the interface could not be the type of the other parameterized interface class.

 

Could anyone help to explain that?

Link to comment
Share on other sites

The BNF does not allow it An interface is not a data_type (A.2.2.1 Net and variable types).

 

A virtual interface is a data type, but not the interface itself.

Thank you very much to reply.

But the BNF of the section 8.26.1 Interface class syntax in IEEE Std 1800-2012 System Verilog is

 

interface_class_declaration ::=

    interface class class_identifier[parameter_port_list] 

    [extends interface_class_type {, interface_class_type} ]; ........

 

Could you please provide which section has the description that the parameterized class only allow the data_type to be parameterized type?

Thank you very  much.

Link to comment
Share on other sites

An interface class is not the same as a plain interface. The interface keyword in front of a class type definition is special modifier, like the virtual keyword that defines a special type of class.

 

The BNF shows you the syntax that is possible to express, but not all of it is necessarily legal. Any syntax that is not expressible is illegal. If you scan through this series of BNF items, you will observe that there is no way to assign an interface/module/program to a type parameter.

 

parameter_declaration ::=

parameter data_type_or_implicit list_of_param_assignments

| parameter type list_of_type_assignments

 

list_of_type_assignments ::= type_assignment { , type_assignment }

 

type_assignment ::=

      type_identifier [ = data_type ]

data_type ::=

integer_vector_type [ signing ] { packed_dimension }

| integer_atom_type [ signing ]

| non_integer_type

| struct_union [ packed [ signing ] ] { struct_union_member { struct_union_member } }

{ packed_dimension }13

| enum [ enum_base_type ] { enum_name_declaration { , enum_name_declaration } }

{ packed_dimension }

| string

| chandle

| virtual [ interface ] interface_identifier [ parameter_value_assignment ] [ . modport_identifier ]

| [ class_scope | package_scope ] type_identifier { packed_dimension }

| class_type

| event

| ps_covergroup_identifier

| type_reference

If you go through the list of data_type items, there is nothing that allows an interface_identifier unless it is preceded by the virtual keyword.
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...