aboutsummaryrefslogblamecommitdiff
path: root/rtl/modexpng_parameters.vh
blob: 6d63735dc193236e6ca3ac29d38a209a7f10fcae (plain) (tree)


















                                                             


                                                                 



















































                                                                                   
`include "modexpng_parameters_x8.vh"

function    integer cryptech_clog2;
    input   integer value;
            integer temp_value;
            integer result;
    //
    begin
        temp_value = value - 1;
        for (result = 0; temp_value > 0; result = result + 1)
            temp_value = temp_value >> 1;
        cryptech_clog2 = result;
    end
    //
endfunction

localparam WORD_W     = 16;
localparam WORD_EXT_W = 18;
localparam MAC_W      = 47;
localparam BUS_DATA_W = 32;

localparam BUS_OP_ADDR_W = cryptech_clog2(MAX_OP_W / BUS_DATA_W);

localparam MAX_OP_W = 4096;

localparam BANK_ADDR_W = 3;
localparam OP_ADDR_W   = cryptech_clog2(MAX_OP_W / WORD_W); 
localparam COL_INDEX_W = OP_ADDR_W - cryptech_clog2(NUM_MULTS); 

localparam MAC_INDEX_W = cryptech_clog2(NUM_MULTS);

localparam RDCT_CARRY_W = WORD_EXT_W - WORD_W;

localparam [RDCT_CARRY_W-1:0] RDCT_CARRY_ZEROES = {RDCT_CARRY_W{1'b0}};

localparam [BANK_ADDR_W-1:0] BANK_WIDE_A = 3'd0;
localparam [BANK_ADDR_W-1:0] BANK_WIDE_B = 3'd1;
localparam [BANK_ADDR_W-1:0] BANK_WIDE_C = 3'd2;
localparam [BANK_ADDR_W-1:0] BANK_WIDE_D = 3'd3;
localparam [BANK_ADDR_W-1:0] BANK_WIDE_E = 3'd4;
localparam [BANK_ADDR_W-1:0] BANK_WIDE_N = 3'd5;
localparam [BANK_ADDR_W-1:0] BANK_WIDE_L = 3'd6;
localparam [BANK_ADDR_W-1:0] BANK_WIDE_H = 3'd7;

localparam [BANK_ADDR_W-1:0] BANK_NARROW_A      = 3'd0;
localparam [BANK_ADDR_W-1:0] BANK_NARROW_B      = 3'd1;
localparam [BANK_ADDR_W-1:0] BANK_NARROW_C      = 3'd2;
localparam [BANK_ADDR_W-1:0] BANK_NARROW_D      = 3'd3;
localparam [BANK_ADDR_W-1:0] BANK_NARROW_E      = 3'd4;
localparam [BANK_ADDR_W-1:0] BANK_NARROW_COEFF  = 3'd5;
localparam [BANK_ADDR_W-1:0] BANK_NARROW_Q      = 3'd6;
localparam [BANK_ADDR_W-1:0] BANK_NARROW_EXT    = 3'd7; // [0] -> COEFF', [1] -> Q'

localparam [BANK_ADDR_W-1:0] BANK_RCMB_ML  = 3'd0;
localparam [BANK_ADDR_W-1:0] BANK_RCMB_MH  = 3'd1;
localparam [BANK_ADDR_W-1:0] BANK_RCMB_EXT = 3'd2; // [0] -> MH'

localparam [BANK_ADDR_W-1:0] BANK_DONT_CARE = {BANK_ADDR_W{1'bX}};

localparam [OP_ADDR_W-1:0] OP_ADDR_EXT_COEFF = 0;
localparam [OP_ADDR_W-1:0] OP_ADDR_EXT_Q     = 1;

localparam [OP_ADDR_W-1:0] OP_ADDR_ZERO = {OP_ADDR_W{1'b0}};
localparam [OP_ADDR_W-1:0] OP_ADDR_ONE = {{(OP_ADDR_W-1){1'b0}}, 1'b1};
localparam [OP_ADDR_W-1:0] OP_ADDR_DONT_CARE = {OP_ADDR_W{1'bX}};

localparam [WORD_W-1:0] WORD_NULL = {WORD_W{1'b0}};
localparam [WORD_EXT_W-1:0] WORD_EXT_NULL = {WORD_EXT_W{1'b0}};

localparam [WORD_EXT_W-1:0] WORD_EXT_DONT_CARE = {WORD_EXT_W{1'bX}};

localparam [MAC_INDEX_W-1:0] MAC_INDEX_DONT_CARE = {MAC_INDEX_W{1'bX}};

localparam [NUM_MULTS-1:0] MULT_BITMAP_ZEROES = {NUM_MULTS{1'b0}};