|
|
1.1 root 1: //
2: // nono
3: // Copyright (C) 2020 nono project
4: // Licensed under nono-license.txt
5: //
6:
7: // 実行系とデバッガで演算器を共有したい
8:
9: #pragma once
10:
11: // 命令フィールドの取り出し
12: #define m88100opf_D(x) (((x) >> 21) & 0x1f)
13: #define m88100opf_S1(x) (((x) >> 16) & 0x1f)
14: #define m88100opf_S2(x) ( (x) & 0x1f)
15: #define m88100opf_CR(x) (((x) >> 5) & 0x3f)
16: #define m88100opf_B5(x) m88100opf_D(x)
17: #define m88100opf_M5(x) m88100opf_D(x)
18: #define m88100opf_W5(x) m88100opf_CR(x)
19: #define m88100opf_O5(x) m88100opf_S2(x)
20: #define m88100opf_IMM16(x) ((x) & 0x0000ffffU)
21: #define m88100opf_VEC9(x) ((x) & 0x000001ffU)
1.1.1.2 root 22: // FP フィールド
23: #define m88100opf_FP_T1(x) (((x) >> 9) & 3)
24: #define m88100opf_FP_T2(x) (((x) >> 7) & 3)
25: #define m88100opf_FP_TD(x) (((x) >> 5) & 3)
1.1 root 26:
27: // cmp のやつ
1.1.1.5 ! root 28: inline uint32
1.1 root 29: acc_cmp(uint32 a, uint32 b)
30: {
31: uint32 rv = 0;
1.1.1.4 root 32: if (a >= b) rv |= (1U << 11);
33: if (a < b) rv |= (1U << 10);
34: if (a <= b) rv |= (1U << 9);
35: if (a > b) rv |= (1U << 8);
36: if ((int32)a >= (int32)b) rv |= (1U << 7);
37: if ((int32)a < (int32)b) rv |= (1U << 6);
38: if ((int32)a <= (int32)b) rv |= (1U << 5);
39: if ((int32)a > (int32)b) rv |= (1U << 4);
40: if ((int32)a != (int32)b) rv |= (1U << 3);
41: if ((int32)a == (int32)b) rv |= (1U << 2);
1.1 root 42: return rv;
43: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.