Derek Chow | c768771 | 2023-08-10 13:03:15 -0700 | [diff] [blame] | 1 | # Copyright 2023 Google LLC |
Cindy Liu | e7e931f | 2023-10-19 18:16:09 -0700 | [diff] [blame] | 2 | # |
| 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 Chow | c768771 | 2023-08-10 13:03:15 -0700 | [diff] [blame] | 14 | |
Derek Chow | 36ad2bd | 2023-08-01 11:10:05 -0700 | [diff] [blame] | 15 | cc_library( |
| 16 | name = "sim_libs", |
| 17 | hdrs = [ |
| 18 | "fifo.h", |
| 19 | "sysc_module.h", |
| 20 | "sysc_tb.h", |
| 21 | ], |
Cindy Liu | 0406058 | 2023-08-13 13:29:39 -0700 | [diff] [blame] | 22 | includes = [ |
| 23 | "systemc/include", |
| 24 | ], |
| 25 | deps = [ |
| 26 | "@accellera_systemc//:systemc", |
| 27 | ], |
Derek Chow | 36ad2bd | 2023-08-01 11:10:05 -0700 | [diff] [blame] | 28 | ) |
| 29 | |
| 30 | cc_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 Damme | aa9ac24 | 2024-02-29 14:28:40 -0800 | [diff] [blame] | 37 | "@kelvin_hw//hdl/chisel/src/kelvin:kelvin_parameters.h", |
Derek Chow | 36ad2bd | 2023-08-01 11:10:05 -0700 | [diff] [blame] | 38 | ], |
| 39 | defines = ["KELVIN_SIMD=256"], |
| 40 | ) |
| 41 | |
| 42 | cc_binary( |
| 43 | name = "core_sim", |
| 44 | srcs = [ |
| 45 | "kelvin/core_tb.cc", |
| 46 | ], |
| 47 | deps = [ |
Derek Chow | 36ad2bd | 2023-08-01 11:10:05 -0700 | [diff] [blame] | 48 | ":kelvin_if", |
Cindy Liu | 9a2e8c2 | 2023-08-09 23:06:21 -0700 | [diff] [blame] | 49 | ":sim_libs", |
Derek Chow | 7ae25a0 | 2024-01-11 13:10:51 -0800 | [diff] [blame] | 50 | "//hdl/chisel/src/kelvin:core_cc_library", |
Cindy Liu | 9e2fc99 | 2023-08-27 18:34:29 -0700 | [diff] [blame] | 51 | "@com_google_absl//absl/flags:flag", |
| 52 | "@com_google_absl//absl/flags:parse", |
| 53 | "@com_google_absl//absl/flags:usage", |
Derek Chow | 36ad2bd | 2023-08-01 11:10:05 -0700 | [diff] [blame] | 54 | ], |
| 55 | ) |
| 56 | |
| 57 | cc_binary( |
Cindy Liu | 2d1a49b | 2023-08-14 18:03:47 -0700 | [diff] [blame] | 58 | 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 Chow | 7ae25a0 | 2024-01-11 13:10:51 -0800 | [diff] [blame] | 66 | "//hdl/chisel/src/matcha:kelvin_cc_library", |
Cindy Liu | 2d1a49b | 2023-08-14 18:03:47 -0700 | [diff] [blame] | 67 | ], |
| 68 | ) |
| 69 | |
Alex Van Damme | 152a99c | 2024-01-29 14:46:55 -0800 | [diff] [blame] | 70 | cc_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 Liu | 2d1a49b | 2023-08-14 18:03:47 -0700 | [diff] [blame] | 89 | cc_test( |
Derek Chow | 36ad2bd | 2023-08-01 11:10:05 -0700 | [diff] [blame] | 90 | name = "dbus2axi_tb", |
Cindy Liu | 2d1a49b | 2023-08-14 18:03:47 -0700 | [diff] [blame] | 91 | size = "small", |
Derek Chow | 36ad2bd | 2023-08-01 11:10:05 -0700 | [diff] [blame] | 92 | srcs = [ |
| 93 | "kelvin/dbus2axi_tb.cc", |
| 94 | ], |
| 95 | deps = [ |
| 96 | ":sim_libs", |
Derek Chow | 7ae25a0 | 2024-01-11 13:10:51 -0800 | [diff] [blame] | 97 | "//hdl/chisel/src/kelvin:dbus2axi_cc_library", |
Derek Chow | 36ad2bd | 2023-08-01 11:10:05 -0700 | [diff] [blame] | 98 | ], |
| 99 | ) |
| 100 | |
Cindy Liu | ddb410a | 2023-08-14 18:28:44 -0700 | [diff] [blame] | 101 | cc_test( |
Derek Chow | 36ad2bd | 2023-08-01 11:10:05 -0700 | [diff] [blame] | 102 | name = "l1dcache_tb", |
Michael Hoang | 7c1ccd5 | 2023-08-29 19:36:28 +0000 | [diff] [blame] | 103 | size = "large", |
Derek Chow | 36ad2bd | 2023-08-01 11:10:05 -0700 | [diff] [blame] | 104 | srcs = [ |
| 105 | "kelvin/l1dcache_tb.cc", |
| 106 | ], |
| 107 | deps = [ |
| 108 | ":kelvin_if", |
| 109 | ":sim_libs", |
Derek Chow | 7ae25a0 | 2024-01-11 13:10:51 -0800 | [diff] [blame] | 110 | "//hdl/chisel/src/kelvin:l1dcache_cc_library", |
Derek Chow | 36ad2bd | 2023-08-01 11:10:05 -0700 | [diff] [blame] | 111 | ], |
| 112 | ) |
| 113 | |
Cindy Liu | 2d1a49b | 2023-08-14 18:03:47 -0700 | [diff] [blame] | 114 | cc_test( |
Cindy Liu | 7851395 | 2023-10-19 14:37:15 -0700 | [diff] [blame] | 115 | 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 Chow | 7ae25a0 | 2024-01-11 13:10:51 -0800 | [diff] [blame] | 125 | "//hdl/chisel/src/kelvin:l1dcachebank_cc_library", |
Cindy Liu | 7851395 | 2023-10-19 14:37:15 -0700 | [diff] [blame] | 126 | ], |
| 127 | ) |
| 128 | |
| 129 | cc_test( |
Derek Chow | 36ad2bd | 2023-08-01 11:10:05 -0700 | [diff] [blame] | 130 | name = "l1icache_tb", |
| 131 | srcs = [ |
| 132 | "kelvin/l1icache_tb.cc", |
| 133 | ], |
| 134 | deps = [ |
| 135 | ":kelvin_if", |
| 136 | ":sim_libs", |
Derek Chow | 7ae25a0 | 2024-01-11 13:10:51 -0800 | [diff] [blame] | 137 | "//hdl/chisel/src/kelvin:l1icache_cc_library", |
Derek Chow | 36ad2bd | 2023-08-01 11:10:05 -0700 | [diff] [blame] | 138 | ], |
| 139 | ) |
| 140 | |
Cindy Liu | 003c90a | 2023-08-18 03:59:42 -0700 | [diff] [blame] | 141 | cc_library( |
| 142 | name = "valu", |
| 143 | hdrs = [ |
| 144 | "kelvin/alu_ref.h", |
| 145 | "kelvin/valu.h", |
| 146 | ], |
| 147 | deps = [ |
| 148 | ":vencodeop", |
| 149 | ], |
| 150 | ) |
| 151 | |
Cindy Liu | 6362102 | 2023-08-16 18:36:36 -0700 | [diff] [blame] | 152 | cc_test( |
| 153 | name = "valu_tb", |
| 154 | size = "large", |
| 155 | srcs = [ |
Cindy Liu | 6362102 | 2023-08-16 18:36:36 -0700 | [diff] [blame] | 156 | "kelvin/valu_tb.cc", |
| 157 | ], |
| 158 | deps = [ |
| 159 | ":kelvin_if", |
| 160 | ":sim_libs", |
Cindy Liu | 003c90a | 2023-08-18 03:59:42 -0700 | [diff] [blame] | 161 | ":valu", |
Derek Chow | 7ae25a0 | 2024-01-11 13:10:51 -0800 | [diff] [blame] | 162 | "//hdl/chisel/src/kelvin:valu_cc_library", |
Cindy Liu | 6362102 | 2023-08-16 18:36:36 -0700 | [diff] [blame] | 163 | ], |
| 164 | ) |
Derek Chow | 36ad2bd | 2023-08-01 11:10:05 -0700 | [diff] [blame] | 165 | |
Cindy Liu | 003c90a | 2023-08-18 03:59:42 -0700 | [diff] [blame] | 166 | cc_test( |
| 167 | name = "valuint_tb", |
Cindy Liu | 9e2fc99 | 2023-08-27 18:34:29 -0700 | [diff] [blame] | 168 | size = "large", |
Cindy Liu | 003c90a | 2023-08-18 03:59:42 -0700 | [diff] [blame] | 169 | srcs = [ |
| 170 | "kelvin/valuint_tb.cc", |
| 171 | ], |
| 172 | deps = [ |
| 173 | ":kelvin_if", |
| 174 | ":sim_libs", |
| 175 | ":valu", |
Derek Chow | 7ae25a0 | 2024-01-11 13:10:51 -0800 | [diff] [blame] | 176 | "//hdl/chisel/src/kelvin:valuint_cc_library", |
Cindy Liu | 003c90a | 2023-08-18 03:59:42 -0700 | [diff] [blame] | 177 | ], |
| 178 | ) |
| 179 | |
Derek Chow | 36ad2bd | 2023-08-01 11:10:05 -0700 | [diff] [blame] | 180 | cc_library( |
| 181 | name = "vdecode", |
| 182 | hdrs = [ |
| 183 | "kelvin/vdecode.h", |
| 184 | ], |
| 185 | deps = [ |
| 186 | ":vdecodeop", |
| 187 | ":vencodeop", |
| 188 | ], |
| 189 | ) |
| 190 | |
| 191 | cc_library( |
| 192 | name = "vdecodeop", |
| 193 | hdrs = [ |
| 194 | "kelvin/vdecodeop.h", |
| 195 | ], |
| 196 | ) |
| 197 | |
| 198 | cc_library( |
| 199 | name = "vencodeop", |
| 200 | hdrs = [ |
| 201 | "kelvin/vencodeop.h", |
| 202 | ], |
| 203 | ) |
| 204 | |
Cindy Liu | 2d1a49b | 2023-08-14 18:03:47 -0700 | [diff] [blame] | 205 | cc_test( |
Derek Chow | 36ad2bd | 2023-08-01 11:10:05 -0700 | [diff] [blame] | 206 | name = "vcmdq_tb", |
| 207 | srcs = [ |
| 208 | "kelvin/vcmdq_tb.cc", |
| 209 | ], |
| 210 | deps = [ |
| 211 | ":kelvin_if", |
| 212 | ":sim_libs", |
| 213 | ":vencodeop", |
Derek Chow | 7ae25a0 | 2024-01-11 13:10:51 -0800 | [diff] [blame] | 214 | "//hdl/chisel/src/kelvin:vcmdq_cc_library", |
Derek Chow | 36ad2bd | 2023-08-01 11:10:05 -0700 | [diff] [blame] | 215 | ], |
| 216 | ) |
| 217 | |
Cindy Liu | 2d1a49b | 2023-08-14 18:03:47 -0700 | [diff] [blame] | 218 | cc_test( |
Derek Chow | 36ad2bd | 2023-08-01 11:10:05 -0700 | [diff] [blame] | 219 | name = "vconvalu_tb", |
| 220 | srcs = [ |
| 221 | "kelvin/vconvalu_tb.cc", |
| 222 | ], |
| 223 | deps = [ |
| 224 | ":kelvin_if", |
| 225 | ":sim_libs", |
Derek Chow | 7ae25a0 | 2024-01-11 13:10:51 -0800 | [diff] [blame] | 226 | "//hdl/chisel/src/kelvin:vconvalu_cc_library", |
Derek Chow | 36ad2bd | 2023-08-01 11:10:05 -0700 | [diff] [blame] | 227 | ], |
| 228 | ) |
| 229 | |
Cindy Liu | 9a2e8c2 | 2023-08-09 23:06:21 -0700 | [diff] [blame] | 230 | cc_test( |
Derek Chow | 36ad2bd | 2023-08-01 11:10:05 -0700 | [diff] [blame] | 231 | name = "vconvctrl_tb", |
Cindy Liu | 2d1a49b | 2023-08-14 18:03:47 -0700 | [diff] [blame] | 232 | size = "small", |
Derek Chow | 36ad2bd | 2023-08-01 11:10:05 -0700 | [diff] [blame] | 233 | srcs = [ |
| 234 | "kelvin/vconvctrl_tb.cc", |
| 235 | ], |
| 236 | deps = [ |
| 237 | ":kelvin_if", |
| 238 | ":sim_libs", |
| 239 | ":vencodeop", |
Derek Chow | 7ae25a0 | 2024-01-11 13:10:51 -0800 | [diff] [blame] | 240 | "//hdl/chisel/src/kelvin:vconvctrl_cc_library", |
Derek Chow | 36ad2bd | 2023-08-01 11:10:05 -0700 | [diff] [blame] | 241 | ], |
| 242 | ) |
| 243 | |
Cindy Liu | 9a2e8c2 | 2023-08-09 23:06:21 -0700 | [diff] [blame] | 244 | cc_test( |
Derek Chow | 36ad2bd | 2023-08-01 11:10:05 -0700 | [diff] [blame] | 245 | name = "vdecodeinstruction_tb", |
Cindy Liu | 2d1a49b | 2023-08-14 18:03:47 -0700 | [diff] [blame] | 246 | size = "small", |
Derek Chow | 36ad2bd | 2023-08-01 11:10:05 -0700 | [diff] [blame] | 247 | srcs = [ |
| 248 | "kelvin/vdecodeinstruction_tb.cc", |
| 249 | ], |
| 250 | deps = [ |
| 251 | ":kelvin_if", |
| 252 | ":sim_libs", |
| 253 | ":vdecode", |
Derek Chow | 7ae25a0 | 2024-01-11 13:10:51 -0800 | [diff] [blame] | 254 | "//hdl/chisel/src/kelvin:vdecodeinstruction_cc_library", |
Derek Chow | 36ad2bd | 2023-08-01 11:10:05 -0700 | [diff] [blame] | 255 | ], |
| 256 | ) |
| 257 | |
Cindy Liu | 9a2e8c2 | 2023-08-09 23:06:21 -0700 | [diff] [blame] | 258 | cc_test( |
Derek Chow | 36ad2bd | 2023-08-01 11:10:05 -0700 | [diff] [blame] | 259 | name = "vdecode_tb", |
| 260 | srcs = [ |
| 261 | "kelvin/vdecode_tb.cc", |
| 262 | ], |
| 263 | deps = [ |
| 264 | ":kelvin_if", |
| 265 | ":sim_libs", |
| 266 | ":vdecode", |
Derek Chow | 7ae25a0 | 2024-01-11 13:10:51 -0800 | [diff] [blame] | 267 | "//hdl/chisel/src/kelvin:vdecode_cc_library", |
Derek Chow | 36ad2bd | 2023-08-01 11:10:05 -0700 | [diff] [blame] | 268 | ], |
| 269 | ) |
| 270 | |
Cindy Liu | de8ea11 | 2023-08-10 16:48:03 -0700 | [diff] [blame] | 271 | cc_test( |
Derek Chow | 36ad2bd | 2023-08-01 11:10:05 -0700 | [diff] [blame] | 272 | name = "vldst_tb", |
| 273 | srcs = [ |
| 274 | "kelvin/vldst_tb.cc", |
| 275 | ], |
| 276 | deps = [ |
| 277 | ":kelvin_if", |
| 278 | ":sim_libs", |
| 279 | ":vencodeop", |
Derek Chow | 7ae25a0 | 2024-01-11 13:10:51 -0800 | [diff] [blame] | 280 | "//hdl/chisel/src/kelvin:vldst_cc_library", |
Derek Chow | 36ad2bd | 2023-08-01 11:10:05 -0700 | [diff] [blame] | 281 | ], |
| 282 | ) |
| 283 | |
Cindy Liu | de8ea11 | 2023-08-10 16:48:03 -0700 | [diff] [blame] | 284 | cc_test( |
Derek Chow | 36ad2bd | 2023-08-01 11:10:05 -0700 | [diff] [blame] | 285 | name = "vld_tb", |
Cindy Liu | 2d1a49b | 2023-08-14 18:03:47 -0700 | [diff] [blame] | 286 | size = "small", |
Derek Chow | 36ad2bd | 2023-08-01 11:10:05 -0700 | [diff] [blame] | 287 | srcs = [ |
| 288 | "kelvin/vld_tb.cc", |
| 289 | ], |
| 290 | deps = [ |
| 291 | ":kelvin_if", |
| 292 | ":sim_libs", |
| 293 | ":vencodeop", |
Derek Chow | 7ae25a0 | 2024-01-11 13:10:51 -0800 | [diff] [blame] | 294 | "//hdl/chisel/src/kelvin:vld_cc_library", |
Derek Chow | 36ad2bd | 2023-08-01 11:10:05 -0700 | [diff] [blame] | 295 | ], |
| 296 | ) |
| 297 | |
Cindy Liu | 2d1a49b | 2023-08-14 18:03:47 -0700 | [diff] [blame] | 298 | cc_test( |
Derek Chow | 36ad2bd | 2023-08-01 11:10:05 -0700 | [diff] [blame] | 299 | name = "vregfilesegment_tb", |
Cindy Liu | 2d1a49b | 2023-08-14 18:03:47 -0700 | [diff] [blame] | 300 | size = "small", |
Derek Chow | 36ad2bd | 2023-08-01 11:10:05 -0700 | [diff] [blame] | 301 | srcs = [ |
| 302 | "kelvin/vregfilesegment_tb.cc", |
| 303 | ], |
| 304 | deps = [ |
| 305 | ":kelvin_if", |
| 306 | ":sim_libs", |
Derek Chow | 7ae25a0 | 2024-01-11 13:10:51 -0800 | [diff] [blame] | 307 | "//hdl/chisel/src/kelvin:vregfilesegment_cc_library", |
Derek Chow | 36ad2bd | 2023-08-01 11:10:05 -0700 | [diff] [blame] | 308 | ], |
| 309 | ) |
| 310 | |
Cindy Liu | 2d1a49b | 2023-08-14 18:03:47 -0700 | [diff] [blame] | 311 | cc_test( |
Derek Chow | 36ad2bd | 2023-08-01 11:10:05 -0700 | [diff] [blame] | 312 | name = "vregfile_tb", |
| 313 | srcs = [ |
| 314 | "kelvin/vregfile_tb.cc", |
| 315 | ], |
| 316 | deps = [ |
| 317 | ":kelvin_if", |
| 318 | ":sim_libs", |
Derek Chow | 7ae25a0 | 2024-01-11 13:10:51 -0800 | [diff] [blame] | 319 | "//hdl/chisel/src/kelvin:vregfile_cc_library", |
Derek Chow | 36ad2bd | 2023-08-01 11:10:05 -0700 | [diff] [blame] | 320 | ], |
| 321 | ) |
| 322 | |
Cindy Liu | de8ea11 | 2023-08-10 16:48:03 -0700 | [diff] [blame] | 323 | cc_test( |
Derek Chow | 36ad2bd | 2023-08-01 11:10:05 -0700 | [diff] [blame] | 324 | name = "vst_tb", |
| 325 | srcs = [ |
| 326 | "kelvin/vst_tb.cc", |
| 327 | ], |
| 328 | deps = [ |
| 329 | ":kelvin_if", |
| 330 | ":sim_libs", |
| 331 | ":vencodeop", |
Derek Chow | 7ae25a0 | 2024-01-11 13:10:51 -0800 | [diff] [blame] | 332 | "//hdl/chisel/src/kelvin:vst_cc_library", |
Derek Chow | 36ad2bd | 2023-08-01 11:10:05 -0700 | [diff] [blame] | 333 | ], |
| 334 | ) |