blob: 933cf68fce763112f19d8c49943656db1a2870bd (
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
|
// license:BSD-3-Clause
// copyright-holders:Morten Shearman Kirkegaard, Samuel Neves, Peter Wilhelmsen
/*************************************************************************
atarixga.h
Atari XGA encryption FPGA
*************************************************************************/
#ifndef __MACHINE_ATARIXGA__
#define __MACHINE_ATARIXGA__
extern const device_type ATARI_XGA;
class atari_xga_device : public device_t
{
public:
// construction/destruction
atari_xga_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
DECLARE_WRITE32_MEMBER(write);
DECLARE_READ32_MEMBER(read);
protected:
virtual void device_start() override;
virtual void device_reset() override;
private:
static const size_t RAM_WORDS = 2048;
enum fpga_mode
{
FPGA_RESET,
FPGA_SETKEY,
FPGA_DECIPHER
};
uint16_t powers2(uint8_t k, uint16_t x);
uint16_t lfsr2(uint16_t x);
uint16_t lfsr1(uint16_t x);
uint16_t parity(uint16_t x);
size_t popcount(uint16_t x);
uint16_t ctz(uint16_t x);
uint16_t decipher(uint8_t k, uint16_t c);
fpga_mode m_mode;
uint16_t m_address; // last written address
uint16_t m_ciphertext; // last written ciphertext
std::unique_ptr<uint16_t[]> m_ram; // CY7C185-45PC, only 16-Kbit used
};
#endif
|