C++ Device API Reference Manual
Reference documentation for the Simics C++ Device API.
 
Loading...
Searching...
No Matches
register-interface.h
Go to the documentation of this file.
1// -*- mode: C++; c-file-style: "virtutech-c++" -*-
2
3/*
4 © 2022 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_IFACE_REGISTER_INTERFACE_H
17#define SIMICS_IFACE_REGISTER_INTERFACE_H
18
19#include <string_view>
20#include <string>
21#include <vector>
22#include <cstdint>
23
24#include "../conf-object.h"
27#include "../type/field-type.h"
28#include "../type/register-type.h"
29
30namespace simics {
31
32class MappableConfObject;
33class BankInterface;
34
37 public:
38 virtual ~RegisterInterface() = default;
39
40 // @return the register name without level delimiter
41 virtual std::string_view name() const = 0;
42
43 // @return the hierarchical name for the register including the bank name
44 virtual const std::string &hierarchical_name() const = 0;
45
46 // @return the description string
47 virtual const std::string &description() const = 0;
48
49 // @return the device object holds the register
50 virtual MappableConfObject *dev_obj() const = 0;
51
52 virtual ConfObjectRef bank_obj_ref() const = 0;
53
54 // @return the register size in bytes
55 virtual unsigned number_of_bytes() const = 0;
56
57 /*
58 *Initialize the register with a description, size in bytes and an initial
59 * value. Typically called after the register is instantiated.
60 */
61 virtual void init(std::string_view desc, unsigned number_of_bytes,
62 uint64_t init_val) = 0;
63
64 // Reset to the initial value
65 virtual void reset() = 0;
66
67 // @return if the register is read-only
68 virtual bool is_read_only() const = 0;
69
70 // @return if the register is mapped
71 virtual bool is_mapped() const = 0;
72
73 /*
74 * Parse the field information, add the field or field array into
75 * the resource map. The field reuses the memory allocated for the
76 * enclosing register.
77 * offset 0 is always the least significant bit regardless of bit order
78 * e.g. 2 bytes value 0b10100111
79 * | |
80 * offset:7 offset:0 => width = 8
81 */
82 virtual void parse_field(const field_t &f) = 0;
83
84 // @return information of fields in the register
85 virtual std::vector<field_t> fields_info() const = 0;
86
87 // @return the parent bank interface
88 virtual BankInterface *parent() const = 0;
89
90 virtual void set_byte_pointers(
91 const register_memory_t &byte_pointers) = 0;
92};
93
94} // namespace simics
95
96#endif
Definition: bank-interface.h:45
Represents Simics C type conf_object_t.
Definition: conf-object.h:37
Definition: mappable-conf-object.h:131
Definition: register-interface.h:36
virtual const std::string & description() const =0
virtual const std::string & hierarchical_name() const =0
virtual ~RegisterInterface()=default
virtual std::vector< field_t > fields_info() const =0
virtual std::string_view name() const =0
virtual bool is_mapped() const =0
virtual void init(std::string_view desc, unsigned number_of_bytes, uint64_t init_val)=0
virtual void set_byte_pointers(const register_memory_t &byte_pointers)=0
virtual ConfObjectRef bank_obj_ref() const =0
virtual bool is_read_only() const =0
virtual BankInterface * parent() const =0
virtual void reset()=0
virtual void parse_field(const field_t &f)=0
virtual MappableConfObject * dev_obj() const =0
virtual unsigned number_of_bytes() const =0
Definition: value-accessor-interface.h:24
Definition: value-mutator-interface.h:24
Definition: attr-value.h:23
std::tuple< Name, Description, Offset, BitWidth > field_t
Definition: field-type.h:38
std::vector< uint8_t * > register_memory_t
Definition: register-type.h:52