diff --git a/src/InterpretedVirtualMachine.cpp b/src/InterpretedVirtualMachine.cpp
index 15a5049..c27efe6 100644
--- a/src/InterpretedVirtualMachine.cpp
+++ b/src/InterpretedVirtualMachine.cpp
@@ -74,8 +74,9 @@ namespace RandomX {
}
static void print(__m128d f) {
- uint64_t lo = *(((uint64_t*)&f) + 0);
- uint64_t hi = *(((uint64_t*)&f) + 1);
+ uint64_t hi, lo;
+ memcpy(&lo, &f, 8);
+ memcpy(&hi, (uint8_t*)&f + 8, 8);
std::cout << std::hex << std::setw(16) << std::setfill('0') << hi << '-' << std::hex << std::setw(16) << std::setfill('0') << lo << std::endl;
}
@@ -417,6 +418,9 @@ namespace RandomX {
_mm_store_pd(®.e[1].lo, e[1]);
_mm_store_pd(®.e[2].lo, e[2]);
_mm_store_pd(®.e[3].lo, e[3]);
+
+ printState(r, f, e, a);
+ std::cout << "=================================================" << std::endl;
}
static int getConditionRegister(int(®isterUsage)[8]) {
diff --git a/src/main.cpp b/src/main.cpp
index a28bc52..438e025 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -16,7 +16,7 @@ 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.
*/
-//#define TRACE
+#define TRACE
#include "InterpretedVirtualMachine.hpp"
#include "CompiledVirtualMachine.hpp"
#include "CompiledLightVirtualMachine.hpp"
@@ -179,11 +179,21 @@ void mine(RandomX::VirtualMachine* vm, std::atomic& atomicNonce, Atomi
for (int chain = 0; chain < RANDOMX_PROGRAM_COUNT - 1; ++chain) {
fillAes1Rx4((void*)hash, sizeof(RandomX::Program), vm->getProgramBuffer());
vm->initialize();
+ if (RandomX::trace) {
+ std::cout << "Program " << chain << std::endl;
+ std::cout << *vm->getProgramBuffer();
+ std::cout << "=================================================" << std::endl;
+ }
vm->execute();
vm->getResult(nullptr, 0, hash);
}
fillAes1Rx4((void*)hash, sizeof(RandomX::Program), vm->getProgramBuffer());
vm->initialize();
+ if (RandomX::trace) {
+ std::cout << "Program 7" << std::endl;
+ std::cout << *vm->getProgramBuffer();
+ std::cout << "=================================================" << std::endl;
+ }
vm->execute();
/*if (RandomX::trace) {
for (int j = 0; j < RandomX::ProgramLength; ++j) {
@@ -191,6 +201,7 @@ void mine(RandomX::VirtualMachine* vm, std::atomic& atomicNonce, Atomi
std::cout << std::hex << std::setw(16) << std::setfill('0') << res << std::endl;
}
}*/
+ dump((char*)scratchpad, RANDOMX_SCRATCHPAD_L3, "scratchpad");
vm->getResult(scratchpad, RANDOMX_SCRATCHPAD_L3, hash);
result.xorWith(hash);
if (RandomX::trace) {
@@ -211,7 +222,7 @@ int main(int argc, char** argv) {
readOption("--mine", argc, argv, miningMode);
readOption("--verify", argc, argv, verificationMode);
readIntOption("--threads", argc, argv, threadCount, 1);
- readIntOption("--nonces", argc, argv, programCount, 1000);
+ readIntOption("--nonces", argc, argv, programCount, 1);
readIntOption("--init", argc, argv, initThreadCount, 1);
readIntOption("--epoch", argc, argv, epoch, 0);
readOption("--largePages", argc, argv, largePages);