I have multiple functions that generate concatenated array of 1 bit variables/defines/enums. Everytime a concatenation happens i want to make sure the final size is 32 bits wide. And flag an error if it is less than or greater than 32 bits. i have tried $bits, $size, but they seem to be wanting a variable and provide the variable width not the width of concatenation. which defeats the purpose.
Any help is appreciated.
Thanks!
here is what i was thinking :- For example.
logic [31:0] var_out;
function f1(bunch of inputs generated by macros(variable no. of input) a,b,c)
size({a,b,c});
var_out = {a,b,c};
endfunction
function f2(bunch of inputs generated by macros(variable no. of input) e,f,g,h,i)
size({e,f,g,h,i});
var_out = {e,f,g,h,i};
endfunction
function size (in) **// what should be in this function ?**
if(length(in)!=32) - $error("msg"); *// this is what i want to achieve*
if ($bits({a,b,c}) != 32) $error()into the function?