configuration.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*
  2. Copyright (c) 2019 tevador
  3. This file is part of RandomX.
  4. RandomX is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. RandomX is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with RandomX. If not, see<http://www.gnu.org/licenses/>.
  14. */
  15. #pragma once
  16. //Cache size in KiB. Must be a power of 2.
  17. #define RANDOMX_ARGON_MEMORY 262144
  18. //Number of Argon2d iterations for Cache initialization
  19. #define RANDOMX_ARGON_ITERATIONS 3
  20. //Number of parallel lanes for Cache initialization
  21. #define RANDOMX_ARGON_LANES 1
  22. //Argon2d salt
  23. #define RANDOMX_ARGON_SALT "RandomX\x03"
  24. //Number of random Cache accesses per Dataset item. Minimum is 2.
  25. #define RANDOMX_CACHE_ACCESSES 8
  26. //Target latency for SuperscalarHash (in cycles of the reference CPU).
  27. #define RANDOMX_SUPERSCALAR_LATENCY 170
  28. //The maximum size of a SuperscalarHash program (number of instructions).
  29. #define RANDOMX_SUPERSCALAR_MAX_SIZE 512
  30. //Dataset base size in bytes. Must be a power of 2.
  31. #define RANDOMX_DATASET_BASE_SIZE 2147483648
  32. //Dataset extra size. Must be divisible by 64.
  33. #define RANDOMX_DATASET_EXTRA_SIZE 33554368
  34. //Number of instructions in a RandomX program
  35. #define RANDOMX_PROGRAM_SIZE 256
  36. //Number of iterations during VM execution
  37. #define RANDOMX_PROGRAM_ITERATIONS 2048
  38. //Number of chained VM executions per hash
  39. #define RANDOMX_PROGRAM_COUNT 8
  40. //Scratchpad L3 size in bytes. Must be a power of 2.
  41. #define RANDOMX_SCRATCHPAD_L3 2097152
  42. //Scratchpad L2 size in bytes. Must be a power of two and less than or equal to RANDOMX_SCRATCHPAD_L3.
  43. #define RANDOMX_SCRATCHPAD_L2 262144
  44. //Scratchpad L1 size in bytes. Must be a power of two and less than or equal to RANDOMX_SCRATCHPAD_L2.
  45. #define RANDOMX_SCRATCHPAD_L1 16384
  46. //Jump condition mask size in bits.
  47. #define RANDOMX_JUMP_BITS 8
  48. //Jump condition mask offset in bits.
  49. #define RANDOMX_JUMP_OFFSET 8
  50. /*
  51. Instruction frequencies (per 256 opcodes)
  52. Total sum of frequencies must be 256
  53. */
  54. #define RANDOMX_FREQ_IADD_RS 25
  55. #define RANDOMX_FREQ_IADD_M 7
  56. #define RANDOMX_FREQ_ISUB_R 16
  57. #define RANDOMX_FREQ_ISUB_M 7
  58. #define RANDOMX_FREQ_IMUL_R 16
  59. #define RANDOMX_FREQ_IMUL_M 4
  60. #define RANDOMX_FREQ_IMULH_R 4
  61. #define RANDOMX_FREQ_IMULH_M 1
  62. #define RANDOMX_FREQ_ISMULH_R 4
  63. #define RANDOMX_FREQ_ISMULH_M 1
  64. #define RANDOMX_FREQ_IMUL_RCP 8
  65. #define RANDOMX_FREQ_INEG_R 2
  66. #define RANDOMX_FREQ_IXOR_R 15
  67. #define RANDOMX_FREQ_IXOR_M 5
  68. #define RANDOMX_FREQ_IROR_R 10
  69. #define RANDOMX_FREQ_IROL_R 0
  70. #define RANDOMX_FREQ_ISWAP_R 4
  71. #define RANDOMX_FREQ_FSWAP_R 8
  72. #define RANDOMX_FREQ_FADD_R 20
  73. #define RANDOMX_FREQ_FADD_M 5
  74. #define RANDOMX_FREQ_FSUB_R 20
  75. #define RANDOMX_FREQ_FSUB_M 5
  76. #define RANDOMX_FREQ_FSCAL_R 6
  77. #define RANDOMX_FREQ_FMUL_R 20
  78. #define RANDOMX_FREQ_FDIV_M 4
  79. #define RANDOMX_FREQ_FSQRT_R 6
  80. #define RANDOMX_FREQ_CBRANCH 16
  81. #define RANDOMX_FREQ_CFROUND 1
  82. #define RANDOMX_FREQ_ISTORE 16
  83. #define RANDOMX_FREQ_NOP 0
  84. /* ------
  85. 256
  86. */