2019-03-08 14:34:34 +00:00
|
|
|
/*
|
|
|
|
Copyright (c) 2019 tevador
|
|
|
|
|
|
|
|
This file is part of RandomX.
|
|
|
|
|
|
|
|
RandomX is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
RandomX is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with RandomX. If not, see<http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
//Cache size in KiB. Must be a power of 2.
|
|
|
|
#define RANDOMX_ARGON_MEMORY (256 * 1024)
|
|
|
|
|
|
|
|
//Number of Argon2d iterations for Cache initialization
|
|
|
|
#define RANDOMX_ARGON_ITERATIONS 3
|
|
|
|
|
|
|
|
//Number of parallel lanes for Cache initialization
|
|
|
|
#define RANDOMX_ARGON_LANES 1
|
|
|
|
|
|
|
|
//Argon2d salt
|
|
|
|
#define RANDOMX_ARGON_SALT "RandomX\x03"
|
|
|
|
|
2019-04-27 21:52:26 +00:00
|
|
|
//Number of random Cache accesses per Dataset item. Minimum is 2.
|
2019-03-22 11:53:16 +00:00
|
|
|
#define RANDOMX_CACHE_ACCESSES 8
|
2019-03-08 14:34:34 +00:00
|
|
|
|
2019-04-28 14:42:45 +00:00
|
|
|
//Target latency for SuperscalarHash (in cycles of the reference CPU).
|
2019-04-11 22:02:22 +00:00
|
|
|
#define RANDOMX_SUPERSCALAR_LATENCY 170
|
2019-04-28 14:42:45 +00:00
|
|
|
|
|
|
|
//The maximum size of a SuperscalarHash program (number of instructions).
|
2019-04-11 22:02:22 +00:00
|
|
|
#define RANDOMX_SUPERSCALAR_MAX_SIZE 512
|
2019-03-28 14:27:10 +00:00
|
|
|
|
2019-04-26 14:05:30 +00:00
|
|
|
//Dataset base size in bytes. Must be a power of 2.
|
|
|
|
#define RANDOMX_DATASET_BASE_SIZE (2ULL * 1024 * 1024 * 1024)
|
|
|
|
|
|
|
|
//Dataset extra size. Must be divisible by 64.
|
|
|
|
#define RANDOMX_DATASET_EXTRA_SIZE 33554368
|
2019-03-08 14:34:34 +00:00
|
|
|
|
|
|
|
//Number of instructions in a RandomX program
|
|
|
|
#define RANDOMX_PROGRAM_SIZE 256
|
|
|
|
|
|
|
|
//Number of iterations during VM execution
|
|
|
|
#define RANDOMX_PROGRAM_ITERATIONS 2048
|
|
|
|
|
|
|
|
//Number of chained VM executions per hash
|
2019-03-10 22:14:03 +00:00
|
|
|
#define RANDOMX_PROGRAM_COUNT 8
|
2019-03-08 14:34:34 +00:00
|
|
|
|
|
|
|
//Scratchpad L3 size in bytes. Must be a power of 2.
|
|
|
|
#define RANDOMX_SCRATCHPAD_L3 (2 * 1024 * 1024)
|
|
|
|
|
|
|
|
//Scratchpad L2 size in bytes. Must be a power of two and less than or equal to RANDOMX_SCRATCHPAD_L3.
|
|
|
|
#define RANDOMX_SCRATCHPAD_L2 (256 * 1024)
|
|
|
|
|
|
|
|
//Scratchpad L1 size in bytes. Must be a power of two and less than or equal to RANDOMX_SCRATCHPAD_L2.
|
|
|
|
#define RANDOMX_SCRATCHPAD_L1 (16 * 1024)
|
|
|
|
|
2019-04-28 14:42:45 +00:00
|
|
|
//How many register bits must be zero for a jump condition to be triggered. If set to 0, jumps are disabled.
|
|
|
|
#define RANDOMX_JUMP_BITS 7
|
2019-03-17 22:09:11 +00:00
|
|
|
|
2019-03-08 14:34:34 +00:00
|
|
|
/*
|
|
|
|
Instruction frequencies (per 256 opcodes)
|
|
|
|
Total sum of frequencies must be 256
|
|
|
|
*/
|
|
|
|
|
2019-04-06 10:00:56 +00:00
|
|
|
#define RANDOMX_FREQ_IADD_RS 32
|
2019-03-10 22:14:03 +00:00
|
|
|
#define RANDOMX_FREQ_IADD_M 7
|
2019-04-06 10:00:56 +00:00
|
|
|
#define RANDOMX_FREQ_ISUB_R 17
|
2019-03-10 22:14:03 +00:00
|
|
|
#define RANDOMX_FREQ_ISUB_M 7
|
|
|
|
#define RANDOMX_FREQ_IMUL_R 16
|
|
|
|
#define RANDOMX_FREQ_IMUL_M 4
|
|
|
|
#define RANDOMX_FREQ_IMULH_R 4
|
|
|
|
#define RANDOMX_FREQ_IMULH_M 1
|
|
|
|
#define RANDOMX_FREQ_ISMULH_R 4
|
|
|
|
#define RANDOMX_FREQ_ISMULH_M 1
|
|
|
|
#define RANDOMX_FREQ_IMUL_RCP 8
|
|
|
|
#define RANDOMX_FREQ_INEG_R 2
|
2019-04-16 16:58:44 +00:00
|
|
|
#define RANDOMX_FREQ_IXOR_R 15
|
|
|
|
#define RANDOMX_FREQ_IXOR_M 5
|
2019-03-10 22:14:03 +00:00
|
|
|
#define RANDOMX_FREQ_IROR_R 10
|
|
|
|
#define RANDOMX_FREQ_IROL_R 0
|
|
|
|
#define RANDOMX_FREQ_ISWAP_R 4
|
|
|
|
|
|
|
|
#define RANDOMX_FREQ_FSWAP_R 8
|
|
|
|
#define RANDOMX_FREQ_FADD_R 20
|
|
|
|
#define RANDOMX_FREQ_FADD_M 5
|
|
|
|
#define RANDOMX_FREQ_FSUB_R 20
|
|
|
|
#define RANDOMX_FREQ_FSUB_M 5
|
|
|
|
#define RANDOMX_FREQ_FSCAL_R 6
|
|
|
|
#define RANDOMX_FREQ_FMUL_R 20
|
|
|
|
#define RANDOMX_FREQ_FDIV_M 4
|
|
|
|
#define RANDOMX_FREQ_FSQRT_R 6
|
|
|
|
|
2019-04-16 16:58:44 +00:00
|
|
|
#define RANDOMX_FREQ_COND_R 8
|
2019-03-10 22:14:03 +00:00
|
|
|
#define RANDOMX_FREQ_CFROUND 1
|
|
|
|
#define RANDOMX_FREQ_ISTORE 16
|
|
|
|
|
|
|
|
#define RANDOMX_FREQ_NOP 0
|
|
|
|
/* ------
|
|
|
|
256
|
|
|
|
*/
|