minor update

This commit is contained in:
Blaise Tine
2021-08-02 22:29:05 -07:00
parent 16f1f24a62
commit 07f6667b66
3 changed files with 30 additions and 5 deletions

View File

@@ -9,8 +9,6 @@
`define FIXED_HALF (`FIXED_ONE >> 1)
`define FIXED_MASK (`FIXED_ONE - 1)
`define CLAMP(x,lo,hi) (($signed(x) < $signed(lo)) ? lo : ((x > hi) ? hi : x))
`define TEX_ADDR_BITS 32
`define TEX_FORMAT_BITS 3
`define TEX_WRAP_BITS 2

View File

@@ -12,14 +12,20 @@ module VX_tex_wrap #(
reg [`FIXED_FRAC-1:0] coord_r;
wire [31:0] clamp = `CLAMP(coord_i, 0, `FIXED_MASK);
wire [`FIXED_FRAC-1:0] clamp;
`UNUSED_VAR (clamp)
VX_sat_fx #(
.IN_W (32),
.OUT_W (`FIXED_FRAC)
) sat_fx (
.data_in (coord_i),
.data_out (clamp)
);
always @(*) begin
case (wrap_i)
`TEX_WRAP_CLAMP:
coord_r = clamp[`FIXED_FRAC-1:0];
coord_r = clamp;
`TEX_WRAP_MIRROR:
coord_r = coord_i[`FIXED_FRAC-1:0] ^ {`FIXED_FRAC{coord_i[`FIXED_FRAC]}};
default: //`TEX_WRAP_REPEAT