//NETLIB_UPDATE_PARAMI() public override void update_param() { throw new emu_unimplemented(); #if false m_inc = netlist_time::from_double(1.0 / (m_freq() * 2.0)); #endif }
void step(netlist_time delta) { nl_double dd = delta.as_double(); for (int k = 0; k < m_step_devices.size(); k++) { m_step_devices[k].timestep(dd); } }
//NETLIB_CONSTRUCTOR(mainclock) //detail.family_setter_t m_famsetter; //template <class CLASS> nld_mainclock(object owner, string name) : base(owner, name) { m_Q = new logic_output_t(this, "Q"); m_freq = new param_double_t(this, "FREQ", 7159000.0 * 5); m_inc = netlist_time.from_double(1.0 / (m_freq.op() * 2.0)); }
public void update_forced() { netlist_time new_timestep = solve(); update_inputs(); if (m_params.m_dynamic_ts && has_timestep_devices()) { m_Q_sync.net().toggle_and_push_to_queue(netlist_time.from_double(m_params.m_min_timestep)); } }
//void create_solver_code(std::map<pstring, pstring> &mp); //NETLIB_UPDATE(solver) protected override void update() { if (m_params.m_dynamic_ts) { return; } /* force solving during start up if there are no time-step devices */ /* FIXME: Needs a more elegant solution */ bool force_solve = (exec().time() < netlist_time.from_double(2 * m_params.m_max_timestep)); int nthreads = std.min(m_parallel.op(), plib.omp.pomp_global.get_max_threads()); std.vector <matrix_solver_t> solvers = force_solve ? m_mat_solvers : m_mat_solvers_timestepping; if (nthreads > 1 && solvers.size() > 1) { throw new emu_unimplemented(); #if false plib.omp.set_num_threads(nthreads); plib.omp.for_static(0, t_cnt, [this, &solv](int i) { netlist_time ts = this.m_mat_solvers[solv[i]].solve(); }); #endif } else { foreach (var solver in solvers) { netlist_time ts = solver.solve(); } } foreach (var solver in solvers) { solver.update_inputs(); } /* step circuit */ if (!m_Q_step.net().is_queued()) { m_Q_step.net().toggle_and_push_to_queue(netlist_time.from_double(m_params.m_max_timestep)); } }
/* after every call to solve, update inputs must be called. * this can be done as well as a batch to ease parallel processing. */ public netlist_time solve() { netlist_time now = exec().time(); netlist_time delta = now - m_last_step.op; // We are already up to date. Avoid oscillations. // FIXME: Make this a parameter! if (delta < netlist_time.quantum()) { return(netlist_time.zero()); } /* update all terminals for new time step */ m_last_step.op = now; step(delta); solve_base(); netlist_time next_time_step = compute_next_timestep(delta.as_double()); return(next_time_step); }
} //constexpr pqentry_t() noexcept : m_exec_time(), m_object(nullptr) { } public pqentry_t(netlist_time t, Element o) { m_exec_time = t; m_object = o; } //constexpr pqentry_t(const Time &t, const Element &o) noexcept : m_exec_time(t), m_object(o) { }
pqentry_t() { m_exec_time = new netlist_time(); m_object = default(Element); } //constexpr pqentry_t() noexcept : m_exec_time(), m_object(nullptr) { }