trunk/src/emu/netlist/analog/nld_solver.c
| r29620 | r29621 | |
| 32 | 32 | |
| 33 | 33 | (*pn)->m_solver = this; |
| 34 | 34 | |
| 35 | | for (netlist_core_terminal_t *p = (*pn)->m_list.first(); p != NULL; p = (*pn)->m_list.next(p)) |
| 35 | for (int i = 0; i < (*pn)->m_core_terms.count(); i++) |
| 36 | 36 | { |
| 37 | netlist_core_terminal_t *p = (*pn)->m_core_terms[i]; |
| 37 | 38 | NL_VERBOSE_OUT(("%s %s %d\n", p->name().cstr(), (*pn)->name().cstr(), (int) (*pn)->isRailNet())); |
| 38 | 39 | switch (p->type()) |
| 39 | 40 | { |
| r29620 | r29621 | |
| 89 | 90 | } |
| 90 | 91 | for (netlist_core_terminal_t * const *p = m_inps.first(); p != NULL; p = m_inps.next(p)) |
| 91 | 92 | { |
| 92 | | (*p)->net().m_last_Analog = (*p)->net().m_cur_Analog; |
| 93 | if ((*p)->net().m_last_Analog != (*p)->net().m_cur_Analog) |
| 94 | (*p)->net().m_last_Analog = (*p)->net().m_cur_Analog; |
| 93 | 95 | } |
| 94 | 96 | |
| 95 | 97 | } |
| r29620 | r29621 | |
| 625 | 627 | |
| 626 | 628 | ATTR_COLD static void process_net(net_groups_t groups, int &cur_group, netlist_net_t *net) |
| 627 | 629 | { |
| 628 | | if (net->m_list.is_empty()) |
| 630 | if (net->m_core_terms.is_empty()) |
| 629 | 631 | return; |
| 630 | 632 | /* add the net */ |
| 631 | 633 | SOLVER_VERBOSE_OUT(("add %d - %s\n", cur_group, net->name().cstr())); |
| 632 | 634 | groups[cur_group].add(net); |
| 633 | | for (netlist_core_terminal_t *p = net->m_list.first(); p != NULL; p = net->m_list.next(p)) |
| 635 | for (int i = 0; i < net->m_core_terms.count(); i++) |
| 634 | 636 | { |
| 635 | | SOLVER_VERBOSE_OUT(("terminal %s\n", p->name().cstr())); |
| 637 | netlist_core_terminal_t *p = net->m_core_terms[i]; |
| 638 | SOLVER_VERBOSE_OUT(("terminal %s\n", p->name().cstr())); |
| 636 | 639 | if (p->isType(netlist_terminal_t::TERMINAL)) |
| 637 | 640 | { |
| 638 | 641 | SOLVER_VERBOSE_OUT(("isterminal\n")); |
| r29620 | r29621 | |
| 853 | 856 | { |
| 854 | 857 | SOLVER_VERBOSE_OUT(("Net %d: %s\n", j, groups[i][j]->name().cstr())); |
| 855 | 858 | netlist_net_t *n = groups[i][j]; |
| 856 | | for (netlist_core_terminal_t *p = n->m_list.first(); p != NULL; p = n->m_list.next(p)) |
| 859 | for (int k = 0; k < n->m_core_terms.count(); k++) |
| 857 | 860 | { |
| 861 | ATTR_UNUSED netlist_core_terminal_t *p = n->m_core_terms[k]; |
| 858 | 862 | SOLVER_VERBOSE_OUT((" %s\n", p->name().cstr())); |
| 859 | 863 | } |
| 860 | 864 | } |
trunk/src/emu/netlist/nl_setup.c
| r29620 | r29621 | |
| 402 | 402 | #if 1 |
| 403 | 403 | /* connect all existing terminals to new net */ |
| 404 | 404 | |
| 405 | | netlist_core_terminal_t *p = out.net().m_list.first(); |
| 406 | | while (p != NULL) |
| 405 | for (int i = 0; i < out.net().m_core_terms.count(); i++) |
| 407 | 406 | { |
| 408 | | netlist_core_terminal_t *np = out.net().m_list.next(p); |
| 407 | netlist_core_terminal_t *p = out.net().m_core_terms[i]; |
| 409 | 408 | p->clear_net(); // de-link from all nets ... |
| 410 | 409 | connect(proxy->out(), *p); |
| 411 | | p = np; |
| 412 | 410 | } |
| 413 | | out.net().m_list.clear(); // clear the list |
| 411 | out.net().m_core_terms.clear(); // clear the list |
| 414 | 412 | out.net().m_num_cons = 0; |
| 415 | 413 | #endif |
| 416 | 414 | out.net().register_con(proxy->m_I); |
| r29620 | r29621 | |
| 620 | 618 | |
| 621 | 619 | for (netlist_net_t *const *pn = netlist().m_nets.first(); pn != NULL; pn = netlist().m_nets.next(pn)) |
| 622 | 620 | { |
| 623 | | if ((*pn)->m_list.is_empty()) |
| 621 | if ((*pn)->m_core_terms.is_empty()) |
| 624 | 622 | { |
| 625 | 623 | todelete.add(*pn); |
| 626 | 624 | } |
| 627 | 625 | else |
| 628 | 626 | { |
| 627 | #if 0 |
| 629 | 628 | for (netlist_core_terminal_t *p = (*pn)->m_list.first(); p != NULL; p = (*pn)->m_list.next(p)) |
| 630 | 629 | (*pn)->m_registered.add(p); |
| 630 | #else |
| 631 | (*pn)->rebuild_list(); |
| 632 | #endif |
| 631 | 633 | } |
| 632 | 634 | } |
| 633 | 635 | |
trunk/src/emu/netlist/nl_lists.h
| r29620 | r29621 | |
| 42 | 42 | |
| 43 | 43 | ATTR_COLD netlist_list_t &operator=(const netlist_list_t &rhs) |
| 44 | 44 | { |
| 45 | | this->reset(); |
| 45 | this->clear(); |
| 46 | 46 | for (int i=0; i<rhs.count(); i++) |
| 47 | 47 | { |
| 48 | 48 | this->add(rhs[i]); |
| r29620 | r29621 | |
| 129 | 129 | ATTR_HOT inline const _ListClass *next(const _ListClass *lc) const { return ((lc < last()) ? lc + 1 : NULL ); } |
| 130 | 130 | ATTR_HOT inline const _ListClass *last() const { return &m_list[m_count -1]; } |
| 131 | 131 | ATTR_HOT inline int count() const { return m_count; } |
| 132 | | ATTR_HOT inline bool empty() const { return (m_count == 0); } |
| 132 | ATTR_HOT inline bool is_empty() const { return (m_count == 0); } |
| 133 | 133 | ATTR_HOT inline void clear() { m_count = 0; } |
| 134 | 134 | ATTR_HOT inline int capacity() const { return m_num_elements; } |
| 135 | 135 | |
trunk/src/emu/netlist/nl_base.c
| r29620 | r29621 | |
| 496 | 496 | |
| 497 | 497 | if (USE_ADD_REMOVE_LIST) |
| 498 | 498 | { |
| 499 | | m_list.insert(term); |
| 499 | m_list_active.insert(term); |
| 500 | 500 | //m_list.add(term); |
| 501 | 501 | } |
| 502 | 502 | |
| r29620 | r29621 | |
| 534 | 534 | |
| 535 | 535 | if (USE_ADD_REMOVE_LIST) |
| 536 | 536 | { |
| 537 | | m_list.remove(term); |
| 537 | m_list_active.remove(term); |
| 538 | 538 | } |
| 539 | 539 | |
| 540 | 540 | if (USE_DEACTIVE_DEVICE) |
| r29620 | r29621 | |
| 548 | 548 | { |
| 549 | 549 | /* rebuild m_list */ |
| 550 | 550 | |
| 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]); |
| 551 | m_list_active.clear(); |
| 552 | for (int i=0; i < m_core_terms.count(); i++) |
| 553 | if (m_core_terms[i]->state() != netlist_input_t::STATE_INP_PASSIVE) |
| 554 | m_list_active.add(*m_core_terms[i]); |
| 555 | 555 | } |
| 556 | 556 | |
| 557 | 557 | ATTR_COLD void netlist_net_t::reset() |
| r29620 | r29621 | |
| 568 | 568 | |
| 569 | 569 | /* rebuild m_list */ |
| 570 | 570 | |
| 571 | | m_list.clear(); |
| 572 | | for (int i=0; i < m_registered.count(); i++) |
| 573 | | m_list.add(*m_registered[i]); |
| 571 | m_list_active.clear(); |
| 572 | for (int i=0; i < m_core_terms.count(); i++) |
| 573 | m_list_active.add(*m_core_terms[i]); |
| 574 | 574 | |
| 575 | | for (netlist_core_terminal_t *t = m_list.first(); t != NULL; t = m_list.next(t)) |
| 576 | | { |
| 577 | | t->do_reset(); |
| 578 | | } |
| 579 | | for (netlist_core_terminal_t *t = m_list.first(); t != NULL; t = m_list.next(t)) |
| 580 | | { |
| 581 | | if (t->state() != netlist_input_t::STATE_INP_PASSIVE) |
| 582 | | m_active++; |
| 583 | | } |
| 575 | for (int i=0; i < m_core_terms.count(); i++) |
| 576 | m_core_terms[i]->do_reset(); |
| 577 | |
| 578 | for (int i=0; i < m_core_terms.count(); i++) |
| 579 | if (m_core_terms[i]->state() != netlist_input_t::STATE_INP_PASSIVE) |
| 580 | m_active++; |
| 584 | 581 | } |
| 585 | 582 | |
| 586 | 583 | ATTR_COLD void netlist_net_t::init_object(netlist_base_t &nl, const pstring &aname) |
| r29620 | r29621 | |
| 625 | 622 | } |
| 626 | 623 | else |
| 627 | 624 | { |
| 628 | | netlist_core_terminal_t *p = othernet->m_list.first(); |
| 629 | | while (p != NULL) |
| 625 | for (int i = 0; i < othernet->m_core_terms.count(); i++) |
| 630 | 626 | { |
| 631 | | netlist_core_terminal_t *pn = othernet->m_list.next(p); |
| 627 | netlist_core_terminal_t *p = othernet->m_core_terms[i]; |
| 632 | 628 | register_con(*p); |
| 633 | | p = pn; |
| 634 | 629 | } |
| 635 | 630 | |
| 636 | | othernet->m_list.clear(); // FIXME: othernet needs to be free'd from memory |
| 631 | othernet->m_core_terms.clear(); // FIXME: othernet needs to be free'd from memory |
| 637 | 632 | } |
| 638 | 633 | } |
| 639 | 634 | |
| r29620 | r29621 | |
| 641 | 636 | { |
| 642 | 637 | terminal.set_net(*this); |
| 643 | 638 | |
| 644 | | m_list.insert(terminal); |
| 639 | m_core_terms.add(&terminal); |
| 645 | 640 | m_num_cons++; |
| 646 | 641 | |
| 647 | 642 | if (terminal.state() != netlist_input_t::STATE_INP_PASSIVE) |
| r29620 | r29621 | |
| 667 | 662 | |
| 668 | 663 | const UINT32 masks[4] = { 1, 5, 3, 1 }; |
| 669 | 664 | const UINT32 mask = masks[ (m_last_Q << 1) | m_new_Q ]; |
| 670 | | netlist_core_terminal_t *p = m_list.first(); |
| 665 | netlist_core_terminal_t *p = m_list_active.first(); |
| 671 | 666 | |
| 672 | 667 | m_in_queue = 2; /* mark as taken ... */ |
| 673 | 668 | m_cur_Q = m_new_Q; |
| r29620 | r29621 | |
| 680 | 675 | { |
| 681 | 676 | case 2: |
| 682 | 677 | update_dev(p, mask); |
| 683 | | p = m_list.next(p); |
| 678 | p = m_list_active.next(p); |
| 684 | 679 | if (p == NULL) break; |
| 685 | 680 | case 1: |
| 686 | 681 | update_dev(p, mask); |
| r29620 | r29621 | |
| 689 | 684 | while (p != NULL) |
| 690 | 685 | { |
| 691 | 686 | update_dev(p, mask); |
| 692 | | p = m_list.next(p); |
| 687 | p = m_list_active.next(p); |
| 693 | 688 | } |
| 694 | 689 | break; |
| 695 | 690 | } |
| r29620 | r29621 | |
| 700 | 695 | { |
| 701 | 696 | case 2: |
| 702 | 697 | update_dev(p, mask); |
| 703 | | p = m_list.next(p); |
| 698 | p = m_list_active.next(p); |
| 704 | 699 | case 1: |
| 705 | 700 | update_dev(p, mask); |
| 706 | 701 | break; |
| r29620 | r29621 | |
| 708 | 703 | do |
| 709 | 704 | { |
| 710 | 705 | update_dev(p, mask); |
| 711 | | p = m_list.next(p); |
| 706 | p = m_list_active.next(p); |
| 712 | 707 | } while (p != NULL); |
| 713 | 708 | break; |
| 714 | 709 | } |