SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
mii_management_extension.h
Go to the documentation of this file.
1// -*- mode: C++; c-file-style: "virtutech-c++" -*-
2
3/*
4 © 2021 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_MII_MANAGEMENT_EXTENSION_H
17#define SIMICS_SYSTEMC_IFACE_MII_MANAGEMENT_EXTENSION_H
18
21#include <stdint.h>
22
23namespace simics {
24namespace systemc {
25namespace iface {
26
27class MiiManagementExtension : public Extension<MiiManagementExtension,
28 MiiManagementInterface> {
29 public:
30 void call(MiiManagementInterface *device) override {
31 switch (method_.value<Method>()) {
32 case SERIAL_ACCESS:
34 method_input_[0].value<int>(),
35 method_input_[1].value<int>());
36 break;
37 case READ_REGISTER:
39 method_input_[0].value<int>(),
40 method_input_[1].value<int>());
41 break;
42 case WRITE_REGISTER:
43 device->write_register(method_input_[0].value<int>(),
44 method_input_[1].value<int>(),
45 method_input_[2].value<uint16_t>());
46 break;
47 }
48 }
49
50 virtual int serial_access(int data_in, int clock) {
51 method_input_.push_back(data_in);
52 method_input_.push_back(clock);
53 method_ = SERIAL_ACCESS;
54 send();
55 return method_return_.value<int>();
56 }
57
58 virtual uint16_t read_register(int phy, int reg) {
59 method_input_.push_back(phy);
60 method_input_.push_back(reg);
61 method_ = READ_REGISTER;
62 send();
63 return method_return_.value<uint16_t>();
64 }
65
66 virtual void write_register(int phy, int reg, uint16_t value) {
67 method_input_.push_back(phy);
68 method_input_.push_back(reg);
69 method_input_.push_back(value);
70 method_ = WRITE_REGISTER;
71 send();
72 }
73
74 private:
75 enum Method {
76 SERIAL_ACCESS,
77 READ_REGISTER,
78 WRITE_REGISTER
79 };
80};
81
82} // namespace iface
83} // namespace systemc
84} // namespace simics
85
86#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: mii_management_extension.h:28
virtual int serial_access(int data_in, int clock)
Definition: mii_management_extension.h:50
virtual void write_register(int phy, int reg, uint16_t value)
Definition: mii_management_extension.h:66
void call(MiiManagementInterface *device) override
Definition: mii_management_extension.h:30
virtual uint16_t read_register(int phy, int reg)
Definition: mii_management_extension.h:58
Definition: mii_management_interface.h:25
virtual int serial_access(int data_in, int clock)=0
virtual void write_register(int phy, int reg, uint16_t value)=0
virtual uint16_t read_register(int phy, int reg)=0
T value()
Definition: any_type.h:84
Definition: pci_bus_interface.h:24