summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/machine/74181.h
blob: 4eed4bc697cf2a666d564cca3d6b63d9f03a6d03 (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
/***************************************************************************

    74181

    4-Bit Arithmetic Logic Unit

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

#pragma once

#ifndef __74181_H__
#define __74181_H__

#include "emu.h"


//**************************************************************************
//  INTERFACE CONFIGURATION MACROS
//**************************************************************************

#define MCFG_TTL74181_ADD(_tag) \
	MCFG_DEVICE_ADD(_tag, TTL74181, 0) \


//**************************************************************************
//  TYPE DEFINITIONS
//**************************************************************************

// ======================> ttl74181_device

class ttl74181_device : public device_t
{
public:
	// construction/destruction
	ttl74181_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);

	// inputs
	void input_a_w(UINT8 data);
	void input_b_w(UINT8 data);
	void select_w(UINT8 data);
	DECLARE_WRITE_LINE_MEMBER( mode_w );
	DECLARE_WRITE_LINE_MEMBER( carry_w );

	// outputs
	UINT8 function_r() { return m_f; }
	DECLARE_READ_LINE_MEMBER( carry_r ) { return m_cn; }
	DECLARE_READ_LINE_MEMBER( generate_r ) { return m_g; }
	DECLARE_READ_LINE_MEMBER( propagate_r ) { return m_p; }
	DECLARE_READ_LINE_MEMBER( equals_r ) { return m_equals; }

protected:
	// device-level overrides
	virtual void device_start();
	virtual void device_post_load();

private:
	void update();

	// inputs
	UINT8 m_a;
	UINT8 m_b;
	UINT8 m_s;
	int m_m;
	int m_c;

	// outputs
	UINT8 m_f;
	int m_cn;
	int m_g;
	int m_p;
	int m_equals;
};


// device type definition
extern const device_type TTL74181;


#endif  /* __74181_H__ */