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

module gfx_lerp
(
	input  logic clk,

	input  fixed b1,
	             b2,
				 q0,
	             q1_q0,
	             q2_q0,
	input  logic stall,

	output fixed q
);

	/* Interpolación lineal, trivializada.
	 *
	 * Esta es la clave: https://fgiesen.wordpress.com/2013/02/06/the-barycentric-conspirac/
	 */

	gfx_fixed_fma_dot fma
	(
		.c(q0),
		.a0(b1),
		.b0(q1_q0),
		.a1(b2),
		.b1(q2_q0),
		.*
	);

endmodule