Skip to content

Instantly share code, notes, and snippets.

@GaryLee
Created May 13, 2025 06:52
Show Gist options
  • Save GaryLee/51cb2026bbb6d1cd4cd41f6039e53f83 to your computer and use it in GitHub Desktop.
Save GaryLee/51cb2026bbb6d1cd4cd41f6039e53f83 to your computer and use it in GitHub Desktop.
The answer of HDLBits
module top_module (
input [7:0] a,
input [7:0] b,
output [7:0] s,
output overflow
);
logic c;
assign {c, s} = a + b;
assign overflow = ~(a[7] ^ b[7]) & (c ^ s[7]);
endmodule
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment