Prev Problem
Next Problem

69. Binary Subtractor

Back To All Submissions
Previous Submission
Next Submission

Solving Approach

just implement whats questioned

 

Code

/*Write your code here*/
module sub4_2c(
    input [3:0] a,
    input [3:0] b,
    output [3:0] diff,
    output bout
);
    wire [3:0] temp;
    assign temp = ~b;
    assign bout = (a<b)? 1:0;
    assign diff = a + temp + 4'b0001;
endmodule

 

Was this helpful?
Upvote
Downvote