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

Subversion Repositories riscv_vhdl

[/] [riscv_vhdl/] [trunk/] [debugger/] [src/] [common/] [coreservices/] [iwire.h] - 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      Single wire interface.
6
 */
7
 
8
#ifndef __DEBUGGER_COMMON_CORESERVICES_IWIRE_H__
9
#define __DEBUGGER_COMMON_CORESERVICES_IWIRE_H__
10
 
11
#include <inttypes.h>
12
#include <iface.h>
13
#include <attribute.h>
14
#include <iservice.h>
15
 
16
namespace debugger {
17
 
18
static const char *const IFACE_WIRE = "IWire";
19
 
20
class IWire : public IFace {
21
 public:
22
    IWire() : IFace(IFACE_WIRE) {}
23
 
24
    virtual void raiseLine() = 0;
25
    virtual void lowerLine() = 0;
26
    virtual void setLevel(bool level) = 0;
27
    virtual bool getLevel() = 0;
28
};
29
 
30
class GenericWireAttribute : public AttributeType,
31
                             public IWire {
32
 public:
33
    GenericWireAttribute(IService *parent, const char *name)
34
        : parent_(parent) {
35
        parent->registerAttribute(name, static_cast<IAttribute *>(this));
36
        parent->registerPortInterface(name, static_cast<IWire *>(this));
37
        wireName_.make_string(name);
38
        make_boolean(false);
39
    }
40
 
41
    /** IWire */
42
    virtual void raiseLine() { make_boolean(true); }
43
    virtual void lowerLine() { make_boolean(false); }
44
    virtual void setLevel(bool level) { make_boolean(level); }
45
    virtual bool getLevel() { return to_bool(); }
46
 
47
 protected:
48
    // Debug output compatibility
49
    IFace *getInterface(const char *name) {
50
        return parent_->getInterface(name);
51
    }
52
 
53
 protected:
54
    IService *parent_;
55
    AttributeType wireName_;
56
};
57
 
58
}  // namespace debugger
59
 
60
#endif  // __DEBUGGER_COMMON_CORESERVICES_IWIRE_H__

powered by: WebSVN 2.1.0

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