This repository was archived by the owner on Feb 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathipu.h
More file actions
66 lines (56 loc) · 1.22 KB
/
ipu.h
File metadata and controls
66 lines (56 loc) · 1.22 KB
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
#pragma once
#include <int128.h>
#include <queue>
class Bus;
union IPUCommand
{
uint32_t value;
struct
{
uint32_t option : 28;
uint32_t code : 4;
};
};
union IPUControl
{
uint64_t value;
struct
{
uint64_t input_fifo_size : 4;
uint64_t output_fifo_size : 4;
uint64_t coded_block_pattern : 6;
uint64_t error_code_detected : 1;
uint64_t start_code_detected : 1;
uint64_t intra_dc_precision : 2;
uint64_t : 2;
uint64_t scan_pattern_bdec : 1;
uint64_t intra_vlc_format : 1;
uint64_t quantize_step_bdec : 1;
uint64_t mpeg1 : 1;
uint64_t picture_type_vdec : 3;
uint64_t : 3;
uint64_t reset_ipu : 1;
uint64_t busy : 1;
uint64_t : 32;
};
};
struct IPURegs
{
IPUControl control;
};
class IPU
{
public:
IPU(Bus* parent);
~IPU() = default;
uint64_t read(uint32_t addr);
void write(uint32_t addr, uint64_t data);
uint128_t read_fifo(uint32_t addr);
void write_fifo(uint32_t addr, uint128_t data);
void decode_command(IPUCommand cmd);
uint64_t get_command_result();
private:
Bus* bus;
IPURegs regs = {};
std::queue<uint32_t> fifo;
};