gpcas_forwardcom 0.1.1

ForwardCom instruction set architecture (ISA) properties for use with the General Purpose Core Architecture Simulator (GPCAS).
Documentation
// Filename: multi_format.rs
// Author:	 Kai Rese
// Version:	 0.12
// Date:	 15-08-2022 (DD-MM-YYYY)
// Library:  gpcas_forwardcom
//
// Copyright (c) 2022 Kai Rese
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this program. If not, see
// <https://www.gnu.org/licenses/>.

//! A table of all multi-format instructions.

use super::functions::*;
use super::*;

use gpcas_base::instruction_type;
use gpcas_isa::instruction_flags;

/// All multi format instructions.
///
/// Every instruction in here can use any of the multi formats as long as they provide enough
/// operands for it.
pub const MULTI_FORMAT_INSTRUCTIONS: [SimpleIsaInstruction; 64] = [
    // 0
    NOP,
    // 1
    SimpleIsaInstruction {
        function: move_instruction,
        inputs: 1,
        instr_type: instruction_type::MOVE,
        instruction_flags: instruction_flags::MEM_IN | instruction_flags::MEM_OUT,
        ..SimpleIsaInstruction::DEFAULT
    },
    // 2
    SimpleIsaInstruction {
        function: move_instruction,
        inputs: 1,
        instr_type: instruction_type::MOVE,
        ..SimpleIsaInstruction::DEFAULT
    },
    // 3
    // prefetch is ignored for now
    NOP,
    // 4
    SimpleIsaInstruction {
        function: sign_extend_instruction,
        inputs: 1,
        instr_type: instruction_type::SIMPLE,
        ..SimpleIsaInstruction::DEFAULT
    },
    // 5
    SimpleIsaInstruction {
        function: sign_extend_add,
        inputs: 2,
        instr_type: instruction_type::SIMPLE,
        ..SimpleIsaInstruction::DEFAULT
    },
    // 6
    UNSPECIFIED_INSTRUCTION,
    // 7
    NOT_YET_IMPLEMENTED_INSTRUCTION,
    // 8
    SimpleIsaInstruction {
        function: add,
        inputs: 2,
        instr_type: instruction_type::INT_ADD,
        ..SimpleIsaInstruction::DEFAULT
    },
    // 9
    SimpleIsaInstruction {
        function: sub,
        inputs: 2,
        instr_type: instruction_type::INT_ADD,
        ..SimpleIsaInstruction::DEFAULT
    },
    // 10
    NOT_YET_IMPLEMENTED_INSTRUCTION,
    // 11
    SimpleIsaInstruction {
        function: mul,
        inputs: 2,
        instr_type: instruction_type::INT_ADD,
        ..SimpleIsaInstruction::DEFAULT
    },
    // 12
    NOT_YET_IMPLEMENTED_INSTRUCTION,
    // 13
    NOT_YET_IMPLEMENTED_INSTRUCTION,
    // 14
    SimpleIsaInstruction {
        function: div,
        inputs: 2,
        instr_type: instruction_type::INT_ADD,
        ..SimpleIsaInstruction::DEFAULT
    },
    // 15
    NOT_YET_IMPLEMENTED_INSTRUCTION,
    // 16
    NOT_YET_IMPLEMENTED_INSTRUCTION,
    // 17
    UNSPECIFIED_INSTRUCTION,
    // 18
    NOT_YET_IMPLEMENTED_INSTRUCTION,
    // 19
    NOT_YET_IMPLEMENTED_INSTRUCTION,
    // 20
    SimpleIsaInstruction {
        function: min,
        inputs: 2,
        instr_type: instruction_type::SIMPLE,
        ..SimpleIsaInstruction::DEFAULT
    },
    // 21
    SimpleIsaInstruction {
        function: min_u,
        inputs: 2,
        instr_type: instruction_type::SIMPLE,
        ..SimpleIsaInstruction::DEFAULT
    },
    // 22
    SimpleIsaInstruction {
        function: max,
        inputs: 2,
        instr_type: instruction_type::SIMPLE,
        ..SimpleIsaInstruction::DEFAULT
    },
    // 23
    SimpleIsaInstruction {
        function: max_u,
        inputs: 2,
        instr_type: instruction_type::SIMPLE,
        ..SimpleIsaInstruction::DEFAULT
    },
    // 24
    UNSPECIFIED_INSTRUCTION,
    // 25
    UNSPECIFIED_INSTRUCTION,
    // 26
    NOT_YET_IMPLEMENTED_INSTRUCTION,
    // 27
    NOT_YET_IMPLEMENTED_INSTRUCTION,
    // 28
    NOT_YET_IMPLEMENTED_INSTRUCTION,
    // 29
    UNSPECIFIED_INSTRUCTION,
    // 30
    UNSPECIFIED_INSTRUCTION,
    // 31
    UNSPECIFIED_INSTRUCTION,
    // 32
    SimpleIsaInstruction {
        function: shift_left,
        inputs: 2,
        instr_type: instruction_type::INT_SHIFT,
        ..SimpleIsaInstruction::DEFAULT
    },
    // 33
    NOT_YET_IMPLEMENTED_INSTRUCTION,
    // 34
    SimpleIsaInstruction {
        function: shift_right_s,
        inputs: 2,
        instr_type: instruction_type::INT_SHIFT,
        ..SimpleIsaInstruction::DEFAULT
    },
    // 35
    SimpleIsaInstruction {
        function: shift_right_u,
        inputs: 2,
        instr_type: instruction_type::INT_SHIFT,
        ..SimpleIsaInstruction::DEFAULT
    },
    // 36
    NOT_YET_IMPLEMENTED_INSTRUCTION,
    // 37
    NOT_YET_IMPLEMENTED_INSTRUCTION,
    // 38
    NOT_YET_IMPLEMENTED_INSTRUCTION,
    // 39
    NOT_YET_IMPLEMENTED_INSTRUCTION,
    // 40
    NOT_YET_IMPLEMENTED_INSTRUCTION,
    // 41
    NOT_YET_IMPLEMENTED_INSTRUCTION,
    // 42
    UNSPECIFIED_INSTRUCTION,
    // 43
    UNSPECIFIED_INSTRUCTION,
    // 44
    NOT_YET_IMPLEMENTED_INSTRUCTION,
    // 45
    NOT_YET_IMPLEMENTED_INSTRUCTION,
    // 46
    NOT_YET_IMPLEMENTED_INSTRUCTION,
    // 47
    UNSPECIFIED_INSTRUCTION,
    // 48
    SimpleIsaInstruction {
        function: mul_add::<false>,
        inputs: 3,
        instr_type: instruction_type::INT_MUL_ADD,
        has_option_bits: true,
        operand_type_override: Some(OperandType::F16),
        ..SimpleIsaInstruction::DEFAULT
    },
    // 49
    SimpleIsaInstruction {
        function: mul_add::<false>,
        inputs: 3,
        instr_type: instruction_type::INT_MUL_ADD,
        has_option_bits: true,
        ..SimpleIsaInstruction::DEFAULT
    },
    // 50
    SimpleIsaInstruction {
        function: mul_add::<true>,
        inputs: 3,
        instr_type: instruction_type::INT_MUL_ADD,
        has_option_bits: true,
        ..SimpleIsaInstruction::DEFAULT
    },
    // 51
    SimpleIsaInstruction {
        function: add_add,
        inputs: 3,
        instr_type: instruction_type::INT_ADD,
        has_option_bits: true,
        ..SimpleIsaInstruction::DEFAULT
    },
    // 52
    NOT_YET_IMPLEMENTED_INSTRUCTION,
    // 53
    NOT_YET_IMPLEMENTED_INSTRUCTION,
    // 54
    UNSPECIFIED_INSTRUCTION,
    // 55
    UNSPECIFIED_INSTRUCTION,
    // 56
    UNSPECIFIED_INSTRUCTION,
    // 57
    UNSPECIFIED_INSTRUCTION,
    // 58
    UNSPECIFIED_INSTRUCTION,
    // 59
    UNSPECIFIED_INSTRUCTION,
    // 60
    UNSPECIFIED_INSTRUCTION,
    // 61
    UNSPECIFIED_INSTRUCTION,
    // 62
    UNSPECIFIED_INSTRUCTION,
    // 63
    UNSPECIFIED_INSTRUCTION,
];