summaryrefslogtreecommitdiff
path: root/rtl/gfx/gfx_frag.sv
blob: d52a0d0669282c6023576875268622de8c937101 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
`include "gfx/gfx_defs.sv"

module gfx_frag
(
	input  logic      clk,
	                  rst_n,

	input  frag_xy    frag,
	input  fixed_tri  bary,
	                  ws,
	input  logic      in_valid,
	output logic      in_ready,

	input  logic      out_ready,
	output logic      out_valid,
	output frag_paint out
);

	logic stall;
	frag_paint frag_out;

	gfx_pipeline_flow #(.STAGES(`GFX_FRAG_STAGES)) addr_flow
	(
		.*
	);

	linear_coord linear;

	gfx_frag_addr addr
	(
		.*
	);

	localparam ADDR_WAIT_STAGES = `GFX_FRAG_STAGES - `GFX_FRAG_ADDR_STAGES;

	gfx_pipes #(.WIDTH($bits(linear_coord)), .DEPTH(ADDR_WAIT_STAGES)) addr_pipes
	(
		.in(linear),
		.out(frag_out.addr),
		.*
	);

	fixed b1, b2;

	gfx_frag_bary frag_bary
	(
		.*
	);

	gfx_frag_shade shade
	(
		.color(frag_out.color),
		.argb0(),
		.argb1_argb0(),
		.argb2_argb0(),
		.*
	);

	gfx_skid_buf #(.WIDTH($bits(frag_out))) skid
	(
		.in(frag_out),
		.*
	);

endmodule