summaryrefslogtreecommitdiff
path: root/rtl/gfx/gfx_persp_vertex.sv
blob: f7434f0f32d5210bbb30d5ab4bcb38079567c73a (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
`include "gfx/gfx_defs.sv"

module gfx_persp_vertex
(
	input  logic       clk,

	input  raster_xyzw in_vertex,
	input  logic       stall,

	output raster_xyzw out_vertex
);

	raster_xyzw skid_vertex;

	gfx_fixed_div x_div
	(
		.z(in_vertex.xy.x),
		.d(in_vertex.zw.w),
		.q(skid_vertex.xy.x),
		.*
	);

	gfx_fixed_div y_div
	(
		.z(in_vertex.xy.y),
		.d(in_vertex.zw.w),
		.q(skid_vertex.xy.y),
		.*
	);

	gfx_pipes #(.WIDTH($bits(fixed)), .DEPTH(`FIXED_DIV_STAGES)) z_pipes
	(
		.in(in_vertex.zw.z),
		.out(skid_vertex.zw.z),
		.*
	);

	gfx_pipes #(.WIDTH($bits(fixed)), .DEPTH(`FIXED_DIV_STAGES)) w_pipes
	(
		.in(in_vertex.zw.w),
		.out(skid_vertex.zw.w),
		.*
	);

	gfx_skid_buf #(.WIDTH($bits(out_vertex))) vertex_skid
	(
		.in(skid_vertex),
		.out(out_vertex),
		.*
	);

endmodule