An I2C verification environment, which uses 
memories and VPI (c code) to 
drive and monitor data to/from DUT, will be described in this work.
- 
In this site many verification environments have been presented, using, 
specman
, 
VHDL
etc....
 
The main page of this work is accessed with the following 
link. 
The verilog code of the project, contains a BFM and also 
controls the operation of c code. 
This page describes how the verilog test-bench communicates with the 
c code. The bench may request the c code to prepare buffers to
initialize the I2C DUT, poll its data ready register or any other request 
for buffers. Those buffer are than used by the bench to perform APB bus 
transactions.
 
- 
The verilog test-bench simply sets a value in the address array, before 
requesting buffers from the c code. This is done in the following 
way:
  
  a_paddr[`RAM_SZ-1]=1; 
  $mem_wrt(a_paddr); 
  $mem_wrt(a_pwdata); 
  $mem_wrt(a_ctrl); 
 
- 
The c code checks for the message and acts appropriately.
  
- ...
  
- enum t_verilog_to_c {t_reg_init, t_poll};
  
- enum t_verilog_to_c verilog_to_c;
  
- ...
  
-   vpi_printf("C: the address range is 0x%x 0x%x\n", left_addr, right_addr);
  
-   h3 = vpi_handle_by_index(argh, right_addr);
  
-   ar_da.format = vpiIntVal;
  
-   data_to_a.format = vpiIntVal;
  
-   vpi_get_value (h3, &ar_da);
  
-   vpi_printf("C: a_paddr right value is %x field %d\n", ar_da.value.integer, (int)mem_field);
  
 
-   if(mem_field == t_addr && ar_da.value.integer == 1) {
  
-     verilog_to_c = t_reg_init;
  
- ...
  
-   }
  
  
-   vpi_printf("C: current mem_field %d \n", (int)mem_field);
  
-   if(verilog_to_c == t_reg_init) {
  
  
 
- 
The c-code environment also has a scoreboard to check that correct 
transactions are collected at the output. 
 The 
first steps 
were simple and stand alone cpp programs called from within a c-code. The 
main verification program is c and uses VPI to communicate with the verilog 
bench. A scoreboard, however, is very simple to implement, using STD queues.
 
 
                           |