Want to use inputs to be passed in range of another vector to extract corresponding value
Say for example see the Verilog code below.
But the problem is: I cant pass a variable(input) into the range of another variable. But this has to be done like that. Is there any other was to execute code with similar functionality? Actually my question pertains to the syntax correction of this code, and options available to execute similar functionality.
module foo(input1, input2, output1)
input [3:0] input1;
input [3:0] input2;
output reg [3:0] output1;
always@(*) begin
output1 <= input2[3:3-input1[1:0]];
end
endmodule
paramter? In other words, is it a known constant at instantiation of 'foo'?