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

Subversion Repositories riscv_vhdl

[/] [riscv_vhdl/] [trunk/] [debugger/] [src/] [cpu_arm_plugin/] [cpu_arm7_func.h] - Blame information for rev 5

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 sergeykhbr
/*
2
 *  Copyright 2018 Sergey Khabarov, sergeykhbr@gmail.com
3
 *
4
 *  Licensed under the Apache License, Version 2.0 (the "License");
5
 *  you may not use this file except in compliance with the License.
6
 *  You may obtain a copy of the License at
7
 *
8
 *      http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 *  Unless required by applicable law or agreed to in writing, software
11
 *  distributed under the License is distributed on an "AS IS" BASIS,
12
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 *  See the License for the specific language governing permissions and
14
 *  limitations under the License.
15
 */
16
 
17
#ifndef __DEBUGGER_CPU_ARM7_FUNCTIONAL_H__
18
#define __DEBUGGER_CPU_ARM7_FUNCTIONAL_H__
19
 
20
#include "arm-isa.h"
21
#include "instructions.h"
22
#include "generic/cpu_generic.h"
23
#include "coreservices/icpuarm.h"
24
 
25
namespace debugger {
26
 
27
class CpuCortex_Functional : public CpuGeneric,
28
                             public ICpuArm {
29
 public:
30
     explicit CpuCortex_Functional(const char *name);
31
     virtual ~CpuCortex_Functional();
32
 
33
    /** IService interface */
34
    virtual void postinitService();
35
 
36
    /** IResetListener itnterface */
37
    virtual void reset(bool active);
38
 
39
    /** ICpuGeneric interface */
40
    virtual void raiseSignal(int idx);
41
    virtual void lowerSignal(int idx);
42
    virtual void raiseSoftwareIrq() {}
43
    virtual uint64_t getIrqAddress(int idx) { return 0; }
44
 
45
    /** ICpuArm */
46
    virtual uint32_t getZ() { return p_psr_->u.Z; }
47
    virtual void setZ(uint32_t z) { p_psr_->u.Z = z; }
48
    virtual uint32_t getC() { return p_psr_->u.C; }
49
    virtual void setC(uint32_t c) { p_psr_->u.C = c; }
50
    virtual uint32_t getN() { return p_psr_->u.N; }
51
    virtual void setN(uint32_t n) { p_psr_->u.N = n; }
52
    virtual uint32_t getV() { return p_psr_->u.V; }
53
    virtual void setV(uint32_t v) { p_psr_->u.V = v; }
54
 
55
    // Common River methods shared with instructions:
56
    uint64_t *getpRegs() { return portRegs_.getpR64(); }
57
 
58
 protected:
59
    /** CpuGeneric common methods */
60
    virtual EEndianessType endianess() { return LittleEndian; }
61
    virtual GenericInstruction *decodeInstruction(Reg64Type *cache);
62
    virtual void generateIllegalOpcode();
63
    virtual void handleTrap();
64
    /** Tack Registers changes during execution */
65
    virtual void trackContextStart();
66
    /** // Stop tracking and write trace file */
67
    virtual void trackContextEnd();
68
 
69
    void addArm7tmdiIsa();
70
    unsigned addSupportedInstruction(ArmInstruction *instr);
71
    uint32_t hash32(uint32_t val) { return (val >> 24) & 0xf; }
72
 
73
 private:
74
    AttributeType listExtISA_;
75
    AttributeType vendorID_;
76
    AttributeType vectorTable_;
77
 
78
    static const int INSTR_HASH_TABLE_SIZE = 1 << 4;
79
    AttributeType listInstr_[INSTR_HASH_TABLE_SIZE];
80
 
81
    GenericReg64Bank portRegs_;
82
    GenericReg64Bank portSavedRegs_;
83
    ProgramStatusRegsiterType *p_psr_;
84
};
85
 
86
DECLARE_CLASS(CpuCortex_Functional)
87
 
88
}  // namespace debugger
89
 
90
#endif  // __DEBUGGER_CPU_RISCV_FUNCTIONAL_H__

powered by: WebSVN 2.1.0

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