Skip to content

Commit 4713399

Browse files
committed
rsp-cxd4: updated to latest from mupen64plus/mupen64plus-rsp-cxd4@818c0e4
1 parent 4dbb8e6 commit 4713399

File tree

16 files changed

+551
-358
lines changed

16 files changed

+551
-358
lines changed

mupen64plus-rsp-cxd4/README.md

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ In the engineering make-up of the Nintendo 64 (original codename: Project Reali
1010

1111
Here, the entire MIPS R4000 instruction set was modified for very fast, exception-free processing flow, and operation definitions for each instruction do not fall within the scope of this section. Presented instead are layouts of the new instructions added to the scalar unit (those under `LWC2` and `SWC2`, even though they do interface with the vector unit) and the vector unit (essentially, any instruction under `COP2` whose mnemonic starts with a 'V'). Information of how pre-existing MIPS R4000 instructions were modified or which ones were removed is the adventure of the MIPS programmer to research.
1212

13-
V*_vd_, _vs_, _vt_[_element_] `/* exceptions: scalar divide reads */`
14-
<table border="1">
15-
<tr align="center"><td>COP2</td><td>element</td><td>vs1</td><td>vs2</td><td>vt</td><td>func</td></tr>
16-
<tr align="right"><td>010010</td><td>1----</td><td>-----</td><td>-----</td><td>-----</td><td>??????</td></tr>
17-
</table>
13+
`C2` _vd_, _vs_, _vt_[_element_] `/* exceptions: scalar divide reads */`
14+
15+
| COP2 | element | vs1 | vs2 | vt | func |
16+
| ------ |:-------:| ----- | ----- | ----- | ------ |
17+
|`010010`| `1eeee` |`ttttt`|`sssss`|`ddddd`|`??????`|
1818

1919
The major types of VU computational instructions are _multiply,_ _add,_ _select,_ _logical,_ and _divide._
2020

@@ -25,14 +25,13 @@ Multiply instructions are the most frequent and classifiable as follows:
2525
* If `(format & 0b100) == 0`, then the operation is single-precision (`VMUL*` and `VMAC*`).
2626
* If `(format & 0b100) != 0`, then the operation is double-precision (`VMUD*` and `VMAD*`).
2727

28-
<table border="1">
29-
<tr align="center"><td><i>op-code</i></td><td>Type</td></tr>
30-
<tr><td>0 0 a x x x</td><td>multiply</td></tr>
31-
<tr><td>0 1 x x x x</td><td>add</td></tr>
32-
<tr><td>1 0 0 x x x</td><td>select</td></tr>
33-
<tr><td>1 0 1 x x x</td><td>logical</td></tr>
34-
<tr><td>1 1 0 x x x</td><td>divide</td></tr>
35-
</table>
28+
|_op-code_| Type |
29+
| -------:| -------- |
30+
| `00axxx`| multiply |
31+
| `01xxxx`| add |
32+
| `100xxx`| select |
33+
| `101xxx`| logical |
34+
| `110xxx`| divide |
3635

3736
* `00 (VMULF)` Vector Multiply Signed Fractions
3837
* `01 (VMULU)` Vector Multiply Unsigned Fractions
@@ -101,25 +100,24 @@ Multiply instructions are the most frequent and classifiable as follows:
101100

102101
### RSP Vector Load Transfers
103102

104-
The VR-DMEM transaction instruction cycles are still processed by the scalar unit, not the vector unit. In the modern implementations accepted by most vector unit communications systems today, the transfer instructions are classifiable under five groups:
105-
<ol>
106-
<li>BV, SV, LV, DV</li>
107-
<li>PV, UV, XV, ZV</li>
108-
<li>HV, FV, AV</li>
109-
<li>QV, RV</li>
110-
<li>TV, WV</li>
111-
</ol>
103+
The VR-DMEM transaction instruction cycles are still processed by the scalar unit, not the vector unit. In the modern implementations accepted by most vector unit communications systems today, the transfer instructions are classifiable under five groups:
104+
105+
1. BV, SV, LV, DV
106+
2. PV, UV, XV, ZV
107+
3. HV, FV, AV
108+
4. QV, RV
109+
5. TV, WV
112110

113-
Not all of those instructions were implemented as of the time of the Nintendo 64's RCP, however. Additionally, their ordering in the opcode matrix was a little skewed to what is seen below. At this time, it is better to use only three categories of instructions:
111+
Not all of those instructions were implemented as of the time of the Nintendo 64's RCP, however. Additionally, their ordering in the opcode matrix was a little skewed to what is seen below. At this time, it is better to use only three categories of instructions:
114112
* _normal_: Anything under Group I or Group IV is normal type. Only the element must be aligned; `addr & 1` may resolve true.
115113
* _packed_: Anything under Group II or Group III. Useful for working with specially mapped data, such as pixels.
116114
* _transposed_: `LTV`, *LTWV,* `STV`, and `SWV` can be found in heaps of 16 instructions, all dedicated to matrix transposition through eight diagonals of halfword elements.
117115

118-
LWC2&#8;_vt_[_element_], _offset_(_base_)
119-
<table border="1">
120-
<tr align="center"><td>LWC2</td><td>base</td><td>vt</td><td>rd</td><td>element</td><td>offset</td></tr>
121-
<tr align="right"><td>110010</td><td>-----</td><td>-----</td><td>?????</td><td>----</td><td>-------</td></tr>
122-
</table>
116+
`LWC2` _vt_[_element_], _offset_(_base_)
117+
118+
| LWC2 | base | vt | rd | element | offset |
119+
| ------ | ----- | ----- | ----- |:-------:| -------- |
120+
|`110010`|`sssss`|`ttttt`|`?????`| `eeee` | `Xxxxxxx`|
123121

124122
* `00 (LBV)` Load Byte to Vector Unit
125123
* `01 (LSV)` Load Shortword to Vector Unit
@@ -138,10 +136,11 @@ LWC2&#8;_vt_[_element_], _offset_(_base_)
138136
* `16 reserved`
139137
* `17 reserved`
140138

141-
<table border="1">
142-
<tr align="center"><td>SWC2</td><td>base</td><td>vt</td><td>rd</td><td>element</td><td>offset</td></tr>
143-
<tr align="right"><td>111010</td><td>-----</td><td>-----</td><td>?????</td><td>----</td><td>-------</td></tr>
144-
</table>
139+
`SWC2` _vt_[_element_], _offset_(_base_)
140+
141+
| SWC2 | base | vt | rd | element | offset |
142+
| ------ | ----- | ----- | ----- |:-------:| -------- |
143+
|`111010`|`sssss`|`ttttt`|`?????`| `eeee` | `Xxxxxxx`|
145144

146145
* `00 (SBV)` Store Byte from Vector Unit
147146
* `01 (SSV)` Store Shortword from Vector Unit

mupen64plus-rsp-cxd4/make_w32.cmd

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
@ECHO OFF
22
TITLE MinGW Compiler Suite Invocation
33

4-
set MinGW=C:/MinGW
5-
REM set rsp=%USERPROFILE%/rsp
4+
set MinGW=C:\MinGW
5+
REM set rsp=%USERPROFILE%\rsp
66
set rsp=%CD%
7-
set obj=%rsp%/obj
7+
set obj=%rsp%\obj
88

99
set OBJ_LIST=^
10-
%obj%/module.o ^
11-
%obj%/su.o ^
12-
%obj%/vu/vu.o ^
13-
%obj%/vu/multiply.o ^
14-
%obj%/vu/add.o ^
15-
%obj%/vu/select.o ^
16-
%obj%/vu/logical.o ^
17-
%obj%/vu/divide.o
10+
%obj%\module.o ^
11+
%obj%\su.o ^
12+
%obj%\vu\vu.o ^
13+
%obj%\vu\multiply.o ^
14+
%obj%\vu\add.o ^
15+
%obj%\vu\select.o ^
16+
%obj%\vu\logical.o ^
17+
%obj%\vu\divide.o
1818

1919
set FLAGS_ANSI=-O3^
2020
-DPLUGIN_API_VERSION=0x0101^
@@ -30,38 +30,38 @@ set FLAGS_x86=-O3^
3030
-mstackrealign^
3131
-Wall^
3232
-pedantic
33-
set C_FLAGS=%FLAGS_X86%
33+
set C_FLAGS=%FLAGS_x86%
3434

3535
if not exist obj (
3636
mkdir obj
3737
cd obj
3838
mkdir vu
3939
)
40-
cd %MinGW%/bin
40+
cd %MinGW%\bin
4141

4242
ECHO Compiling C source code...
43-
cc -S %C_FLAGS% -o %obj%/module.asm %rsp%/module.c
44-
cc -S %C_FLAGS% -o %obj%/su.asm %rsp%/su.c
45-
cc -S %C_FLAGS% -o %obj%/vu/vu.asm %rsp%/vu/vu.c
46-
cc -S %C_FLAGS% -o %obj%/vu/multiply.asm %rsp%/vu/multiply.c
47-
cc -S %C_FLAGS% -o %obj%/vu/add.asm %rsp%/vu/add.c
48-
cc -S %C_FLAGS% -o %obj%/vu/select.asm %rsp%/vu/select.c
49-
cc -S %C_FLAGS% -o %obj%/vu/logical.asm %rsp%/vu/logical.c
50-
cc -S %C_FLAGS% -o %obj%/vu/divide.asm %rsp%/vu/divide.c
43+
cc -S %C_FLAGS% -o %obj%\module.asm %rsp%\module.c
44+
cc -S %C_FLAGS% -o %obj%\su.asm %rsp%\su.c
45+
cc -S %C_FLAGS% -o %obj%\vu\vu.asm %rsp%\vu\vu.c
46+
cc -S %C_FLAGS% -o %obj%\vu\multiply.asm %rsp%\vu\multiply.c
47+
cc -S %C_FLAGS% -o %obj%\vu\add.asm %rsp%\vu\add.c
48+
cc -S %C_FLAGS% -o %obj%\vu\select.asm %rsp%\vu\select.c
49+
cc -S %C_FLAGS% -o %obj%\vu\logical.asm %rsp%\vu\logical.c
50+
cc -S %C_FLAGS% -o %obj%\vu\divide.asm %rsp%\vu\divide.c
5151
ECHO.
5252

5353
ECHO Assembling compiled sources...
54-
as --statistics -o %obj%/module.o %obj%/module.asm
55-
as --statistics -o %obj%/su.o %obj%/su.asm
56-
as --statistics -o %obj%/vu/vu.o %obj%/vu/vu.asm
57-
as -o %obj%/vu/multiply.o %obj%/vu/multiply.asm
58-
as -o %obj%/vu/add.o %obj%/vu/add.asm
59-
as -o %obj%/vu/select.o %obj%/vu/select.asm
60-
as -o %obj%/vu/logical.o %obj%/vu/logical.asm
61-
as -o %obj%/vu/divide.o %obj%/vu/divide.asm
54+
as --statistics -o %obj%\module.o %obj%\module.asm
55+
as --statistics -o %obj%\su.o %obj%\su.asm
56+
as --statistics -o %obj%\vu\vu.o %obj%\vu\vu.asm
57+
as -o %obj%\vu\multiply.o %obj%\vu\multiply.asm
58+
as -o %obj%\vu\add.o %obj%\vu\add.asm
59+
as -o %obj%\vu\select.o %obj%\vu\select.asm
60+
as -o %obj%\vu\logical.o %obj%\vu\logical.asm
61+
as -o %obj%\vu\divide.o %obj%\vu\divide.asm
6262
ECHO.
6363

6464
ECHO Linking assembled object files...
65-
ld --shared -e _DllMain@12 -o %obj%/rspdebug.dll %OBJ_LIST% -lkernel32
65+
ld --shared -e _DllMain@12 -o %obj%\rspdebug.dll %OBJ_LIST% %MinGW%\lib\libkernel32.a
6666
strip -o %obj%/rsp.dll %obj%/rspdebug.dll
6767
PAUSE

mupen64plus-rsp-cxd4/make_w64.cmd

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
@ECHO OFF
2+
TITLE MinGW Compiler Suite Invocation
3+
4+
set version=x86_64-5.1.0-win32-seh-rt_v4-rev0
5+
set MinGW="C:\Program Files\mingw-w64\%version%\mingw64"
6+
REM set rsp=%USERPROFILE%\rsp
7+
set rsp=%CD%
8+
set obj=%rsp%\obj
9+
10+
set OBJ_LIST=^
11+
%obj%\module.o ^
12+
%obj%\su.o ^
13+
%obj%\vu\vu.o ^
14+
%obj%\vu\multiply.o ^
15+
%obj%\vu\add.o ^
16+
%obj%\vu\select.o ^
17+
%obj%\vu\logical.o ^
18+
%obj%\vu\divide.o ^
19+
%MinGW%\x86_64-w64-mingw32\lib\libkernel32.a
20+
21+
set FLAGS_ANSI=-Wall^
22+
-DPLUGIN_API_VERSION=0x0101^
23+
-march=native^
24+
-mstackrealign^
25+
-pedantic
26+
set FLAGS_x86=-Wall^
27+
-masm=intel^
28+
-DPLUGIN_API_VERSION=0x0101^
29+
-DARCH_MIN_SSE2^
30+
-march=native^
31+
-mstackrealign^
32+
-pedantic
33+
set C_FLAGS=%FLAGS_x86%
34+
35+
if not exist obj (
36+
mkdir obj
37+
cd obj
38+
mkdir vu
39+
)
40+
cd %MinGW%\bin
41+
42+
ECHO Compiling C source code...
43+
%MinGW%\bin\gcc.exe -S -Os %C_FLAGS% -o %obj%\module.asm %rsp%\module.c
44+
%MinGW%\bin\gcc.exe -S -O3 %C_FLAGS% -o %obj%\su.asm %rsp%\su.c
45+
%MinGW%\bin\gcc.exe -S -O3 %C_FLAGS% -o %obj%\vu\vu.asm %rsp%\vu\vu.c
46+
%MinGW%\bin\gcc.exe -S -O3 %C_FLAGS% -o %obj%\vu\multiply.asm %rsp%\vu\multiply.c
47+
%MinGW%\bin\gcc.exe -S -O3 %C_FLAGS% -o %obj%\vu\add.asm %rsp%\vu\add.c
48+
%MinGW%\bin\gcc.exe -S -O3 %C_FLAGS% -o %obj%\vu\select.asm %rsp%\vu\select.c
49+
%MinGW%\bin\gcc.exe -S -O3 %C_FLAGS% -o %obj%\vu\logical.asm %rsp%\vu\logical.c
50+
%MinGW%\bin\gcc.exe -S -O3 %C_FLAGS% -o %obj%\vu\divide.asm %rsp%\vu\divide.c
51+
ECHO.
52+
53+
ECHO Assembling compiled sources...
54+
%MinGW%\bin\as.exe -o %obj%\module.o %obj%\module.asm
55+
%MinGW%\bin\as.exe -o %obj%\su.o %obj%\su.asm
56+
%MinGW%\bin\as.exe -o %obj%\vu\vu.o %obj%\vu\vu.asm
57+
%MinGW%\bin\as.exe -o %obj%\vu\multiply.o %obj%\vu\multiply.asm
58+
%MinGW%\bin\as.exe -o %obj%\vu\add.o %obj%\vu\add.asm
59+
%MinGW%\bin\as.exe -o %obj%\vu\select.o %obj%\vu\select.asm
60+
%MinGW%\bin\as.exe -o %obj%\vu\logical.o %obj%\vu\logical.asm
61+
%MinGW%\bin\as.exe -o %obj%\vu\divide.o %obj%\vu\divide.asm
62+
ECHO.
63+
64+
ECHO Linking assembled object files...
65+
%MinGW%\bin\ld.exe --shared -e DllMain -o %obj%\rspdebug.dll %OBJ_LIST%
66+
%MinGW%\bin\strip.exe -o %obj%/rsp.dll %obj%/rspdebug.dll
67+
PAUSE

mupen64plus-rsp-cxd4/module.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#define _MODULE_H_
1818

1919
#include <stdio.h>
20-
2120
#include "rsp.h"
2221

2322
#define CFG_FILE "rsp_conf.bin"

0 commit comments

Comments
 (0)