/*
 Copyright (C) 2016 Cedric Orban

 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 This module is a parameterized mux that is used to forward the output
 of different processing units through the sigmoid activation function.
 
*/

`include "DeepGATE_include.v"

module sig_mux #(

	parameter  WIDTH = 10,
	parameter  SIZE = 4
	
)(

	input [$clog2(SIZE) - 1'b1 : 0] sel,   
	input [(SIZE*WIDTH) - 1'b1 : 0] mux_i,
	output [WIDTH - 1 : 0] mux_o
 
);

wire [WIDTH - 1 : 0] input_array [SIZE - 1 : 0];

genvar i;
generate

    for(i = 0; i < SIZE; i = i + 1) begin: ARRAY
	 
        assign  input_array[i] = mux_i[`IDX(i, WIDTH)];
		  
    end
	 
endgenerate

assign  mux_o = input_array[sel];

endmodule

