123:
A call to an
Imported task can result in suspension of the currently executing thread. This occurs when an Imported task calls an Exported task, and the Exported task executes a delay control, event control or wait statement. Thus it is possible for an Imported task to be simultaneously active in
190:
1) A Context
Imported task or function can access (read or write) any SystemVerilog data object by calling (PLI/VPI) or by calling Export task or function. Therefore, a call to Context task or function is a barrier for SystemVerilog compiler optimization.
156:
A Pure function call can be safely eliminated if its result is not needed or if its results for the same value of input arguments is available for reuse without needing to recalculate.
111:
Imported function can access the initial value of a formal inout argument. Changes that the
Imported function makes to a formal inout argument shall be visible outside the function.
182:
An
Imported task or function which calls "Exported" tasks or functions or accesses SystemVerilog data objects other than its actual arguments is called Context task or function.
108:
Imported function shall not assume any initial values of formal output arguments. The initial value of output arguments is undetermined and implementation dependent.
627:
1173:
105:
The formal input arguments shall not be modified. If such arguments are changed within a function, the changes shall not be visible outside the function.
1178:
650:
828:
798:
672:
153:
Functions specified as Pure shall have no side effects, their results need to depend solely on the values of their input arguments.
58:
and
Foreign language. The functions implemented in Foreign language can be called from SystemVerilog and such functions are called
620:
813:
99:
An
Imported function shall complete their execution instantly and consume zero simulation time. Imported task can consume time.
858:
739:
660:
141:
A function whose results solely depends on the value of its input arguments with no side effects is called Pure function.
853:
613:
677:
636:
1095:
833:
719:
702:
687:
682:
27:
1072:
1013:
899:
1023:
914:
904:
729:
1087:
1034:
919:
818:
724:
1132:
988:
714:
692:
256:
SystemVerilog code can call Unix functions directly by importing them, with no need for a wrapper.
74:
functions. DPIs allow transfer of data between two domains through function arguments and return.
1008:
924:
939:
808:
655:
1042:
150:
Only Non-Void functions with no output or inout arguments can be called as Pure functions.
116:
An
Imported function shall not free the memory allocated by SystemVerilog code nor expect
127:
An
Imported function or task can be equip with special properties called pure or context.
1144:
1167:
1115:
1100:
972:
894:
781:
599:
117:
87:
83:
63:
55:
39:
23:
1057:
1047:
697:
42:
layer and a foreign language layer. Both the layers are isolated from each other.
843:
757:
665:
159:
A Pure function is assumed not to directly or indirectly perform the following:
82:
1) Function Import:- A function implemented in
Foreign language can be used in
1062:
993:
962:
774:
22:(Direct Programming Interface) is an interface which can be used to interface
1127:
1122:
1105:
1067:
874:
752:
165:
Read or Write anything in
Environment Variable, Shared memory, Sockets etc.
1110:
1003:
934:
879:
838:
803:
769:
1077:
967:
929:
793:
747:
35:
1139:
998:
823:
707:
605:
120:
code to free memory allocated by Foreign code or (Foreign Compiler).
31:
909:
889:
848:
1052:
764:
609:
102:
Imported function can have input, output, and inout arguments.
884:
592:
168:
Access any persistent data like Global or Static variable.
54:) allows direct inter language function calls between the
26:
with foreign languages. These foreign languages can be
528:"Sleeping for 3 seconds with Unix function"
86:
by importing it. A Foreign language function used in
555:"Exiting from SystemVerilog Initial Block"
1086:
1033:
1022:
981:
955:
948:
867:
738:
643:
474:"Entering in SystemVerilog Initial Block"
38:as well as others. DPIs consist of two layers: a
62:functions. Similarly, functions implemented in
216:" function int calc_parity (input int a);
621:
8:
173:An Imported task can never be declared Pure.
264:
1030:
952:
628:
614:
606:
354:"Addition Successful and Result = %d
186:Properties of context tasks and functions
94:Properties of imported function and task
265:Calling 'C' functions in SystemVerilog
66:can be called from Foreign language (
7:
132:Pure and context tasks and functions
1174:Application programming interfaces
14:
16:Hardware description language API
1179:Hardware verification languages
50:Direct Programming Interface (
1:
90:is called Imported function.
70:); such functions are called
593:"SystemVerilog DPI Tutorial"
145:Properties of pure functions
591:Gopi Krishna (2005-11-09).
507:"Value of J = %d"
178:Context tasks and functions
162:Perform any file operation.
124:multiple execution threads.
1195:
600:SystemVerilog DPI Tutorial
78:Function import and export
720:Circuit underutilization
703:Reconfigurable computing
390:
273:
225:
198:
387:SystemVerilog code file
252:Calling Unix functions
730:Hardware acceleration
602:from Project VeriPage
920:Microchip Technology
725:High-level synthesis
989:Intel Quartus Prime
715:Soft microprocessor
637:Programmable logic
222:Export declaration
195:Import declaration
1161:
1160:
1157:
1156:
1153:
1152:
940:Texas Instruments
423:"DPI-C"
405:"DPI-C"
231:"DPI-C"
68:C/C++ or System C
20:SystemVerilog DPI
1186:
1031:
953:
630:
623:
616:
607:
596:
580:
577:
574:
571:
568:
565:
562:
559:
556:
553:
550:
547:
544:
541:
538:
535:
532:
529:
526:
523:
520:
517:
514:
511:
508:
505:
502:
499:
496:
493:
490:
487:
484:
481:
478:
475:
472:
469:
466:
463:
460:
457:
454:
451:
448:
445:
442:
439:
436:
433:
430:
427:
424:
421:
418:
415:
412:
409:
406:
403:
400:
397:
394:
382:
379:
376:
373:
370:
367:
364:
361:
358:
355:
352:
349:
346:
343:
340:
337:
334:
331:
328:
325:
322:
319:
316:
313:
310:
307:
304:
301:
298:
295:
292:
289:
286:
285:<stdlib.h>
283:
280:
277:
247:
244:
241:
238:
235:
232:
229:
217:
214:
211:
208:
205:
202:
1194:
1193:
1189:
1188:
1187:
1185:
1184:
1183:
1164:
1163:
1162:
1149:
1082:
1025:
1018:
977:
944:
863:
734:
639:
634:
590:
587:
582:
581:
578:
575:
572:
569:
566:
563:
560:
557:
554:
551:
548:
545:
542:
539:
536:
533:
530:
527:
524:
521:
518:
515:
512:
509:
506:
503:
500:
497:
494:
491:
488:
485:
482:
479:
476:
473:
470:
467:
464:
461:
458:
455:
452:
449:
446:
443:
440:
437:
434:
431:
428:
425:
422:
419:
416:
413:
410:
407:
404:
401:
398:
395:
392:
389:
384:
383:
380:
377:
374:
371:
368:
365:
362:
359:
356:
353:
350:
347:
344:
341:
338:
335:
332:
329:
326:
323:
320:
317:
314:
311:
308:
305:
302:
299:
296:
293:
290:
287:
284:
281:
279:<stdio.h>
278:
275:
272:
267:
262:
254:
249:
248:
245:
242:
239:
236:
233:
230:
227:
224:
219:
218:
215:
212:
209:
206:
203:
200:
197:
188:
180:
147:
139:
134:
96:
80:
48:
17:
12:
11:
5:
1192:
1190:
1182:
1181:
1176:
1166:
1165:
1159:
1158:
1155:
1154:
1151:
1150:
1148:
1147:
1142:
1137:
1136:
1135:
1130:
1120:
1119:
1118:
1108:
1103:
1098:
1092:
1090:
1084:
1083:
1081:
1080:
1075:
1070:
1065:
1060:
1055:
1050:
1045:
1039:
1037:
1028:
1020:
1019:
1017:
1016:
1011:
1006:
1001:
996:
991:
985:
983:
979:
978:
976:
975:
970:
965:
959:
957:
950:
946:
945:
943:
942:
937:
932:
927:
922:
917:
912:
907:
902:
897:
892:
887:
882:
877:
871:
869:
865:
864:
862:
861:
856:
851:
846:
841:
836:
831:
826:
821:
816:
811:
806:
801:
796:
791:
790:
789:
779:
778:
777:
772:
762:
761:
760:
755:
744:
742:
736:
735:
733:
732:
727:
722:
717:
712:
711:
710:
700:
695:
690:
685:
680:
675:
670:
669:
668:
658:
653:
647:
645:
641:
640:
635:
633:
632:
625:
618:
610:
604:
603:
597:
586:
583:
391:
388:
385:
274:
271:
268:
266:
263:
261:
258:
253:
250:
226:
223:
220:
199:
196:
193:
187:
184:
179:
176:
175:
174:
171:
170:
169:
166:
163:
157:
154:
151:
146:
143:
138:
137:Pure functions
135:
133:
130:
129:
128:
125:
121:
114:
113:
112:
109:
106:
100:
95:
92:
79:
76:
47:
44:
15:
13:
10:
9:
6:
4:
3:
2:
1191:
1180:
1177:
1175:
1172:
1171:
1169:
1146:
1143:
1141:
1138:
1134:
1131:
1129:
1126:
1125:
1124:
1121:
1117:
1114:
1113:
1112:
1109:
1107:
1104:
1102:
1101:LatticeMico32
1099:
1097:
1094:
1093:
1091:
1089:
1085:
1079:
1076:
1074:
1071:
1069:
1066:
1064:
1061:
1059:
1056:
1054:
1051:
1049:
1046:
1044:
1041:
1040:
1038:
1036:
1032:
1029:
1027:
1021:
1015:
1012:
1010:
1007:
1005:
1002:
1000:
997:
995:
992:
990:
987:
986:
984:
980:
974:
971:
969:
966:
964:
961:
960:
958:
954:
951:
947:
941:
938:
936:
933:
931:
928:
926:
923:
921:
918:
916:
913:
911:
908:
906:
903:
901:
898:
896:
893:
891:
888:
886:
883:
881:
878:
876:
873:
872:
870:
866:
860:
857:
855:
852:
850:
847:
845:
842:
840:
837:
835:
832:
830:
827:
825:
822:
820:
817:
815:
812:
810:
807:
805:
802:
800:
797:
795:
792:
788:
785:
784:
783:
782:SystemVerilog
780:
776:
773:
771:
768:
767:
766:
763:
759:
756:
754:
751:
750:
749:
746:
745:
743:
741:
737:
731:
728:
726:
723:
721:
718:
716:
713:
709:
706:
705:
704:
701:
699:
696:
694:
691:
689:
686:
684:
681:
679:
676:
674:
671:
667:
664:
663:
662:
659:
657:
654:
652:
649:
648:
646:
642:
638:
631:
626:
624:
619:
617:
612:
611:
608:
601:
598:
594:
589:
588:
584:
386:
270:C - code file
269:
259:
257:
251:
221:
194:
192:
185:
183:
177:
172:
167:
164:
161:
160:
158:
155:
152:
149:
148:
144:
142:
136:
131:
126:
122:
119:
118:SystemVerilog
115:
110:
107:
104:
103:
101:
98:
97:
93:
91:
89:
88:SystemVerilog
85:
84:SystemVerilog
77:
75:
73:
69:
65:
64:SystemVerilog
61:
57:
56:SystemVerilog
53:
45:
43:
41:
40:SystemVerilog
37:
33:
29:
25:
24:SystemVerilog
21:
1058:LatticeMico8
1048:ARM Cortex-M
1024:Intellectual
786:
255:
234:my_cfunction
189:
181:
140:
81:
71:
67:
59:
51:
49:
19:
18:
1088:Open-source
1035:Proprietary
844:Flow to HDL
666:Logic block
260:DPI example
46:Explanation
1168:Categories
1063:MicroBlaze
1014:Simulators
994:Xilinx ISE
585:References
243:myfunction
1133:Microwatt
1128:Libre-SOC
1123:Power ISA
1106:OpenCores
1068:PicoBlaze
875:Accellera
868:Companies
740:Languages
579:endmodule
1111:OpenRISC
1026:property
1004:ModelSim
982:Software
956:Hardware
949:Products
935:Synopsys
905:Infineon
880:Achronix
839:C to HDL
804:Handel-C
644:Concepts
426:function
408:function
282:#include
276:#include
240:function
1078:Nios II
968:Stratix
930:Siemens
915:Lattice
900:Cadence
794:SystemC
748:Verilog
549:display
522:display
501:display
468:display
459:initial
36:SystemC
1140:RISC-V
999:Vivado
973:Virtex
859:Chisel
824:PALASM
708:Xputer
570:finish
420:import
402:import
396:tb_dpi
393:module
372:return
360:"
348:printf
288:extern
228:export
204:"
201:import
72:Export
60:Import
910:Intel
890:Aldec
849:MyHDL
775:VITAL
534:sleep
462:begin
438:input
432:sleep
1116:1200
1073:Nios
1053:LEON
854:ELLA
834:CUPL
829:ABEL
809:Lola
799:AHDL
765:VHDL
698:PSoC
678:EPLD
673:CPLD
661:FPGA
651:ASIC
444:secs
1145:Zet
1096:JOP
1043:ARC
1009:VTR
963:iCE
925:NXP
895:Arm
885:AMD
819:UPF
814:PSL
787:DPI
770:AMS
758:AMS
693:GAL
688:PAL
683:PLA
656:SoC
576:end
495:();
492:add
450:int
441:int
429:int
417:();
414:add
411:int
303:int
294:add
291:int
207:DPI
52:DPI
32:C++
1170::
567:$
558:);
546:$
543:);
531:);
519:$
516:);
498:$
483:20
477:);
465:$
447:);
369:);
357:\n
324:20
312:10
297:()
34:,
30:,
753:A
629:e
622:t
615:v
595:.
573:;
564:5
561:#
552:(
540:3
537:(
525:(
513:j
510:,
504:(
489:=
486:j
480:#
471:(
456:;
453:j
435:(
399:;
381:}
378:;
375:a
366:a
363:,
351:(
345:;
342:b
339:+
336:a
333:=
330:a
327:;
321:=
318:b
315:,
309:=
306:a
300:{
246:;
237:=
213:C
210:-
28:C
Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.