module modexpng_mac_array ( clk, ce, clr, ce_aux, clr_aux, casc_a, casc_a_aux, a_in, b_in, p_out, a_in_aux, p_out_aux ); // // Includes // `include "modexpng_parameters.vh" `include "modexpng_parameters_x8.vh" // // Ports // input clk; input ce; input [NUM_MULTS -1:0] clr; input ce_aux; input clr_aux; input [NUM_MULTS -2:0] casc_a; input casc_a_aux; input [NUM_MULTS * WORD_WIDTH -1:0] a_in; input [ 1 * WORD_WIDTH -1:0] b_in; output [NUM_MULTS * MAC_WIDTH -1:0] p_out; input [ 1 * WORD_WIDTH -1:0] a_in_aux; output [ 1 * MAC_WIDTH -1:0] p_out_aux; // // A-Cascade Paths // wire [WORD_WIDTH-1:0] a_casc_int[0:NUM_MULTS-2]; wire [WORD_WIDTH-1:0] a_casc_int_aux; // // LSB // modexpng_mac mac_lsb ( .clk (clk), .ce (ce), .clr (clr[0]), .casc_a (1'b0), .a_in (a_in[0+:WORD_WIDTH]), .b_in (b_in), .p_out (p_out[0+:MAC_WIDTH]), .a_casc_in ({WORD_WIDTH{1'b0}}), .a_casc_out (a_casc_int[0]) ); // // INT // genvar z; generate for (z=1; z<(NUM_MULTS-1); z=z+1) begin : gen_modexpng_mac_int modexpng_mac mac_int ( .clk (clk), .ce (ce), .clr (clr[z]), .casc_a (casc_a[z-1]), .a_in (a_in[z*WORD_WIDTH+:WORD_WIDTH]), .b_in (b_in), .p_out (p_out[z*MAC_WIDTH+:MAC_WIDTH]), .a_casc_in (a_casc_int[z-1]), .a_casc_out (a_casc_int[z]) ); end endgenerate // // MSB // modexpng_mac mac_msb ( .clk (clk), .ce (ce), .clr (clr[NUM_MULTS-1]), .casc_a (casc_a[NUM_MULTS-2]), .a_in (a_in[(NUM_MULTS-1)*WORD_WIDTH+:WORD_WIDTH]), .b_in (b_in), .p_out (p_out[(NUM_MULTS-1)*MAC_WIDTH+:MAC_WIDTH]), .a_casc_in (a_casc_int[NUM_MULTS-2]), .a_casc_out (a_casc_int_aux) ); // // AUX // modexpng_mac mac_aux ( .clk (clk), .ce (ce_aux), .clr (clr_aux), .casc_a (casc_a_aux), .a_in (a_in_aux), .b_in (b_in), .p_out (p_out_aux), .a_casc_in (a_casc_int_aux), .a_casc_out () ); endmodule