25 cci::cci_param<uint32_t> p_hartid_base;
26 cci::cci_param<unsigned int> p_num_harts;
27 cci::cci_param<uint64_t> p_timecmp_base;
28 cci::cci_param<uint64_t> p_time_base;
29 cci::cci_param<uint64_t> p_aperture_size;
30 cci::cci_param<uint32_t> p_timebase_freq;
31 cci::cci_param<bool> p_provide_rdtime;
34 sc_core::sc_vector<QemuInitiatorSignalSocket> timer_irq;
42 , p_hartid_base(
"hartid_base", 0,
"Base hart ID for this ACLINT MTimer")
43 , p_num_harts(
"num_harts", 0,
"Number of HARTS this CLINT is connected to")
44 , p_timecmp_base(
"timecmp_base", 0,
"Base address for the TIMECMP registers")
45 , p_time_base(
"time_base", 0,
"Base address for the TIME registers")
46 , p_aperture_size(
"aperture_size", 0,
"Size of the whole CLINT address space")
47 , p_timebase_freq(
"timebase_freq", 10000000,
"")
48 , p_provide_rdtime(
"provide_rdtime",
false,
49 "If true, provide the CPU with "
52 , timer_irq(
"timer_irq")
56 void before_end_of_elaboration()
override
58 QemuDevice::before_end_of_elaboration();
61 if (timer_irq.size() == 0) {
65 if (timer_irq.size() != p_num_harts) {
66 SCP_WARN(
SCMOD) <<
"Timer IRQ size mismatch: timer_irq.size()=" << timer_irq.size()
67 <<
" != p_num_harts=" << (
unsigned int)p_num_harts;
70 m_dev.set_prop_int(
"hartid-base", p_hartid_base);
71 m_dev.set_prop_int(
"num-harts", p_num_harts);
72 m_dev.set_prop_int(
"timecmp-base", p_timecmp_base);
73 m_dev.set_prop_int(
"time-base", p_time_base);
74 m_dev.set_prop_int(
"aperture-size", p_aperture_size);
75 m_dev.set_prop_int(
"timebase-freq", p_timebase_freq);
76 m_dev.set_prop_bool(
"provide-rdtime", p_provide_rdtime);
79 void end_of_elaboration()
override
81 QemuDevice::set_sysbus_as_parent_bus();
82 QemuDevice::end_of_elaboration();
88 for (
unsigned int i = 0;
i < p_num_harts;
i++) {
89 timer_irq[
i].init(m_dev,
i);
93 SCP_INFO(
SCMOD) <<
"Timer IRQ GPIO outputs ready for connection";