Major Tools
Other Tools
General Info

recursive function support?

Added by Yong Fu 10 months ago

We have download a design from Github. This design can run correctly in VCS. But verilator compile hang.

Guess it is the following function (recursive function as it call itself) cause the issue:

function automatic [31:0] W;
    input [6:0] x;
    input [6:0] y;
    if(^x === 1'bX) W = 32'h777;
    else W = (x<16) ? padded[((PADDED_SIZE-1-y*512)-x*32) -: 32] : rho1(W(x-2, y)) + W(x-7, y) + rho0(W(x-15, y)) + W(x-16, y);

Any suggestions on how to change the code for workaround? Or enhancement?

Replies (1)

RE: recursive function support? - Added by Wilson Snyder 10 months ago

I presume you got an error message as opposed to a hang (that's what I get). Or perhaps you are not using the latest message.

Anyhow, recursive functions are not currently supported - please file an issue and we'll get to fixing it.

Meantime, make the function non-recursive, for example you could make 15 copies of the function and have the top one call e.g. W1, W1 calls W2 etc. (My reading of the code is 15 is enough but I might be wrong - you could use Icarus to simulate hw deep the call stack is.)