VHDL为信号分配一个数字';姓名

VHDL为信号分配一个数字';姓名,vhdl,modelsim,Vhdl,Modelsim,我将使用随机数选择信号,但无法将该数字指定给该信号的名称 在这段代码中,我有三个输入端口,它们的名称是: A1B、A2B、A3B、A4B 现在我想通过1到4之间的rand函数随机使用它们 rand = 4, then input A4B selected. rand = 2, then input A2B selected. rand = 3, then input A3B selected. 这不是我使用的simple()数组 for(i=1;i简单易读的方法是使用switch案例 如果您不

我将使用随机数选择信号,但无法将该数字指定给该信号的名称

在这段代码中,我有三个输入端口,它们的名称是: A1B、A2B、A3B、A4B

现在我想通过1到4之间的rand函数随机使用它们

rand = 4, then input A4B selected.
rand = 2, then input A2B selected.
rand = 3, then input A3B selected.
这不是我使用的simple()数组


for(i=1;i简单易读的方法是使用
switch
案例

如果您不想使用
开关
如果需要

有一个指向这些变量的指针数组

示例:

int A1B,A2B,A3B,A4B;
int *ptr[] = {&A1B, &A2B, &A3B, &A4B};

for (i=1; i<5; i++)
   *ptr[i-1] = 1 + i;
int AxB[100];

使用
switch()
语句?或使用
if…elsif…elsif…else…end if;
?请学习如何在此处设置问题格式。谢谢,下次;)对象无法间接寻址。根据您的需要使用适当的数组。您的示例代码未格式化为VHDL语法。谢谢,但我需要VHDL:)@VHDLVerificationgeek我不熟悉VHDL。由于这个问题被标记为
C
,我已经在
C
中回答了它。
int AxB[100];