Project

General

Profile

Getting Started with x86 » History » Revision 39

Revision 38 (Alexander Kamkin, 04/06/2017 04:57 PM) → Revision 39/87 (Alexander Kamkin, 04/06/2017 04:58 PM)

h1. Getting Started with x86 

 {{toc}} 

 h2. Prerequisite 

 MicroTESK should be [[Installation Guide|installed]]. 

 h2. Demo Specifications 

 Specifications of the x86 (8086) instruction set architecture (ISA) can be found in "$MICROTESK_HOME/arch/demo/x86/model/x86.nml":http://forge.ispras.ru/projects/microtesk/repository/entry/trunk/microtesk/src/main/arch/demo/x86/model/x86.nml. 

 Each instruction is described in [[nML Language Reference|nML]] by means of the following constructs (_mov r16/r16_ is taken as an example): 

 ## the signature 
 <pre>op mov_r1616 (dst: GPR16, src: GPR16)</pre> 
 ## the assembly format 
 <pre>syntax = format("mov %s, %s", dst.syntax, src.syntax)</pre> 
 ## the binary encoding 
 <pre>image = format("1000101111%s%s", dst.image, src.image)</pre> 
 ## the semantics 
 <pre> 
   action = { 
     dst = src; 
     ... 
   } 
 </pre> 

 To compile the ISA model, run the following command: 
 <pre>$MICROTESK_HOME/bin/compile.sh x86.nml</pre> 

 h2. Demo Templates 

 Test templates for the x86 ISA can be found in "$MICROTESK_HOME/arch/demo/x86/templates":http://forge.ispras.ru/projects/microtesk/repository/entry/trunk/microtesk/src/main/arch/demo/x86/templates. 

 The directory contains a number of demo templates including the following ones: 

 {background:#f6fcff}. | "block.rb":http://forge.ispras.ru/projects/microtesk/repository/entry/trunk/microtesk/src/main/arch/demo/x86/templates/block.rb | demonstrates how to use block constructs | 
                       | "block_random.rb":http://forge.ispras.ru/projects/microtesk/repository/entry/trunk/microtesk/src/main/arch/demo/x86/templates/block_random.rb | demonstrates how to create randomized instruction sequences using block constructs | 
 {background:#f6fcff}. | "euclid.rb":http://forge.ispras.ru/projects/microtesk/repository/entry/trunk/microtesk/src/main/arch/demo/x86/templates/euclid.rb | demonstrates test program simulation to predict the resulting microprocessor state | 
                       | "random.rb":http://forge.ispras.ru/projects/microtesk/repository/entry/trunk/microtesk/src/main/arch/demo/x86/templates/random.rb | demonstrates how to randomize tests by using biased values, intervals, arrays, and shows usage of probability distributions | 
 {background:#f6fcff}. | "random_immediate.rb":http://forge.ispras.ru/projects/microtesk/repository/entry/trunk/microtesk/src/main/arch/demo/x86/templates/random_immediate.rb | shows randomization of immediate values | 
                       | "random_registers.rb":http://forge.ispras.ru/projects/microtesk/repository/entry/trunk/microtesk/src/main/arch/demo/x86/templates/random_registers.rb | shows randomization of registers (dependencies) | 

 To run template processing use the following command: 
 <pre>$MICROTESK_HOME/bin/generate.sh x86 block.rb --code-file-prefix block --code-file-extension -v</pre> 
 When the processing is finished, files with the resulting assembly code can be found in @$MICROTESK_HOME@ 

 For more information, see MicroTESK wiki: http://forge.ispras.ru/projects/microtesk/wiki/Template_Description_Language