system on systemverilog

system

form the IEEE:
systemmakesacalltotheCfunctionsystem(). system can be called as either a task or a function. When called
as a function, it returns the return value of the call to system() with data type int. If $system is called with
no string argument, the C function system() will be called with the NULL string.
function system 有返回值,它的返回值就是system fork出來的子進程的結果值。
而linux system進程值的解釋如下:
-1 : 子進程fork fail
0 :子進程創建成功
>0: 子進程的返回值

example:
module top;
int id;
initial begin
id = system(perleprintsuccess\n); display(“the id is %d”, id);
end
endmodule
此時id=0;
id = system(perleexit10); display(“the id is %d”, id);
id = 10
所以system的返回值就是子進程的返回值

這在程序中可以用於生成不受seed決定的real random 值

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章