|
| 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_benchmark_ir", |
| 18 | + "xls_dslx_ir", |
| 19 | + "xls_dslx_library", |
| 20 | + "xls_dslx_test", |
| 21 | + "xls_ir_opt_ir", |
| 22 | + "xls_ir_verilog", |
| 23 | +) |
| 24 | + |
| 25 | +package( |
| 26 | + default_applicable_licenses = ["//:license"], |
| 27 | + default_visibility = ["//xls:xls_users"], |
| 28 | + licenses = ["notice"], |
| 29 | +) |
| 30 | + |
| 31 | +# Common |
| 32 | +xls_dslx_library( |
| 33 | + name = 'dma_common', |
| 34 | + srcs = [ |
| 35 | + 'config.x', |
| 36 | + 'axi_pkg.x', |
| 37 | + ] |
| 38 | +) |
| 39 | + |
| 40 | +xls_dslx_test( |
| 41 | + name = "test_common", |
| 42 | + library = "dma_common", |
| 43 | +) |
| 44 | + |
| 45 | +# CSR |
| 46 | +xls_dslx_library( |
| 47 | + name = 'csr', |
| 48 | + srcs = [ |
| 49 | + 'csr.x' |
| 50 | + ], |
| 51 | + deps = [ |
| 52 | + ':dma_common', |
| 53 | + ] |
| 54 | +) |
| 55 | + |
| 56 | +xls_dslx_test( |
| 57 | + name = "test_csr", |
| 58 | + library = "csr", |
| 59 | +) |
| 60 | + |
| 61 | +xls_dslx_ir( |
| 62 | + name = "ir_csr_8_32_14", |
| 63 | + dslx_top = "csr_8_32_14", |
| 64 | + ir_file = "csr_8_32_14.ir", |
| 65 | + library = "csr", |
| 66 | +) |
| 67 | + |
| 68 | +xls_ir_opt_ir( |
| 69 | + name = "opt_ir_csr_8_32_14", |
| 70 | + src = "csr_8_32_14.ir", |
| 71 | + top = "__csr__csr_8_32_14__CSR_0__8_32_14_next" |
| 72 | +) |
| 73 | + |
| 74 | +xls_ir_verilog( |
| 75 | + name = "verilog_csr_8_32_14", |
| 76 | + src = ":opt_ir_csr_8_32_14.opt.ir", |
| 77 | + codegen_args = { |
| 78 | + "module_name": "csr_8_32_14", |
| 79 | + "delay_model": "unit", |
| 80 | + "pipeline_stages": "2", |
| 81 | + "reset": "rst", |
| 82 | + "use_system_verilog": "false", |
| 83 | + }, |
| 84 | + verilog_file = "csr_8_32_14.v", |
| 85 | +) |
| 86 | + |
| 87 | +# AXI CSR |
| 88 | +xls_dslx_library( |
| 89 | + name = 'axi_csr', |
| 90 | + srcs = [ |
| 91 | + 'axi_csr.x' |
| 92 | + ], |
| 93 | + deps = [ |
| 94 | + ':dma_common', |
| 95 | + ':csr' |
| 96 | + ] |
| 97 | +) |
| 98 | + |
| 99 | +xls_dslx_test( |
| 100 | + name = "test_axi_csr", |
| 101 | + library = "axi_csr", |
| 102 | +) |
| 103 | + |
| 104 | +xls_dslx_ir( |
| 105 | + name = "axi_csr_8_32_14_ir", |
| 106 | + dslx_top = "axi_csr_8_32_14", |
| 107 | + ir_file = "axi_csr_8_32_14.ir", |
| 108 | + library = "axi_csr", |
| 109 | +) |
| 110 | + |
| 111 | +xls_ir_opt_ir( |
| 112 | + name = "axi_csr_8_32_14_opt_ir", |
| 113 | + src = "axi_csr_8_32_14.ir", |
| 114 | + top = "__axi_csr__axi_csr_8_32_14__axi_csr_0__8_32_4_14_4_next" |
| 115 | +) |
| 116 | + |
| 117 | +xls_ir_verilog( |
| 118 | + name = "axi_csr_verilog", |
| 119 | + src = ":axi_csr_8_32_14_opt_ir.opt.ir", |
| 120 | + codegen_args = { |
| 121 | + "module_name": "axi_csr", |
| 122 | + "delay_model": "unit", |
| 123 | + "pipeline_stages": "4", |
| 124 | + "reset": "rst", |
| 125 | + "use_system_verilog": "false", |
| 126 | + }, |
| 127 | + verilog_file = "axi_csr.v", |
| 128 | +) |
| 129 | + |
| 130 | +# FIFO |
| 131 | + |
| 132 | +xls_dslx_library( |
| 133 | + name = 'fifo', |
| 134 | + srcs = [ |
| 135 | + 'fifo.x' |
| 136 | + ], |
| 137 | + deps = [ |
| 138 | + ':dma_common', |
| 139 | + '//xls/examples:ram_dslx' |
| 140 | + ] |
| 141 | +) |
| 142 | + |
| 143 | +xls_dslx_test( |
| 144 | + name = "test_fifo", |
| 145 | + library = "fifo", |
| 146 | +) |
| 147 | + |
| 148 | +xls_dslx_ir( |
| 149 | + name = "fifo_ir", |
| 150 | + dslx_top = "fifo_synth", |
| 151 | + ir_file = "fifo_ir.ir", |
| 152 | + library = "fifo", |
| 153 | +) |
| 154 | + |
| 155 | +xls_ir_opt_ir( |
| 156 | + name = "fifo_ir_opt", |
| 157 | + src = "fifo_ir.ir", |
| 158 | + # FIXME: Top level is not correctly generated in verilog |
| 159 | + top = "__xls_examples_ram__fifo_synth__FIFO__FifoRAM__RamModel2RW_0__4_8_0_0_16_0_next" |
| 160 | +) |
| 161 | + |
| 162 | +xls_ir_verilog( |
| 163 | + name = "fifo_verilog", |
| 164 | + src = ":fifo_ir_opt.opt.ir", |
| 165 | + codegen_args = { |
| 166 | + "module_name": "fifo", |
| 167 | + "delay_model": "unit", |
| 168 | + "pipeline_stages": "3", |
| 169 | + "worst_case_throughput": "2", |
| 170 | + "reset": "rst", |
| 171 | + "use_system_verilog": "false", |
| 172 | + # TODO: setup configuration for RAM macro generation |
| 173 | + # https://google.github.io/xls/codegen_options/#rams-experimental |
| 174 | + # https://github.com/google/xls/blob/609a7ab89d96d2a7396d2418d00d30e4cb57b119/xls/codegen/ram_configuration.h#L99 |
| 175 | + # https://github.com/google/xls/blob/609a7ab89d96d2a7396d2418d00d30e4cb57b119/docs_src/tutorials/xlscc_memory.md?plain=1#L140 |
| 176 | + }, |
| 177 | + verilog_file = "fifo.v", |
| 178 | +) |
| 179 | + |
| 180 | +# LibA |
| 181 | +xls_dslx_library( |
| 182 | + name = 'libA', |
| 183 | + srcs = [ |
| 184 | + 'libA.x' |
| 185 | + ] |
| 186 | +) |
| 187 | + |
| 188 | +xls_dslx_library( |
| 189 | + name = 'libB', |
| 190 | + srcs = [ |
| 191 | + 'libB.x' |
| 192 | + ], |
| 193 | + deps = [ |
| 194 | + 'libA' |
| 195 | + ] |
| 196 | +) |
| 197 | + |
| 198 | +xls_dslx_ir( |
| 199 | + name = "libB_ir", |
| 200 | + dslx_top = "procWrapperA", |
| 201 | + ir_file = "procWrapperA.ir", |
| 202 | + library = "libB", |
| 203 | +) |
| 204 | + |
| 205 | +xls_dslx_test( |
| 206 | + name = "test_libA", |
| 207 | + library = "libA", |
| 208 | +) |
| 209 | + |
| 210 | +xls_dslx_test( |
| 211 | + name = "test_libB", |
| 212 | + library = "libB", |
| 213 | +) |
0 commit comments