SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
serial_device_extension.h
Go to the documentation of this file.
1// -*- mode: C++; c-file-style: "virtutech-c++" -*-
2
3/*
4 © 2015 Intel Corporation
5
6 This software and the related documents are Intel copyrighted materials, and
7 your use of them is governed by the express license under which they were
8 provided to you ("License"). Unless the License provides otherwise, you may
9 not use, modify, copy, publish, distribute, disclose or transmit this software
10 or the related documents without Intel's prior written permission.
11
12 This software and the related documents are provided as is, with no express or
13 implied warranties, other than those that are expressly stated in the License.
14*/
15
16#ifndef SIMICS_SYSTEMC_IFACE_SERIAL_DEVICE_EXTENSION_H
17#define SIMICS_SYSTEMC_IFACE_SERIAL_DEVICE_EXTENSION_H
18
21
22namespace simics {
23namespace systemc {
24namespace iface {
25
26//:: pre SerialDeviceExtension {{
27class SerialDeviceExtension : public Extension<SerialDeviceExtension,
28 SerialDeviceInterface> {
29 public:
30 virtual void call(SerialDeviceInterface *device) {
31 switch (method_.value<Method>()) {
32 case WRITE:
33 method_return_ = device->write(method_input_[0].value<int>());
34 break;
35 case RECEIVE_READY:
36 device->receive_ready();
37 break;
38 }
39 }
40
41 virtual int write(int value) {
42 method_input_.push_back(value);
43 method_ = WRITE;
44 send();
45 return method_return_.value<int>();
46 }
47 virtual void receive_ready() {
48 method_ = RECEIVE_READY;
49 send();
50 }
51
52 private:
53 enum Method {
54 WRITE,
55 RECEIVE_READY
56 };
57};
58// }}
59
60} // namespace iface
61} // namespace systemc
62} // namespace simics
63
64#endif
Base class for TLM2 extension, responsible for marshal/unmarshal of a Simics interface.
Definition: extension.h:40
std::vector< types::AnyType > method_input_
Definition: extension.h:118
Definition: serial_device_extension.h:28
virtual void call(SerialDeviceInterface *device)
Definition: serial_device_extension.h:30
virtual void receive_ready()
Definition: serial_device_extension.h:47
virtual int write(int value)
Definition: serial_device_extension.h:41
Definition: serial_device_interface.h:24
T value()
Definition: any_type.h:84
Definition: pci_bus_interface.h:24