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

module vec_dot
(
	input  logic clk,

	input  logic stall_mul,
	             stall_fold,
	             feedback,
	             feedback_last,

	input  vec4  a,
		         b,

	output fp    q
);

	vec4 products_fold, products_mul;

	horizontal_fold fold
	(
		.vec(products_fold),
		.stall(stall_fold),
		.*
	);

	genvar i;
	generate
		for (i = 0; i < `FLOATS_PER_VEC; ++i) begin: entries
			fp_mul entry_i
			(
				.a(a[i]),
				.b(b[i]),
				.q(products_mul[i]),
				.stall(stall_mul),
				.*
			);

			skid_buf #(.WIDTH($bits(vec4))) skid_i
			(
				.in(products_mul[i]),
				.out(products_fold[i]),
				.stall(stall_mul),
				.*
			);
		end
	endgenerate

endmodule