aboutsummaryrefslogblamecommitdiff
path: root/rtl/modexpng_dsp48e1.vh
blob: b41590c92926e1399d932f717c948e751939a442 (plain) (tree)
1
2
3
4

                                                                        

                                                            










                                                                         


                                                                         














                                                                           









                                     
 









                                            
                                            






                                                                                                   

                                                                                                              
                                                                                                              




                                                                                                              
                                                                                                              
                                                                                                             


                                                                                                              







                                                             
//======================================================================
//
// Copyright: 2019, The Commons Conservancy Cryptech Project
// SPDX-License-Identifier: BSD-3-Clause
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// - Redistributions of source code must retain the above copyright
//   notice, this list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright
//   notice, this list of conditions and the following disclaimer in the
//   documentation and/or other materials provided with the distribution.
//
// - Neither the name of the copyright holder nor the names of its
//   contributors may be used to endorse or promote products derived from
//   this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//======================================================================

localparam DSP48E1_A_W          = 30;
localparam DSP48E1_B_W          = 18;
localparam DSP48E1_C_W          = 48;
localparam DSP48E1_D_W          = 25;
localparam DSP48E1_P_W          = 48;
localparam DSP48E1_INMODE_W     = 5;
localparam DSP48E1_OPMODE_W     = 7;
localparam DSP48E1_ALUMODE_W    = 4;
localparam DSP48E1_CARRYINSEL_W = 3;
localparam DSP48E1_CARRYOUT_W   = 4;

localparam DSP48E1_OPMODE_X_DNC = 2'bXX;
localparam DSP48E1_OPMODE_X_0   = 2'b00;
localparam DSP48E1_OPMODE_X_AB  = 2'b11;

localparam DSP48E1_OPMODE_Y_DNC = 2'bXX;
localparam DSP48E1_OPMODE_Y_0   = 2'b00;
localparam DSP48E1_OPMODE_Y_C   = 2'b11;

localparam DSP48E1_OPMODE_Z_DNC    = 3'bXXX;
localparam DSP48E1_OPMODE_Z_0      = 3'b000;
localparam DSP48E1_OPMODE_Z_PCIN   = 3'b001;
localparam DSP48E1_OPMODE_Z_P17    = 3'b110;
localparam DSP48E1_OPMODE_Z_PCIN17 = 3'b101;
localparam DSP48E1_OPMODE_Z_P      = 3'b010;
localparam DSP48E1_OPMODE_Z_C      = 3'b011;

localparam DSP48E1_OPMODE_DNC = {DSP48E1_OPMODE_Z_DNC, DSP48E1_OPMODE_Y_DNC, DSP48E1_OPMODE_X_DNC};

localparam DSP48E1_OPMODE_Z0_YC_X0       = {DSP48E1_OPMODE_Z_0,      DSP48E1_OPMODE_Y_C, DSP48E1_OPMODE_X_0};
localparam DSP48E1_OPMODE_Z0_Y0_XAB      = {DSP48E1_OPMODE_Z_0,      DSP48E1_OPMODE_Y_0, DSP48E1_OPMODE_X_AB};
localparam DSP48E1_OPMODE_Z0_YC_XAB      = {DSP48E1_OPMODE_Z_0,      DSP48E1_OPMODE_Y_C, DSP48E1_OPMODE_X_AB};
localparam DSP48E1_OPMODE_ZC_Y0_XAB      = {DSP48E1_OPMODE_Z_C,      DSP48E1_OPMODE_Y_0, DSP48E1_OPMODE_X_AB};
localparam DSP48E1_OPMODE_ZP_Y0_XAB      = {DSP48E1_OPMODE_Z_P,      DSP48E1_OPMODE_Y_0, DSP48E1_OPMODE_X_AB};
localparam DSP48E1_OPMODE_ZP_YC_X0       = {DSP48E1_OPMODE_Z_P,      DSP48E1_OPMODE_Y_C, DSP48E1_OPMODE_X_0};
localparam DSP48E1_OPMODE_ZP_YC_XAB      = {DSP48E1_OPMODE_Z_P,      DSP48E1_OPMODE_Y_C, DSP48E1_OPMODE_X_AB};
localparam DSP48E1_OPMODE_ZP17_Y0_XAB    = {DSP48E1_OPMODE_Z_P17,    DSP48E1_OPMODE_Y_0, DSP48E1_OPMODE_X_AB};
localparam DSP48E1_OPMODE_ZP17_YC_XAB    = {DSP48E1_OPMODE_Z_P17,    DSP48E1_OPMODE_Y_C, DSP48E1_OPMODE_X_AB};
localparam DSP48E1_OPMODE_ZP17_YC_X0     = {DSP48E1_OPMODE_Z_P17,    DSP48E1_OPMODE_Y_C, DSP48E1_OPMODE_X_0};
localparam DSP48E1_OPMODE_ZPCIN17_YC_XAB = {DSP48E1_OPMODE_Z_PCIN17, DSP48E1_OPMODE_Y_C, DSP48E1_OPMODE_X_AB};
localparam DSP48E1_OPMODE_ZPCIN_Y0_XAB   = {DSP48E1_OPMODE_Z_PCIN,   DSP48E1_OPMODE_Y_0, DSP48E1_OPMODE_X_AB};
localparam DSP48E1_OPMODE_ZPCIN_YC_XAB   = {DSP48E1_OPMODE_Z_PCIN,   DSP48E1_OPMODE_Y_C, DSP48E1_OPMODE_X_AB};

localparam DSP48E1_CARRYINSEL_DNC          = 3'bXXX;
localparam DSP48E1_CARRYINSEL_CARRYIN      = 3'b000;
localparam DSP48E1_CARRYINSEL_CARRYCASCOUT = 3'b100;

localparam DSP48E1_ALUMODE_DNC                     = 4'bXXXX;
localparam DSP48E1_ALUMODE_Z_PLUS_X_AND_Y_AND_CIN  = 4'b0000;
localparam DSP48E1_ALUMODE_Z_MINUS_X_AND_Y_AND_CIN = 4'b0011;