re-reserve bit in setvl -- needed for extending registers:
[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 binaries are decoded by a given ISA class instance.
21 SVP64 binaries are also supported. Simulation is managed cycle by cycle,
22 for instruction and memory debugging.
23 Use of QEMU as a co-simulator is also supported for verifying the
24 binaries run identically.
25
26 To find out about input arg information, run the script with "-h/--help"
27 or no arguments to get the help message:
28
29 * python3 openpower-isa/src/openpower/decoder/isa/pypowersim.py
30
31 ## Tests
32
33 ### About
34
35 The tests consist of running Pypowersim with several input arg's:
36
37 * ".gpr" text file for initialising the General Purpose (integer) Registers
38 * ".spr" text file for initialising the Special Purpose Registers
39 * Initialising the Program Counter
40 * Loading given binaries into specified memory locations
41 * Select which memory regions to dump to a file
42 * Select the executable to run
43
44 There are other options available (such as initialising the Floating Point
45 Registers).
46 for
47
48 ### Before running the tests!
49
50 **NOTE**: Is this correct?
51
52 As the SVP64 spec and Libre-SOC CPU is developing, the available opcodes
53 will grow. Make sure to update the auto-generated Python functions
54 simulating the instructions by calling:
55
56 * run "pywriter"
57
58 (This is an installed utility, so should be in your PATH)
59
60 ### Download audio data (**only need to do this once?**)
61
62 Call the Makefile inside "openpower-isa/media" to download the audio
63 samples:
64
65 * run "make wget"
66
67 ### Running both tests
68
69 Run the Makefile in the "openpower-isa/media" directory with "tests" arg:
70
71 * run "make tests"
72
73 All the debug will go to standard output, so you may wish to direct it to a
74 log file (the file will be **big**!).
75
76 To suppress verbose debug log, uncomment "#export SILENCELOG = 1" in the
77 Makefile.
78
79 ### Running "mp3_x" tests individually
80
81 Inside "openpower-isa/media" directory run:
82
83 * ./audio/mp3/mp3_0.sh 0 out
84
85 The "out" file will be created in the "media" directory. Change the name
86 if you don't want the second test to overwrite the results of the first.
87
88 ### Checking results
89
90 If you run both tests through the makefile, the shell script
91 automatically compares the input "sample0" file with the
92 generated "out" file.
93
94 For manual checking, you need to know where the "out" file is, and then
95 use the "cmp" program to compare byte by byte the sample and output
96 files.
97
98 * cmp out0 data/audio/mp3/mp3_0_data/samples0
99
100 No output indicates the files are identical.