是否可以在 SystemVerilog 中不同的其他 case 语句中包含的 case 语句中使用相同的表达式?
Is it possible to use the same expression in a case statement included in different other case statement in SystemVerilog?
我有一个 SystemVerilog 测试平台,我想在我的程序中的其他 case
语句中使用 case
语句。
比如我有:
task a(string b,string c)
case(b)
"a1": x(x1,case(c) "b1":y=1; "b2":y=2;);
"a2": x(x2,case(c) "b3":y=4; "b4":y=5;);
这是我要实现的结构,在多个不同的 case 项中使用带有字符串 c 的 case。
如果我猜对了,x
表示一个任务或一个函数,而您正在尝试将 case 语句作为参数传递。正确的?不可能。
但这应该有效:
task a(string b,string c)
case(c)
"b1": y = 1;
"b2": y = 2;
...
endcase
case(b)
"a1": x(x1,y);
"a2": x(x2,y);
或一般使用的案例中的案例begin/end:
"a1": begin
x=x1;
case(c)
"b1":y=1;
"b2":y=2;
endcase
end
"a2": begin
x = x2;
case(c)
"b3": y=3;
"b4": y= 4;
endcase
end
endcase
我有一个 SystemVerilog 测试平台,我想在我的程序中的其他 case
语句中使用 case
语句。
比如我有:
task a(string b,string c)
case(b)
"a1": x(x1,case(c) "b1":y=1; "b2":y=2;);
"a2": x(x2,case(c) "b3":y=4; "b4":y=5;);
这是我要实现的结构,在多个不同的 case 项中使用带有字符串 c 的 case。
如果我猜对了,x
表示一个任务或一个函数,而您正在尝试将 case 语句作为参数传递。正确的?不可能。
但这应该有效:
task a(string b,string c)
case(c)
"b1": y = 1;
"b2": y = 2;
...
endcase
case(b)
"a1": x(x1,y);
"a2": x(x2,y);
或一般使用的案例中的案例begin/end:
"a1": begin
x=x1;
case(c)
"b1":y=1;
"b2":y=2;
endcase
end
"a2": begin
x = x2;
case(c)
"b3": y=3;
"b4": y= 4;
endcase
end
endcase