forked from laanwj/decuda
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLogic.py
More file actions
45 lines (45 loc) · 2.28 KB
/
Logic.py
File metadata and controls
45 lines (45 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Logic table for G80 architecture, all condition codes against all
# flag combinations. This was evaluated on actual hardware.
# The flags are assigned to values like this:
# 1 Z zero flag
# 2 S sign flag
# 4 C carry flag
# 8 O overflow flag
ZF = 1
SF = 2
CF = 4
OF = 8
#
# fl 0 1 2 3 4 5 6 7 8 9 a b c d e f
l = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], # 00 fl
[0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1], # 01 lt
[0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0], # 02 eq
[0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0], # 03 le
[1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0], # 04 gt
[1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], # 05 ne (also nz)
[1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1], # 06 ge
[1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0], # 07 leg
[0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1], # 08 nan
[0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0], # 09 ltu
[0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], # 0a equ (also zf)
[0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 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