Project

General

Profile

Getting Started with x86 » History » Version 24

Alexander Kamkin, 04/06/2017 04:36 PM

1 18 Alexander Kamkin
h1. Getting Started with x86
2 1 Mikhail Chupilko
3
{{toc}}
4
5
h2. Prerequisite
6
7 5 Alexander Kamkin
MicroTESK should be installed (see [[Installation Guide]]).
8 1 Mikhail Chupilko
9 13 Alexander Kamkin
h2. Demo Specifications
10 1 Mikhail Chupilko
11 16 Alexander Kamkin
Specifications of the x86 (8086) instruction set architecture (ISA) can be found in @$MICROTESK_HOME/arch/demo/x86/model@.
12 1 Mikhail Chupilko
13 8 Alexander Kamkin
Each instruction is described in nML (see [[nML Language Reference]]) by means of the following constructs (register move instruction is taken as an example):
14
15 10 Alexander Kamkin
## the signature
16 8 Alexander Kamkin
<pre>op mov_r1616 (dst: GPR16, src: GPR16)</pre>
17 10 Alexander Kamkin
## the assembly format
18 8 Alexander Kamkin
<pre>syntax = format("mov %s, %s", dst.syntax, src.syntax)</pre>
19 10 Alexander Kamkin
## the binary encoding
20 8 Alexander Kamkin
<pre>image = format("1000101111%s%s", dst.image, src.image)</pre>
21 14 Alexander Kamkin
## the semantics
22 1 Mikhail Chupilko
<pre>
23
  action = {
24
    dst = src;
25 9 Alexander Kamkin
    ...
26 1 Mikhail Chupilko
  }
27
</pre>
28
29 24 Alexander Kamkin
Here are the full specifications (repository):
30
http://forge.ispras.ru/projects/microtesk/repository/entry/trunk/microtesk/src/main/arch/demo/x86/model/x86.nml
31
32 11 Alexander Kamkin
To compile the ISA model, run the following command:
33 8 Alexander Kamkin
<pre>$MICROTESK_HOME/bin/compile.sh x86.nml</pre>
34 1 Mikhail Chupilko
35 17 Alexander Kamkin
h2. Demo Templates
36 1 Mikhail Chupilko
37 21 Alexander Kamkin
Test templates for the x86 ISA can be found in @$MICROTESK_HOME/arch/demo/x86/templates@.
38 1 Mikhail Chupilko
39 22 Alexander Kamkin
By now, the directory contains six demo templates:
40 17 Alexander Kamkin
41 23 Alexander Kamkin
{background:#f6fcff}. | @block.rb@            | shows usage of test generation blocks |
42 20 Alexander Kamkin
                      | @block_random.rb@     | shows creation of the randomized instruction sequences using block constructs |
43
{background:#f6fcff}. | @euclid.rb@           | shows simulation of a test program to predict the resulting state of the CPU under test |
44
                      | @random.rb@           | shows generation of the randomized test cases by using biased values, intervals, arrays and distributions |
45 21 Alexander Kamkin
{background:#f6fcff}. | @random_immediate.rb@ | shows randomization of immediate values |
46 20 Alexander Kamkin
                      | @random_registers.rb@ | shows dependent instructions with random registers |
47 1 Mikhail Chupilko
48
To run template processing use the following command:
49
<pre>$MICROTESK_HOME/bin/generate.sh x86 block.rb --code-file-prefix block --code-file-extension -v</pre>
50
When the processing is finished, files with the resulting assembly code can be found in @$MICROTESK_HOME@
51
52
For more information, see MicroTESK wiki: http://forge.ispras.ru/projects/microtesk/wiki/Template_Description_Language