Skip to content

Commit

Permalink
[TEMP] Add Buffer
Browse files Browse the repository at this point in the history
google#1167

modules/zstd: Add buffer library

This commit adds a DSLX Buffer library that provides the Buffer struct,
and helper functions that can be used to operate on it. The Buffer
is meant to be a storage for data coming from the channel. It acts like
a FIFO, allowing data of any length to be put in or popped out of it.
Provided DSLX tests verify the correct behaviour of the library.

Internal-tag: [#50221]
Signed-off-by: Robert Winkler <[email protected]>

modules/zstd: Add Buffer use-case example

This commit adds a simple test that shows, how one can use the Buffer
struct inside a Proc.

Internal-tag: [#50221]
Signed-off-by: Robert Winkler <[email protected]>

modules/zstd/buffer: Add benchmarking rules

Signed-off-by: Pawel Czarnecki <[email protected]>
  • Loading branch information
rw1nkler authored and lpawelcz committed Mar 7, 2024
1 parent a4223b5 commit aa75b59
Show file tree
Hide file tree
Showing 3 changed files with 610 additions and 0 deletions.
121 changes: 121 additions & 0 deletions xls/modules/zstd/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# Copyright 2023 The XLS Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# 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.

# Build rules for XLS ZSTD codec implementation.

load("@rules_hdl//place_and_route:build_defs.bzl", "place_and_route")
load("@rules_hdl//synthesis:build_defs.bzl", "benchmark_synth", "synthesize_rtl")
load("@rules_hdl//verilog:providers.bzl", "verilog_library")
load(
"//xls/build_rules:xls_build_defs.bzl",
"xls_benchmark_ir",
"xls_dslx_library",
"xls_dslx_test",
"xls_dslx_verilog",
)

package(
default_applicable_licenses = ["//:license"],
default_visibility = ["//xls:xls_users"],
licenses = ["notice"],
)

xls_dslx_library(
name = "buffer_dslx",
srcs = [
"buffer.x",
],
)

xls_dslx_test(
name = "buffer_dslx_test",
library = ":buffer_dslx",
)

xls_dslx_library(
name = "window_buffer_dslx",
srcs = [
"window_buffer.x",
],
deps = [
":buffer_dslx",
],
)

xls_dslx_test(
name = "window_buffer_dslx_test",
library = ":window_buffer_dslx",
)

xls_dslx_verilog(
name = "window_buffer_verilog",
codegen_args = {
"module_name": "WindowBuffer64",
"delay_model": "asap7",
"pipeline_stages": "2",
"reset": "rst",
"use_system_verilog": "false",
},
dslx_top = "WindowBuffer64",
library = ":window_buffer_dslx",
# TODO: 2024-01-25: Workaround for https://github.com/google/xls/issues/869
# Force proc inlining and set last internal proc as top proc for IR optimization
opt_ir_args = {
"inline_procs": "true",
"top": "__window_buffer__WindowBuffer64__WindowBuffer_0__64_32_48_next",
},
verilog_file = "window_buffer.v",
)

xls_benchmark_ir(
name = "window_buffer_opt_ir_benchmark",
src = ":window_buffer_verilog.opt.ir",
benchmark_ir_args = {
"pipeline_stages": "2",
"delay_model": "asap7",
},
)

verilog_library(
name = "window_buffer_verilog_lib",
srcs = [
":window_buffer.v",
],
)

synthesize_rtl(
name = "window_buffer_synth_asap7",
standard_cells = "@org_theopenroadproject_asap7sc7p5t_28//:asap7-sc7p5t_rev28_rvt",
top_module = "WindowBuffer64",
deps = [
":window_buffer_verilog_lib",
],
)

benchmark_synth(
name = "window_buffer_benchmark_synth",
synth_target = ":window_buffer_synth_asap7",
)

place_and_route(
name = "window_buffer_place_and_route",
clock_period = "750",
core_padding_microns = 2,
min_pin_distance = "0.5",
placement_density = "0.30",
skip_detailed_routing = True,
synthesized_rtl = ":window_buffer_synth_asap7",
target_die_utilization_percentage = "10",
)

Loading

0 comments on commit aa75b59

Please sign in to comment.