Wednesday, June 30, 2010

8x1 Multiplexer

It is an combinational device that performs multiplexing; it selects one of many analog or digital input signals and forwards the selected input into a single line. A multiplexer of 2n inputs has n select lines, which are used to select which input line to send to the just acts as switch between devices.....

module mux (s, z, x);
input [2:0] s;
output z;
input [7:0] x;
reg  z;
always @(*)
            3'b000 :z=x[0];
            3'b001 :z=x[1];
            3'b010 :z=x[2];
            3'b011 :z=x[3];
            3'b100 :z=x[4];
            3'b101 :z=x[5];
            3'b110 :z=x[6];
            3'b111 :z=x[7];
            default: z=1'bz;
You could download file mux.v and testbench.tb here

No comments:

Post a Comment