本文共 766 字,大约阅读时间需要 2 分钟。
法一
author : Mr.Maoe-mail : 2458682080@qq.commodule mux16_1( input [3:0] sel, input [15:0] D, output Y);assign Y = D[sel];endmodule
法二
author : Mr.Maoe-mail : 2458682080@qq.commodule MUX16_1(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,s0,s1,s2,s3,y);input a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p;input s0,s1,s2,s3;output y;reg y;always@(*)begin case({s0,s1,s2,s3}) 4'b0000 : y <= a ; 4'b0001 : y <= b ; 4'b0010 : y <= c ; 4'b0011 : y <= d ; 4'b0100 : y <= e ; 4'b0101 : y <= f ; 4'b0110 : y <= g ; 4'b0111 : y <= h ; 4'b1000 : y <= i ; 4'b1001 : y <= j ; 4'b1010 : y <= k ; 4'b1011 : y <= l ; 4'b1100 : y <= m ; 4'b1101 : y <= n ; 4'b1110 : y <= o ; 4'b1111 : y <= p ; default : y <= a ; endcaseendendmodule
转载地址:http://fyiwi.baihongyu.com/