25class qemu_cpu_hexagon :
public QemuCpu
27 cci::cci_broker_handle m_broker;
33 static constexpr qemu::Target ARCH = qemu::Target::HEXAGON;
34 sc_core::sc_vector<QemuTargetSignalSocket> irq_in;
36 qemu_cpu_hexagon(
const sc_core::sc_module_name& name, sc_core::sc_object* o1, sc_core::sc_object* o2)
40 qemu_cpu_hexagon(
const sc_core::sc_module_name& name, sc_core::sc_object* o1, sc_core::sc_object* o2,
41 sc_core::sc_object* o3)
46 qemu_cpu_hexagon(
const sc_core::sc_module_name& name, sc_core::sc_object* o1, sc_core::sc_object* o2,
47 sc_core::sc_object* o3, sc_core::sc_object* o4)
54 : QemuCpu(name, inst,
"v67-hexagon")
55 , m_broker(cci::cci_get_broker())
57 , p_cfgbase(
"config_table_addr", 0xffffffffULL,
"config table address")
58 , p_vp_mode(
"vp_mode",
true,
"override the vp_mode for testing")
59 , p_semihosting(
"enable_semihosting",
false,
"enable semihosting for debugging/testing")
60 , p_dsp_arch(
"dsp_arch",
"v68",
"DSP arch")
61 , p_start_powered_off(
"start_powered_off",
false,
62 "Start and reset the CPU "
63 "in powered-off state")
64 , p_sched_limit(
"sched_limit",
true,
"use sched limit")
65 , p_paranoid(
"paranoid_commit_state",
false,
"enable per-packet checks")
66 , p_subsystem_id(
"subsystem_id", 0,
"subsystem id")
67 , p_hexagon_num_threads(
"hexagon_num_threads", 8,
68 "number of hexagon threads")
69 , p_isdben_trusted(
"isdben_trusted",
true,
"isdben trusted")
70 , p_isdben_secure(
"isdben_secure",
true,
"isdben secure")
71 , p_cmdline(
"cmdline",
"",
"cmdline")
72 , p_vtcm_base_addr(
"vtcm_base_addr", 0,
"vtcm base address")
73 , p_vtcm_size_kb(
"vtcm_size_kb", 0,
"vtcm size in kb")
74 , p_coproc2_present(
"coproc2_present",
false,
"secondary coprocessor is present")
75 , p_hvx_contexts(
"hvx_contexts", 0,
"number of HVX contexts")
76 , p_hex_greg(hex_greg)
84 for (
int i = 0; i < irq_in.size(); ++i) {
85 m_external_ev |= irq_in[i]->default_event();
90 void set_hex_tlb(
hexagon_tlb* tlb) { m_hex_tlb = tlb; }
92 void before_end_of_elaboration()
override
94 const std::string dsp_arch = p_dsp_arch.get_value();
95 set_qom_type(dsp_arch +
"-hexagon-cpu");
97 QemuCpu::before_end_of_elaboration();
100 qemu::CpuHexagon::Rev_t dsp_rev = qemu::CpuHexagon::parse_dsp_arch(dsp_arch);
101 if (dsp_rev == qemu::CpuHexagon::unknown_rev) {
102 SCP_FATAL(())(
"Unrecognized Architecture Revision: " + dsp_arch);
104 cpu.set_prop_bool(
"start-powered-off", p_start_powered_off);
105 cpu.set_prop_bool(
"sched-limit", p_sched_limit);
106 cpu.set_prop_bool(
"virtual-platform-mode", p_vp_mode);
107 cpu.set_prop_bool(
"enable-semihosting", p_semihosting);
108 cpu.set_prop_bool(
"paranoid-commit-state", p_paranoid);
109 cpu.set_prop_int(
"subsystem-id", p_subsystem_id);
110 cpu.set_prop_int(
"thread-count", p_hexagon_num_threads);
111 cpu.set_prop_str(
"cmdline", p_cmdline.get_value().data());
112 cpu.set_prop_int(
"vtcm-base-addr", p_vtcm_base_addr);
113 cpu.set_prop_int(
"vtcm-size-kb", p_vtcm_size_kb);
114 cpu.set_prop_bool(
"coproc2-present", p_coproc2_present);
115 cpu.set_prop_int(
"hvx-contexts", p_hvx_contexts);
117 p_hex_greg->before_end_of_elaboration();
120 cpu_dev.set_prop_link(
"global-regs", hex_greg_dev);
124 m_l2vic->before_end_of_elaboration();
126 cpu_dev.set_prop_link(
"l2vic", m_l2vic->get_qemu_dev());
130 m_hex_tlb->before_end_of_elaboration();
132 cpu_dev.set_prop_link(
"tlb", m_hex_tlb->get_qemu_dev());
138 void end_of_elaboration()
override
140 QemuCpu::end_of_elaboration();
142 get_cpu_hexagon().register_reset();
144 for (
int i = 0; i < irq_in.size(); ++i) {
145 irq_in[i].init(m_dev, i);
150 cci::cci_param<uint64_t> p_cfgbase;
151 cci::cci_param<bool> p_vp_mode;
152 cci::cci_param<bool> p_semihosting;
153 cci::cci_param<bool> p_start_powered_off;
154 cci::cci_param<bool> p_sched_limit;
155 cci::cci_param<bool> p_paranoid;
156 cci::cci_param<std::string> p_dsp_arch;
157 cci::cci_param<uint32_t> p_subsystem_id;
158 cci::cci_param<uint32_t> p_hexagon_num_threads;
159 cci::cci_param<bool> p_isdben_trusted;
160 cci::cci_param<bool> p_isdben_secure;
161 cci::cci_param<std::string> p_cmdline;
162 cci::cci_param<uint64_t> p_vtcm_base_addr;
163 cci::cci_param<uint32_t> p_vtcm_size_kb;
164 cci::cci_param<bool> p_coproc2_present;
165 cci::cci_param<uint32_t> p_hvx_contexts;