|
| 1 | +# Copyright 2023 The XLS Authors |
| 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. |
| 14 | + |
| 15 | +load( |
| 16 | + "//xls/build_rules:xls_build_defs.bzl", |
| 17 | + "xls_dslx_ir", |
| 18 | + "xls_dslx_library", |
| 19 | + "xls_dslx_test", |
| 20 | + "xls_ir_opt_ir", |
| 21 | + "xls_ir_verilog", |
| 22 | +) |
| 23 | + |
| 24 | +package( |
| 25 | + default_applicable_licenses = ["//:license"], |
| 26 | + default_visibility = ["//xls:xls_users"], |
| 27 | + licenses = ["notice"], |
| 28 | +) |
| 29 | + |
| 30 | +# Common |
| 31 | +xls_dslx_library( |
| 32 | + name = "dma_common", |
| 33 | + srcs = [ |
| 34 | + "bus/axi_pkg.x", |
| 35 | + "bus/axi_st_pkg.x", |
| 36 | + "common.x", |
| 37 | + "config.x", |
| 38 | + "gpf.x", |
| 39 | + ], |
| 40 | +) |
| 41 | + |
| 42 | +xls_dslx_test( |
| 43 | + name = "test_common", |
| 44 | + library = "dma_common", |
| 45 | +) |
| 46 | + |
| 47 | +# CSR |
| 48 | +xls_dslx_library( |
| 49 | + name = "csr", |
| 50 | + srcs = [ |
| 51 | + "csr.x", |
| 52 | + ], |
| 53 | + deps = [ |
| 54 | + ":dma_common", |
| 55 | + ], |
| 56 | +) |
| 57 | + |
| 58 | +xls_dslx_test( |
| 59 | + name = "test_csr", |
| 60 | + library = "csr", |
| 61 | +) |
| 62 | + |
| 63 | +xls_dslx_ir( |
| 64 | + name = "ir_csr_8_32_14", |
| 65 | + dslx_top = "csr_8_32_14", |
| 66 | + ir_file = "csr_8_32_14.ir", |
| 67 | + library = "csr", |
| 68 | +) |
| 69 | + |
| 70 | +xls_ir_opt_ir( |
| 71 | + name = "opt_ir_csr_8_32_14", |
| 72 | + src = "csr_8_32_14.ir", |
| 73 | + top = "__csr__csr_8_32_14__CSR_0__8_32_14_next", |
| 74 | +) |
| 75 | + |
| 76 | +xls_ir_verilog( |
| 77 | + name = "verilog_csr", |
| 78 | + src = ":opt_ir_csr_8_32_14.opt.ir", |
| 79 | + codegen_args = { |
| 80 | + "module_name": "csr", |
| 81 | + "delay_model": "unit", |
| 82 | + "pipeline_stages": "2", |
| 83 | + "reset": "rst", |
| 84 | + "use_system_verilog": "false", |
| 85 | + }, |
| 86 | + verilog_file = "csr.v", |
| 87 | +) |
| 88 | + |
| 89 | +# AXI CSR |
| 90 | +xls_dslx_library( |
| 91 | + name = "axi_csr", |
| 92 | + srcs = [ |
| 93 | + "axi_csr.x", |
| 94 | + ], |
| 95 | + deps = [ |
| 96 | + ":csr", |
| 97 | + ":dma_common", |
| 98 | + ], |
| 99 | +) |
| 100 | + |
| 101 | +xls_dslx_test( |
| 102 | + name = "test_axi_csr", |
| 103 | + library = "axi_csr", |
| 104 | +) |
| 105 | + |
| 106 | +xls_dslx_ir( |
| 107 | + name = "axi_csr_8_32_14_ir", |
| 108 | + dslx_top = "axi_csr_8_32_14", |
| 109 | + ir_file = "axi_csr_8_32_14.ir", |
| 110 | + library = "axi_csr", |
| 111 | +) |
| 112 | + |
| 113 | +xls_ir_opt_ir( |
| 114 | + name = "axi_csr_8_32_14_opt_ir", |
| 115 | + src = "axi_csr_8_32_14.ir", |
| 116 | + top = "__axi_csr__axi_csr_8_32_14__axi_csr_0__8_32_4_14_4_next", |
| 117 | +) |
| 118 | + |
| 119 | +xls_ir_verilog( |
| 120 | + name = "verilog_axi_csr", |
| 121 | + src = ":axi_csr_8_32_14_opt_ir.opt.ir", |
| 122 | + codegen_args = { |
| 123 | + "module_name": "axi_csr", |
| 124 | + "delay_model": "unit", |
| 125 | + "pipeline_stages": "4", |
| 126 | + "reset": "rst", |
| 127 | + "use_system_verilog": "false", |
| 128 | + }, |
| 129 | + verilog_file = "axi_csr.v", |
| 130 | +) |
| 131 | + |
| 132 | +# FIFO |
| 133 | +xls_dslx_library( |
| 134 | + name = "fifo", |
| 135 | + srcs = [ |
| 136 | + "fifo.x", |
| 137 | + ], |
| 138 | + deps = [ |
| 139 | + ":dma_common", |
| 140 | + "//xls/examples:ram_dslx", |
| 141 | + ], |
| 142 | +) |
| 143 | + |
| 144 | +xls_dslx_test( |
| 145 | + name = "test_fifo", |
| 146 | + library = "fifo", |
| 147 | +) |
| 148 | + |
| 149 | +# xls_dslx_ir( |
| 150 | +# name = "fifo_ir", |
| 151 | +# dslx_top = "fifo_synth", |
| 152 | +# ir_file = "fifo_ir.ir", |
| 153 | +# library = "fifo", |
| 154 | +# ) |
| 155 | + |
| 156 | +# xls_ir_opt_ir( |
| 157 | +# name = "fifo_ir_opt", |
| 158 | +# src = "fifo_ir.ir", |
| 159 | +# # FIXME: Top level is not correctly generated in verilog |
| 160 | +# top = "__fifo__fifo_synth__FIFO__Writer_0__4_8_1_1_16_1_next" |
| 161 | +# ) |
| 162 | + |
| 163 | +# xls_ir_verilog( |
| 164 | +# name = "verilog_fifo", |
| 165 | +# src = ":fifo_ir_opt.opt.ir", |
| 166 | +# codegen_args = { |
| 167 | +# "module_name": "fifo", |
| 168 | +# "delay_model": "unit", |
| 169 | +# "pipeline_stages": "3", |
| 170 | +# "worst_case_throughput": "2", |
| 171 | +# "reset": "rst", |
| 172 | +# "use_system_verilog": "false", |
| 173 | +# # TODO: setup configuration for RAM macro generation |
| 174 | +# # https://google.github.io/xls/codegen_options/#rams-experimental |
| 175 | +# # https://github.com/google/xls/blob/609a7ab89d96d2a7396d2418d00d30e4cb57b119/xls/codegen/ram_configuration.h#L99 |
| 176 | +# # https://github.com/google/xls/blob/609a7ab89d96d2a7396d2418d00d30e4cb57b119/docs_src/tutorials/xlscc_memory.md?plain=1#L140 |
| 177 | +# }, |
| 178 | +# verilog_file = "fifo.v", |
| 179 | +# ) |
| 180 | + |
| 181 | +# Address Generator |
| 182 | +xls_dslx_library( |
| 183 | + name = "address_generator_lib", |
| 184 | + srcs = [ |
| 185 | + "address_generator.x", |
| 186 | + ], |
| 187 | + deps = [ |
| 188 | + ":dma_common", |
| 189 | + ], |
| 190 | +) |
| 191 | + |
| 192 | +xls_dslx_test( |
| 193 | + name = "test_address_generator", |
| 194 | + library = "address_generator_lib", |
| 195 | +) |
| 196 | + |
| 197 | +# Frontend Reader |
| 198 | +xls_dslx_library( |
| 199 | + name = "frontend_reader_lib", |
| 200 | + srcs = [ |
| 201 | + "frontend_reader.x", |
| 202 | + ], |
| 203 | + deps = [ |
| 204 | + ":dma_common", |
| 205 | + ], |
| 206 | +) |
| 207 | + |
| 208 | +xls_dslx_test( |
| 209 | + name = "test_frontend_reader", |
| 210 | + library = "frontend_reader_lib", |
| 211 | +) |
| 212 | + |
| 213 | +# Frontend writer |
| 214 | +xls_dslx_library( |
| 215 | + name = "frontend_writer_lib", |
| 216 | + srcs = [ |
| 217 | + "frontend_writer.x", |
| 218 | + ], |
| 219 | + deps = [ |
| 220 | + ":dma_common", |
| 221 | + ], |
| 222 | +) |
| 223 | + |
| 224 | +xls_dslx_test( |
| 225 | + name = "test_frontend_writer", |
| 226 | + library = "frontend_writer_lib", |
| 227 | +) |
| 228 | + |
| 229 | +# TODO: Uncomment recipce once ready for testing |
| 230 | +# Main controller |
| 231 | +# xls_dslx_library( |
| 232 | +# name = 'main_controller_lib', |
| 233 | +# srcs = [ |
| 234 | +# 'main_controller.x', |
| 235 | +# ], |
| 236 | +# ) |
| 237 | + |
| 238 | +# xls_dslx_test( |
| 239 | +# name = "test_main_controller", |
| 240 | +# library = "main_controller_lib", |
| 241 | +# ) |
0 commit comments