Previous 199869 Revisions Next

r34130 Wednesday 31st December, 2014 at 13:51:20 UTC by Couriersud
Netlist update. Most prominent one is a "frontier" element which on a
low to high impedance node will - no other connections provided - let
the system create two matrices.
[src/emu/netlist]nl_base.h
[src/emu/netlist/analog]nld_ms_direct.h nld_ms_gauss_seidel.h nld_opamps.c nld_solver.c nld_solver.h
[src/emu/netlist/devices]net_lib.c nld_4020.c nld_cmos.h nld_system.h
[src/lib/util]chd.c
[src/mess/video]gb_lcd.c wswan_video.c

trunk/src/emu/netlist/analog/nld_ms_direct.h
r242641r242642
1414public:
1515
1616   netlist_matrix_solver_direct_t(const netlist_solver_parameters_t &params, int size);
17    netlist_matrix_solver_direct_t(const eSolverType type, const netlist_solver_parameters_t &params, int size);
1718
1819   virtual ~netlist_matrix_solver_direct_t();
1920
r242641r242642
186187    * Sorting as a general matrix pre-conditioning is mentioned in
187188    * literature but I have found no articles about Gauss Seidel.
188189    *
190     * For Gaussian Elimination however increasing order is better suited.
191     * FIXME: Even better would be to sort on elements right of the matrix diagonal.
192     *
189193    */
190194
195    int sort_order = (type() == GAUSS_SEIDEL ? 1 : -1);
191196
192197   for (int k = 0; k < N() / 2; k++)
193198      for (int i = 0; i < N() - 1; i++)
194199      {
195         if (m_terms[i]->m_railstart < m_terms[i+1]->m_railstart)
200            if ((m_terms[i]->m_railstart - m_terms[i+1]->m_railstart) * sort_order < 0)
196201         {
197202            std::swap(m_terms[i],m_terms[i+1]);
198203            m_nets.swap(i, i+1);
r242641r242642
443448
444449template <int m_N, int _storage_N>
445450netlist_matrix_solver_direct_t<m_N, _storage_N>::netlist_matrix_solver_direct_t(const netlist_solver_parameters_t &params, int size)
446: netlist_matrix_solver_t(params)
451: netlist_matrix_solver_t(GAUSSIAN_ELIMINATION, params)
447452, m_dim(size)
448453, m_lp_fact(0)
449454{
r242641r242642
458463   m_row_ops[N()] = vector_ops_t::create_ops(N());
459464}
460465
466template <int m_N, int _storage_N>
467netlist_matrix_solver_direct_t<m_N, _storage_N>::netlist_matrix_solver_direct_t(const eSolverType type, const netlist_solver_parameters_t &params, int size)
468: netlist_matrix_solver_t(type, params)
469, m_dim(size)
470, m_lp_fact(0)
471{
472    m_terms = new terms_t *[N()];
473    m_rails_temp = new terms_t[N()];
461474
475    for (int k = 0; k < N(); k++)
476    {
477        m_terms[k] = new terms_t;
478        m_row_ops[k] = vector_ops_t::create_ops(k);
479    }
480    m_row_ops[N()] = vector_ops_t::create_ops(N());
481}
462482
483
463484#endif /* NLD_MS_DIRECT_H_ */
trunk/src/emu/netlist/analog/nld_ms_gauss_seidel.h
r242641r242642
1717public:
1818
1919   netlist_matrix_solver_gauss_seidel_t(const netlist_solver_parameters_t &params, int size)
20      : netlist_matrix_solver_direct_t<m_N, _storage_N>(params, size)
20      : netlist_matrix_solver_direct_t<m_N, _storage_N>(netlist_matrix_solver_t::GAUSS_SEIDEL, params, size)
2121      , m_lp_fact(0)
2222      , m_gs_fail(0)
2323      , m_gs_total(0)
r242641r242642
4545template <int m_N, int _storage_N>
4646void netlist_matrix_solver_gauss_seidel_t<m_N, _storage_N>::log_stats()
4747{
48#if 0
49   if (this->m_calculations == 0)
48#if 1
49    if (this->m_stat_calculations == 0)
5050      return;
5151   printf("==============================================\n");
5252   printf("Solver %s\n", this->name().cstr());
5353   printf("       ==> %d nets\n", this->N()); //, (*(*groups[i].first())->m_core_terms.first())->name().cstr());
5454   printf("       has %s elements\n", this->is_dynamic() ? "dynamic" : "no dynamic");
5555   printf("       has %s elements\n", this->is_timestep() ? "timestep" : "no timestep");
56    printf("       %6.3f average newton raphson loops\n", (double) this->m_stat_newton_raphson / (double) this->m_stat_vsolver_calls);
5657   printf("       %10d invocations (%6d Hz)  %10d gs fails (%6.2f%%) %6.3f average\n",
57         this->m_calculations,
58         this->m_calculations * 10 / (int) (this->netlist().time().as_double() * 10.0),
58            this->m_stat_calculations,
59            this->m_stat_calculations * 10 / (int) (this->netlist().time().as_double() * 10.0),
5960         this->m_gs_fail,
60         100.0 * (double) this->m_gs_fail / (double) this->m_calculations,
61         (double) this->m_gs_total / (double) this->m_calculations);
61            100.0 * (double) this->m_gs_fail / (double) this->m_stat_calculations,
62            (double) this->m_gs_total / (double) this->m_stat_calculations);
6263#endif
6364}
6465
r242641r242642
292293      //if (fabs(gabs_t - fabs(gtot_t)) > 1e-20)
293294      //    printf("%d %e abs: %f tot: %f\n",k, gabs_t / gtot_t -1.0, gabs_t, gtot_t);
294295
295      gabs_t *= 0.5; // avoid rounding issues
296        gabs_t *= 0.95; // avoid rounding issues
296297      if (!USE_GABS || gabs_t <= gtot_t)
297298      {
298299         w[k] = ws / gtot_t;
r242641r242642
336337      this->m_nets[k]->m_cur_Analog = new_V[k];
337338
338339   this->m_gs_total += resched_cnt;
339   this->m_calculations++;
340    this->m_stat_calculations++;
340341
341342   if (resched)
342343   {
trunk/src/emu/netlist/analog/nld_opamps.c
r242641r242642
3131   NET_C(R1.2, R2.2, G1.ON)
3232   VCVS(G1)
3333   PARAM(G1.G, 10000000)
34   //PARAM(G1.RI, 100)
34    //PARAM(G1.RI, 1)
3535   PARAM(G1.RO, RES_K(8))
3636
3737NETLIST_END()
trunk/src/emu/netlist/analog/nld_solver.c
r242641r242642
3636#include "../nl_lists.h"
3737
3838#if HAS_OPENMP
39#include <omp.h>
39#include "omp.h"
4040#endif
4141
4242vector_ops_t *vector_ops_t::create_ops(const int size)
r242641r242642
9999// netlist_matrix_solver
100100// ----------------------------------------------------------------------------------------
101101
102ATTR_COLD netlist_matrix_solver_t::netlist_matrix_solver_t(const netlist_solver_parameters_t &params)
103: m_calculations(0), m_params(params), m_cur_ts(0)
102ATTR_COLD netlist_matrix_solver_t::netlist_matrix_solver_t(const eSolverType type, const netlist_solver_parameters_t &params)
103: m_stat_calculations(0),
104  m_stat_newton_raphson(0),
105  m_stat_vsolver_calls(0),
106 m_params(params),
107 m_cur_ts(0),
108 m_type(type)
104109{
105110}
106111
r242641r242642
254259template<class C >
255260void netlist_matrix_solver_t::solve_base(C *p)
256261{
262    m_stat_vsolver_calls++;
257263   if (is_dynamic())
258264   {
259265      int this_resched;
r242641r242642
266272         newton_loops++;
267273      } while (this_resched > 1 && newton_loops < m_params.m_nr_loops);
268274
275        m_stat_newton_raphson += newton_loops;
269276      // reschedule ....
270277      if (this_resched > 1 && !m_Q_sync.net().is_queued())
271278      {
r242641r242642
285292   netlist_time delta = now - m_last_step;
286293
287294   // We are already up to date. Avoid oscillations.
295   // FIXME: Make this a parameter!
288296   if (delta < netlist_time::from_nsec(1))
289297      return -1.0;
290298
trunk/src/emu/netlist/analog/nld_solver.h
r242641r242642
1414
1515#define USE_PIVOT_SEARCH (0)
1616#define VECTALT 1
17#define USE_GABS 0
17#define USE_GABS 1
1818#define USE_MATRIX_GS 0
1919// savings are eaten up by effort
2020#define USE_LINEAR_PREDICTION (0)
r242641r242642
197197   typedef plinearlist_t<netlist_matrix_solver_t *> list_t;
198198   typedef netlist_core_device_t::list_t dev_list_t;
199199
200   ATTR_COLD netlist_matrix_solver_t(const netlist_solver_parameters_t &params);
200   enum eSolverType
201   {
202       GAUSSIAN_ELIMINATION,
203       GAUSS_SEIDEL
204   };
205
206   ATTR_COLD netlist_matrix_solver_t(const eSolverType type, const netlist_solver_parameters_t &params);
201207   ATTR_COLD virtual ~netlist_matrix_solver_t();
202208
203209   ATTR_COLD virtual void vsetup(netlist_analog_net_t::list_t &nets) = 0;
r242641r242642
224230   ATTR_COLD int get_net_idx(netlist_net_t *net);
225231   ATTR_COLD virtual void log_stats() {};
226232
233   inline const eSolverType type() const { return m_type; }
234
227235protected:
228236
229237   ATTR_COLD void setup(netlist_analog_net_t::list_t &nets);
r242641r242642
237245   plinearlist_t<netlist_analog_net_t *> m_nets;
238246   plinearlist_t<netlist_analog_output_t *> m_inps;
239247
240   int m_calculations;
248    int m_stat_calculations;
249    int m_stat_newton_raphson;
250    int m_stat_vsolver_calls;
251
241252   const netlist_solver_parameters_t &m_params;
242253
243254   ATTR_HOT inline const double current_timestep() { return m_cur_ts; }
r242641r242642
255266
256267   ATTR_HOT void update_inputs();
257268
269    const eSolverType m_type;
258270};
259271
260272
trunk/src/emu/netlist/devices/net_lib.c
r242641r242642
9191   ENTRY(VCCS,                 VCCS,                   "-")
9292   ENTRY(CCCS,                 CCCS,                   "-")
9393   ENTRY(dummy_input,          DUMMY_INPUT,            "-")
94    ENTRY(frontier,             FRONTIER,               "+I,Q")
9495   ENTRY(QBJT_EB,              QBJT_EB,                "model")
9596   ENTRY(QBJT_switch,          QBJT_SW,                "model")
9697   ENTRY(ttl_input,            TTL_INPUT,              "IN")
trunk/src/emu/netlist/devices/nld_4020.c
r242641r242642
88NETLIB_START(4020)
99{
1010   register_sub(sub, "sub");
11   register_sub(m_supply, "supply");
1112
1213   register_input("RESET", m_RESET);
1314   register_subalias("IP", sub.m_IP);
r242641r242642
4243   register_output("Q5", m_Q[4]);
4344   register_output("Q6", m_Q[5]);
4445   register_output("Q7", m_Q[6]);
45   register_output("Q8", m_Q[8]);
46    register_output("Q8", m_Q[7]);
4647   register_output("Q9", m_Q[8]);
4748   register_output("Q10", m_Q[9]);
4849   register_output("Q11", m_Q[10]);
trunk/src/emu/netlist/devices/nld_cmos.h
r242641r242642
2121
2222   protected:
2323      ATTR_HOT void update() {};
24      ATTR_HOT void start()  {};
24        ATTR_HOT void start()
25        {
26            register_input("VDD,", m_vdd);
27            register_input("VSS,", m_vss);
28        };
2529      ATTR_HOT void reset()  {};
2630
2731public:
trunk/src/emu/netlist/devices/nld_system.h
r242641r242642
3939#define DUMMY_INPUT(_name)                                                     \
4040      NET_REGISTER_DEV(dummy_input, _name)
4141
42#define FRONTIER(_name, _IN, _OUT)                                             \
43        NET_REGISTER_DEV(frontier, _name)                                      \
44        NET_C(_IN, _name.I)                                                    \
45        NET_C(_OUT, _name.Q)                                                   \
46
4247// -----------------------------------------------------------------------------
4348// mainclock
4449// -----------------------------------------------------------------------------
r242641r242642
147152
148153};
149154
155// -----------------------------------------------------------------------------
156// nld_frontier
157// -----------------------------------------------------------------------------
150158
159class NETLIB_NAME(frontier) : public netlist_device_t
160{
161public:
162    ATTR_COLD NETLIB_NAME(frontier)()
163            : netlist_device_t(DUMMY) { }
164
165    ATTR_COLD virtual ~NETLIB_NAME(frontier)() {}
166
167protected:
168
169    ATTR_COLD void start()
170    {
171        register_input("I", m_I);
172        register_output("Q", m_Q);
173    }
174
175    ATTR_COLD void reset()
176    {
177    }
178
179    ATTR_HOT ATTR_ALIGN void update()
180    {
181        OUTANALOG(m_Q, INPANALOG(m_I));
182    }
183
184private:
185    netlist_analog_input_t m_I;
186    netlist_analog_output_t m_Q;
187
188};
189
190
151191// -----------------------------------------------------------------------------
152192// netdev_a_to_d
153193// -----------------------------------------------------------------------------
trunk/src/emu/netlist/nl_base.h
r242641r242642
337337      CAPACITOR,  // Capacitor
338338      DIODE,      // Diode
339339      DUMMY,      // DUMMY device without function
340        FRONTIER,   // Net frontier
340341      BJT_EB,     // BJT(Ebers-Moll)
341342      BJT_SWITCH, // BJT(Switch)
342343      VCVS,       // Voltage controlled voltage source
trunk/src/lib/util/chd.c
r242641r242642
452452               compressor = CHD_CODEC_PARENT;
453453               compbytes = 0;
454454               break;
455
456            default:
457               return CHDERR_UNKNOWN_COMPRESSION;
458455         }
459456         break;
460457   }
trunk/src/mess/video/gb_lcd.c
r242641r242642
215215void gb_lcd_device::common_start()
216216{
217217   m_screen->register_screen_bitmap(m_bitmap);
218   save_item(NAME(m_bitmap));
219218   m_oam = auto_alloc_array_clear(machine(), UINT8, 0x100);
220219
221220   machine().save().register_postload(save_prepost_delegate(FUNC(gb_lcd_device::videoptr_restore), this));
trunk/src/mess/video/wswan_video.c
r242641r242642
6969   save_item(NAME(m_timer_hblank_enable));
7070   save_item(NAME(m_timer_hblank_mode));
7171   save_item(NAME(m_timer_hblank_reload));
72   save_item(NAME(m_timer_hblank_count));
7372   save_item(NAME(m_timer_vblank_enable));
7473   save_item(NAME(m_timer_vblank_mode));
7574   save_item(NAME(m_timer_vblank_reload));


Previous 199869 Revisions Next


© 1997-2024 The MAME Team