2020-07-21 21:12:29 +08:00
|
|
|
|
`timescale 1ns / 1ps
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// Author: ljgibbs / lf_gibbs@163.com
|
|
|
|
|
// Create Date: 2020/07/19
|
|
|
|
|
// Design Name: sm3
|
|
|
|
|
// Module Name: sm3_cfg
|
|
|
|
|
// Description:
|
|
|
|
|
// SM3 模块配置信息
|
|
|
|
|
// Dependencies:
|
|
|
|
|
//
|
|
|
|
|
// Revision:
|
|
|
|
|
// Revision 0.01 - File Created
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////
|
2020-07-26 16:12:58 +08:00
|
|
|
|
//定义设计阶段-----------------------------
|
2020-07-21 21:12:29 +08:00
|
|
|
|
`define DESIGN_SIM
|
|
|
|
|
// `define DESIGN_SYNT
|
|
|
|
|
|
2020-07-29 16:41:30 +08:00
|
|
|
|
//模块调试开关-----------------------------
|
2020-07-26 16:12:58 +08:00
|
|
|
|
`ifdef DESIGN_SIM
|
2020-07-27 11:36:28 +08:00
|
|
|
|
//`define SM3_PAD_SIM_DBG
|
2020-08-04 23:11:26 +08:00
|
|
|
|
// `define SM3_EXPND_SIM_DBG
|
|
|
|
|
`define SM3_CMPRS_SIM_DBG
|
2020-07-28 16:47:39 +08:00
|
|
|
|
// `define SM3_CMPRS_SIM_FILE_LOG
|
2020-07-26 16:12:58 +08:00
|
|
|
|
`endif
|
|
|
|
|
|
2020-07-29 16:41:30 +08:00
|
|
|
|
//C模型相关设置----------------------------
|
|
|
|
|
// `define C_MODEL_SELF_TEST
|
|
|
|
|
|
2020-07-26 16:12:58 +08:00
|
|
|
|
//定义 SM3 输入位宽------------------------
|
2020-07-29 23:14:40 +08:00
|
|
|
|
// `define SM3_INPT_DW_32
|
|
|
|
|
`define SM3_INPT_DW_64
|
2020-07-21 21:12:29 +08:00
|
|
|
|
|
|
|
|
|
`ifdef SM3_INPT_DW_32
|
|
|
|
|
`define INPT_DW 32
|
|
|
|
|
`elsif SM3_INPT_DW_64
|
|
|
|
|
`define INPT_DW 64
|
|
|
|
|
`endif
|
|
|
|
|
|
2020-07-22 22:38:24 +08:00
|
|
|
|
// `define INPT_DW1 (INPT_DW - 1)
|
|
|
|
|
`define INPT_DW1 (`INPT_DW - 1)
|
|
|
|
|
`define INPT_BYTE_DW1 (`INPT_DW/8 - 1)
|
|
|
|
|
`define INPT_BYTE_DW (`INPT_BYTE_DW1 + 1)
|
2020-07-21 21:12:29 +08:00
|
|
|
|
|
2020-07-26 16:12:58 +08:00
|
|
|
|
//定义 SM3 输出位宽-------------------------
|
2020-07-21 21:12:29 +08:00
|
|
|
|
// `define SM3_OTPT_DW_32
|
|
|
|
|
`define SM3_OTPT_DW_64
|
|
|
|
|
// `define SM3_OTPT_DW_128
|
|
|
|
|
// `define SM3_OTPT_DW_256
|
|
|
|
|
|
|
|
|
|
`ifdef SM3_OTPT_DW_32
|
|
|
|
|
`define OTPT_DW 32
|
|
|
|
|
`elsif SM3_OTPT_DW_64
|
|
|
|
|
`define OTPT_DW 64
|
|
|
|
|
`elsif SM3_OTPT_DW_128
|
|
|
|
|
`define OTPT_DW 128
|
|
|
|
|
`elsif SM3_OTPT_DW_256
|
|
|
|
|
`define OTPT_DW 256
|
|
|
|
|
`endif
|
|
|
|
|
|
2020-07-26 16:12:58 +08:00
|
|
|
|
`define OTPT_DW1 (OTPT_DW - 1)
|
|
|
|
|
|
|
|
|
|
//定义 SM3 字扩展模式-----------------------
|
2020-07-28 22:19:22 +08:00
|
|
|
|
`define SM3_EXPND_PRE_LOAD_REG
|
|
|
|
|
|
|
|
|
|
//定义 SM3 迭代压缩中的加法方式-----------------------
|
|
|
|
|
//直接使用加法符,使工具推断
|
|
|
|
|
`define SM3_CMPRSS_DIRECT_ADD
|
2020-08-05 11:03:55 +08:00
|
|
|
|
//显式例化 CSA 加法器 在 SM3_CMPRSS_DIRECT_ADD 未定义时有效
|
2020-07-28 22:19:22 +08:00
|
|
|
|
`define SM3_CMPRSS_CSA_ADD
|