4 |
<table border=0 width=100% bgcolor="#d0d0d0"><tr> |
<table border=0 width=100% bgcolor="#d0d0d0"><tr> |
5 |
<td width=100% align=center valign=center><table border=0 width=100%><tr> |
<td width=100% align=center valign=center><table border=0 width=100%><tr> |
6 |
<td align="left" valign=center bgcolor="#d0efff"><font color="#6060e0" size="6"> |
<td align="left" valign=center bgcolor="#d0efff"><font color="#6060e0" size="6"> |
7 |
<b>Gavare's eXperimental Emulator:</b></font><br> |
<b>GXemul:</b></font> |
8 |
<font color="#000000" size="6"><b>Experimenting with GXemul</b> |
<font color="#000000" size="6"><b>Experimenting with GXemul</b> |
9 |
</font></td></tr></table></td></tr></table><p> |
</font></td></tr></table></td></tr></table><p> |
10 |
|
|
11 |
<!-- |
<!-- |
12 |
|
|
13 |
$Id: experiments.html,v 1.105 2006/12/30 13:30:50 debug Exp $ |
$Id: experiments.html,v 1.112 2007/06/23 16:59:35 debug Exp $ |
14 |
|
|
15 |
Copyright (C) 2003-2007 Anders Gavare. All rights reserved. |
Copyright (C) 2003-2007 Anders Gavare. All rights reserved. |
16 |
|
|
65 |
|
|
66 |
<p> |
<p> |
67 |
<ul> |
<ul> |
68 |
<li>Build and install a cross-compiler for your chosen target. |
<li>Build and install a cross-compiler for your chosen target, |
69 |
GCC is usually a good compiler choice, because it is portable |
e.g. <tt>mips64-unknown-elf</tt>. |
70 |
and in wide-spread use. (Other compilers should work too.) |
<a href="http://gcc.gnu.org/">GCC</a> is usually a good compiler |
71 |
|
choice, because it is portable and in wide-spread use. |
72 |
|
(Other compilers should work too.) |
73 |
<p> |
<p> |
74 |
<li>Compile the Hello World demo program for your chosen target, and run |
<li>Compile the Hello World demo program for your chosen target, and run |
75 |
it in the emulator. |
it in the emulator. |
80 |
subdirectory. The README files in the demo directories have several |
subdirectory. The README files in the demo directories have several |
81 |
examples of how the demo programs can be built. |
examples of how the demo programs can be built. |
82 |
|
|
83 |
|
<p>Once you have tried running the Hello World program from the command |
84 |
|
line, e.g.<pre> |
85 |
|
<b>gxemul -E testmips hello_mips</b> |
86 |
|
</pre> |
87 |
|
you can experiment with adding one or more of the following command line |
88 |
|
options: |
89 |
|
|
90 |
|
<p><ul> |
91 |
|
<li><b><tt>-t</tt></b>, to show a function call trace, |
92 |
|
<li><b><tt>-i</tt></b>, to show instruction disassembly (for each |
93 |
|
executed instruction), |
94 |
|
<li>and finally <b><tt>-V</tt></b> to start the emulator in a "paused" |
95 |
|
state. |
96 |
|
</ul> |
97 |
|
|
98 |
|
<p>If you start the emulator in the paused state, or if you press CTRL-C |
99 |
|
during normal execution, you will end up with a <tt><b>GXemul></b></tt> |
100 |
|
prompt. This is the built-in debugger. |
101 |
|
|
102 |
|
<p>Using the built-in debugger, you can single step (<tt><b>s</b></tt>), |
103 |
|
show the current contents of the emulated registers (<tt><b>r</b></tt>), |
104 |
|
turn on/off the function call trace mode (<tt><b>trace</b></tt>), or |
105 |
|
continue at full speed (<tt><b>c</b></tt>). Typing <tt><b>quit</b></tt> |
106 |
|
exits the emulator. |
107 |
|
|
108 |
<p>Hopefully this is enough to get you inspired. :-) |
<p>Hopefully this is enough to get you inspired. :-) |
109 |
|
|
110 |
|
|
257 |
<tr> |
<tr> |
258 |
<td align="left" valign="top"><tt>0x00d0</tt></td> |
<td align="left" valign="top"><tt>0x00d0</tt></td> |
259 |
<td align="left" valign="top">Read: <b><tt>ncycles()</tt></b>. |
<td align="left" valign="top">Read: <b><tt>ncycles()</tt></b>. |
260 |
Returns approximately the number of cycles executed. |
Returns approximately the number of cycles executed on |
261 |
Note: this value is not updated for every instruction, |
this CPU. Note: this value is not updated for every instruction, |
262 |
so it cannot be used for small measurements.</td> |
so it cannot be used for small measurements.</td> |
263 |
</tr> |
</tr> |
264 |
</table> |
</table> |
441 |
</td> |
</td> |
442 |
</tr> |
</tr> |
443 |
|
|
444 |
|
<tr height="15"> |
445 |
|
<td height="15"> </td> |
446 |
|
</tr> |
447 |
|
|
448 |
|
<tr> |
449 |
|
<td align="left" valign="top"> |
450 |
|
<a name="expdevices_irqc"><b><tt>irqc</tt>:</b></a> |
451 |
|
<p>An Interrupt Controller. (Note: Not used for the MIPS test machine.) |
452 |
|
<p>Source code: <font color="#0000f0"><tt>src/devices/dev_irqc.c</tt></font> |
453 |
|
<p>Include file: <font color="#0000f0"><tt>dev_irqc.h</tt></font> |
454 |
|
<br>Default physical address:  <font color="#0000f0">0x16000000</font> |
455 |
|
</td> |
456 |
|
<td></td> |
457 |
|
<td align="left" valign="top"> |
458 |
|
<table border="0"> |
459 |
|
<tr> |
460 |
|
<td align="left" valign="top"><i><u>Offset:</u></i> </td> |
461 |
|
<td align="left" valign="top"><i><u>Effect:</u></i></td> |
462 |
|
</tr> |
463 |
|
<tr> |
464 |
|
<td align="left" valign="top"><tt>0x0</tt></td> |
465 |
|
<td align="left" valign="top">Read: IRQ status as a 32-bit word, one bit per interrupt source.</td> |
466 |
|
</tr> |
467 |
|
<tr> |
468 |
|
<td align="left" valign="top"><tt>0x4</tt></td> |
469 |
|
<td align="left" valign="top">Write: Mask one interrupt source. Value should be an integer 0..31.</td> |
470 |
|
</tr> |
471 |
|
<tr> |
472 |
|
<td align="left" valign="top"><tt>0x8</tt></td> |
473 |
|
<td align="left" valign="top">Write: Unmask one interrupt source. Value should be an integer 0..31.</td> |
474 |
|
</tr> |
475 |
|
</table> |
476 |
|
</td> |
477 |
|
</tr> |
478 |
|
|
479 |
</table></center> |
</table></center> |
480 |
|
|
481 |
<p> |
<p>The include files for the test machine devices are found in |
482 |
While these devices may resemble real-world hardware, they are |
<a href="../src/include/testmachine/"><tt>src/include/testmachine/</tt></a>. |
483 |
|
|
484 |
|
<p>While these devices may resemble real-world hardware, they are |
485 |
intentionally made simpler to use. (An exception is the framebuffer; |
intentionally made simpler to use. (An exception is the framebuffer; |
486 |
some machines actually have simple linear framebuffers like this.) |
some machines actually have simple linear framebuffers like this.) |
487 |
|
|
491 |
<tt>0xffffffff90000000</tt> too, but devices should usually be accessed in |
<tt>0xffffffff90000000</tt> too, but devices should usually be accessed in |
492 |
a non-cached manner.) |
a non-cached manner.) |
493 |
|
|
494 |
<p>When using the Alpha, ARM, or PPC test machines, the addresses are |
<p>When using the ARM or PPC test machines, the addresses are |
495 |
<tt>0x10000000</tt>, <tt>0x11000000</tt> etc., so no need to add any |
<tt>0x10000000</tt>, <tt>0x11000000</tt> etc., so no need to add any |
496 |
virtual displacement. |
virtual displacement. |
497 |
|
|
525 |
<p><center> |
<p><center> |
526 |
<table border="1"> |
<table border="1"> |
527 |
<tr><td align="center"> |
<tr><td align="center"> |
528 |
<b><tt>testmips</tt></b> |
<b><tt>testmips</tt></b> (as native MIPS interrupts) |
529 |
</td></tr> |
</td></tr> |
530 |
<tr><td> |
<tr><td> |
531 |
<table border="0"> |
<table border="0"> |
544 |
</table> |
</table> |
545 |
</td></tr> |
</td></tr> |
546 |
</table> |
</table> |
547 |
|
|
548 |
|
<p><table border="1"> |
549 |
|
<tr><td align="center"> |
550 |
|
<b><tt>testarm</tt> and others</b> (via the <tt>irqc</tt> device) |
551 |
|
</td></tr> |
552 |
|
<tr><td> |
553 |
|
<table border="0"> |
554 |
|
<tr><td align="center">IRQ:</td><td> </td> |
555 |
|
<td>Used for:</td></tr> |
556 |
|
<tr><td align="center">6</td><td></td> |
557 |
|
<td><tt>mp</tt> (inter-processor interrupts)</td></tr> |
558 |
|
<tr><td align="center">4</td><td></td> |
559 |
|
<td><tt>rtc</tt></td></tr> |
560 |
|
<tr><td align="center">3</td><td></td> |
561 |
|
<td><tt>ether</tt></td></tr> |
562 |
|
<tr><td align="center">2</td><td></td> |
563 |
|
<td><tt>cons</tt></td></tr> |
564 |
|
</table> |
565 |
|
</td></tr> |
566 |
|
</table> |
567 |
</center> |
</center> |
568 |
|
|
|
<p>Other machines: TODO |
|
569 |
|
|
570 |
|
|
571 |
<p><br> |
<p><br> |