blob: 65963de0ccd16ff59a5cd2b0691d4915a3629f8e [file] [log] [blame]
Derek Chowc7687712023-08-10 13:03:15 -07001# Copyright 2023 Google LLC
Cindy Liue7e931f2023-10-19 18:16:09 -07002#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
Derek Chowc7687712023-08-10 13:03:15 -070014
Derek Chow36ad2bd2023-08-01 11:10:05 -070015cc_library(
16 name = "sim_libs",
17 hdrs = [
18 "fifo.h",
19 "sysc_module.h",
20 "sysc_tb.h",
21 ],
Cindy Liu04060582023-08-13 13:29:39 -070022 includes = [
23 "systemc/include",
24 ],
25 deps = [
26 "@accellera_systemc//:systemc",
27 ],
Derek Chow36ad2bd2023-08-01 11:10:05 -070028)
29
30cc_library(
31 name = "kelvin_if",
32 hdrs = [
33 "kelvin/core_if.h",
34 "kelvin/debug_if.h",
35 "kelvin/kelvin_cfg.h",
36 "kelvin/memory_if.h",
Alex Van Dammeaa9ac242024-02-29 14:28:40 -080037 "@kelvin_hw//hdl/chisel/src/kelvin:kelvin_parameters.h",
Derek Chow36ad2bd2023-08-01 11:10:05 -070038 ],
39 defines = ["KELVIN_SIMD=256"],
40)
41
42cc_binary(
43 name = "core_sim",
44 srcs = [
45 "kelvin/core_tb.cc",
46 ],
47 deps = [
Derek Chow36ad2bd2023-08-01 11:10:05 -070048 ":kelvin_if",
Cindy Liu9a2e8c22023-08-09 23:06:21 -070049 ":sim_libs",
Derek Chow7ae25a02024-01-11 13:10:51 -080050 "//hdl/chisel/src/kelvin:core_cc_library",
Cindy Liu9e2fc992023-08-27 18:34:29 -070051 "@com_google_absl//absl/flags:flag",
52 "@com_google_absl//absl/flags:parse",
53 "@com_google_absl//absl/flags:usage",
Derek Chow36ad2bd2023-08-01 11:10:05 -070054 ],
55)
56
57cc_binary(
Cindy Liu2d1a49b2023-08-14 18:03:47 -070058 name = "kelvin_tb",
59 srcs = [
60 "matcha/kelvin_if.h",
61 "matcha/kelvin_tb.cc",
62 ],
63 deps = [
64 ":kelvin_if",
65 ":sim_libs",
Derek Chow7ae25a02024-01-11 13:10:51 -080066 "//hdl/chisel/src/matcha:kelvin_cc_library",
Cindy Liu2d1a49b2023-08-14 18:03:47 -070067 ],
68)
69
Alex Van Damme152a99c2024-01-29 14:46:55 -080070cc_binary(
71 name = "chai_sim",
72 srcs = [
73 "chai/chai_if.h",
74 "chai/chai_tb.cc",
75 ],
76 deps = [
77 ":kelvin_if",
78 ":sim_libs",
79 "//hdl/chisel/src/chai:chai_cc_library",
80 "@com_google_absl//absl/flags:flag",
81 "@com_google_absl//absl/flags:parse",
82 "@com_google_absl//absl/flags:usage",
83 "@com_google_absl//absl/log",
84 "@com_google_absl//absl/log:check",
85 ],
86)
87
88
Cindy Liu2d1a49b2023-08-14 18:03:47 -070089cc_test(
Derek Chow36ad2bd2023-08-01 11:10:05 -070090 name = "dbus2axi_tb",
Cindy Liu2d1a49b2023-08-14 18:03:47 -070091 size = "small",
Derek Chow36ad2bd2023-08-01 11:10:05 -070092 srcs = [
93 "kelvin/dbus2axi_tb.cc",
94 ],
95 deps = [
96 ":sim_libs",
Derek Chow7ae25a02024-01-11 13:10:51 -080097 "//hdl/chisel/src/kelvin:dbus2axi_cc_library",
Derek Chow36ad2bd2023-08-01 11:10:05 -070098 ],
99)
100
Cindy Liuddb410a2023-08-14 18:28:44 -0700101cc_test(
Derek Chow36ad2bd2023-08-01 11:10:05 -0700102 name = "l1dcache_tb",
Michael Hoang7c1ccd52023-08-29 19:36:28 +0000103 size = "large",
Derek Chow36ad2bd2023-08-01 11:10:05 -0700104 srcs = [
105 "kelvin/l1dcache_tb.cc",
106 ],
107 deps = [
108 ":kelvin_if",
109 ":sim_libs",
Derek Chow7ae25a02024-01-11 13:10:51 -0800110 "//hdl/chisel/src/kelvin:l1dcache_cc_library",
Derek Chow36ad2bd2023-08-01 11:10:05 -0700111 ],
112)
113
Cindy Liu2d1a49b2023-08-14 18:03:47 -0700114cc_test(
Cindy Liu78513952023-10-19 14:37:15 -0700115 name = "l1dcachebank_tb",
116 srcs = [
117 "kelvin/l1dcache_tb.cc",
118 ],
119 defines = [
120 "L1DCACHEBANK",
121 ],
122 deps = [
123 ":kelvin_if",
124 ":sim_libs",
Derek Chow7ae25a02024-01-11 13:10:51 -0800125 "//hdl/chisel/src/kelvin:l1dcachebank_cc_library",
Cindy Liu78513952023-10-19 14:37:15 -0700126 ],
127)
128
129cc_test(
Derek Chow36ad2bd2023-08-01 11:10:05 -0700130 name = "l1icache_tb",
131 srcs = [
132 "kelvin/l1icache_tb.cc",
133 ],
134 deps = [
135 ":kelvin_if",
136 ":sim_libs",
Derek Chow7ae25a02024-01-11 13:10:51 -0800137 "//hdl/chisel/src/kelvin:l1icache_cc_library",
Derek Chow36ad2bd2023-08-01 11:10:05 -0700138 ],
139)
140
Cindy Liu003c90a2023-08-18 03:59:42 -0700141cc_library(
142 name = "valu",
143 hdrs = [
144 "kelvin/alu_ref.h",
145 "kelvin/valu.h",
146 ],
147 deps = [
148 ":vencodeop",
149 ],
150)
151
Cindy Liu63621022023-08-16 18:36:36 -0700152cc_test(
153 name = "valu_tb",
154 size = "large",
155 srcs = [
Cindy Liu63621022023-08-16 18:36:36 -0700156 "kelvin/valu_tb.cc",
157 ],
158 deps = [
159 ":kelvin_if",
160 ":sim_libs",
Cindy Liu003c90a2023-08-18 03:59:42 -0700161 ":valu",
Derek Chow7ae25a02024-01-11 13:10:51 -0800162 "//hdl/chisel/src/kelvin:valu_cc_library",
Cindy Liu63621022023-08-16 18:36:36 -0700163 ],
164)
Derek Chow36ad2bd2023-08-01 11:10:05 -0700165
Cindy Liu003c90a2023-08-18 03:59:42 -0700166cc_test(
167 name = "valuint_tb",
Cindy Liu9e2fc992023-08-27 18:34:29 -0700168 size = "large",
Cindy Liu003c90a2023-08-18 03:59:42 -0700169 srcs = [
170 "kelvin/valuint_tb.cc",
171 ],
172 deps = [
173 ":kelvin_if",
174 ":sim_libs",
175 ":valu",
Derek Chow7ae25a02024-01-11 13:10:51 -0800176 "//hdl/chisel/src/kelvin:valuint_cc_library",
Cindy Liu003c90a2023-08-18 03:59:42 -0700177 ],
178)
179
Derek Chow36ad2bd2023-08-01 11:10:05 -0700180cc_library(
181 name = "vdecode",
182 hdrs = [
183 "kelvin/vdecode.h",
184 ],
185 deps = [
186 ":vdecodeop",
187 ":vencodeop",
188 ],
189)
190
191cc_library(
192 name = "vdecodeop",
193 hdrs = [
194 "kelvin/vdecodeop.h",
195 ],
196)
197
198cc_library(
199 name = "vencodeop",
200 hdrs = [
201 "kelvin/vencodeop.h",
202 ],
203)
204
Cindy Liu2d1a49b2023-08-14 18:03:47 -0700205cc_test(
Derek Chow36ad2bd2023-08-01 11:10:05 -0700206 name = "vcmdq_tb",
207 srcs = [
208 "kelvin/vcmdq_tb.cc",
209 ],
210 deps = [
211 ":kelvin_if",
212 ":sim_libs",
213 ":vencodeop",
Derek Chow7ae25a02024-01-11 13:10:51 -0800214 "//hdl/chisel/src/kelvin:vcmdq_cc_library",
Derek Chow36ad2bd2023-08-01 11:10:05 -0700215 ],
216)
217
Cindy Liu2d1a49b2023-08-14 18:03:47 -0700218cc_test(
Derek Chow36ad2bd2023-08-01 11:10:05 -0700219 name = "vconvalu_tb",
220 srcs = [
221 "kelvin/vconvalu_tb.cc",
222 ],
223 deps = [
224 ":kelvin_if",
225 ":sim_libs",
Derek Chow7ae25a02024-01-11 13:10:51 -0800226 "//hdl/chisel/src/kelvin:vconvalu_cc_library",
Derek Chow36ad2bd2023-08-01 11:10:05 -0700227 ],
228)
229
Cindy Liu9a2e8c22023-08-09 23:06:21 -0700230cc_test(
Derek Chow36ad2bd2023-08-01 11:10:05 -0700231 name = "vconvctrl_tb",
Cindy Liu2d1a49b2023-08-14 18:03:47 -0700232 size = "small",
Derek Chow36ad2bd2023-08-01 11:10:05 -0700233 srcs = [
234 "kelvin/vconvctrl_tb.cc",
235 ],
236 deps = [
237 ":kelvin_if",
238 ":sim_libs",
239 ":vencodeop",
Derek Chow7ae25a02024-01-11 13:10:51 -0800240 "//hdl/chisel/src/kelvin:vconvctrl_cc_library",
Derek Chow36ad2bd2023-08-01 11:10:05 -0700241 ],
242)
243
Cindy Liu9a2e8c22023-08-09 23:06:21 -0700244cc_test(
Derek Chow36ad2bd2023-08-01 11:10:05 -0700245 name = "vdecodeinstruction_tb",
Cindy Liu2d1a49b2023-08-14 18:03:47 -0700246 size = "small",
Derek Chow36ad2bd2023-08-01 11:10:05 -0700247 srcs = [
248 "kelvin/vdecodeinstruction_tb.cc",
249 ],
250 deps = [
251 ":kelvin_if",
252 ":sim_libs",
253 ":vdecode",
Derek Chow7ae25a02024-01-11 13:10:51 -0800254 "//hdl/chisel/src/kelvin:vdecodeinstruction_cc_library",
Derek Chow36ad2bd2023-08-01 11:10:05 -0700255 ],
256)
257
Cindy Liu9a2e8c22023-08-09 23:06:21 -0700258cc_test(
Derek Chow36ad2bd2023-08-01 11:10:05 -0700259 name = "vdecode_tb",
260 srcs = [
261 "kelvin/vdecode_tb.cc",
262 ],
263 deps = [
264 ":kelvin_if",
265 ":sim_libs",
266 ":vdecode",
Derek Chow7ae25a02024-01-11 13:10:51 -0800267 "//hdl/chisel/src/kelvin:vdecode_cc_library",
Derek Chow36ad2bd2023-08-01 11:10:05 -0700268 ],
269)
270
Cindy Liude8ea112023-08-10 16:48:03 -0700271cc_test(
Derek Chow36ad2bd2023-08-01 11:10:05 -0700272 name = "vldst_tb",
273 srcs = [
274 "kelvin/vldst_tb.cc",
275 ],
276 deps = [
277 ":kelvin_if",
278 ":sim_libs",
279 ":vencodeop",
Derek Chow7ae25a02024-01-11 13:10:51 -0800280 "//hdl/chisel/src/kelvin:vldst_cc_library",
Derek Chow36ad2bd2023-08-01 11:10:05 -0700281 ],
282)
283
Cindy Liude8ea112023-08-10 16:48:03 -0700284cc_test(
Derek Chow36ad2bd2023-08-01 11:10:05 -0700285 name = "vld_tb",
Cindy Liu2d1a49b2023-08-14 18:03:47 -0700286 size = "small",
Derek Chow36ad2bd2023-08-01 11:10:05 -0700287 srcs = [
288 "kelvin/vld_tb.cc",
289 ],
290 deps = [
291 ":kelvin_if",
292 ":sim_libs",
293 ":vencodeop",
Derek Chow7ae25a02024-01-11 13:10:51 -0800294 "//hdl/chisel/src/kelvin:vld_cc_library",
Derek Chow36ad2bd2023-08-01 11:10:05 -0700295 ],
296)
297
Cindy Liu2d1a49b2023-08-14 18:03:47 -0700298cc_test(
Derek Chow36ad2bd2023-08-01 11:10:05 -0700299 name = "vregfilesegment_tb",
Cindy Liu2d1a49b2023-08-14 18:03:47 -0700300 size = "small",
Derek Chow36ad2bd2023-08-01 11:10:05 -0700301 srcs = [
302 "kelvin/vregfilesegment_tb.cc",
303 ],
304 deps = [
305 ":kelvin_if",
306 ":sim_libs",
Derek Chow7ae25a02024-01-11 13:10:51 -0800307 "//hdl/chisel/src/kelvin:vregfilesegment_cc_library",
Derek Chow36ad2bd2023-08-01 11:10:05 -0700308 ],
309)
310
Cindy Liu2d1a49b2023-08-14 18:03:47 -0700311cc_test(
Derek Chow36ad2bd2023-08-01 11:10:05 -0700312 name = "vregfile_tb",
313 srcs = [
314 "kelvin/vregfile_tb.cc",
315 ],
316 deps = [
317 ":kelvin_if",
318 ":sim_libs",
Derek Chow7ae25a02024-01-11 13:10:51 -0800319 "//hdl/chisel/src/kelvin:vregfile_cc_library",
Derek Chow36ad2bd2023-08-01 11:10:05 -0700320 ],
321)
322
Cindy Liude8ea112023-08-10 16:48:03 -0700323cc_test(
Derek Chow36ad2bd2023-08-01 11:10:05 -0700324 name = "vst_tb",
325 srcs = [
326 "kelvin/vst_tb.cc",
327 ],
328 deps = [
329 ":kelvin_if",
330 ":sim_libs",
331 ":vencodeop",
Derek Chow7ae25a02024-01-11 13:10:51 -0800332 "//hdl/chisel/src/kelvin:vst_cc_library",
Derek Chow36ad2bd2023-08-01 11:10:05 -0700333 ],
334)