aboutsummaryrefslogblamecommitdiff
path: root/rtl/modexpng_parameters.vh
blob: c7566add6514bebd48b7ad0fc78abb7b68610ee9 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16















                                                             

                           


                           
 
                           
                                                                 
 
                                                  






                                                                
                                         
 

                                               
                                                      






















                                                                                   





















                                                                            
 



                                                                                  




                                                                       
                                                           
 


                                                               
 

                                                               
 
                                                                 
 
                                                                  
`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 MAX_OP_W = 4096;

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 BIT_INDEX_W = cryptech_clog2(MAX_OP_W);

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 CARRY_W = WORD_EXT_W - WORD_W;

localparam WORD_MUX_W = cryptech_clog2(WORD_W);

localparam [CARRY_W-1:0] CARRY_ZERO = {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_IN_1_M        = 3'd0;
localparam [BANK_ADDR_W-1:0] BANK_IN_1_N        = 3'd1;
localparam [BANK_ADDR_W-1:0] BANK_IN_1_N_FACTOR = 3'd2;
localparam [BANK_ADDR_W-1:0] BANK_IN_1_N_COEFF  = 3'd3;/*
localparam [BANK_ADDR_W-1:0] BANK_IN_1_EXT      = 3'd4; // [0] -> N_COEFF'*/
localparam [BANK_ADDR_W-1:0] BANK_IN_1_X        = 3'd5;
localparam [BANK_ADDR_W-1:0] BANK_IN_1_Y        = 3'd6;

localparam [BANK_ADDR_W-1:0] BANK_IN_2_D        = 3'd0;
localparam [BANK_ADDR_W-1:0] BANK_IN_2_P        = 3'd1;
localparam [BANK_ADDR_W-1:0] BANK_IN_2_P_FACTOR = 3'd2;
localparam [BANK_ADDR_W-1:0] BANK_IN_2_P_COEFF  = 3'd3;
localparam [BANK_ADDR_W-1:0] BANK_IN_2_Q        = 3'd4;
localparam [BANK_ADDR_W-1:0] BANK_IN_2_Q_FACTOR = 3'd5;
localparam [BANK_ADDR_W-1:0] BANK_IN_2_Q_COEFF  = 3'd6;
localparam [BANK_ADDR_W-1:0] BANK_IN_2_QINV     = 3'd7;

localparam [BANK_ADDR_W-1:0] BANK_OUT_S         = 3'd0;
localparam [BANK_ADDR_W-1:0] BANK_OUT_XM        = 3'd1;
localparam [BANK_ADDR_W-1:0] BANK_OUT_YM        = 3'd2;

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

localparam [OP_ADDR_W-1:0] OP_ADDR_LADDER_LAST = 3; // 0..3, i.e. <dummy>, D, P, Q

localparam [BIT_INDEX_W-1:0] BIT_INDEX_ZERO = {BIT_INDEX_W{1'b0}};

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_DNC = {OP_ADDR_W{1'bX}};

localparam [WORD_W-1:0] WORD_ZERO = {WORD_W{1'b0}};
localparam [WORD_W-1:0] WORD_DNC  = {WORD_W{1'bX}};
localparam [WORD_W-1:0] WORD_ONE  = {{(WORD_W-1){1'b0}}, 1'b1};

localparam [WORD_EXT_W-1:0] WORD_EXT_ZERO = {WORD_EXT_W{1'b0}};
localparam [WORD_EXT_W-1:0] WORD_EXT_DNC  = {WORD_EXT_W{1'bX}};

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

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