Last active
May 5, 2020 08:05
-
-
Save dan-rodrigues/2a4c6ab5fbf98357f4069ccf375a7f91 to your computer and use it in GitHub Desktop.
Yosys SB_MAC16 multiply-add test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`default_nettype none | |
module infer_mac_test( | |
input clk, | |
input signed [15:0] pretranslate_x, | |
input signed [15:0] pretranslate_y, | |
input signed [15:0] translate_x, | |
input signed [15:0] a, | |
input signed [15:0] b, | |
output reg [23:0] out | |
); | |
reg signed [15:0] translate_x_r; | |
always @(posedge clk) begin | |
translate_x_r <= translate_x; | |
end | |
always @(posedge clk) begin | |
// this seems to infer multiply-add with the extra parens | |
// out <= pretranslate_x * a + (pretranslate_y * b + translate_x_r); | |
// this doesn't seem to infer multiply-add. only multiply with extra cells spent | |
out <= pretranslate_x * a + pretranslate_y * b + translate_x_r; | |
end | |
endmodule |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment