Jump to content

How to get the value of a string when using the string in a hierarchical path

Recommended Posts

Hi all

        Is there a way to use the value of string variable in systemverilog.  I have a text file with the pin name and the value to be driven to that pin, on each line.

There are around 50 pins. The name of the pin declared in the interface and the text file are same. I want to read the pin name and value from text file into a string and integer.

Then use the string to refer the signal in interface and drive the value to it. The code i want to use is roughly as show below.

 The interface vif has pins pinabc and pinbcd declared in it. obviously here when i use vif.pin the tool is searching for a pin with name "pin" in interface. Is there a way to get

  the value of the string pin.


 pinabc   20

 pinbcd   30

---------------sv code----------------------------------

   interger FILE,pin_val;

   string line,pin;

   FILE = $fopen("./file.txt","r");

  while ($fgets(line,FILE)) begin

      void'($sscanf(line,"%s %d\n",pin,pin_val));

      vif.pin = pin_val;


Link to comment
Share on other sites

Hi uwes

       thanks for the response. uvm_hdl_deposit did work. But i had to give the HDL interface instance path.

    When i tried to use the path of the  interface handle in the driver module, the API cound't find the path and gave 

   UVM_ERROR: set: unable to locate hdl path. if possible I dont want to use hard coded hdl path in my verification env.

   Any reason why uvm_hdl_deposit is not able to work with UVM path?




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.

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.

  • Create New...