OpenCores
URL https://opencores.org/ocsvn/riscv_vhdl/riscv_vhdl/trunk

Subversion Repositories riscv_vhdl

[/] [riscv_vhdl/] [trunk/] [debugger/] [src/] [cpu_fnc_plugin/] [instructions.cpp] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 sergeykhbr
/**
2
 * @file
3
 * @copyright  Copyright 2017 GNSS Sensor Ltd. All right reserved.
4
 * @author     Sergey Khabarov - sergeykhbr@gmail.com
5
 * @brief      Instruction types parser.
6
 */
7
 
8
#include "api_utils.h"
9
#include "riscv-isa.h"
10
#include "instructions.h"
11
#include "cpu_riscv_func.h"
12
 
13
namespace debugger {
14
 
15
RiscvInstruction::RiscvInstruction(CpuRiver_Functional *icpu, const char *name,
16
                                    const char *bits) {
17
    icpu_ = icpu;
18
    R = icpu->getpRegs();
19
    name_.make_string(name);
20
    mask_ = 0;
21
    opcode_ = 0;
22
    for (int i = 0; i < 32; i++) {
23
        switch (bits[i]) {
24
        case '0':
25
            break;
26
        case '1':
27
            opcode_ |= (1 << (31 - i));
28
            break;
29
        case '?':
30
            mask_ |= (1 << (31 - i));
31
            break;
32
        default:;
33
        }
34
    }
35
    mask_ ^= ~0;
36
}
37
 
38
}  // namespace debugger

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.