Prev Problem
Next Problem

69. Binary Subtractor

Back To All Submissions
Previous Submission
Next Submission

Code

module sub4_2c (
    input [3:0] a,
    input [3:0] b,
    output [3:0] diff, 
    output bout
);
    assign diff = a + (~b + 4'd1);
    assign bout = (a < b) ? 1 : 0;

endmodule

 

Was this helpful?
Upvote
Downvote