SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
attr_dmi.h
Go to the documentation of this file.
1/*
2 © 2017 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_INJECTION_ATTR_DMI_H
15#define SIMICS_SYSTEMC_INJECTION_ATTR_DMI_H
16
17
18
20
21#include <tlm>
22
23#include <string>
24
25namespace simics {
26namespace systemc {
27namespace injection {
28
31 public:
32 explicit AttrDmi(tlm::tlm_dmi *dmi) : dmi_(dmi) {}
34
35 bool parse(AttrDictParser *parser, const std::string &key,
36 attr_value_t *attr) override {
37 if (key == "dmi_ptr") {
38 uint64_t v;
39 if (!parser->value(&v))
40 return false;
41
42 dmi_->set_dmi_ptr(reinterpret_cast<unsigned char*> (v));
43 } else if (key == "start_address") {
44 uint64_t v;
45 if (!parser->value(&v))
46 return false;
47
48 dmi_->set_start_address(v);
49 } else if (key == "end_address") {
50 uint64_t v;
51 if (!parser->value(&v))
52 return false;
53
54 dmi_->set_end_address(v);
55 } else if (key == "read_latency") {
56 uint64_t v;
57 if (!parser->value(&v))
58 return false;
59
60 dmi_->set_read_latency(sc_core::sc_time::from_value(v));
61 } else if (key == "write_latency") {
62 uint64_t v;
63 if (!parser->value(&v))
64 return false;
65
66 dmi_->set_write_latency(sc_core::sc_time::from_value(v));
67 } else if (key == "granted_access") {
68 uint64_t v;
69 if (!parser->value(&v))
70 return false;
71
72 dmi_->set_granted_access(static_cast<tlm::tlm_dmi::dmi_access_e>(
73 v));
74 } else {
75 return false;
76 }
77
78 return true;
79 }
80
81 private:
82 tlm::tlm_dmi *dmi_;
83};
84
85} // namespace injection
86} // namespace systemc
87} // namespace simics
88
89#endif
#define ATTR_DICT_PARSER_NAMESPACE(ns)
Definition: attr_dict_parser.h:32
Definition: attr_dict_parser.h:38
Definition: attr_dmi.h:30
AttrDmi(tlm::tlm_dmi *dmi)
Definition: attr_dmi.h:32
bool parse(AttrDictParser *parser, const std::string &key, attr_value_t *attr) override
Definition: attr_dmi.h:35
Definition: adapter.h:79