Skip to content

Commit

Permalink
modules/zstd: Add common zstd definitions
Browse files Browse the repository at this point in the history
Internal-tag: [#51343]
Signed-off-by: Robert Winkler <[email protected]>
  • Loading branch information
rw1nkler authored and lpawelcz committed Dec 27, 2023
1 parent ce6194d commit d2b4b32
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
8 changes: 8 additions & 0 deletions xls/modules/zstd/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@ xls_dslx_library(
],
)

xls_dslx_library(
name = "common_dslx",
srcs = [
"common.x",
],
deps = [],
)

xls_dslx_test(
name = "frame_header_dslx_test",
library = ":frame_header_dslx",
Expand Down
33 changes: 33 additions & 0 deletions xls/modules/zstd/common.x
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// 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.

pub const DATA_WIDTH = u32:64;
pub const MAX_ID = u32::MAX;

pub type BlockData = bits[DATA_WIDTH];

pub enum BlockType : u2 {
RAW = 0,
RLE = 1,
COMPRESSED = 2,
RESERVED = 3,
}

pub struct BlockDataPacket {
last: bool,
last_block: bool,
id: u32,
data: BlockData,
length: u32
}

0 comments on commit d2b4b32

Please sign in to comment.