From 938b66f2326d642f972b12f0daef8adce676410c Mon Sep 17 00:00:00 2001 From: Krishna Yalamarthy Date: Mon, 22 Mar 2021 13:39:30 -0400 Subject: [PATCH] sampler bug fixes --- hw/rtl/tex_unit/VX_tex_bilerp.v | 10 ++--- hw/rtl/tex_unit/VX_tex_format.v | 7 +++- hw/rtl/tex_unit/VX_tex_memory.v | 1 - hw/rtl/tex_unit/VX_tex_sampler.v | 66 ++++++++++++++++---------------- hw/rtl/tex_unit/VX_tex_unit.v | 1 - 5 files changed, 42 insertions(+), 43 deletions(-) diff --git a/hw/rtl/tex_unit/VX_tex_bilerp.v b/hw/rtl/tex_unit/VX_tex_bilerp.v index 1c0dbb53..71a1594f 100644 --- a/hw/rtl/tex_unit/VX_tex_bilerp.v +++ b/hw/rtl/tex_unit/VX_tex_bilerp.v @@ -7,7 +7,7 @@ module VX_tex_bilerp #( input wire [`BLEND_FRAC_64-1:0] blendV, input wire [3:0][63:0] texels, - input wire [`TEX_FORMAT_BITS-1:0] color_enable, + input wire [`NUM_COLOR_CHANNEL-1:0] color_enable, output wire [31:0] sampled_data ); @@ -40,22 +40,22 @@ module VX_tex_bilerp #( ); always @(*) begin - if (color_enable[3]==1) //R + if (color_enable[3]==1'b1) //R sampled_r[31:24] = V_lerp[55:48]; else sampled_r[31:24] = {`TEX_COLOR_BITS{1'b0}}; - if (color_enable[2]==1) //G + if (color_enable[2]==1'b1) //G sampled_r[23:16] = V_lerp[39:32]; else sampled_r[23:16] = {`TEX_COLOR_BITS{1'b0}}; - if (color_enable[1]==1) //B + if (color_enable[1]==1'b1) //B sampled_r[15:8] = V_lerp[23:16]; else sampled_r[15:8] = {`TEX_COLOR_BITS{1'b0}}; - if (color_enable[0]==1) //A + if (color_enable[0]==1'b1) //A sampled_r[7:0] = V_lerp[7:0]; else sampled_r[7:0] = {`TEX_COLOR_BITS{1'b1}}; diff --git a/hw/rtl/tex_unit/VX_tex_format.v b/hw/rtl/tex_unit/VX_tex_format.v index a64a829b..68081e22 100644 --- a/hw/rtl/tex_unit/VX_tex_format.v +++ b/hw/rtl/tex_unit/VX_tex_format.v @@ -13,7 +13,7 @@ module VX_tex_format #( `UNUSED_PARAM (CORE_ID) reg [`NUM_COLOR_CHANNEL-1:0] color_enable_r; - reg [NUM_TEXELS][63:0] formatted_texel_r; + reg [NUM_TEXELS-1:0][63:0] formatted_texel_r; always @(*) begin for (integer i = 0; i