Fixed description error
[libreriscv.git] / docs / pypowersim.mdwn
1 # Links
2
3 * <https://bugs.libre-soc.org/show_bug.cgi?id=758>
4 * [Pypowersim](https://git.libre-soc.org/?p=openpower-isa.git;a=blob;f=src/openpower/decoder/isa/pypowersim.py)
5 * [Media directory](https://git.libre-soc.org/?p=openpower-isa.git;a=tree;f=media;hb=HEAD)
6 * [MP3 test directory](https://git.libre-soc.org/?p=openpower-isa.git;a=tree;f=media/audio/mp3;hb=HEAD)
7
8 # Pypowersim Guide
9
10 These are multimedia tests intended to cover the inner loops of various
11 Audio/Video CODECs (such as MP3).
12
13 **Note:** There's no GUI, UART, or console. To check that the tests ran
14 succesfully, you need to dump the memory contents and inspect them.
15
16
17 ## Pypowersim - PowerISA Simulator
18
19 Pypowersim is a PowerISA simulator written and Python.
20 PowerISA assembler code is decoded by a given ISA class instance, and a
21 simulation is managed cycle by cycle, for instruction and memory debugging.
22 Use of QEMU as a co-simulator is also supported for verifying the binaries
23 run identically.
24
25 To find out about input arg information, run the script with "-h/--help" or
26 no arguments to get the help message:
27
28 * python3 openpower-isa/src/openpower/decoder/isa/pypowersim.py
29
30 ## Tests
31
32 ### About
33
34 The tests consist of running Pypowersim with several input arg's:
35
36 * ".gpr" text file for initialising the General Purpose (integer) Registers
37 * ".spr" text file for initialising the Special Purpose Registers
38 * Initialising the Program Counter
39 * Loading given binaries into specified memory locations
40 * Select which memory regions to dump to a file
41 * Select the executable to run
42
43 There are other options available (such as initialising the Floating Point
44 Registers).
45 for
46
47 ### Before running the tests!
48
49 **NOTE**: Is this correct?
50
51 As the SVP64 spec and Libre-SOC CPU is developing, the available opcodes
52 will grow. Make sure to update the auto-generated Python functions
53 simulating the instructions by calling:
54
55 * run "pywriter"
56
57 (This is an installed utility, so should be in your PATH)
58
59 ### Download audio data (**only need to do this once?**)
60
61 Call the Makefile inside "openpower-isa/media" to download the audio
62 samples:
63
64 * run "make wget"
65
66 ### Running both tests
67
68 Run the Makefile in the "openpower-isa/media" directory with "tests" arg:
69
70 * run "make tests"
71
72 All the debug will go to standard output, so you may wish to direct it to a
73 log file (the file will be **big**!).
74
75 To suppress verbose debug log, uncomment "#export SILENCELOG = 1" in the
76 Makefile.
77
78 ### Running "mp3_x" tests individually
79
80 Inside "openpower-isa/media" directory run:
81
82 * ./audio/mp3/mp3_0.sh 0 out
83
84 The "out" file will be created in the "media" directory. Change the name
85 if you don't want the second test to overwrite the results of the first.
86
87 ### Checking results
88
89 If you run both tests through the makefile, the shell script
90 automatically compares the input "sample0" file with the
91 generated "out" file.
92
93 For manual checking, you need to know where the "out" file is, and then
94 use the "cmp" program to compare byte by byte the sample and output
95 files.
96
97 * cmp out0 data/audio/mp3/mp3_0_data/samples0
98
99 No output indicates the files are identical.