Generic Multiplexers: Parameters Discussion D7.5 Example 8
A Generic 2-to-1 MUX // Example 8a: Generic 2-to-1 MUX using a parameter module mux2g #(parameter N = 4) (input wire [N-1:0] a, input wire [N-1:0] b, input wire s, output reg [N-1:0] y ); if(s == 0) y = a; else y = b; endmodule
// Example 8b: 8-line 2-to-1 MUX using a parameter module mux28( input wire [7:0] a, input wire [7:0] b, input wire s, output wire [7:0] y ); defparam M8.N = 8; mux2g M8 (.a(a),.b(b),.s(s),.y(y) ); endmodule N = 8
Aldec Active-HDL Simulation