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

Subversion Repositories riscv_vhdl

[/] [riscv_vhdl/] [trunk/] [debugger/] [src/] [socsim_plugin/] [gnss_stub.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      GNSS stub module functional model.
6
 */
7
 
8
#ifndef __DEBUGGER_SOCSIM_PLUGIN_GNSS_STUB_H__
9
#define __DEBUGGER_SOCSIM_PLUGIN_GNSS_STUB_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 GNSSStub : public IService,
21
                 public IMemoryOperation,
22
                 public IClockListener {
23
public:
24
    GNSSStub(const char *name);
25
    ~GNSSStub();
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
    uint64_t OFFSET(void *addr) {
45
        return reinterpret_cast<uint64_t>(addr)
46
             - reinterpret_cast<uint64_t>(&regs_);
47
    }
48
 
49
private:
50
    AttributeType baseAddress_;
51
    AttributeType length_;
52
    AttributeType irqLine_;
53
    AttributeType irqctrl_;
54
    AttributeType clksrc_;
55
    IWire *iwire_;
56
    IClock *iclk_;
57
 
58
    typedef struct MiscType {
59
        volatile uint32_t Date;
60
        volatile uint32_t GenericChanCfg;
61
        uint64_t hide[7];
62
    } MiscType;
63
 
64
    typedef struct TimerType {
65
        uint32_t rw_MsLength;
66
        uint32_t r_MsCnt;
67
        int32_t  rw_tow;
68
        int32_t  rw_tod;
69
        uint32_t unused[12];
70
    } TimerType;
71
 
72
    struct gnss_map {
73
        MiscType misc;
74
        TimerType   tmr;
75
        uint64_t noise[8];
76
        uint64_t chan[256*8];
77
    } regs_;
78
};
79
 
80
DECLARE_CLASS(GNSSStub)
81
 
82
}  // namespace debugger
83
 
84
#endif  // __DEBUGGER_SOCSIM_PLUGIN_GNSS_STUB_H__

powered by: WebSVN 2.1.0

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