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

Subversion Repositories riscv_vhdl

[/] [riscv_vhdl/] [trunk/] [debugger/] [src/] [cpu_sysc_plugin/] [cpu_riscv_rtl.h] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 sergeykhbr
/*
2
 *  Copyright 2018 Sergey Khabarov, sergeykhbr@gmail.com
3 3 sergeykhbr
 *
4 4 sergeykhbr
 *  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 3 sergeykhbr
 * @details    Use the following targets attributes to generate trace files:
17
 *             GenerateRef - Generate memory and registers write accesses
18
 *                           trace files to compare them with functional model
19
 *             InVcdFile   - Stimulus VCD file
20
 *             OutVcdFile  - Reference VCD file with any number of signals
21
 *
22
 * @note       When GenerateRef is true Core uses step counter instead
23
 *             of clock counter to generate callbacks.
24
 */
25
 
26
#ifndef __DEBUGGER_CPU_RISCV_RTL_H__
27
#define __DEBUGGER_CPU_RISCV_RTL_H__
28
 
29
#include "iclass.h"
30
#include "iservice.h"
31
#include "ihap.h"
32
#include "async_tqueue.h"
33
#include "coreservices/ithread.h"
34
#include "coreservices/icpuriscv.h"
35
#include "coreservices/imemop.h"
36
#include "coreservices/iclock.h"
37
#include "rtl_wrapper.h"
38
#include "riverlib/river_top.h"
39
#include <systemc.h>
40
 
41
namespace debugger {
42
 
43
class CpuRiscV_RTL : public IService,
44
                 public IThread,
45
                 public IClock,
46
                 public IHap {
47
public:
48
    CpuRiscV_RTL(const char *name);
49
    virtual ~CpuRiscV_RTL();
50
 
51
    /** IService interface */
52
    virtual void postinitService();
53
 
54
    /** IClock */
55
    virtual uint64_t getStepCounter() {
56
        return wb_time.read() + 2;
57
    }
58
 
59
    virtual void registerStepCallback(IClockListener *cb, uint64_t t) {
60
        wrapper_->registerStepCallback(cb, t);
61
    }
62
 
63 4 sergeykhbr
    virtual double getFreqHz() { return 1.0; }
64
 
65 3 sergeykhbr
    /** IHap */
66
    virtual void hapTriggered(IFace *isrc, EHapType type, const char *descr);
67
 
68
    virtual void stop();
69
 
70
protected:
71
    /** IThread interface */
72
    virtual void busyLoop();
73
 
74
private:
75
    void createSystemC();
76
    void deleteSystemC();
77
 
78
private:
79
    AttributeType bus_;
80
    AttributeType freqHz_;
81
    AttributeType InVcdFile_;
82
    AttributeType OutVcdFile_;
83
    AttributeType GenerateRef_;
84
    event_def config_done_;
85 4 sergeykhbr
    IMemoryOperation *ibus_;
86 3 sergeykhbr
 
87
    sc_signal<bool> w_clk;
88
    sc_signal<bool> w_nrst;
89
    // Timer:
90
    sc_signal<sc_uint<64>> wb_time;
91
    // Memory interface:
92
    sc_signal<bool> w_req_mem_ready;
93
    sc_signal<bool> w_req_mem_valid;
94
    sc_signal<bool> w_req_mem_write;
95
    sc_signal<sc_uint<BUS_ADDR_WIDTH>> wb_req_mem_addr;
96
    sc_signal<sc_uint<BUS_DATA_BYTES>> wb_req_mem_strob;
97
    sc_signal<sc_uint<BUS_DATA_WIDTH>> wb_req_mem_data;
98
    sc_signal<bool> w_resp_mem_data_valid;
99
    sc_signal<sc_uint<BUS_DATA_WIDTH>> wb_resp_mem_data;
100
    /** Interrupt line from external interrupts controller. */
101
    sc_signal<bool> w_interrupt;
102
    // Debug interface
103
    sc_signal<bool> w_dport_valid;
104
    sc_signal<bool> w_dport_write;
105
    sc_signal<sc_uint<2>> wb_dport_region;
106
    sc_signal<sc_uint<12>> wb_dport_addr;
107
    sc_signal<sc_uint<RISCV_ARCH>> wb_dport_wdata;
108
    sc_signal<bool> w_dport_ready;
109
    sc_signal<sc_uint<RISCV_ARCH>> wb_dport_rdata;
110
 
111
 
112
    sc_trace_file *i_vcd_;      // stimulus pattern
113
    sc_trace_file *o_vcd_;      // reference pattern for comparision
114
    RiverTop *top_;
115
    RtlWrapper *wrapper_;
116
};
117
 
118
DECLARE_CLASS(CpuRiscV_RTL)
119
 
120
}  // namespace debugger
121
 
122
#endif  // __DEBUGGER_CPU_RISCV_RTL_H__

powered by: WebSVN 2.1.0

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