-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaal.h
executable file
·79 lines (63 loc) · 1.66 KB
/
aal.h
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
#pragma once
#include <cash.h>
namespace aal {
//
// Description:
// - memory data are 64 byte cache line width
// - there are two write response ports
// - memory responses are returned in order
//
using namespace ch::logic;
template <unsigned ADDR, unsigned MDATA, unsigned CDATA>
struct aal_qpi {
static constexpr unsigned addr_wdith = ADDR;
static constexpr unsigned mdata_width = MDATA;
static constexpr unsigned cdata_width = CDATA;
__inout (rd_req_io, (
(ch_in<ch_bool>) almostfull,
(ch_out<ch_uint<ADDR>>) addr,
(ch_out<ch_bit<MDATA>>) mdata,
(ch_out<ch_bool>) valid
));
__inout (rd_rsp_io, (
(ch_in<ch_bit<MDATA>>) mdata,
(ch_in<ch_bit<CDATA>>) data,
(ch_in<ch_bool>) valid
));
__inout (wr_req_io, (
(ch_in<ch_bool>) almostfull,
(ch_out<ch_uint<ADDR>>) addr,
(ch_out<ch_bit<MDATA>>) mdata,
(ch_out<ch_bit<CDATA>>) data,
(ch_out<ch_bool>) valid
));
__inout (wr_rsp_io, (
(ch_in<ch_bit<MDATA>>) mdata,
(ch_in<ch_bool>) valid
));
__inout (io, (
(rd_req_io) rd_req,
(rd_rsp_io) rd_rsp,
(wr_req_io) wr_req,
(wr_rsp_io) wr_rsp0,
(wr_rsp_io) wr_rsp1
));
};
using aal_qpi0 = aal_qpi<20, 14, 512>;
using aal_qpi1 = aal_qpi<42, 16, 512>;
template <typename Context, typename Qpi = aal_qpi0>
class aal_device {
public:
using qpi_io = typename Qpi::io;
static_assert(ch_width_v<Context> == Qpi::cdata_width, "invalid context size");
__io (
(qpi_io) qpi,
__in(Context) ctx,
(ch_in<ch_bool>) start,
(ch_out<ch_bool>) done
);
aal_device() {}
virtual ~aal_device() {}
virtual void describe() = 0;
};
}