summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--rtl/gfx/gfx.sv1
-rw-r--r--rtl/gfx/gfx_defs.sv7
-rw-r--r--rtl/gfx/gfx_frag.sv5
-rw-r--r--rtl/gfx/gfx_frag_bary.sv8
-rw-r--r--rtl/gfx/gfx_frag_funnel.sv28
-rw-r--r--rtl/gfx/gfx_raster.sv11
-rw-r--r--rtl/gfx/gfx_raster_fine.sv2
7 files changed, 47 insertions, 15 deletions
diff --git a/rtl/gfx/gfx.sv b/rtl/gfx/gfx.sv
index bd797df..8e6d20f 100644
--- a/rtl/gfx/gfx.sv
+++ b/rtl/gfx/gfx.sv
@@ -43,6 +43,7 @@ module gfx
);
logic raster_ready;
+ bary_lanes barys;
paint_lanes raster_valid;
frag_xy_lanes fragments;
diff --git a/rtl/gfx/gfx_defs.sv b/rtl/gfx/gfx_defs.sv
index 7da259a..f7c874c 100644
--- a/rtl/gfx/gfx_defs.sv
+++ b/rtl/gfx/gfx_defs.sv
@@ -127,9 +127,10 @@ typedef struct packed
xy_coord x, y;
} frag_xy;
-typedef frag_xy[`GFX_FINE_LANES - 1:0] frag_xy_lanes;
-typedef logic[`GFX_FINE_LANES - 1:0] paint_lanes;
-typedef fixed[`COLOR_CHANNELS - 1:0] color_lerp_lanes;
+typedef frag_xy[`GFX_FINE_LANES - 1:0] frag_xy_lanes;
+typedef logic[`GFX_FINE_LANES - 1:0] paint_lanes;
+typedef fixed[`COLOR_CHANNELS - 1:0] color_lerp_lanes;
+typedef fixed_tri[`GFX_FINE_LANES - 1:0] bary_lanes;
typedef struct packed
{
diff --git a/rtl/gfx/gfx_frag.sv b/rtl/gfx/gfx_frag.sv
index 79fb2b4..d4b2495 100644
--- a/rtl/gfx/gfx_frag.sv
+++ b/rtl/gfx/gfx_frag.sv
@@ -6,6 +6,7 @@ module gfx_frag
rst_n,
input frag_xy_lanes fragments,
+ input bary_lanes barys,
input paint_lanes in_valid,
output logic in_ready,
@@ -16,6 +17,7 @@ module gfx_frag
logic funnel_valid;
frag_xy funnel_frag;
+ fixed_tri bary;
gfx_frag_funnel funnel
(
@@ -58,10 +60,9 @@ module gfx_frag
fixed b1, b2;
- gfx_frag_bary bary
+ gfx_frag_bary frag_bary
(
.ws(),
- .edges(),
.stall(frag_stall),
.*
);
diff --git a/rtl/gfx/gfx_frag_bary.sv b/rtl/gfx/gfx_frag_bary.sv
index 5004866..4f4f452 100644
--- a/rtl/gfx/gfx_frag_bary.sv
+++ b/rtl/gfx/gfx_frag_bary.sv
@@ -4,7 +4,7 @@ module gfx_frag_bary
(
input logic clk,
- input fixed_tri edges,
+ input fixed_tri bary,
ws,
input logic stall,
@@ -19,9 +19,9 @@ module gfx_frag_bary
assign b1_w1 = bs_ws[1];
assign b2_w2 = bs_ws[2];
- assign orthographic_bs[0] = edges[`EDGE_P1_TO_P2];
- assign orthographic_bs[1] = edges[`EDGE_P2_TO_P0];
- assign orthographic_bs[2] = edges[`EDGE_P0_TO_P1];
+ assign orthographic_bs[0] = bary[`EDGE_P1_TO_P2];
+ assign orthographic_bs[1] = bary[`EDGE_P2_TO_P0];
+ assign orthographic_bs[2] = bary[`EDGE_P0_TO_P1];
genvar i;
generate
diff --git a/rtl/gfx/gfx_frag_funnel.sv b/rtl/gfx/gfx_frag_funnel.sv
index f3458b4..943f582 100644
--- a/rtl/gfx/gfx_frag_funnel.sv
+++ b/rtl/gfx/gfx_frag_funnel.sv
@@ -6,29 +6,40 @@ module gfx_frag_funnel
rst_n,
input frag_xy_lanes fragments,
+ input bary_lanes barys,
input paint_lanes in_valid,
output logic in_ready,
input logic out_ready,
output logic out_valid,
- output frag_xy frag
+ output frag_xy frag,
+ output fixed_tri bary
);
logic skid_ready, stall, ready, valid;
- frag_xy next_frag, out;
+ frag_xy next_frag, out_frag;
+ fixed_tri next_bary, out_bary;
+ bary_lanes barys_hold;
paint_lanes current, next;
frag_xy_lanes fragments_hold;
assign ready = !(|next);
assign in_ready = skid_ready && ready;
- gfx_skid_buf #(.WIDTH($bits(frag))) skid
+ gfx_skid_buf #(.WIDTH($bits(frag))) skid_frag
(
- .in(out),
+ .in(out_frag),
.out(frag),
.*
);
+ gfx_skid_buf #(.WIDTH($bits(bary))) skid_bary
+ (
+ .in(out_bary),
+ .out(bary),
+ .*
+ );
+
gfx_skid_flow skid_flow
(
.in_ready(skid_ready),
@@ -38,6 +49,7 @@ module gfx_frag_funnel
always_comb begin
next = 0;
+ next_bary = {($bits(next_bary)){1'bx}};
next_frag = {($bits(next_frag)){1'bx}};
for (integer i = 0; i < `GFX_FINE_LANES; ++i)
@@ -45,6 +57,7 @@ module gfx_frag_funnel
next = current;
next[i] = 0;
+ next_bary = barys_hold[i];
next_frag = fragments_hold[i];
end
end
@@ -60,10 +73,13 @@ module gfx_frag_funnel
always_ff @(posedge clk)
if (!stall) begin
- if (ready)
+ if (ready) begin
+ barys_hold <= barys;
fragments_hold <= fragments;
+ end
- out <= next_frag;
+ out_bary <= next_bary;
+ out_frag <= next_frag;
end
endmodule
diff --git a/rtl/gfx/gfx_raster.sv b/rtl/gfx/gfx_raster.sv
index a51c4bb..ab282e7 100644
--- a/rtl/gfx/gfx_raster.sv
+++ b/rtl/gfx/gfx_raster.sv
@@ -12,6 +12,7 @@ module gfx_raster
output logic in_ready,
output frag_xy_lanes fragments,
+ output bary_lanes barys,
input logic out_ready,
output paint_lanes out_valid
);
@@ -69,6 +70,7 @@ module gfx_raster
);
frag_xy fragment_ij[`GFX_RASTER_SIZE][`GFX_RASTER_SIZE];
+ fixed_tri barys_ij[`GFX_RASTER_SIZE][`GFX_RASTER_SIZE];
logic[`GFX_FINE_LANES - 1:0] paint_ij, skid_paint_ij;
gfx_skid_buf #(.WIDTH(`GFX_FINE_LANES)) skid_paint
@@ -90,6 +92,7 @@ module gfx_raster
.pos(coarse_pos),
.corners(coarse_corners),
+ .barys(barys_ij[i][j]),
.paint(paint_ij[j * `GFX_RASTER_SIZE + i]),
.fragment(fragment_ij[i][j]),
.*
@@ -102,6 +105,14 @@ module gfx_raster
.stall(fine_stall),
.*
);
+
+ gfx_skid_buf #(.WIDTH($bits(fixed_tri))) skid_barys
+ (
+ .in(barys_ij[i][j]),
+ .out(barys[j * `GFX_RASTER_SIZE + i]),
+ .stall(fine_stall),
+ .*
+ );
end
end
endgenerate
diff --git a/rtl/gfx/gfx_raster_fine.sv b/rtl/gfx/gfx_raster_fine.sv
index 2cb9c6a..05d3b0d 100644
--- a/rtl/gfx/gfx_raster_fine.sv
+++ b/rtl/gfx/gfx_raster_fine.sv
@@ -11,6 +11,7 @@ module gfx_raster_fine
input logic stall,
output frag_xy fragment,
+ output fixed_tri barys,
output logic paint
);
@@ -34,6 +35,7 @@ module gfx_raster_fine
always_ff @(posedge clk)
if (!stall) begin
+ barys <= edges;
paint <= signs == 0;
fragment <= fragment_hold;