Annotation of nono/m88xx0/m88100acc.h, revision 1.1

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)
        !            22: 
        !            23: // cmp のやつ
        !            24: static inline uint32
        !            25: acc_cmp(uint32 a, uint32 b)
        !            26: {
        !            27:        uint32 rv = 0;
        !            28:        if (a >= b) rv |= (1 << 11);
        !            29:        if (a <  b) rv |= (1 << 10);
        !            30:        if (a <= b) rv |= (1 << 9);
        !            31:        if (a >  b) rv |= (1 << 8);
        !            32:        if ((int32)a >= (int32)b) rv |= (1 << 7);
        !            33:        if ((int32)a <  (int32)b) rv |= (1 << 6);
        !            34:        if ((int32)a <= (int32)b) rv |= (1 << 5);
        !            35:        if ((int32)a >  (int32)b) rv |= (1 << 4);
        !            36:        if ((int32)a != (int32)b) rv |= (1 << 3);
        !            37:        if ((int32)a == (int32)b) rv |= (1 << 2);
        !            38:        return rv;
        !            39: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.