9-to-1 multiplexer
Create a 16-bit wide, 9-to-1 multiplexer. sel=0 chooses a, sel=1 chooses b, etc. For the unused cases (sel=9 to 15), set all output bits to '1'.
1 module top_module( 2 input [15:0] a, b, c, d, e, f, g, h, i, 3 input [3:0] sel, 4 output [15:0] out ); 5 always@(*) 6 case(sel) 7 4'd1: //因为是十进制,所以用的是d,如果用b的话,则在后续是无法显示的 8 out=b; 9 4'd0: 10 out=a; 11 4'd2: 12 out=c; 13 4'd3: 14 out=d; 15 4'd4: 16 out=e; 17 4'd5: 18 out=f; 19 4'd6: 20 out=g; 21 4'd7: 22 out=h; 23 4'd8: 24 out=i; 25 4'd9,4'd10,4'd11,4'd12,4'd13,4'd14,4'd15: 26 out=16'hffff; //这个地方还用了16进制,即h,但是此处的ffff并不理解,也是看了答案上写的是ffff,但还是要思考 27 endcase 28 endmodule
再写:
“//这个地方还用了16进制,即h,但是此处的ffff并不理解,也是看了答案上写的是ffff,但还是要思考
”这里用了16进制,挺容易理解的啊,就是二进制的1111 1111 1111 1111,将所有位都设置为1
……也不知道当时是啥水平

浙公网安备 33010602011771号