VHDL, verilog, design, verification, scripts, ...
Email: bknpk@hotmail.com Phone: +972-54-7649119



 

ASIC/FPGA Design and Verification Out Source Services

A simple c-code program to read a memory array from verilog RTL, using VPI.

  1. The former page discussed the simple verilog file, which served as the example's DUT. This one describes the c code, which reads a memory array from the verilog DUT.

  2. This pages only explains how the read is done. The c code registration is discussed in other examples ( my first hello world: VPI, a sparse memory model: VPI ), which are also available on the site.

  3. The c code gets the left and right addresses of the verilog array and starts a read loop.

    ...
      argh = vpi_scan(args_iter);
      argval.format = vpiIntVal;
      vpi_get_value(vpi_handle(vpiLeftRange, argh), &argval);
      left_addr = argval.value.integer;
      argval.format = vpiIntVal;
      vpi_get_value(vpi_handle(vpiRightRange, argh), &argval);
      right_addr = argval.value.integer;

      vpi_printf("the address range is %x %x\n", left_addr, right_addr);
      vpiHandle h3;
      s_vpi_value ar_da;

      for(ix_addr=left_addr; ix_addr <= right_addr; ix_addr++) {
        h3 = vpi_handle_by_index(argh, ix_addr);
        ar_da.format = vpiIntVal;
        vpi_get_value (h3, &ar_da);
        vpi_printf("the value is %d\n", ar_da.value.integer);
      }
    ...

  4. Go to the next page to read the description on the compilation script and download the code.

Home

The usage of queues in C++ and discusses some motivation to implement it for verification environments.






Search This Site


Feedback This Site




new pages on this site