C++ Device API Reference Manual
Reference documentation for the Simics C++ Device API.
 
Loading...
Searching...
No Matches
bank-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_BANK_INTERFACE_H
17#define SIMICS_BANK_INTERFACE_H
18
19#include <simics/base/memory.h> // exception_type_t
20#include <simics/base/transaction.h> // transaction_t
21
22#include <cstdint>
23#include <map>
24#include <string>
25#include <string_view>
26#include <utility>
27#include <vector>
28
30
31namespace simics {
32
33enum class ByteOrder {
34 BE, LE,
35};
36
37class MappableConfObject;
38class RegisterInterface;
39class BankIssueCallbacksInterface;
40
48 public:
49 virtual ~BankInterface() = default;
50
56 virtual std::string_view name() const = 0;
57
63 virtual MappableConfObject *dev_obj() const = 0;
64
70 virtual const std::string &description() const = 0;
71
77 virtual void set_description(std::string_view desc) = 0;
78
84 virtual void add_register(const register_t &reg) = 0;
85
96 virtual void add_register(std::string_view name, std::string_view desc,
97 Offset offset, ByteSize number_of_bytes,
98 InitValue init_value,
99 const std::vector<field_t> &fields) = 0;
100
104 virtual unsigned number_of_registers() const = 0;
105
115 virtual std::pair<size_t, RegisterInterface *> register_at_index(
116 unsigned index) const = 0;
117
121 virtual const std::map<size_t, RegisterInterface *> &
122 mapped_registers() const = 0;
123
127 virtual void set_callbacks(BankIssueCallbacksInterface *callbacks) = 0;
128
132 virtual ByteOrder get_byte_order() const = 0;
133
137 virtual void set_miss_pattern(uint8_t miss_pattern) = 0;
138
150 virtual exception_type_t transaction_access(transaction_t *t,
151 uint64_t offset) = 0;
152};
153
154} // namespace simics
155
156#endif
An interface implemented by a Simics bank.
Definition: bank-interface.h:47
virtual void set_description(std::string_view desc)=0
Set the description for the bank.
virtual std::string_view name() const =0
Get the name of the bank without level delimiters.
virtual unsigned number_of_registers() const =0
Get the number of registers in the bank.
virtual void add_register(const register_t &reg)=0
Parse a register name and add register to the bank.
virtual void set_callbacks(BankIssueCallbacksInterface *callbacks)=0
Set the callbacks for bank issues.
virtual MappableConfObject * dev_obj() const =0
Get the device object.
virtual ~BankInterface()=default
virtual const std::map< size_t, RegisterInterface * > & mapped_registers() const =0
Get all mapped registers on the bank ordered by offset.
virtual exception_type_t transaction_access(transaction_t *t, uint64_t offset)=0
Entry point for a memory access from the transaction interface.
virtual std::pair< size_t, RegisterInterface * > register_at_index(unsigned index) const =0
Get the register at a specific index.
virtual void add_register(std::string_view name, std::string_view desc, Offset offset, ByteSize number_of_bytes, InitValue init_value, const std::vector< field_t > &fields)=0
Add a register to the bank.
virtual const std::string & description() const =0
Get the description of the bank.
virtual ByteOrder get_byte_order() const =0
Get the byte order of the bank.
virtual void set_miss_pattern(uint8_t miss_pattern)=0
Set the miss pattern for the bank.
Definition: bank-issue-callbacks-interface.h:25
Definition: mappable-conf-object.h:134
Literal type that extends size_t type.
Definition: common-types.h:30
Definition: after-bank.h:33
ByteOrder
Definition: bank-interface.h:33
std::tuple< Name, Description, Offset, ByteSize, InitValue, std::vector< field_t > > register_t
Definition: register-type.h:45