• 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. Problem with user define net types resolution functions

Stats

  • Locked Locked
  • Replies 6
  • Subscribers 65
  • Views 17523
  • 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

Problem with user define net types resolution functions

jach78
jach78 over 8 years ago

Hi all,
I have defined a net in this way:
typedef struct{
real V;
real I;
} EEstruct;

function automatic EEstruct res_EE(input EEstruct driver[]);
foreach(driver[i]) begin
.....

to debug my resolution function I need to know which driver is driving the net. How can I know this information?
what kind of data structure driver is? Is there a name field in the driver element or somthing like that?

Another questione,
In the testbench I assign the net in the following way:

assign mynet = '{1.0,2.0}; // is this correct?
assign mynet2 = '{`wrealZState, `wrealZState};

Are this assignment correct?

Thanks,
Jack

  • Cancel
  • tpylant
    tpylant over 8 years ago
    You can use $display, $resolved_wudn_name and $resolved_wudn_drivers within the resolution function to help you debug.

    Those assignments will work.

    Tim
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • jach78
    jach78 over 8 years ago
    Hi Tim,
    can you provide a simple example on how to use those method?
    Or link me some resources where I can read the parameters these functions accepts as input and what they return?

    Many thanks,
    Jack.
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • tpylant
    tpylant over 8 years ago

    //user-defined data type instruction

    typedef struct  {
      real opcode;
      real val;
    } instruction;

    // user-defined resolution function FUNC

    function automatic instruction FUNC(input instruction drivers[]);
      $display("\nNet %s is being Resolved\n", $resolved_wudn_name());
      $resolved_wudn_drivers;
      foreach (drivers[j])
        
    $display ("Time: %f,  FUNC: drivers[%d](opcode= %f, val = %f}", $realtime, j, drivers[j].opcode, drivers[j].val);
        
    FUNC = '{4.1, 4.2};
    endfunction

    // A nettype declaration with datatype and resolution function

    nettype instruction net_r_inst with FUNC;

    module top;
      net_r_inst  I1;
      instruction I2 = '{1.1, 1.2} ;
      instruction I3 = '{2.1, 2.2} ;

      assign I1 = I2;

      assign I1 = I3;

      initial begin
        
    #0 $display("\n time: %f I1 = %p, I2 = %p, I3 = %p", $realtime,I1, I2, I3);
        
    #1 $display("\n time: %f I1 = %p, I2 = %p, I3 = %p", $realtime,I1, I2, I3);
        #5 $finish;
      end
    endmodule

    Output

    Net top.I1 is being Resolved

    I1.........net(nettype net_r_inst) struct {
                  real opcode = 0
                  real val = 0
               } = '{opcode:0, val:0}
       '{opcode:0, val:0} <- (top) assign I1 = I2
       '{opcode:0, val:0} <- (top) assign I1 = I3

    Time: 0.000000,  FUNC: drivers[          0](opcode= 0.000000, val = 0.000000}

    Time: 0.000000,  FUNC: drivers[          1](opcode= 0.000000, val = 0.000000}

    Net top.I1 is being Resolved

    I1.........net(nettype net_r_inst) struct {
                  real opcode = 4.1
                  real val = 4.2
               } = '{opcode:4.1, val:4.2}
       '{opcode:1.1, val:1.2} <- (top) assign I1 = I2
       '{opcode:2.1, val:2.2} <- (top) assign I1 = I3

    Time: 0.000000,  FUNC: drivers[          0](opcode= 1.100000, val = 1.200000}

    Time: 0.000000,  FUNC: drivers[          1](opcode= 2.100000, val = 2.200000}

     time: 0.000000 I1 = '{opcode:4.1, val:4.2}, I2 = '{opcode:1.1, val:1.2}, I3 = '{opcode:2.1, val:2.2}

     time: 1.000000 I1 = '{opcode:4.1, val:4.2}, I2 = '{opcode:1.1, val:1.2}, I3 = '{opcode:2.1, val:2.2}

    Simulation complete via $finish(1) at time 6 NS + 0

    ./top.sv:13       #5 $finish;  

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • jach78
    jach78 over 8 years ago
    Hi Tim,
    thank you very much for your help, that's what I was asking for.

    Best regards,
    Jack.
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • jach78
    jach78 over 8 years ago

    Hi Tim,

    when I use the $resolved_wudn_drivers, as in your example, I receive the following error:

    ncsim: *E,OBJACC: Object must have read and connectivity access: tb_instance_name.VX

    Do you have any advice on the root cause?

    Thank you very much and best regards,

    Jack.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • tpylant
    tpylant over 8 years ago
    Try adding "-access rwc" (or "-debug" which does the same thing) to the irun command line. This will open up read, write, and connectivity access. However, it will affect performance so you want to only add it during debug.

    Tim
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

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