Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ref_obj to reference typespecs #3857

Closed
wants to merge 2 commits into from

Conversation

hs-apotell
Copy link
Collaborator

Use ref_obj to reference typespecs

scope::Typespecs are cloned from non-elaborated tree to the elaborated tree.
However, at the moment, this collection doesn't have all the typespecs in the
non-elaborated tree.

This change solves a few different problems -

  • Avoids too many duplicates in the elaborated tree.
  • ref_obj will hold the type location information in parameter declaration.

Known Issues -

  • Need to collect all typespecs in the scope subtree to populate
    scope::Typespecs
  • Though the typespecs are cloned, elaborated tree is still using the ones
    from the non-elaborated tree. The tree is still complete but typespecs are
    crossing the boundary between elaborated and non-elaborated. Need to fix
    this during binding.

scope::Typespecs are cloned from non-elaborated tree to the elaborated tree.
However, at the moment, this collection doesn't have all the typespecs in the
non-elaborated tree.

This change solves a few different problems -

* Avoids too many duplicates in the elaborated tree.
* ref_obj will hold the type location information in parameter declaration.

Known Issues -
* Need to collect all typespecs in the scope subtree to populate
  scope::Typespecs
* Though the typespecs are cloned, elaborated tree is still using the ones
  from the non-elaborated tree. The tree is still complete but typespecs are
  crossing the boundary between elaborated and non-elaborated. Need to fix
  this during binding.
@alaindargelas
Copy link
Collaborator

@kbieganski the plugin action is broken

@alaindargelas
Copy link
Collaborator

@hs-apotell , you'll need to provide the code change for the plugin.

|vpiInstance:
\_module_inst: work@top (work@top), file:${SURELOG_DIR}/tests/AllBinding/dut.sv, line:1:1, endln:5:10
\_weaklyReferenced:
Copy link
Collaborator

@alaindargelas alaindargelas Sep 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this new relation? That is not in the Standard Object Model. That is an unwanted departure from the Standard.
I can't tell what this means.
I can't even see it in the UHDM changes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is temporary in the output. This is list of all objects in the tree that are weakly referenced i.e. connected to tree only by vpiParent, ref_obj::actual_object, vpiInstance, vpiExtends, and alike. ref_obj in the tree don't print the entire object that is references - it includes only a single line. So, there is nothing in the output to show the full definition of the referenced typespec.

A near future change will collect the typespecs under a scope and populate the scope::typespecs vector and show these entries under the weakReferences section will move under there and this will disappear.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't make this:

"A near future change will collect the typespecs under a scope and populate the scope::typespecs vector and show these entries under the weakReferences section will move under there and this will disappear."

an other backward compatibility problem with existing code. Existing UHDM code need to be able to navigate the typespecs from their logical anchor points.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is NOT a change in the graph. It is merely printing additional information in the UHDM output. You can turn this off in output by disabling the flag VpiVisitor::m_visitWeaklyReferenced. The only reason I left this turned ON is to have the necessary information in the output for debugging purposes.

When vpiTypespec of typespec -

    |vpiTypespec:
    \_enum_typespec: (type_scr1_mem_resp_e), line:1:1, endln:5:24
    \_ref_obj: ([email protected]_resp_ii)
      |vpiParent:
      |vpiParent:
      \_design: (work@top)
      \_logic_net: ([email protected]_resp_ii), line:3:37, endln:3:53
      |vpiName:type_scr1_mem_resp_e
      |vpiFullName:[email protected]_resp_ii
      |vpiInstance:
      |vpiActual:
      \_design: (work@top)
      \_enum_typespec: (type_scr1_mem_resp_e), line:1:1, endln:5:24
      |vpiBaseTypespec:
      \_logic_typespec: , line:1:14, endln:1:24
        |vpiRange:
        \_range: , line:1:19, endln:1:24
          |vpiParent:
          \_logic_typespec: , line:1:14, endln:1:24
          |vpiLeftRange:
          \_constant: , line:1:20, endln:1:21
            |vpiParent:
            \_range: , line:1:19, endln:1:24
            |vpiDecompile:1
            |vpiSize:64
            |UINT:1
            |vpiConstType:9
          |vpiRightRange:
          \_constant: , line:1:22, endln:1:23
            |vpiParent:
            \_range: , line:1:19, endln:1:24
            |vpiDecompile:0
            |vpiSize:64
            |UINT:0
            |vpiConstType:9
      |vpiEnumConst:
      \_enum_const: (SCR1_MEM_RESP_NOTRDY), line:2:5, endln:2:36
        |vpiParent:
        \_enum_typespec: (type_scr1_mem_resp_e), line:1:1, endln:5:24
        |vpiName:SCR1_MEM_RESP_NOTRDY
        |BIN:00
        |vpiDecompile:2'b00
        |vpiSize:2
      |vpiEnumConst:
      \_enum_const: (SCR1_MEM_RESP_RDY_OK), line:3:5, endln:3:36
        |vpiParent:
        \_enum_typespec: (type_scr1_mem_resp_e), line:1:1, endln:5:24
        |vpiName:SCR1_MEM_RESP_RDY_OK
        |BIN:01
        |vpiDecompile:2'b01
        |vpiSize:2
      |vpiEnumConst:
      \_enum_const: (SCR1_MEM_RESP_RDY_ER), line:4:5, endln:4:36
        |vpiParent:
        \_enum_typespec: (type_scr1_mem_resp_e), line:1:1, endln:5:24
        |vpiName:SCR1_MEM_RESP_RDY_ER
        |BIN:10
        |vpiDecompile:2'b10
        |vpiSize:2

With vpiTypespec of type ref_obj -

    |vpiTypespec:
    \_ref_obj: ([email protected]_resp_ii)
      |vpiParent:
      \_logic_net: ([email protected]_resp_ii), line:3:37, endln:3:53
      |vpiFullName:[email protected]_resp_ii
      |vpiActual:
      \_enum_typespec: (type_scr1_mem_resp_e), line:1:1, endln:5:24

So, you see important information is missing in the printed UHDM output with this change. The above output with the full description of the typespec is now printed in the weakReferences.

This should be fixes once all the typespecs under a scope become part of the vpiTypespcs array. But that work is outside the scope of this change, but not too far either once this (or one of its variant) is merged.

@kbieganski
Copy link
Collaborator

the plugin action is broken

There was a problem with custom runners but I think it's been resolved, try restarting the job (I don't have that option).

@alaindargelas
Copy link
Collaborator

Now yosys-systemverilog-plugin / test-plugin (pull_request) Failing after 24m fails for the good reason that the schema this change brings in will require update in the plugin.

@hs-apotell
Copy link
Collaborator Author

Discarding this in favor of #3868

@hs-apotell hs-apotell closed this Sep 20, 2023
@hs-apotell hs-apotell deleted the rots branch September 21, 2023 05:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants