OUBT : Ref. Question : Create a 4-bit wide, 256-to-1 multiplexer. The 256 4-bit inputs are all packed into a single 1024-bit input vector. sel=0 should select bits in[3:0], sel=1 selects bits in[7:4], sel=2 selects bits in[11:8], etc. module top_module( input [1023:0] in, input [7:0] sel, output [3:0] out ); //assign out = in[sel*4+3:sel*4]; assign out = {in[sel*4+3], in[sel*4+2], in[sel*4+1], in[sel*4+0]}; endmodule In the above code there are two assign statements . One is commented out and another one is concatenated . When I am executing the commented out one it is showing error but the concatenation on is working fine . Why so ? I am providing the error statements here . ERROR : sel is not a constant File
@@whyRD Both the assignment statements means exact same thing . Either slicing or concatenation both should give same output . I am not able to comprehend why it is not giving output for slicing method . Thanks for replying . Also what are the restrictions of using begin and end in sequential always blocks ? For for loop there is a necessity to define for block name . Why is that ?