veryl
veryl copied to clipboard
Infer generic argument based on function arguments
Since veryl is heavily inspired by rust, I would like to have the following code to work without any hints to the transpiler:
struct Source2<WIDTH: const> {
which: logic,
value: logic <WIDTH>,
}
function decode_source2::<WIDTH: const> (
inp: input logic<WIDTH + 1>,
) -> Source2::<WIDTH> {
return {
inp[msb],
inp[msb - 1:0],
};
}
Currently I have to write decode_source2::<16>(ir[16:0]), but I would like to be able to write decode_source2(ir[16:0]) since the WIDTH const argument can be deduced.
I know, that this can be a very hard problem to solve, but maybe at one day the transpiler can get this functionality <3