@@ -180,13 +180,13 @@ void core_complex<BUSWIDTH, QK>::create_cpu(std::string const& type, std::string
180180
181181#ifndef CWR_SYSTEMC
182182template <unsigned int BUSWIDTH, typename QK>
183- core_complex<BUSWIDTH, QK>::core_complex(sc_module_name const & name)
183+ core_complex<BUSWIDTH, QK>::core_complex(sc_module_name const & name, size_t clint_irq_size )
184184: sc_module(name) {
185- init ();
185+ init (clint_irq_size );
186186}
187187#endif
188188
189- template <unsigned int BUSWIDTH, typename QK> void core_complex<BUSWIDTH, QK>::init() {
189+ template <unsigned int BUSWIDTH, typename QK> void core_complex<BUSWIDTH, QK>::init(size_t clint_irq_size ) {
190190 core_complex_if::exec_on_sysc = util::delegate<void (std::function<void (void )>&)>::from<this_class, &this_class::exec_on_sysc<QK>>(this );
191191 ibus.register_invalidate_direct_mem_ptr ([this ](uint64_t start, uint64_t end) -> void {
192192 auto lut_entry = fetch_lut.getEntry (start);
@@ -209,14 +209,7 @@ template <unsigned int BUSWIDTH, typename QK> void core_complex<BUSWIDTH, QK>::i
209209 }
210210 });
211211
212- auto & type = GET_PROP_VALUE (core_type);
213- SCCDEBUG (SCMOD) << " instantiating core " << type << " with " << GET_PROP_VALUE (backend) << " backend" ;
214- create_cpu (type, GET_PROP_VALUE (backend), GET_PROP_VALUE (gdb_server_port), GET_PROP_VALUE (mhartid));
215- if (type != " ?" ) {
216- sc_assert (vm);
217- }
218- auto xlen = type == " ?" ? 32 : core->get_arch_if ()->get_instrumentation_if ()->get_reg_size (/* x0*/ 0 );
219- clint_irq_i.init (xlen);
212+ clint_irq_i.init (clint_irq_size);
220213 SC_HAS_PROCESS (this_class); // NOLINT
221214 SC_THREAD (run);
222215 SC_METHOD (rst_cb);
@@ -263,8 +256,14 @@ template <unsigned int BUSWIDTH, typename QK> core_complex<BUSWIDTH, QK>::~core_
263256template <unsigned int BUSWIDTH, typename QK> void core_complex<BUSWIDTH, QK>::trace(sc_trace_file* trf) const {}
264257
265258template <unsigned int BUSWIDTH, typename QK> void core_complex<BUSWIDTH, QK>::before_end_of_elaboration() {
266- if (!core)
259+ auto & type = GET_PROP_VALUE (core_type);
260+ SCCDEBUG (SCMOD) << " instantiating core " << type << " with " << GET_PROP_VALUE (backend) << " backend" ;
261+ create_cpu (type, GET_PROP_VALUE (backend), GET_PROP_VALUE (gdb_server_port), GET_PROP_VALUE (mhartid));
262+ if (type != " ?" ) {
263+ if (!core || !vm)
264+ SCCFATAL (SCOBJ) << " Could not create core " << type;
267265 return ;
266+ }
268267 auto instr_trace = GET_PROP_VALUE (enable_instr_trace) ? trc.init (this ->name ()) : false ;
269268 auto disass = GET_PROP_VALUE (enable_disass);
270269 if (disass)
@@ -543,12 +542,7 @@ bool core_complex<BUSWIDTH, QK>::write_mem_dbg(const addr_t& addr, unsigned leng
543542 gp.set_extension (new sysc::memspace::tlm_memspace_extension<>(static_cast <memspace::common>(addr.space )));
544543 return dbus->transport_dbg (gp) == length;
545544}
546- template <unsigned int BUSWIDTH, typename QK> util::range_lut<tlm_dmi_ext>& core_complex<BUSWIDTH, QK>::get_read_lut(unsigned space) {
547- return get_lut (dmi_read_luts, space);
548- };
549- template <unsigned int BUSWIDTH, typename QK> util::range_lut<tlm_dmi_ext>& core_complex<BUSWIDTH, QK>::get_write_lut(unsigned space) {
550- return get_lut (dmi_write_luts, space);
551- };
545+
552546template <unsigned int BUSWIDTH, typename QK>
553547util::range_lut<tlm_dmi_ext>& core_complex<BUSWIDTH, QK>::get_lut(lut_vec_t & luts, unsigned space) {
554548 if (space >= luts.size ()) {
0 commit comments