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

Subversion Repositories riscv_vhdl

[/] [riscv_vhdl/] [trunk/] [debugger/] [src/] [socsim_plugin/] [gptimers.h] - Blame information for rev 2

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 sergeykhbr
/**
2
 * @file
3
 * @copyright  Copyright 2016 GNSS Sensor Ltd. All right reserved.
4
 * @author     Sergey Khabarov - sergeykhbr@gmail.com
5
 * @brief      General Purpose Timers model.
6
 */
7
 
8
#ifndef __DEBUGGER_SOCSIM_PLUGIN_GPTIMERS_H__
9
#define __DEBUGGER_SOCSIM_PLUGIN_GPTIMERS_H__
10
 
11
#include "iclass.h"
12
#include "iservice.h"
13
#include "coreservices/imemop.h"
14
#include "coreservices/iclklistener.h"
15
#include "coreservices/iclock.h"
16
#include "coreservices/iwire.h"
17
 
18
namespace debugger {
19
 
20
class GPTimers : public IService,
21
                 public IMemoryOperation,
22
                 public IClockListener {
23
public:
24
    GPTimers(const char *name);
25
    ~GPTimers();
26
 
27
    /** IService interface */
28
    virtual void postinitService();
29
 
30
    /** IMemoryOperation */
31
    virtual void b_transport(Axi4TransactionType *trans);
32
 
33
    virtual uint64_t getBaseAddress() {
34
        return baseAddress_.to_uint64();
35
    }
36
    virtual uint64_t getLength() {
37
        return length_.to_uint64();
38
    }
39
 
40
    /** IClockListener */
41
    virtual void stepCallback(uint64_t t);
42
 
43
private:
44
    AttributeType baseAddress_;
45
    AttributeType length_;
46
    AttributeType irqLine_;
47
    AttributeType irqctrl_;
48
    AttributeType clksrc_;
49
    IWire *iwire_;
50
    IClock *iclk_;
51
 
52
    static const uint32_t TIMER_CONTROL_ENA = 1<<0;
53
    struct gptimers_map {
54
        uint64_t highcnt;
55
        uint32_t pending;
56
        uint32_t rsvr[13];
57
        typedef struct gptimer_type {
58
            volatile uint32_t control;
59
            volatile uint32_t rsv1;
60
            volatile uint64_t cur_value;
61
            volatile uint64_t init_value;
62
        } gptimer_type;
63
        gptimer_type timer[2];
64
    } regs_;
65
};
66
 
67
DECLARE_CLASS(GPTimers)
68
 
69
}  // namespace debugger
70
 
71
#endif  // __DEBUGGER_SOCSIM_PLUGIN_GPTIMERS_H__

powered by: WebSVN 2.1.0

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