qualcomm/qbox
Loading...
Searching...
No Matches
csr.h
1/*
2 * Copyright (c) 2025 Qualcomm Innovation Center, Inc. All Rights Reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef csr_H
8#define csr_H
9
10#include "csr_gen.h"
11#include <cci_configuration>
12#include <cciutils.h>
13#include <module_factory_registery.h>
14#include <scp/report.h>
15#include <systemc>
16#include <tlm>
17
18namespace quic {
19class csr : public sc_core::sc_module, public csr_gen
20{
21 SCP_LOGGER();
22 cci::cci_broker_handle m_broker; // Should be a private broker for efficiency, but requires fixes
23 // to cci utils to prevent use of cci_get_broker()
25 bool loaded_ok;
27
28public:
29 cci::cci_param<uint32_t> p_instance_id;
30 tlm_utils::multi_passthrough_target_socket<csr> target_socket;
32
33 csr(sc_core::sc_module_name name);
34
35 void start_of_simulation()
36 {
37 /* NB writes should not happen before simulation starts,
38 * Write any special register initial values here (e.g. over-right what is
39 * in the configuration files)
40 */
41 }
42 void before_end_of_elaboration()
43 {
44 SCP_TRACE(())("Before End of Elaboration, registering callbacks");
45 QDSP6SS_INSTANCE_ID.pre_read([&](TXN()) {
46 /*
47 * p_instance_id is the complete architectural value. In v81,
48 * the NSP number is encoded in bits [15:8], while ID describes
49 * only the low field. Write the whole register here instead of
50 * assigning through ID, since field assignment must mask bits
51 * outside the field.
52 */
53 QDSP6SS_INSTANCE_ID = p_instance_id.get_value();
54 QDSP6SS_INSTANCE_ID.set_mask(0x0); // READ ONLY
55 SCP_DEBUG(()) << "QDSP6SS_INSTANCE_ID = " << p_instance_id.get_value();
56 });
57 }
58};
59} // namespace quic
60
61extern "C" void module_register();
62
63#endif // csr_H
Definition target-signal-socket.h:163
Definition reg_model_maker.h:457
Definition reg_model_maker.h:35
Definition aoss_pmic_arb_pmic_arb_core.h:27