40 likes | 216 Views
4-to-1 Multiplexer: case Statement. Discussion D7.3 Example 6. 4 x 1. MUX. c0. s1. s0. z. c1. 0 0 c0 0 1 c1 1 0 c2 1 1 c3. z. c2. c3. s1. s0. 4-to-1 Multiplexer. // Example 6: 4-to-1 MUX using case statement module mux41c ( input wire [3:0] c ,
E N D
4-to-1 Multiplexer:case Statement Discussion D7.3 Example 6
4 x 1 MUX c0 s1 s0 z c1 0 0 c0 0 1 c1 1 0 c2 1 1 c3 z c2 c3 s1 s0 4-to-1 Multiplexer
// Example 6: 4-to-1 MUX using case statement module mux41c ( inputwire [3:0] c , inputwire [1:0] s , outputreg z ); always @(*) case(s) 0: z = c[0]; 1: z = c[1]; 2: z = c[2]; 3: z = c[3]; default: z = c[0]; endcase endmodule