系统Verilog中串联阵列的位宽度



我具有多个函数,它们生成1位变量/定义/枚举的串联阵列。每次串联发生时,我都想确保最终尺寸为32位。如果错误小于或大于32位,则标记错误。我尝试过$ lits,$ size,但它们似乎想要一个变量,并提供变量宽度而不是串联的宽度。打败目的。

任何帮助将不胜感激。

谢谢!

这是我在想的: - 例如。

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*

SystemVerilog中的任何内容都没有任何参数,可以将其定义以获取可变数量的参数。(您可以有默认参数,但是如果使用默认值,则无法从函数内部了解)

为什么不

function f1(bunch of inputs generated by macros(variable no. of input) a,b,c)
  size_check($bits({a,b,c})); 
  var_out = {a,b,c};
endfunction
function void size (int in) **// what should be in this function ?**
if(in !=32) - $error("msg"); *// this is what i want to achieve*
endfunction

最新更新