Simply put, i'm trying to write a testbench in C++ using VPI.

As a first attempt, i tried to read values from signals using vpi_get_value.
Right after compilation, I've achieved that succesfully.
All signals are UUUU as expected.
Note that type _has_ to be vpiBinStrVal as it's the only one
implemented based from what i can read in grt-vpi.adb.

Now, i'm trying to put a value into a signal. Again, i've to use
vpiBinStrVal as it's the only one implemented.
All i'm able to do is get a segfault. Note that i'm not specifying any
flag nor time as i see that they're ignored anyway. That said, i've
also tried to specify them but it also results in a segfault.

Here's the code snippet:
------ code start -----
          const char *mod_name;
          s_vpi_value val;
          s_vpi_value valset;

          val.format = vpiBinStrVal;
          valset.format = vpiBinStrVal;

          mod_name = vpi_get_str (vpiFullName, net_h);
          /* Get signal value: this works!  */
          vpi_get_value(net_h, &val);
          printf ("Net Name = %s; Value = %s\n",
                  mod_name, val.value.str);

          /* Attempt to set value to signal: this segfaults!  */
          if( !strcmp(mod_name, "ccmultiplier.a") ) {
            /* Note that ccmultiplier.a is a module in port of type
std_logic_vector(7 downto 0) */
            valset.value.str = "00000010";
            vpi_put_value(net_h, &valset, NULL, NULL); /* It segfaults here */
          }
------ code end -----

Now i'm left wondering what's wrong...
- Is it because simulation hasn't started yet and it's too early to put values?
- Is it because valset.value.str = "00000010" is wrong? I've tried
other things w/o success.
- Is it something else?

Also, i would have like to run a debugger on this, but i'm unable to
figure how i should use either ddd or insight on this.

Any help, tip, comment appreciated,

thanks,

-Pascal
-- 
Homepage (http://organact.mine.nu)
Debian GNU/Linux (http://www.debian.org)
LACIME: École de technologie supérieure (http://lacime.etsmtl.ca)

_______________________________________________
Ghdl-discuss mailing list
Ghdl-discuss@gna.org
https://mail.gna.org/listinfo/ghdl-discuss

Reply via email to