Skip to content

Commit

Permalink
fixed output merger synchronization bug
Browse files Browse the repository at this point in the history
  • Loading branch information
tinebp committed Sep 14, 2024
1 parent c622039 commit d4f77fd
Show file tree
Hide file tree
Showing 25 changed files with 207 additions and 176 deletions.
16 changes: 8 additions & 8 deletions ci/regression.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,14 @@ om()
{
echo "begin render output tests..."

CONFIGS="-DEXT_OM_ENABLE" ./ci/blackbox.sh --driver=simx --app=om --args="-w32 -h32 -rwhitebox_32.png"
CONFIGS="-DEXT_OM_ENABLE" ./ci/blackbox.sh --driver=simx --app=om --args="-w32 -h32 -d -rwhitebox_d_32.png"
CONFIGS="-DEXT_OM_ENABLE" ./ci/blackbox.sh --driver=simx --app=om --args="-w32 -h32 -b -rwhitebox_b_32.png"
CONFIGS="-DEXT_OM_ENABLE" ./ci/blackbox.sh --driver=simx --app=om --args="-w32 -h32 -db -rwhitebox_db_32.png"
CONFIGS="-DEXT_OM_ENABLE" ./ci/blackbox.sh --driver=rtlsim --app=om --args="-w32 -h32 -rwhitebox_32.png"
CONFIGS="-DEXT_OM_ENABLE" ./ci/blackbox.sh --driver=rtlsim --app=om --args="-w32 -h32 -d -rwhitebox_d_32.png"
CONFIGS="-DEXT_OM_ENABLE" ./ci/blackbox.sh --driver=rtlsim --app=om --args="-w32 -h32 -b -rwhitebox_b_32.png"
CONFIGS="-DEXT_OM_ENABLE" ./ci/blackbox.sh --driver=rtlsim --app=om --args="-w32 -h32 -db -rwhitebox_db_32.png"
CONFIGS="-DEXT_OM_ENABLE" ./ci/blackbox.sh --driver=simx --app=om --args="-rwhitebox_128.png"
CONFIGS="-DEXT_OM_ENABLE" ./ci/blackbox.sh --driver=simx --app=om --args="-d -rwhitebox_d_128.png"
CONFIGS="-DEXT_OM_ENABLE" ./ci/blackbox.sh --driver=simx --app=om --args="-b -rwhitebox_b_128.png"
CONFIGS="-DEXT_OM_ENABLE" ./ci/blackbox.sh --driver=simx --app=om --args="-db -rwhitebox_db_128.png"
CONFIGS="-DEXT_OM_ENABLE" ./ci/blackbox.sh --driver=rtlsim --app=om --args="-rwhitebox_128.png"
CONFIGS="-DEXT_OM_ENABLE" ./ci/blackbox.sh --driver=rtlsim --app=om --args="-d -rwhitebox_d_128.png"
CONFIGS="-DEXT_OM_ENABLE" ./ci/blackbox.sh --driver=rtlsim --app=om --args="-b -rwhitebox_b_128.png"
CONFIGS="-DEXT_OM_ENABLE" ./ci/blackbox.sh --driver=rtlsim --app=om --args="-db -rwhitebox_db_128.png"
CONFIGS="-DEXT_OM_ENABLE -DOCACHE_DISABLE" ./ci/blackbox.sh --driver=rtlsim --app=om --args="-rwhitebox_128.png"
CONFIGS="-DEXT_OM_ENABLE -DOCACHE_NUM_BANKS=8" ./ci/blackbox.sh --driver=rtlsim --app=om --args="-rwhitebox_128.png" --perf=5
CONFIGS="-DEXT_OM_ENABLE -DNUM_OM_UNITS=2 -DL1_DISABLE -DLM_DISABLE -DOCACHE_DISABLE" ./ci/blackbox.sh --driver=simx --app=om --args="-rwhitebox_128.png" --cores=4 --warps=1 --threads=2
Expand Down
2 changes: 1 addition & 1 deletion hw/rtl/om/VX_om_arb.sv
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module VX_om_arb import VX_om_pkg::*; #(
VX_om_bus_if.master bus_out_if [NUM_OUTPUTS]
);

localparam REQ_DATAW = `UUID_WIDTH + NUM_LANES * (1 + 2 * `VX_OM_DIM_BITS + $bits(rgba_t) + `VX_OM_DEPTH_BITS + 1);
localparam REQ_DATAW = `UUID_WIDTH + NUM_LANES * (1 + 2 * `VX_OM_DIM_BITS + $bits(om_color_t) + `VX_OM_DEPTH_BITS + 1);

wire [NUM_INPUTS-1:0] req_valid_in;
wire [NUM_INPUTS-1:0][REQ_DATAW-1:0] req_data_in;
Expand Down
68 changes: 34 additions & 34 deletions hw/rtl/om/VX_om_blend.sv
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ module VX_om_blend import VX_om_pkg::*; #(
input wire ready_out,

// Input values
input rgba_t [NUM_LANES-1:0] src_color,
input rgba_t [NUM_LANES-1:0] dst_color,
input om_color_t [NUM_LANES-1:0] src_color,
input om_color_t [NUM_LANES-1:0] dst_color,

// Output values
output rgba_t [NUM_LANES-1:0] color_out
output om_color_t [NUM_LANES-1:0] color_out
);
`UNUSED_SPARAM (INSTANCE_ID)

Expand All @@ -52,8 +52,8 @@ module VX_om_blend import VX_om_pkg::*; #(

assign ready_in = ~stall;

rgba_t [NUM_LANES-1:0] src_factor;
rgba_t [NUM_LANES-1:0] dst_factor;
om_color_t [NUM_LANES-1:0] src_factor;
om_color_t [NUM_LANES-1:0] dst_factor;

for (genvar i = 0; i < NUM_LANES; ++i) begin : g_blend_func_src
VX_om_blend_func blend_func_src (
Expand All @@ -80,10 +80,10 @@ module VX_om_blend import VX_om_pkg::*; #(
wire valid_s1, valid_s2;
wire [TAG_WIDTH-1:0] tag_s1, tag_s2;

rgba_t [NUM_LANES-1:0] src_color_s1;
rgba_t [NUM_LANES-1:0] dst_color_s1;
rgba_t [NUM_LANES-1:0] src_factor_s1;
rgba_t [NUM_LANES-1:0] dst_factor_s1;
om_color_t [NUM_LANES-1:0] src_color_s1;
om_color_t [NUM_LANES-1:0] dst_color_s1;
om_color_t [NUM_LANES-1:0] src_factor_s1;
om_color_t [NUM_LANES-1:0] dst_factor_s1;

VX_pipe_register #(
.DATAW (1 + TAG_WIDTH + 32 * 4 * NUM_LANES),
Expand All @@ -97,10 +97,10 @@ module VX_om_blend import VX_om_pkg::*; #(
.data_out ({valid_s1, tag_s1, src_color_s1, dst_color_s1, src_factor_s1, dst_factor_s1})
);

rgba_t [NUM_LANES-1:0] mult_add_color_s2;
rgba_t [NUM_LANES-1:0] min_color_s2;
rgba_t [NUM_LANES-1:0] max_color_s2;
rgba_t [NUM_LANES-1:0] logic_op_color_s2;
om_color_t [NUM_LANES-1:0] mult_add_color_s2;
om_color_t [NUM_LANES-1:0] min_color_s2;
om_color_t [NUM_LANES-1:0] max_color_s2;
om_color_t [NUM_LANES-1:0] logic_op_color_s2;

for (genvar i = 0; i < NUM_LANES; ++i) begin : g_blend_multadd
VX_om_blend_multadd #(
Expand Down Expand Up @@ -158,7 +158,7 @@ module VX_om_blend import VX_om_pkg::*; #(
.data_out ({valid_s2, tag_s2})
);

rgba_t [NUM_LANES-1:0] color_out_s2;
om_color_t [NUM_LANES-1:0] color_out_s2;

for (genvar i = 0; i < NUM_LANES; ++i) begin : g_blending
always @(*) begin
Expand All @@ -167,49 +167,49 @@ module VX_om_blend import VX_om_pkg::*; #(
`VX_OM_BLEND_MODE_ADD,
`VX_OM_BLEND_MODE_SUB,
`VX_OM_BLEND_MODE_REV_SUB: begin
color_out_s2[i].r = mult_add_color_s2[i].r;
color_out_s2[i].g = mult_add_color_s2[i].g;
color_out_s2[i].b = mult_add_color_s2[i].b;
color_out_s2[i].argb[23:16] = mult_add_color_s2[i].argb[23:16];
color_out_s2[i].argb[15:8] = mult_add_color_s2[i].argb[15:8];
color_out_s2[i].argb[7:0] = mult_add_color_s2[i].argb[7:0];
end
`VX_OM_BLEND_MODE_MIN: begin
color_out_s2[i].r = min_color_s2[i].r;
color_out_s2[i].g = min_color_s2[i].g;
color_out_s2[i].b = min_color_s2[i].b;
color_out_s2[i].argb[23:16] = min_color_s2[i].argb[23:16];
color_out_s2[i].argb[15:8] = min_color_s2[i].argb[15:8];
color_out_s2[i].argb[7:0] = min_color_s2[i].argb[7:0];
end
`VX_OM_BLEND_MODE_MAX: begin
color_out_s2[i].r = max_color_s2[i].r;
color_out_s2[i].g = max_color_s2[i].g;
color_out_s2[i].b = max_color_s2[i].b;
color_out_s2[i].argb[23:16] = max_color_s2[i].argb[23:16];
color_out_s2[i].argb[15:8] = max_color_s2[i].argb[15:8];
color_out_s2[i].argb[7:0] = max_color_s2[i].argb[7:0];
end
`VX_OM_BLEND_MODE_LOGICOP: begin
color_out_s2[i].r = logic_op_color_s2[i].r;
color_out_s2[i].g = logic_op_color_s2[i].g;
color_out_s2[i].b = logic_op_color_s2[i].b;
color_out_s2[i].argb[23:16] = logic_op_color_s2[i].argb[23:16];
color_out_s2[i].argb[15:8] = logic_op_color_s2[i].argb[15:8];
color_out_s2[i].argb[7:0] = logic_op_color_s2[i].argb[7:0];
end
default: begin
color_out_s2[i].r = 'x;
color_out_s2[i].g = 'x;
color_out_s2[i].b = 'x;
color_out_s2[i].argb[23:16] = 'x;
color_out_s2[i].argb[15:8] = 'x;
color_out_s2[i].argb[7:0] = 'x;
end
endcase
// Alpha Component
case (dcrs.blend_mode_a)
`VX_OM_BLEND_MODE_ADD,
`VX_OM_BLEND_MODE_SUB,
`VX_OM_BLEND_MODE_REV_SUB: begin
color_out_s2[i].a = mult_add_color_s2[i].a;
color_out_s2[i].argb[31:24] = mult_add_color_s2[i].argb[31:24];
end
`VX_OM_BLEND_MODE_MIN: begin
color_out_s2[i].a = min_color_s2[i].a;
color_out_s2[i].argb[31:24] = min_color_s2[i].argb[31:24];
end
`VX_OM_BLEND_MODE_MAX: begin
color_out_s2[i].a = max_color_s2[i].a;
color_out_s2[i].argb[31:24] = max_color_s2[i].argb[31:24];
end
`VX_OM_BLEND_MODE_LOGICOP: begin
color_out_s2[i].a = logic_op_color_s2[i].a;
color_out_s2[i].argb[31:24] = logic_op_color_s2[i].argb[31:24];
end
default: begin
color_out_s2[i].a = 'x;
color_out_s2[i].argb[31:24] = 'x;
end
endcase
end
Expand Down
28 changes: 14 additions & 14 deletions hw/rtl/om/VX_om_blend_func.sv
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
//!/bin/bash

// Copyright © 2019-2023
//
//
// 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.
Expand All @@ -18,9 +18,9 @@
module VX_blend_func #(
parameter INDEX = 0
) (
input wire [`VX_OM_BLEND_FUNC_BITS-1:0] func,
input wire [3:0][7:0] src,
input wire [3:0][7:0] dst,
input wire [`VX_OM_BLEND_FUNC_BITS-1:0] func,
input wire [3:0][7:0] src,
input wire [3:0][7:0] dst,
input wire [3:0][7:0] cst,
output wire [7:0] result
);
Expand Down Expand Up @@ -57,7 +57,7 @@ module VX_blend_func #(
end

assign result = result_r;

endmodule

module VX_om_blend_func import VX_om_pkg::*; #(
Expand All @@ -66,15 +66,15 @@ module VX_om_blend_func import VX_om_pkg::*; #(
input wire [`VX_OM_BLEND_FUNC_BITS-1:0] func_rgb,
input wire [`VX_OM_BLEND_FUNC_BITS-1:0] func_a,

input rgba_t src_color,
input rgba_t dst_color,
input rgba_t cst_color,
input om_color_t src_color,
input om_color_t dst_color,
input om_color_t cst_color,

output rgba_t factor_out
output om_color_t factor_out
);
VX_blend_func #(0) blend_func_b (func_rgb, src_color, dst_color, cst_color, factor_out.b);
VX_blend_func #(1) blend_func_g (func_rgb, src_color, dst_color, cst_color, factor_out.g);
VX_blend_func #(2) blend_func_r (func_rgb, src_color, dst_color, cst_color, factor_out.r);
VX_blend_func #(3) blend_func_a (func_a, src_color, dst_color, cst_color, factor_out.a);
VX_blend_func #(0) blend_func_b (func_rgb, src_color, dst_color, cst_color, factor_out.argb[7:0]);
VX_blend_func #(1) blend_func_g (func_rgb, src_color, dst_color, cst_color, factor_out.argb[15:8]);
VX_blend_func #(2) blend_func_r (func_rgb, src_color, dst_color, cst_color, factor_out.argb[23:16]);
VX_blend_func #(3) blend_func_a (func_a, src_color, dst_color, cst_color, factor_out.argb[31:24]);

endmodule
58 changes: 29 additions & 29 deletions hw/rtl/om/VX_om_blend_minmax.sv
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
//!/bin/bash

// Copyright © 2019-2023
//
//
// 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.
Expand All @@ -23,49 +23,49 @@ module VX_om_blend_minmax import VX_om_pkg::*; #(

input wire enable,

input rgba_t src_color,
input rgba_t dst_color,
input om_color_t src_color,
input om_color_t dst_color,

output rgba_t min_out,
output rgba_t max_out
output om_color_t min_out,
output om_color_t max_out
);

`UNUSED_VAR (reset)

rgba_t tmp_min;
rgba_t tmp_max;
om_color_t tmp_min;
om_color_t tmp_max;

always @(*) begin
if (src_color.r > dst_color.r) begin
tmp_max.r = src_color.r;
tmp_min.r = dst_color.r;
always @(*) begin
if (src_color.argb[23:16] > dst_color.argb[23:16]) begin
tmp_max.argb[23:16] = src_color.argb[23:16];
tmp_min.argb[23:16] = dst_color.argb[23:16];
end else begin
tmp_max.r = dst_color.r;
tmp_min.r = src_color.r;
tmp_max.argb[23:16] = dst_color.argb[23:16];
tmp_min.argb[23:16] = src_color.argb[23:16];
end

if (src_color.g > dst_color.g) begin
tmp_max.g = src_color.g;
tmp_min.g = dst_color.g;
if (src_color.argb[15:8] > dst_color.argb[15:8]) begin
tmp_max.argb[15:8] = src_color.argb[15:8];
tmp_min.argb[15:8] = dst_color.argb[15:8];
end else begin
tmp_max.g = dst_color.g;
tmp_min.g = src_color.g;
tmp_max.argb[15:8] = dst_color.argb[15:8];
tmp_min.argb[15:8] = src_color.argb[15:8];
end

if (src_color.b > dst_color.b) begin
tmp_max.b = src_color.b;
tmp_min.b = dst_color.b;
if (src_color.argb[7:0] > dst_color.argb[7:0]) begin
tmp_max.argb[7:0] = src_color.argb[7:0];
tmp_min.argb[7:0] = dst_color.argb[7:0];
end else begin
tmp_max.b = dst_color.b;
tmp_min.b = src_color.b;
tmp_max.argb[7:0] = dst_color.argb[7:0];
tmp_min.argb[7:0] = src_color.argb[7:0];
end

if (src_color.a > dst_color.a) begin
tmp_max.a = src_color.a;
tmp_min.a = dst_color.a;
if (src_color.argb[31:24] > dst_color.argb[31:24]) begin
tmp_max.argb[31:24] = src_color.argb[31:24];
tmp_min.argb[31:24] = dst_color.argb[31:24];
end else begin
tmp_max.a = dst_color.a;
tmp_min.a = src_color.a;
tmp_max.argb[31:24] = dst_color.argb[31:24];
tmp_min.argb[31:24] = src_color.argb[31:24];
end
end

Expand Down
Loading

0 comments on commit d4f77fd

Please sign in to comment.