I wish to choose between bits of two indexed part selections using the values of each of the bits of another indexed part selection. Put in code that looks like:
output[idx*WIDTH+:WIDTH] = (condition[idx*WIDTH+:WIDTH]) ? (expression1[idx*WIDTH+:WIDTH) : expression2[idx*WIDTH+:WIDTH];
e.g. Looking at a single bit, if condition[idx*WIDTH] = 1
I want output[idx*WIDTH]
to contain the value of expression1[idx*WIDTH]
and if condition[idx*WIDTH] = 0
, I want output[idx*WIDTH]
to contain the value of expression2[idx*WIDTH]
.
Is this legal in System Verilog? If not, is there a better way to achieve the same functionality while keeping the indexed part select for the buses?