C++ Device API Reference Manual
Reference documentation for the Simics C++ Device API.
 
Loading...
Searching...
No Matches
regs.h
Go to the documentation of this file.
1/*
2 © 2024 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//-*- C++ -*-
15
16// This file simulates generated register code
17
18#ifndef CPP_API_EXTENSIONS_EXAMPLES_REG_INTEGRATION_EXAMPLE_REGS_H
19#define CPP_API_EXTENSIONS_EXAMPLES_REG_INTEGRATION_EXAMPLE_REGS_H
20
21// Simics includes
22#include <simics/cc-api.h>
24
25// Supplemental API includes
26#include "sme/sme.h"
27
29public:
31 : simics::MappableConfObject(o) {
32 }
33 static void init_class(simics::ConfClass *cls);
35};
36
37class SampleBank : public simics::PortBank<> {
38public:
39 using PortBank::PortBank;
40
42 unsigned numOfRegs = number_of_registers();
43 for (unsigned i = 0; i < numOfRegs; ++i) {
44 std::pair<size_t, simics::RegisterInterface *> reg_pair = register_at_index(i);
45 reg_pair.second->reset();
46 }
47 }
48
49 class REG1 : public simics::BankRegister<sme::reg<simics::Register> > {
50 public:
51 using BankRegister::BankRegister;
52
53 class FIELD1 : public simics::RegisterField<sme::field<simics::Field> > {
54 public:
55 using RegisterField::RegisterField;
56 };
57
58 class FIELD2 : public simics::RegisterField<sme::field<simics::Field> > {
59 public:
60 using RegisterField::RegisterField;
61 };
62
63 public:
65 this, simics::Name("FIELD1"),
66 simics::Description("FIELD1"),
67 simics::Offset(32),
69 };
71 this, simics::Name("FIELD2"),
72 simics::Description("FIELD2"),
75 };
76 };
77
79 this, simics::Name("REG1"),
80 simics::Description("REG1"),
81 simics::Offset(0xf4c),
84 };
85
86};
87
88
89class SampleBankPort : public simics::BankPort<GeneratedRegisterDevice> {
90 public:
92
93 private:
94 SampleBank bank {this, simics::Description("a user defined bank")};
95};
96
97#endif
98
Definition: regs.h:28
void add_io_regs_bank(simics::ConfClass *cls)
GeneratedRegisterDevice(simics::ConfObjectRef o)
Definition: regs.h:30
static void init_class(simics::ConfClass *cls)
Definition: regs.h:89
Definition: regs.h:53
Definition: regs.h:58
Definition: regs.h:49
Definition: regs.h:37
void resetAllRegisters()
Definition: regs.h:41
REG1 reg1
Definition: regs.h:78
Extends Port with bank required interfaces.
Definition: bank-port.h:71
BankPort(ConfObjectRef o)
Definition: bank-port.h:82
Definition: register-templates.h:44
unsigned number_of_registers() const override
Get the number of registers in the bank.
std::pair< size_t, RegisterInterface * > register_at_index(unsigned index) const override
Get the register at a specific index.
Represents Simics C type conf_class_t.
Definition: conf-class.h:52
Represents Simics C type conf_object_t.
Definition: conf-object.h:38
Definition: mappable-conf-object.h:134
Definition: bank-templates.h:31
Definition: field-templates.h:36
Definition: after-bank.h:33
detail::HierarchicalObjectName Name
Type used to name a resource.
Definition: common-types.h:43
std::string_view Description
Type used to describe a resource.
Definition: common-types.h:46
detail::ConstSizeT BitWidth
Type used for the number/width of bit.
Definition: common-types.h:52
detail::ConstSizeT Offset
Type used for memory address offset.
Definition: common-types.h:49
detail::ConstSizeT InitValue
Type used for initial value.
Definition: common-types.h:55
detail::ConstSizeT ByteSize
Type used for the number/size of byte TODO(xiuliang): add valid value checker?
Definition: common-types.h:59