-
Notifications
You must be signed in to change notification settings - Fork 18
/
hpdcache_typedef.svh
120 lines (105 loc) · 5.08 KB
/
hpdcache_typedef.svh
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
/*
* Copyright 2023 CEA*
* *Commissariat a l'Energie Atomique et aux Energies Alternatives (CEA)
*
* SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
*
* Licensed under the Solderpad Hardware License v 2.1 (the “License”); you
* may not use this file except in compliance with the License, or, at your
* option, the Apache License version 2.0. You may obtain a copy of the
* License at
*
* https://solderpad.org/licenses/SHL-2.1/
*
* Unless required by applicable law or agreed to in writing, any work
* distributed under the License is distributed on an “AS IS” BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
/*
* Authors : Cesar Fuguet
* Creation Date : February, 2023
* Description : HPDcache Types' Definition
* History :
*/
`ifndef __HPDCACHE_TYPEDEF_SVH__
`define __HPDCACHE_TYPEDEF_SVH__
`define HPDCACHE_DECL_MEM_REQ_T(__addr_t, __id_t) \
struct packed { \
__addr_t mem_req_addr; \
hpdcache_pkg::hpdcache_mem_len_t mem_req_len; \
hpdcache_pkg::hpdcache_mem_size_t mem_req_size; \
__id_t mem_req_id; \
hpdcache_pkg::hpdcache_mem_command_e mem_req_command; \
hpdcache_pkg::hpdcache_mem_atomic_e mem_req_atomic; \
logic mem_req_cacheable; \
}
`define HPDCACHE_DECL_MEM_RESP_R_T(__id_t, __data_t) \
struct packed { \
hpdcache_pkg::hpdcache_mem_error_e mem_resp_r_error; \
__id_t mem_resp_r_id; \
__data_t mem_resp_r_data; \
logic mem_resp_r_last; \
}
`define HPDCACHE_DECL_MEM_REQ_W_T(__data_t, __be_t) \
struct packed { \
__data_t mem_req_w_data; \
__be_t mem_req_w_be; \
logic mem_req_w_last; \
}
`define HPDCACHE_DECL_MEM_RESP_W_T(__id_t) \
struct packed { \
logic mem_resp_w_is_atomic; \
hpdcache_pkg::hpdcache_mem_error_e mem_resp_w_error; \
__id_t mem_resp_w_id; \
}
`define HPDCACHE_TYPEDEF_MEM_ATTR_T(__addr_t, __id_t, __data_t, __be_t, __params) \
typedef logic [ __params.u.memAddrWidth-1:0] __addr_t; \
typedef logic [ __params.u.memIdWidth-1:0] __id_t; \
typedef logic [ __params.u.memDataWidth-1:0] __data_t; \
typedef logic [__params.u.memDataWidth/8-1:0] __be_t
`define HPDCACHE_TYPEDEF_MEM_REQ_T(__name__, __addr_t, __id_t) \
typedef `HPDCACHE_DECL_MEM_REQ_T(__addr_t, __id_t) __name__
`define HPDCACHE_TYPEDEF_MEM_RESP_R_T(__name__, __id_t, __data_t) \
typedef `HPDCACHE_DECL_MEM_RESP_R_T(__id_t, __data_t) __name__
`define HPDCACHE_TYPEDEF_MEM_REQ_W_T(__name__, __data_t, __be_t) \
typedef `HPDCACHE_DECL_MEM_REQ_W_T(__data_t, __be_t) __name__
`define HPDCACHE_TYPEDEF_MEM_RESP_W_T(__name__, __id_t) \
typedef `HPDCACHE_DECL_MEM_RESP_W_T(__id_t) __name__
`define HPDCACHE_DECL_REQ_T(__offset_t, __data_t, __be_t, __sid_t, __tid_t, __tag_t) \
struct packed { \
__offset_t addr_offset; \
__data_t wdata; \
hpdcache_pkg::hpdcache_req_op_t op; \
__be_t be; \
hpdcache_pkg::hpdcache_req_size_t size; \
__sid_t sid; \
__tid_t tid; \
logic need_rsp; \
logic phys_indexed; \
__tag_t addr_tag; \
hpdcache_pkg::hpdcache_pma_t pma; \
}
`define HPDCACHE_TYPEDEF_REQ_ATTR_T(__offset_t, __word_t, __word_be_t, __data_t, __be_t, __sid_t, __tid_t, __tag_t, __params) \
typedef logic [ __params.tagWidth-1:0] __tag_t; \
typedef logic [ __params.u.wordWidth-1:0] __word_t; \
typedef logic [ __params.u.wordWidth/8-1:0] __word_be_t; \
typedef logic [ __params.reqOffsetWidth-1:0] __offset_t; \
typedef __word_t [ __params.u.reqWords-1:0] __data_t; \
typedef __word_be_t [ __params.u.reqWords-1:0] __be_t; \
typedef logic [ __params.u.reqSrcIdWidth-1:0] __sid_t; \
typedef logic [__params.u.reqTransIdWidth-1:0] __tid_t
`define HPDCACHE_TYPEDEF_REQ_T(__name__, __offset_t, __data_t, __be_t, __sid_t, __tid_t, __tag_t) \
typedef `HPDCACHE_DECL_REQ_T(__offset_t, __data_t, __be_t, __sid_t, __tid_t, __tag_t) __name__
`define HPDCACHE_DECL_RSP_T(__data_t, __sid_t, __tid_t) \
struct packed { \
__data_t rdata; \
__sid_t sid; \
__tid_t tid; \
logic error; \
logic aborted; \
}
`define HPDCACHE_TYPEDEF_RSP_T(__name__, __data_t, __sid_t, __tid_t) \
typedef `HPDCACHE_DECL_RSP_T(__data_t, __sid_t, __tid_t) __name__
`endif // __HPDCACHE_TYPEDEF_SVH__