SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
pci_device_extension.h
Go to the documentation of this file.
1/*
2 © 2015 Intel Corporation
3
4 This software and the related documents are Intel copyrighted materials, and
5 your use of them is governed by the express license under which they were
6 provided to you ("License"). Unless the License provides otherwise, you may
7 not use, modify, copy, publish, distribute, disclose or transmit this software
8 or the related documents without Intel's prior written permission.
9
10 This software and the related documents are provided as is, with no express or
11 implied warranties, other than those that are expressly stated in the License.
12*/
13
14#ifndef SIMICS_SYSTEMC_IFACE_PCI_DEVICE_EXTENSION_H
15#define SIMICS_SYSTEMC_IFACE_PCI_DEVICE_EXTENSION_H
16
19
20namespace simics {
21namespace systemc {
22namespace iface {
23
25class PciDeviceExtension : public Extension<PciDeviceExtension,
26 PciDeviceInterface> {
27 public:
28 void call(PciDeviceInterface *device) override {
29 switch (method_.value<Method>()) {
30 case BUS_RESET:
31 device->bus_reset();
32 break;
33 case SYSTEM_ERROR:
34 device->system_error();
35 break;
36 case INTERRUPT_RAISED:
37 device->interrupt_raised(method_input_[0].value<int>());
38 break;
39 case INTERRUPT_LOWERED:
40 device->interrupt_lowered(method_input_[0].value<int>());
41 break;
42 }
43 }
44
45 void bus_reset() override {
46 method_ = BUS_RESET;
47 send();
48 }
49 void system_error() override {
50 method_ = SYSTEM_ERROR;
51 send();
52 }
53 void interrupt_raised(int pin) override {
54 method_input_.push_back(pin);
55 method_ = INTERRUPT_RAISED;
56 send();
57 }
58 void interrupt_lowered(int pin) override {
59 method_input_.push_back(pin);
60 method_ = INTERRUPT_LOWERED;
61 send();
62 }
63
64 private:
65 enum Method {
66 BUS_RESET,
67 SYSTEM_ERROR,
68 INTERRUPT_RAISED,
69 INTERRUPT_LOWERED
70 };
71};
72
73} // namespace iface
74} // namespace systemc
75} // namespace simics
76
77#endif
Base class for TLM2 extension, responsible for marshal/unmarshal of a Simics interface.
Definition: extension.h:38
std::vector< types::AnyType > method_input_
Definition: extension.h:116
Extension for Simics pci_device interface.
Definition: pci_device_extension.h:26
void call(PciDeviceInterface *device) override
Definition: pci_device_extension.h:28
void interrupt_raised(int pin) override
Definition: pci_device_extension.h:53
void system_error() override
Definition: pci_device_extension.h:49
void bus_reset() override
Definition: pci_device_extension.h:45
void interrupt_lowered(int pin) override
Definition: pci_device_extension.h:58
Simics pci_device interface.
Definition: pci_device_interface.h:24
virtual void interrupt_raised(int pin)=0
virtual void interrupt_lowered(int pin)=0
T value()
Definition: any_type.h:87
Definition: adapter.h:79