K
kb33
Guest
Hi,
If I write an ASSIGN statement in the following manner, Modelsim
complains that there is an illegal left-handed side in the continuous
assignment and it doesn't compile the code:
input [2:0] inp_a, inp_b;
wire [2:0] array_a [0:7];
wire [2:0] array_b [0:3];
wire [2:0] array_c [0:3];
genvar i;
generate
for (i=0; i<4; i=i+1)
begin : test_blk
assign array_a [array_b ] = (condition == `SATISFIED) ?
inp_a : 0;
assign array_a [array_c ] = (condition == `SATISFIED) ?
inp_b : 0;
end
endgenerate
As an example, we can assume that array_b has the values 0,2,4,6 and
array_c has the values 1,3,5,7. Hence, if the conditions are met, the
following values should hold good:
array_a [0] = inp_a;
array_a [1] = inp_b;
array_a [2] = inp_a;
array_a [3] = inp_b;
array_a [4] = inp_a;
array_a [5] = inp_b;
array_a [6] = inp_a;
array_a [7] = inp_b;
So what is a good way to assign values (without using an ALWAYS
block) ?
kb33
If I write an ASSIGN statement in the following manner, Modelsim
complains that there is an illegal left-handed side in the continuous
assignment and it doesn't compile the code:
input [2:0] inp_a, inp_b;
wire [2:0] array_a [0:7];
wire [2:0] array_b [0:3];
wire [2:0] array_c [0:3];
genvar i;
generate
for (i=0; i<4; i=i+1)
begin : test_blk
assign array_a [array_b ] = (condition == `SATISFIED) ?
inp_a : 0;
assign array_a [array_c ] = (condition == `SATISFIED) ?
inp_b : 0;
end
endgenerate
As an example, we can assume that array_b has the values 0,2,4,6 and
array_c has the values 1,3,5,7. Hence, if the conditions are met, the
following values should hold good:
array_a [0] = inp_a;
array_a [1] = inp_b;
array_a [2] = inp_a;
array_a [3] = inp_b;
array_a [4] = inp_a;
array_a [5] = inp_b;
array_a [6] = inp_a;
array_a [7] = inp_b;
So what is a good way to assign values (without using an ALWAYS
block) ?
kb33