• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Functional Verification
  3. C++ Object life cycle through SV DPI

Stats

  • Locked Locked
  • Replies 11
  • Subscribers 64
  • Views 18973
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

C++ Object life cycle through SV DPI

archive
archive over 18 years ago

Hi all,

I have a C++ Object life cycle through SV DPI problem.

For example, I have a C++ reference model class named ALU.  Only one public function revealed to client (e.g. ALU::ALU_EXEC) and was encapsulated in DPI(ALU_EXEC_DPI) . And there are two types of ALU commands was entered to ALU::ALU_EXEC. One is setup ALU parameters (i.e. setup the ALU class private member) , the other is calculating the result.
 
The question is when I leave DPI, the ALU object is eliminated and all the setup parameter is cleared, right? So can I keep a C++ Object even after I leave DPI (i.e. is the C++ Object life cycle only as long as DPI call life cycle).

My friend suggest me to return all the ALU parameter out to SV and re-enter these parameters to ALU through ALU_EXEC_DPI when I call the ALU reference model. But it may break the model encapsulation :(

May be my question is not very clear and any suggestions are welcome!
Davy




Originally posted in cdnusers.org by davyzhu
  • Cancel
Parents
  • archive
    archive over 18 years ago

    Hi Vivek,

    Thank you so much :)

    Yes, you got my question. When I refer back to SV DPI spec, I notice DPI can call task.
    Something like from Stuart Sutherland's paper "Integrate SC model with SV DPI"
    //---SV file
    import “DPI” task SC_alu_run(...);
    always @(clk, a, b, opcode)
    SC_alu_run(clk, opcode,a, b, result,$realtime);
    //---

    //---SC file
    SC_alu_run (
    int clk, opcode,
    double a, b,
    double* result,
    double time) {
    sc_start(time);
    results = ...
    }

    I wonder whether this idea can be implemented in Cadence tools. Or there is some other methods Cadence recommend?

    And I have not used SystemC before and I just encapsulate the C reference model with a simple SystemC synchronization shell. Will there be a long learning curve for me (I am familar with C++ and SystemVerilog)?

    Any suggestions are welcome :)

    Best regards,
    Davy


    Originally posted in cdnusers.org by davyzhu
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • archive
    archive over 18 years ago

    Hi Vivek,

    Thank you so much :)

    Yes, you got my question. When I refer back to SV DPI spec, I notice DPI can call task.
    Something like from Stuart Sutherland's paper "Integrate SC model with SV DPI"
    //---SV file
    import “DPI” task SC_alu_run(...);
    always @(clk, a, b, opcode)
    SC_alu_run(clk, opcode,a, b, result,$realtime);
    //---

    //---SC file
    SC_alu_run (
    int clk, opcode,
    double a, b,
    double* result,
    double time) {
    sc_start(time);
    results = ...
    }

    I wonder whether this idea can be implemented in Cadence tools. Or there is some other methods Cadence recommend?

    And I have not used SystemC before and I just encapsulate the C reference model with a simple SystemC synchronization shell. Will there be a long learning curve for me (I am familar with C++ and SystemVerilog)?

    Any suggestions are welcome :)

    Best regards,
    Davy


    Originally posted in cdnusers.org by davyzhu
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information