diff options
| author | Alejandro Soto <alejandro@34project.org> | 2023-10-21 03:21:18 -0600 |
|---|---|---|
| committer | Alejandro Soto <alejandro@34project.org> | 2023-10-21 03:21:18 -0600 |
| commit | d84718bf7955a6bba03aa44938f0f140c1a6390d (patch) | |
| tree | 58aca8052f775ae5697688c759ef24977db4f6a2 /rtl/gfx/vec_dot.sv | |
| parent | 1b5eeb9a949272232ff543f684c7be62d31d0d40 (diff) | |
rtl/gfx: implement non-synthesizable matrix multiplier
Diffstat (limited to 'rtl/gfx/vec_dot.sv')
| -rw-r--r-- | rtl/gfx/vec_dot.sv | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/rtl/gfx/vec_dot.sv b/rtl/gfx/vec_dot.sv new file mode 100644 index 0000000..d984504 --- /dev/null +++ b/rtl/gfx/vec_dot.sv @@ -0,0 +1,40 @@ +`include "gfx/gfx_defs.sv" + +module vec_dot +( + input logic clk, + rst_n, + + input logic start, + input vec4 a, + b, + + output logic done, + output fp q +); + + vec4 products; + logic dones[`FLOATS_PER_VEC]; + + horizontal_fold #(.N(`FLOATS_PER_VEC)) fold + ( + .start(dones[0]), + .vec(products), + .* + ); + + genvar i; + generate + for (i = 0; i < `FLOATS_PER_VEC; ++i) begin: entries + fp_mul entry_i + ( + .a(a[i]), + .b(b[i]), + .done(dones[i]), + .q(products[i]), + .* + ); + end + endgenerate + +endmodule |
