Previous 199869 Revisions Next

r26404 Sunday 24th November, 2013 at 22:57:10 UTC by Couriersud
Netlist: Documented 7430 & 7486
[src/emu/netlist]netlist.mak pstring.c
[src/emu/netlist/devices]net_lib.c net_lib.h nld_7400.h nld_7402.h nld_7410.h nld_7420.h nld_7425.h nld_7427.h nld_7430.h* nld_7486.c* nld_7486.h*

trunk/src/emu/netlist/devices/nld_7410.h
r26403r26404
2929 *
3030 */
3131
32
33#include "nld_signal.h"
34
3532#ifndef NLD_7410_H_
3633#define NLD_7410_H_
3734
35#include "nld_signal.h"
36
3837#define TTL_7410_NAND(_name, _I1, _I2, _I3)                                         \
3938        NET_REGISTER_DEV(7410, _name)                                               \
4039        NET_CONNECT(_name, A, _I1)                                                  \
trunk/src/emu/netlist/devices/nld_7420.h
r26403r26404
3030 *
3131 */
3232
33
34#include "nld_signal.h"
35
3633#ifndef NLD_7420_H_
3734#define NLD_7420_H_
3835
36#include "nld_signal.h"
37
3938#define TTL_7420_NAND(_name, _I1, _I2, _I3, _I4)                                    \
4039        NET_REGISTER_DEV(7420, _name)                                               \
4140        NET_CONNECT(_name, A, _I1)                                                  \
trunk/src/emu/netlist/devices/nld_7402.h
r26403r26404
2929 *
3030 */
3131
32
33#include "nld_signal.h"
34
3532#ifndef NLD_7402_H_
3633#define NLD_7402_H_
3734
35#include "nld_signal.h"
36
3837#define TTL_7402_NOR(_name, _I1, _I2)                                               \
3938        NET_REGISTER_DEV(7402, _name)                                               \
4039        NET_CONNECT(_name, A, _I1)                                                  \
trunk/src/emu/netlist/devices/nld_7430.h
r0r26404
1// license:GPL-2.0+
2// copyright-holders:Couriersud
3/*
4 * nld_7430.h
5 *
6 *  DM7430: 8-Input NAND Gate
7 *
8 *          +--------------+
9 *       A  |1     ++    14| VCC
10 *       B  |2           13| NC
11 *       C  |3           12| H
12 *       D  |4    7430   11| G
13 *       E  |5           10| NC
14 *       F  |6            9| NC
15 *      GND |7            8| Y
16 *          +--------------+
17 *                  ________
18 *              Y = ABCDEFGH
19 *          +---+---+---+---+---+---+---+---++---+
20 *          | A | B | C | D | E | F | G | H || Y |
21 *          +===+===+===+===+===+===+===+===++===+
22 *          | X | X | X | X | X | X | X | 0 || 1 |
23 *          | X | X | X | X | X | X | 0 | X || 1 |
24 *          | X | X | X | X | X | 0 | X | X || 1 |
25 *          | X | X | X | X | 0 | X | X | X || 1 |
26 *          | X | X | X | 0 | X | X | X | X || 1 |
27 *          | X | X | 0 | X | X | X | X | X || 1 |
28 *          | X | 0 | X | X | X | X | X | X || 1 |
29 *          | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 || 0 |
30 *          +---+---+---+---+---+---+---+---++---+
31 *
32 *  Naming conventions follow National Semiconductor datasheet
33 *
34 */
35
36
37#ifndef NLD_7430_H_
38#define NLD_7430_H_
39
40#include "nld_signal.h"
41
42#define TTL_7430_NAND(_name, _I1, _I2, _I3, _I4, _I5, _I6, _I7, _I8)                \
43        NET_REGISTER_DEV(nic7430, _name)                                            \
44        NET_CONNECT(_name, A, _I1)                                                  \
45        NET_CONNECT(_name, B, _I2)                                                  \
46        NET_CONNECT(_name, C, _I3)                                                  \
47        NET_CONNECT(_name, D, _I4)                                                  \
48        NET_CONNECT(_name, E, _I5)                                                  \
49        NET_CONNECT(_name, F, _I6)                                                  \
50        NET_CONNECT(_name, G, _I7)                                                  \
51        NET_CONNECT(_name, H, _I8)
52
53
54NETLIB_SIGNAL(nic7430, 8, 0, 0);
55
56#endif /* NLD_7430_H_ */
Property changes on: trunk/src/emu/netlist/devices/nld_7430.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/emu/netlist/devices/net_lib.h
r26403r26404
6060#include "nld_7420.h"
6161#include "nld_7425.h"
6262#include "nld_7427.h"
63#include "nld_7430.h"
64#include "nld_7486.h"
6365
6466// this is a bad hack
6567#define USE_OLD7493 (0)
r26403r26404
9799// TTL Logic chips
98100// ----------------------------------------------------------------------------------------
99101
100
101
102102#define TTL_7404_INVERT(_name, _I1)                                                 \
103103      NET_REGISTER_DEV(nic7404, _name)                                            \
104104      NET_CONNECT(_name, I1, _I1)
105105
106
107
108#define TTL_7430_NAND(_name, _I1, _I2, _I3, _I4, _I5, _I6, _I7, _I8)                \
109      NET_REGISTER_DEV(nic7430, _name)                                            \
110      NET_CONNECT(_name, A, _I1)                                                  \
111      NET_CONNECT(_name, B, _I2)                                                  \
112      NET_CONNECT(_name, C, _I3)                                                  \
113      NET_CONNECT(_name, D, _I4)                                                  \
114      NET_CONNECT(_name, E, _I5)                                                  \
115      NET_CONNECT(_name, F, _I6)                                                  \
116      NET_CONNECT(_name, G, _I7)                                                  \
117      NET_CONNECT(_name, H, _I8)
118
119106#define TTL_7450_ANDORINVERT(_name, _I1, _I2, _I3, _I4)                             \
120107      NET_REGISTER_DEV(nic7450, _name)                                            \
121108      NET_CONNECT(_name, I1, _I1)                                                 \
r26403r26404
123110      NET_CONNECT(_name, I3, _I3)                                                 \
124111      NET_CONNECT(_name, I4, _I4)
125112
126#define TTL_7486_XOR(_name, _I1, _I2)                                               \
127      NET_REGISTER_DEV(nic7486, _name)                                            \
128      NET_CONNECT(_name, I1, _I1)                                                 \
129      NET_CONNECT(_name, I2, _I2)
130
131113#define TTL_7448(_name, _A0, _A1, _A2, _A3, _LTQ, _BIQ, _RBIQ)                      \
132114      NET_REGISTER_DEV(nic7448, _name)                                            \
133115      NET_CONNECT(_name, A0, _A0)                                                 \
r26403r26404
297279
298280);
299281
300NETLIB_SIGNAL(nic7430, 8, 0, 0);
301282
283
302284NETLIB_DEVICE(nic7404,
303285   netlist_ttl_input_t m_I;
304286   netlist_ttl_output_t m_Q;
r26403r26404
330312   netlist_ttl_input_t m_preQ;
331313);
332314
333NETLIB_DEVICE(nic7486,
334      netlist_ttl_input_t m_I0;
335      netlist_ttl_input_t m_I1;
336      netlist_ttl_output_t m_Q;
337);
338
339315/* 74107 does latch data during high !
340316 * For modelling purposes, we assume 74107 and 74107A are the same
341317 */
trunk/src/emu/netlist/devices/nld_7425.h
r26403r26404
3333 *
3434 */
3535
36
37#include "nld_signal.h"
38
3936#ifndef NLD_7425_H_
4037#define NLD_7425_H_
4138
39#include "nld_signal.h"
40
4241#define TTL_7425_NOR(_name, _I1, _I2, _I3, _I4)                                     \
4342        NET_REGISTER_DEV(7425, _name)                                               \
4443        NET_CONNECT(_name, A, _I1)                                                  \
trunk/src/emu/netlist/devices/nld_7427.h
r26403r26404
2929 *
3030 */
3131
32
33#include "nld_signal.h"
34
3532#ifndef NLD_7427_H_
3633#define NLD_7427_H_
3734
35#include "nld_signal.h"
36
3837#define TTL_7427_NOR(_name, _I1, _I2, _I3)                                          \
3938        NET_REGISTER_DEV(7427, _name)                                               \
4039        NET_CONNECT(_name, A, _I1)                                                  \
trunk/src/emu/netlist/devices/nld_7486.c
r0r26404
1/*
2 * nld_7486.c
3 *
4 */
5
6#include "nld_7486.h"
7
8NETLIB_START(nic7486)
9{
10    register_input("A", m_A);
11    register_input("B", m_B);
12    register_output("Q", m_Q);
13}
14
15NETLIB_UPDATE(nic7486)
16{
17    static const netlist_time delay[2] = { NLTIME_FROM_NS(15), NLTIME_FROM_NS(22) };
18    UINT8 t = INPLOGIC(m_A) ^ INPLOGIC(m_B);
19    OUTLOGIC(m_Q, t, delay[t]);
20}
21
Property changes on: trunk/src/emu/netlist/devices/nld_7486.c
Added: svn:eol-style
   + native
Added: svn:mime-type
   + text/plain
trunk/src/emu/netlist/devices/nld_7486.h
r0r26404
1// license:GPL-2.0+
2// copyright-holders:Couriersud
3/*
4 * nld_7486.h
5 *
6 *  DM7486: Quad 2-Input NAND Gates
7 *
8 *          +--------------+
9 *       A1 |1     ++    14| VCC
10 *       B1 |2           13| B4
11 *       Y1 |3           12| A4
12 *       A2 |4    7486   11| Y4
13 *       B2 |5           10| B3
14 *       Y2 |6            9| A3
15 *      GND |7            8| Y3
16 *          +--------------+
17 *
18 *             Y = A+B
19 *          +---+---++---+
20 *          | A | B || Y |
21 *          +===+===++===+
22 *          | 0 | 0 || 0 |
23 *          | 0 | 1 || 1 |
24 *          | 1 | 0 || 1 |
25 *          | 1 | 1 || 0 |
26 *          +---+---++---+
27 *
28 *  Naming conventions follow National Semiconductor datasheet
29 *
30 */
31
32#ifndef NLD_7486_H_
33#define NLD_7486_H_
34
35#include "nld_signal.h"
36
37#define TTL_7486_XOR(_name, _A, _B)                                                 \
38        NET_REGISTER_DEV(nic7486, _name)                                            \
39        NET_CONNECT(_name, A, _A)                                                   \
40        NET_CONNECT(_name, B, _B)
41
42NETLIB_DEVICE(nic7486,
43        netlist_ttl_input_t m_A;
44        netlist_ttl_input_t m_B;
45        netlist_ttl_output_t m_Q;
46);
47#endif /* NLD_7486_H_ */
Property changes on: trunk/src/emu/netlist/devices/nld_7486.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/emu/netlist/devices/nld_7400.h
r26403r26404
2929 *
3030 */
3131
32#include "nld_signal.h"
33
3432#ifndef NLD_7400_H_
3533#define NLD_7400_H_
3634
35#include "nld_signal.h"
36
3737#define TTL_7400_NAND(_name, _A, _B)                                                \
3838      NET_REGISTER_DEV(7400, _name)                                               \
3939      NET_CONNECT(_name, A, _A)                                                   \
trunk/src/emu/netlist/devices/net_lib.c
r26403r26404
280280   OUTLOGIC(m_Q, t, delay[t]);
281281}
282282
283NETLIB_START(nic7486)
284{
285   register_input("I1", m_I0);
286   register_input("I2", m_I1);
287   register_output("Q", m_Q);
288}
289
290NETLIB_UPDATE(nic7486)
291{
292   static const netlist_time delay[2] = { NLTIME_FROM_NS(15), NLTIME_FROM_NS(22) };
293   UINT8 t = INPLOGIC(m_I0) ^ INPLOGIC(m_I1);
294   OUTLOGIC(m_Q, t, delay[t]);
295}
296
297283NETLIB_START(nic7448)
298284{
299285   register_sub(sub, "sub");
trunk/src/emu/netlist/pstring.c
r26403r26404
107107
108108char *pstring::alloc_str(int n)
109109{
110#if (IMMEDIATE_MODE)
111    return (char *) malloc(n);
112#else
113#if (DEBUG_MODE)
114    int min_alloc = MAX(0, n+sizeof(memblock));
115#else
116    int min_alloc = MAX(8192, n+sizeof(memblock));
117#endif
118    char *ret = NULL;
119
120    //std::printf("m_first %p\n", m_first);
121    for (memblock *p = m_first; p != NULL && ret == NULL; p = p->next)
110    if (IMMEDIATE_MODE)
111        return (char *) malloc(n);
112    else
122113    {
123        if (p->remaining > n)
114        int min_alloc = MAX((DEBUG_MODE) ? 0 : 8192, n+sizeof(memblock));
115        char *ret = NULL;
116
117        //std::printf("m_first %p\n", m_first);
118        for (memblock *p = m_first; p != NULL && ret == NULL; p = p->next)
124119        {
120            if (p->remaining > n)
121            {
122                ret = p->cur;
123                p->cur += n;
124                p->allocated += 1;
125                p->remaining -= n;
126            }
127        }
128
129        if (ret == NULL)
130        {
131            // need to allocate a new block
132            memblock *p = (memblock *) malloc(min_alloc); //new char[min_alloc];
133            p->allocated = 0;
134            p->cur = &p->data[0];
135            p->size = p->remaining = min_alloc - sizeof(memblock);
136            p->next = m_first;
137            //std::printf("allocated block size %d\n", p->size);
138
125139            ret = p->cur;
126140            p->cur += n;
127141            p->allocated += 1;
128142            p->remaining -= n;
143
144            m_first = p;
129145        }
130    }
131146
132    if (ret == NULL)
133    {
134        // need to allocate a new block
135        memblock *p = (memblock *) malloc(min_alloc); //new char[min_alloc];
136        p->allocated = 0;
137        p->cur = &p->data[0];
138        p->size = p->remaining = min_alloc - sizeof(memblock);
139        p->next = m_first;
140        //std::printf("allocated block size %d\n", p->size);
141
142        ret = p->cur;
143        p->cur += n;
144        p->allocated += 1;
145        p->remaining -= n;
146
147        m_first = p;
147        return ret;
148148    }
149
150    return ret;
151#endif
152149}
153150
154151void pstring::dealloc_str(void *ptr)
155152{
156#if (IMMEDIATE_MODE)
157    free(ptr);
158#else
159    for (memblock *p = m_first; p != NULL; p = p->next)
153    if (IMMEDIATE_MODE)
154        free(ptr);
155    else
160156    {
161        if (ptr >= &p->data[0] && ptr < &p->data[p->size])
157        for (memblock *p = m_first; p != NULL; p = p->next)
162158        {
163            p->allocated -= 1;
164            if (p->allocated < 0)
165                fatalerror("nstring: memory corruption\n");
166            if (p->allocated == 0)
159            if (ptr >= &p->data[0] && ptr < &p->data[p->size])
167160            {
168                //std::printf("Block entirely freed\n");
169                p->remaining = p->size;
170                p->cur = &p->data[0];
161                p->allocated -= 1;
162                if (p->allocated < 0)
163                    fatalerror("nstring: memory corruption\n");
164                if (p->allocated == 0)
165                {
166                    //std::printf("Block entirely freed\n");
167                    p->remaining = p->size;
168                    p->cur = &p->data[0];
169                }
170                // shutting down ?
171                if (m_zero == NULL)
172                    resetmem(); // try to free blocks
173                return;
171174            }
172            // shutting down ?
173            if (m_zero == NULL)
174                resetmem(); // try to free blocks
175            return;
176175        }
176        fatalerror("nstring: string <%p> not found\n", ptr);
177177    }
178    fatalerror("nstring: string <%p> not found\n", ptr);
179#endif
180178}
181179
182180void pstring::resetmem()
183181{
184#if (IMMEDIATE_MODE)
185#else
186    memblock **p = &m_first;
187    int totalblocks = 0;
188    int freedblocks = 0;
182    if (!IMMEDIATE_MODE)
183    {
184        memblock **p = &m_first;
185        int totalblocks = 0;
186        int freedblocks = 0;
189187
190    // Release the 0 string
191    if (m_zero != NULL) sfree(m_zero);
192    m_zero = NULL;
188        // Release the 0 string
189        if (m_zero != NULL) sfree(m_zero);
190        m_zero = NULL;
193191
194    while (*p != NULL)
195    {
196        totalblocks++;
197        memblock **next = &((*p)->next);
198        if ((*p)->allocated == 0)
192        while (*p != NULL)
199193        {
200            //std::printf("freeing block %p\n", *p);
201            memblock *freeme = *p;
202            *p = *next;
203            free(freeme); //delete[] *p;
204            freedblocks++;
194            totalblocks++;
195            memblock **next = &((*p)->next);
196            if ((*p)->allocated == 0)
197            {
198                //std::printf("freeing block %p\n", *p);
199                memblock *freeme = *p;
200                *p = *next;
201                free(freeme); //delete[] *p;
202                freedblocks++;
203            }
204            else
205            {
206                if (DEBUG_MODE)
207                    std::printf("Allocated: <%s>\n", ((str_t *)(&(*p)->data[0]))->str());
208
209                p = next;
210            }
205211        }
206        else
207        {
208#if (DEBUG_MODE)
209            std::printf("Allocated: <%s>\n", ((str_t *)(&(*p)->data[0]))->str());
210#endif
211            p = next;
212        }
212        if (DEBUG_MODE)
213            std::printf("Freed %d out of total %d blocks\n", freedblocks, totalblocks);
213214    }
214#if (DEBUG_MODE)
215    std::printf("Freed %d out of total %d blocks\n", freedblocks, totalblocks);
216#endif
217#endif
218215}
trunk/src/emu/netlist/netlist.mak
r26403r26404
2424   $(NETLISTOBJ)/nl_parser.o \
2525   $(NETLISTOBJ)/devices/nld_system.o \
2626   $(NETLISTOBJ)/devices/net_lib.o \
27   $(NETLISTOBJ)/devices/nld_7486.o \
2728

Previous 199869 Revisions Next


© 1997-2024 The MAME Team