Prev Problem
Next Problem

45. Signed vs Unsigned Compare

Back To All Submissions
Previous Submission
Next Submission

Solving Approach

How do you plan to solve it?

 

 

Code

/*Write your code here*/
module signed_thresh( input [7:0] sample,
                      input [7:0] thresh,
                       output reg gt_unsigned,
                       output reg gt_signed);
    
    always@(*) begin
     gt_signed = 0;
    gt_unsigned = 0;
    if (sample >  thresh) 
        gt_unsigned =1;
       if  ($signed(sample) > $signed ( thresh)) 
        gt_signed =1;
    
    end;
    


endmodule

 

Was this helpful?
Upvote
Downvote