summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/netlist/devices/nld_7474.h
blob: 3452400dd54758085d2e4fb01025878ed2d21f22 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// license:GPL-2.0+
// copyright-holders:Couriersud
/*
 * nld_7474.h
 *
 *  DM7474: Dual Positive-Edge-Triggered D Flip-Flops
 *          with Preset, Clear and Complementary Outputs
 *
 *          +--------------+
 *     CLR1 |1     ++    14| VCC
 *       D1 |2           13| CLR2
 *     CLK1 |3           12| D2
 *      PR1 |4    7474   11| CLK2
 *       Q1 |5           10| PR2
 *      Q1Q |6            9| Q2
 *      GND |7            8| Q2Q
 *          +--------------+
 *
 *          +-----+-----+-----+---++---+-----+
 *          | PR  | CLR | CLK | D || Q | QQ  |
 *          +=====+=====+=====+===++===+=====+
 *          |  0  |  1  |  X  | X || 1 |  0  |
 *          |  1  |  0  |  X  | X || 0 |  1  |
 *          |  0  |  0  |  X  | X || 1 |  1  | (*)
 *          |  1  |  1  |  R  | 1 || 1 |  0  |
 *          |  1  |  1  |  R  | 0 || 0 |  1  |
 *          |  1  |  1  |  0  | X || Q0| Q0Q |
 *          +-----+-----+-----+---++---+-----+
 *
 *  (*) This configuration is not stable, i.e. it will not persist
 *  when either the preset and or clear inputs return to their inactive (high) level
 *
 *  Q0 The output logic level of Q before the indicated input conditions were established
 *
 *  R:  0 --> 1
 *
 *  Naming conventions follow National Semiconductor datasheet
 *
 *  FIXME: Check that (*) is emulated properly
 */

#ifndef NLD_7474_H_
#define NLD_7474_H_

#include "nld_signal.h"

#define TTL_7474(_name, _CLK, _D, _CLRQ, _PREQ)                                     \
		NET_REGISTER_DEV(7474, _name)                                               \
		NET_CONNECT(_name, CLK, _CLK)                                               \
		NET_CONNECT(_name, D,  _D)                                                  \
		NET_CONNECT(_name, CLRQ,  _CLRQ)                                            \
		NET_CONNECT(_name, PREQ,  _PREQ)

#define TTL_7474_DIP(_name)                                                         \
		NET_REGISTER_DEV(7474_dip, _name)

NETLIB_SUBDEVICE(7474sub,
	netlist_ttl_input_t m_CLK;

	netlist_state_t<UINT8> m_nextD;
	netlist_ttl_output_t m_Q;
	netlist_ttl_output_t m_QQ;

	ATTR_HOT inline void newstate(const UINT8 stateQ, const UINT8 stateQQ);
);

NETLIB_DEVICE(7474,
public:
	NETLIB_NAME(7474sub) sub;

	netlist_ttl_input_t m_D;
	netlist_ttl_input_t m_CLRQ;
	netlist_ttl_input_t m_PREQ;
);

NETLIB_DEVICE(7474_dip,

	NETLIB_NAME(7474) m_1;
	NETLIB_NAME(7474) m_2;
);

#endif /* NLD_7474_H_ */