Guest User

Untitled

a guest
Mar 21st, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. 1 #include<stdio.h>
  2. 2 #include<stdlib.h>
  3. 3 #include"./include/vpi_user.h"
  4. 4 PLI_INT32 hello(PLI_BYTE8 *user_data){
  5. 5 vpi_printf("hello world!n");
  6. 6 return 0;
  7. 7 }
  8. 8
  9. 9 void hello_register()
  10. 10 {
  11. 11 s_vpi_systf_data tf_data;
  12. 12 tf_data.type=vpiSysTask;
  13. 13 tf_data.sysfunctype=0;
  14. 14 tf_data.tfname="$hello";
  15. 15 tf_data.calltf=hello;
  16. 16 tf_data.compiletf=NULL;
  17. 17 tf_data.sizetf=NULL;
  18. 18 tf_data.user_data=NULL;
  19. 19 vpi_register_systf(&tf_data);
  20. 20 }
  21.  
  22. 23 #include <stdarg.h>
  23. 24 #include "./../include/vpi_user.h"
  24. 25 #include "./../include/vpi_user_cds.h"
  25. 26 #include "./../hello.c"
  26. 27 /*
  27. 28 extern void register_hello();
  28. 29
  29. 30 void (*vlog_startup_routines[])() =
  30. 31 {
  31. 32 register_hello,0
  32. 33 };
  33. 34 */
  34. 35 /* ----------------------------------------------------------------
  35. 36 The following is an example of what should be included in this
  36. file:
  37. 37
  38. 38 extern void setup_my_callbacks(); <-- Add a declaration for your routine.
  39. 39
  40. 40 void (*vlog_startup_routines[])() =
  41. 41 {
  42. 42 $*** add user entries here ***$
  43. 43
  44. 44 setup_my_callbacks, <-- Add your routine to the table.
  45. 45 hello_re
  46. 46 0 $*** final entry must be 0 ***$
  47. 47
  48. 48 };
  49. 49 ------------------------------------------------------------------ */
  50. 50
  51. 51 extern void register_hello();
  52. 52 void (*vlog_startup_routines[VPI_MAXARRAY])() =
  53. 53 {
  54. 54
  55. 55 register_hello,0
  56. 56 /*** final entry must be 0 ***/
  57. 57 };
  58.  
  59. 1.gcc vpi_user.c -fPIC -shared -o hello_vpi.so
  60.  
  61. 2.ncverilog hello_pli.v +access+rwc -loadvpi ./hello_vpi.so:register_hello
Add Comment
Please, Sign In to add comment