Create a 1-bit wide, 256-to-1 multiplexer. The 256 inputs are all packed into a single 256-bit input vector. sel=0 should select in[0], sel=1 selects bits in[1], sel=2 selects bits in[2], etc.
Expected solution length: Around 1 line.
译:
创建一个1位宽的256对1多路复用器。256个输入全部打包成单个256位输入向量。Sel =0选择[0],Sel =1选择[1]中的位,Sel =2选择[2]中的位,等等。
预期解决方案长度:约1行。
个人解法:
module top_module( input [255:0] in,input [7:0] sel,output out );assign out = in[sel];
endmodule
个人解法与官方解法一致;解释如下:
// Select one bit from vector in[]. The bit being selected can be variable.
运行结果: