Previous 199869 Revisions Next

r29370 Sunday 6th April, 2014 at 15:45:52 UTC by Couriersud
Netlist: fixed reset (F3) and save state. Both crashed after last changes. Fixed issues introduced lately around DICE compatibility. [Couriersud]
[src/emu/machine]netlist.c
[src/emu/netlist]nl_base.c nl_base.h nl_dice_compat.h nl_lists.h nl_setup.c pstate.c
[src/emu/netlist/devices]net_lib.c nld_74107.c nld_system.h
[src/mame/drivers]pong.c

trunk/src/mame/drivers/pong.c
r29369r29370
5858
5959#define HRES_MULT                   (1)
6060
61fixedfreq_interface fixedfreq_mode_pong = {
61fixedfreq_interface fixedfreq_mode_pongd = {
6262   MASTER_CLOCK,
63   H_TOTAL-67,H_TOTAL-40,H_TOTAL-8,H_TOTAL,
63   H_TOTAL-67,H_TOTAL-52,H_TOTAL-8,H_TOTAL,
6464   V_TOTAL-22,V_TOTAL-19,V_TOTAL-12,V_TOTAL,
6565   1,  /* non-interlaced */
6666   0.31
6767};
6868
69fixedfreq_interface fixedfreq_mode_pong = {
70    MASTER_CLOCK,
71    H_TOTAL-67,H_TOTAL-40,H_TOTAL-8,H_TOTAL,
72    V_TOTAL-22,V_TOTAL-19,V_TOTAL-12,V_TOTAL,
73    1,  /* non-interlaced */
74    0.31
75};
76
6977fixedfreq_interface fixedfreq_mode_pongX2 = {
7078   MASTER_CLOCK * 2,
7179   (H_TOTAL-67) * 2, (H_TOTAL-40) * 2, (H_TOTAL-8) * 2, (H_TOTAL) * 2,
r29369r29370
105113#if 1
106114#if 0
107115   /* this is the clock circuit in schematics. */
108   MAINCLOCK(xclk)
109   //CLOCK(clk)
110   PARAM(xclk.FREQ, 7159000.0*2)
116   MAINCLOCK(xclk, 7159000.0*2)
111117   TTL_74107(ic_f6a, xclk, high, high, high)
112118   ALIAS(clk, ic_f6a.Q)
113119#else
114   /* abstracting this, performance increases by 40%
120   /* abstracting this, performance increases by 60%
115121    * No surprise, the clock is extremely expensive */
116122   MAINCLOCK(clk, 7159000.0)
117   //CLOCK(clk, 7159000.0)
118123#endif
119124#else
120125   // benchmarking ...
r29369r29370
728733
729734static NETLIST_START(pongd)
730735
731    NETLIST_INCLUDE(pongdoubles)
736    INCLUDE(pongdoubles)
732737
733738    //NETDEV_ANALOG_CALLBACK(sound_cb, AUDIO, pong_state, sound_cb, "")
734739    //NETDEV_ANALOG_CALLBACK(video_cb, videomix, fixedfreq_device, update_vid, "fixfreq")
r29369r29370
946951
947952    //MCFG_FIXFREQ_ADD("fixfreq", "screen", fixedfreq_mode_ntsc720)
948953    //MCFG_FIXFREQ_ADD("fixfreq", "screen", fixedfreq_mode_pongX2)
949    MCFG_FIXFREQ_ADD("fixfreq", "screen", fixedfreq_mode_pong)
954    MCFG_FIXFREQ_ADD("fixfreq", "screen", fixedfreq_mode_pongd)
950955
951956    /* sound hardware */
952957    MCFG_SPEAKER_STANDARD_MONO("mono")
trunk/src/emu/machine/netlist.c
r29369r29370
403403   LOG_DEV_CALLS(("device_post_load\n"));
404404
405405   netlist().post_load();
406   netlist().rebuild_lists();
406407}
407408
408409ATTR_COLD void netlist_mame_device_t::device_pre_save()
trunk/src/emu/netlist/nl_setup.c
r29369r29370
1717static NETLIST_START(base)
1818   TTL_INPUT(ttlhigh, 1)
1919   TTL_INPUT(ttllow, 0)
20    GND()
20   NET_REGISTER_DEV(gnd, GND)
2121
2222    INCLUDE(diode_models);
2323    INCLUDE(bjt_models);
r29369r29370
4545
4646netlist_setup_t::~netlist_setup_t()
4747{
48   m_links.reset();
48   m_links.clear();
4949   m_alias.reset();
5050   m_params.reset();
5151   m_terminals.reset();
r29369r29370
614614
615615    netlist().log("deleting empty nets ...");
616616
617   // delete empty nets ...
617   // delete empty nets ... and save m_list ...
618618
619619    netlist_net_t::list_t todelete;
620620
r29369r29370
624624      {
625625          todelete.add(*pn);
626626      }
627      else
628      {
629          for (netlist_core_terminal_t *p = (*pn)->m_list.first(); p != NULL; p = (*pn)->m_list.next(p))
630              (*pn)->m_registered.add(p);
631      }
627632   }
628633
629634    for (int i=0; i < todelete.count(); i++)
trunk/src/emu/netlist/nl_lists.h
r29369r29370
130130    ATTR_HOT inline const _ListClass *last() const { return &m_list[m_count -1]; }
131131    ATTR_HOT inline int count() const { return m_count; }
132132    ATTR_HOT inline bool empty() const { return (m_count == 0); }
133    ATTR_HOT inline void reset() { m_count = 0; }
133    ATTR_HOT inline void clear() { m_count = 0; }
134134    ATTR_HOT inline int capacity() const { return m_num_elements; }
135135
136    ATTR_COLD void reset_and_free()
136    ATTR_COLD void clear_and_free()
137137    {
138138        for (_ListClass *i = m_list; i < m_list + m_count; i++)
139139        {
140140            delete *i;
141141        }
142        reset();
142        clear();
143143    }
144144
145145    ATTR_HOT inline _ListClass& operator[](const int & index) { return m_list[index]; }
trunk/src/emu/netlist/pstate.c
r29369r29370
77
88ATTR_COLD pstate_manager_t::~pstate_manager_t()
99{
10   m_save.reset_and_free();
10   m_save.clear_and_free();
1111}
1212
1313
r29369r29370
4444    {
4545        m_save.remove(todelete[i]);
4646    }
47    todelete.reset_and_free();
47    todelete.clear_and_free();
4848}
4949
5050ATTR_COLD void pstate_manager_t::pre_save()
trunk/src/emu/netlist/devices/net_lib.c
r29369r29370
7878      net_device_t_base_factory *p = *e;
7979      delete p;
8080   }
81   m_list.reset();
81   m_list.clear();
8282}
8383
8484void netlist_factory_t::initialize()
trunk/src/emu/netlist/devices/nld_74107.c
r29369r29370
5757{
5858   const netlist_sig_t t = m_Q.net().Q();
5959   newstate((!t & m_Q1) | (t & m_Q2) | m_F);
60   if (!m_Q1)
60   if (UNEXPECTED(m_Q1 ^ 1))
6161      m_clk.inactivate();
6262}
6363
trunk/src/emu/netlist/devices/nld_system.h
r29369r29370
3333      NET_REGISTER_DEV(clock, _name)                                       \
3434        PARAM(_name.FREQ, _freq)
3535
36#define GND()                                                                \
36#define GNDA()                                                                \
3737        NET_REGISTER_DEV(gnd, GND)
3838
3939// ----------------------------------------------------------------------------------------
trunk/src/emu/netlist/nl_base.c
r29369r29370
148148        }
149149   }
150150
151   m_nets.reset();
151   m_nets.clear();
152152
153153   tagmap_free_entries<tagmap_devices_t>(m_devices);
154154
r29369r29370
200200   return NULL;
201201}
202202
203ATTR_COLD void netlist_base_t::rebuild_lists()
204{
205    for (int i = 0; i < m_nets.count(); i++)
206        m_nets[i]->rebuild_list();
207}
208
209
203210ATTR_COLD void netlist_base_t::reset()
204211{
205212   m_time = netlist_time::zero;
r29369r29370
537544    }
538545}
539546
547ATTR_COLD void netlist_net_t::rebuild_list()
548{
549    /* rebuild m_list */
540550
551    m_list.clear();
552    for (int i=0; i < m_registered.count(); i++)
553        if (m_registered[i]->state() != netlist_input_t::STATE_INP_PASSIVE)
554            m_list.add(*m_registered[i]);
555}
556
541557ATTR_COLD void netlist_net_t::reset()
542558{
543559    m_last_Analog = 0.0;
r29369r29370
550566    m_active = 0;
551567    m_in_queue = 2;
552568
569    /* rebuild m_list */
570
571    m_list.clear();
572    for (int i=0; i < m_registered.count(); i++)
573        m_list.add(*m_registered[i]);
574
553575    for (netlist_core_terminal_t *t = m_list.first(); t != NULL; t = m_list.next(t))
554576    {
555577        t->do_reset();
trunk/src/emu/netlist/nl_dice_compat.h
r29369r29370
1313 * -------------------------------------------------------------------- */
1414
1515//#define CHIP(_n, _t) netlist.register_dev(NET_NEW(_t ## _dip), _n);
16#define CHIP(_n, _t) netlist.register_dev( new nld_ ## _t ## _dip(), _n);
16#define CHIP(_n, _t) setup.register_dev( new nld_ ## _t ## _dip(), _n);
1717
1818#define CONNECTION( a... ) CONNECTIONX( a )
19#define CONNECTIONX(_a, _b, _c, _d) netlist.register_link(_a "." # _b, _c "." # _d);
20#define NET_CSTR(_a, _b) netlist.register_link( _a, _b);
19#define CONNECTIONX(_a, _b, _c, _d) setup.register_link(_a "." # _b, _c "." # _d);
20#define NET_CSTR(_a, _b) setup.register_link( _a, _b);
2121
2222#define CIRCUIT_LAYOUT(x) NETLIST_START(x)
2323#define CIRCUIT_LAYOUT_END NETLIST_END()
trunk/src/emu/netlist/nl_base.h
r29369r29370
625625
626626    ATTR_HOT void solve();
627627
628    netlist_list_t<netlist_core_terminal_t *> m_registered; // save post-start m_list ...
628629    plinked_list<netlist_core_terminal_t> m_list;
629630
631    ATTR_COLD void rebuild_list();     /* rebuild m_list after a load */
632
630633protected:  //FIXME: needed by current solver code
631634
632635    UINT16 m_num_cons;
r29369r29370
10291032    ATTR_HOT void process_queue(const netlist_time delta);
10301033    ATTR_HOT inline void abort_current_queue_slice() { m_stop = netlist_time::zero; }
10311034
1035    ATTR_COLD void rebuild_lists(); /* must be called after post_load ! */
1036
10321037    ATTR_COLD void set_setup(netlist_setup_t *asetup) { m_setup = asetup;  }
10331038    ATTR_COLD netlist_setup_t &setup() { return *m_setup; }
10341039

Previous 199869 Revisions Next


© 1997-2024 The MAME Team