// ***************************************************************************/
//Actel Corporation Proprietary and Confidential
//Copyright 2009 Actel Corporation. All rights reserved.
//
//ANY USE OR REDISTRIBUTION IN PART OR IN WHOLE MUST BE HANDLED IN
//ACCORDANCE WITH THE ACTEL LICENSE AGREEMENT AND MUST BE APPROVED
//IN ADVANCE IN WRITING.
//
//Description:  CoreFIR
//              Coefficient storage
//
//Revision Information:
//Date         Description
//08Jan2009    Initial Release
//
//SVN Revision Information:
//SVN $Revision: 14586 $
//SVN $Data: $
//
//Resolved SARs
//SAR     Date    Who         Description
//
//Notes:
//

`timescale 1 ns/100 ps

// Const coef storage
module LMS_FIR_TOP_COREFIR_0_const_arr (set,
                  flat_coefo  );
  parameter TAPS        = 100;
  parameter COEF_BITS  = 12;
  parameter COEF_SETS   = 1;

  input [3:0] set;
  output [TAPS*COEF_BITS-1:0] flat_coefo;

  wire [COEF_BITS-1:0] coef_arr [0:15][0:TAPS-1];
  wire [3:0] set_w;

  assign set_w = (COEF_SETS==1) ? 0 : set;
  `include "LMS_FIR_TOP_COREFIR_0_coef.v"

  generate
    genvar j;
    for(j=0; j<TAPS; j=j+1)  begin: array2flat
      assign flat_coefo[COEF_BITS*j +: COEF_BITS] = coef_arr[set_w][TAPS-1-j];
    end
  endgenerate
endmodule


// Combine const coef storage and Shift reg
module LMS_FIR_TOP_COREFIR_0_wide_coef (nGrst, rstn, clk, clkEn,
        coefi,
        coefi_valid,
        set,
        flat_coefo  );
  parameter TAPS        = 100;
  parameter COEF_BITS  = 12;
  parameter COEF_SETS   = 1;
  parameter COEF_TYPE   = 0;

  input nGrst, rstn, clk, clkEn;
  input [COEF_BITS-1:0] coefi;
  input coefi_valid;
  input [3:0] set;
  output[TAPS*COEF_BITS-1:0] flat_coefo;

  generate
    if(COEF_TYPE==1)
      enum_coef_sr # (.TAPS(TAPS), .COEF_WIDTH(COEF_BITS)) coef_sr_0  (
        .nGrst(nGrst),
        .rstn(rstn),
        .clk(clk),
        .clkEn(clkEn),
        .coefi(coefi),
        .coefi_valid(coefi_valid),
        .flat_coefo(flat_coefo)  );
    else
      LMS_FIR_TOP_COREFIR_0_const_arr # ( .TAPS(TAPS), .COEF_BITS(COEF_BITS),
                    .COEF_SETS(COEF_SETS) ) const_arr_0  (
        .set(set),
        .flat_coefo(flat_coefo)  );
  endgenerate
endmodule

