add initial state of registers

This commit is contained in:
moneroexamples 2019-06-05 16:46:24 +08:00
parent dcc4641157
commit 993bc23b8c
2 changed files with 39 additions and 17 deletions

View File

@ -1462,6 +1462,7 @@ show_randomx(uint64_t _blk_height)
for (auto& rxc: rx_code) for (auto& rxc: rx_code)
{ {
mstch::map rx_map = rxc.get_mstch(); mstch::map rx_map = rxc.get_mstch();
rx_map["first_program"] = (code_idx == 1);
rx_map["rx_code_idx"] = code_idx++; rx_map["rx_code_idx"] = code_idx++;
rx_code_str.push_back(rx_map); rx_code_str.push_back(rx_map);
} }

View File

@ -4,18 +4,54 @@
<h4> <h4>
Eight RandomX and correspoding assembly x86 programs used Eight RandomX and correspoding assembly x86 programs used
to calcualte the PoW hash of the block.<br/> to calcualte the PoW hash of the block.<br/>
The RandomX programs are executed on RandomX virtual machine. <br/> The RandomX programs are executed on RandomX virtual machine.
Initial values of the integer and floating point registers in the machine are also provided.
</h4> </h4>
<h5>
Values of the integer and floating point registers
are also provided.
</h5>
{{#rx_codes}} {{#rx_codes}}
<h3> Program #{{rx_code_idx}}</h3> <h3> Program #{{rx_code_idx}}</h3>
<table class="center" style="width: 60%; margin-top:10px"> <table class="center" style="width: 60%; margin-top:10px">
{{#first_program}}
<tr>
<td colspan="2">
Integer registers R:<br/><br/>
r0: 0x0000000000000000, r1: 0x0000000000000000, r2: 0x0000000000000000, r3: 0x0000000000000000<br/>
r4: 0x0000000000000000, r5: 0x0000000000000000, r6: 0x0000000000000000, r7: 0x0000000000000000<br/><br/>
Floating point registers F {lo, hi}:<br/><br/>
Initial values not accessible<br/><br/>
Floating point registers E {lo, hi}:<br/><br/>
Initial values not accessible<br/><br/>
Floating point registers A {lo, hi}:<br/><br/>
a0: {{a0}}, a1: {{a1}}<br/>
a2: {{a2}}, a3: {{a3}}<br/><br/>
{{/first_program}}
</td>
</tr>
<tr>
<td style="text-align: left;">RandomX code</td>
<td style="text-align: left;">ASM x86</td>
</tr>
<tr>
<td style="text-align: left;vertical-align: top;">
<pre>{{rx_code}}</pre>
</td>
<td style="text-align: left;vertical-align: top;">
<pre>{{rx_code_asm}}</pre>
</td>
</tr>
<tr> <tr>
<td colspan="2"> <td colspan="2">
Integer registers R:<br/><br/> Integer registers R:<br/><br/>
r0: {{r0}}, r1: {{r1}}, r2: {{r2}}, r3: {{r3}}<br/> r0: {{r0}}, r1: {{r1}}, r2: {{r2}}, r3: {{r3}}<br/>
r4: {{r4}}, r5: {{r5}}, r6: {{r6}}, r7: {{r7}}<br/><br/> r4: {{r4}}, r5: {{r5}}, r6: {{r6}}, r7: {{r7}}<br/><br/>
Floating point registers F {lo, hi}:<br/><br/> Floating point registers F {lo, hi}:<br/><br/>
f0: {{f0}}, f1: {{f1}}<br/> f0: {{f0}}, f1: {{f1}}<br/>
f2: {{f2}}, f3: {{f3}}<br/><br/> f2: {{f2}}, f3: {{f3}}<br/><br/>
@ -29,21 +65,6 @@
a2: {{a2}}, a3: {{a3}}<br/><br/> a2: {{a2}}, a3: {{a3}}<br/><br/>
<br/> <br/>
</td> </td>
</tr>
<tr>
<td style="text-align: left;">RandomX code</td>
<td style="text-align: left;">ASM x86</td>
</tr>
<tr>
<td colspan="2"></td>
</tr>
<tr>
<td style="text-align: left;vertical-align: top;">
<pre>{{rx_code}}</pre>
</td>
<td style="text-align: left;vertical-align: top;">
<pre>{{rx_code_asm}}</pre>
</td>
</tr> </tr>
</table> </table>
{{/rx_codes}} {{/rx_codes}}