Does it need to work in hardware? If so, is there a speed/throughput requirement? Or a maximum size of the device?
[quote]
In fact, the full SHA-256 is already working also using MyHDL types/classes.[/quote]
I take it that you can simulate your code? Can we see that code?
Yes that is OK. Even recursion should work, although MyHDL may not (yet) allow so.
I see a few candidates in SHA-256 where I would use a function too: e.g. the rightrotate (in Wikipedia’s pseudo-code)
I ran your code through my local MyHDL code-base (which is a heavily evolved branch from the pre-@block tree). And you have a case: the VHDL conversion should make distinction between functions with and without arguments. One without should convert to:
function functionName return returntype is
begin
....
return returnvalue;
end function functionName;
The other issue, the omission of the function instantiation is also an error in to _VHDL.py, the code simply expects there is at least one argument.
Both issues are easy to solve.
But in defence: the use case for a VHDL function without arguments is very rare … In your particular case you could replace the Sha256_new() function with a simple constant.