summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/machine/74175.h
blob: c22aa05747f1dec627cfd085d477690769a115df (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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
/**********************************************************************

    5/74174/5 Hex/Quad D Flip-Flops with Clear

***********************************************************************

    Connection Diagram:
              ___ ___                         ___ ___
    CLEAR  1 |*  u   | 16  Vcc      CLEAR  1 |*  u   | 16  Vcc
       Q1  2 |       | 15  Q6          Q1  2 |       | 15  Q4
       D1  3 |       | 14  D6         /Q1  3 |       | 14  /Q4
       D2  4 |       | 13  D5          D1  4 |       | 13  D4
       Q2  5 |       | 12  Q5          D2  5 |       | 12  D3
       D3  6 |       | 11  D4         /Q2  6 |       | 11  /Q3
       Q3  7 |       | 10  Q4          Q2  7 |       | 10  Q3
      GND  8 |_______| 9   CLOCK      GND  8 |_______| 9   CLOCK

              5/74174                         5/74175

***********************************************************************

    Function Table:
     _________________________________
    |       Inputs        |  Outputs* |
    |---------------------|-----------|
    | Clear | Clock |  D  |  Q  | /Q  |
    |-------|-------|-----|-----|-----|
    |   L   |   X   |  X  |  L  |  H  |
    |   H   |   ^   |  H  |  H  |  L  |
    |   H   |   ^   |  L  |  L  |  H  |
    |   H   |   L   |  X  |  Q0 |  Q0 |
    |_______|_______|_____|_____|_____|

    H = High Level (steady state)
    L = Low Level (steady state)
    X = Don't Care
    ^ = Transition from low to high level
    Q0 = The level of Q before the indicated steady-state input conditions were established.
    * = 175 only

**********************************************************************/

#pragma once

#ifndef TTL74175_H
#define TTL74175_H


#define MCFG_74174_Q1_CB(_devcb) \
	devcb = &ttl741745_device::set_q1_cb(*device, DEVCB_##_devcb);

#define MCFG_74174_Q2_CB(_devcb) \
	devcb = &ttl741745_device::set_q2_cb(*device, DEVCB_##_devcb);

#define MCFG_74174_Q3_CB(_devcb) \
	devcb = &ttl741745_device::set_q3_cb(*device, DEVCB_##_devcb);

#define MCFG_74174_Q4_CB(_devcb) \
	devcb = &ttl741745_device::set_q4_cb(*device, DEVCB_##_devcb);

#define MCFG_74175_Q1_CB(_devcb) \
	devcb = &ttl741745_device::set_q1_cb(*device, DEVCB_##_devcb);

#define MCFG_74175_Q2_CB(_devcb) \
	devcb = &ttl741745_device::set_q2_cb(*device, DEVCB_##_devcb);

#define MCFG_74175_Q3_CB(_devcb) \
	devcb = &ttl741745_device::set_q3_cb(*device, DEVCB_##_devcb);

#define MCFG_74175_Q4_CB(_devcb) \
	devcb = &ttl741745_device::set_q4_cb(*device, DEVCB_##_devcb);

#define MCFG_74174_Q5_CB(_devcb) \
	devcb = &ttl74174_device::set_q5_cb(*device, DEVCB_##_devcb);

#define MCFG_74174_Q6_CB(_devcb) \
	devcb = &ttl74174_device::set_q6_cb(*device, DEVCB_##_devcb);

#define MCFG_74175_NOT_Q1_CB(_devcb) \
	devcb = &ttl74175_device::set_not_q1_cb(*device, DEVCB_##_devcb);

#define MCFG_74175_NOT_Q2_CB(_devcb) \
	devcb = &ttl74175_device::set_not_q2_cb(*device, DEVCB_##_devcb);

#define MCFG_74175_NOT_Q3_CB(_devcb) \
	devcb = &ttl74175_device::set_not_q3_cb(*device, DEVCB_##_devcb);

#define MCFG_74175_NOT_Q4_CB(_devcb) \
	devcb = &ttl74175_device::set_not_q1_cb(*device, DEVCB_##_devcb);

#define MCFG_74174_ADD(_tag) \
	MCFG_DEVICE_ADD(_tag, TTL74174, 0)

#define MCFG_74175_ADD(_tag) \
	MCFG_DEVICE_ADD(_tag, TTL74175, 0)

class ttl741745_device : public device_t
{
public:
	ttl741745_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname);

	template<class _Object> static devcb_base &set_q1_cb(device_t &device, _Object object) { return downcast<ttl741745_device &>(device).m_q1_func.set_callback(object); }
	template<class _Object> static devcb_base &set_q2_cb(device_t &device, _Object object) { return downcast<ttl741745_device &>(device).m_q2_func.set_callback(object); }
	template<class _Object> static devcb_base &set_q3_cb(device_t &device, _Object object) { return downcast<ttl741745_device &>(device).m_q3_func.set_callback(object); }
	template<class _Object> static devcb_base &set_q4_cb(device_t &device, _Object object) { return downcast<ttl741745_device &>(device).m_q4_func.set_callback(object); }

	DECLARE_WRITE_LINE_MEMBER( clear_w );
	DECLARE_WRITE_LINE_MEMBER( d1_w );
	DECLARE_WRITE_LINE_MEMBER( d2_w );
	DECLARE_WRITE_LINE_MEMBER( d3_w );
	DECLARE_WRITE_LINE_MEMBER( d4_w );
	DECLARE_WRITE_LINE_MEMBER( clock_w );

	uint8_t q_w();

protected:
	virtual void device_start() override;
	virtual void device_reset() override;

	virtual void init();
	virtual void tick();

	devcb_write_line m_q1_func;
	devcb_write_line m_q2_func;
	devcb_write_line m_q3_func;
	devcb_write_line m_q4_func;

	uint8_t m_clock;
	uint8_t m_clear;

	uint8_t m_d1;
	uint8_t m_d2;
	uint8_t m_d3;
	uint8_t m_d4;

	uint8_t m_q1;
	uint8_t m_q2;
	uint8_t m_q3;
	uint8_t m_q4;
};

class ttl74174_device : public ttl741745_device
{
public:
	ttl74174_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);

	template<class _Object> static devcb_base &set_q5_cb(device_t &device, _Object object) { return downcast<ttl74174_device &>(device).m_q5_func.set_callback(object); }
	template<class _Object> static devcb_base &set_q6_cb(device_t &device, _Object object) { return downcast<ttl74174_device &>(device).m_q6_func.set_callback(object); }

	DECLARE_WRITE_LINE_MEMBER( d5_w );
	DECLARE_WRITE_LINE_MEMBER( d6_w );

protected:
	virtual void device_start() override;

	virtual void init() override;
	virtual void tick() override;

private:
	devcb_write_line m_q5_func;
	devcb_write_line m_q6_func;

	uint8_t m_d5;
	uint8_t m_d6;

	uint8_t m_q5;
	uint8_t m_q6;
};

class ttl74175_device : public ttl741745_device
{
public:
	ttl74175_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);

	template<class _Object> static devcb_base &set_not_q1_cb(device_t &device, _Object object) { return downcast<ttl74175_device &>(device).m_not_q1_func.set_callback(object); }
	template<class _Object> static devcb_base &set_not_q2_cb(device_t &device, _Object object) { return downcast<ttl74175_device &>(device).m_not_q2_func.set_callback(object); }
	template<class _Object> static devcb_base &set_not_q3_cb(device_t &device, _Object object) { return downcast<ttl74175_device &>(device).m_not_q3_func.set_callback(object); }
	template<class _Object> static devcb_base &set_not_q4_cb(device_t &device, _Object object) { return downcast<ttl74175_device &>(device).m_not_q4_func.set_callback(object); }

protected:
	virtual void device_start() override;

	virtual void tick() override;

private:
	devcb_write_line m_not_q1_func;
	devcb_write_line m_not_q2_func;
	devcb_write_line m_not_q3_func;
	devcb_write_line m_not_q4_func;

	uint8_t m_not_q1;
	uint8_t m_not_q2;
	uint8_t m_not_q3;
	uint8_t m_not_q4;
};

// device type definition
extern const device_type TTL74174;
extern const device_type TTL74175;


#endif /* TTL74175_H */