Logic for “AgtB” (unsigned)
Consider A > B, both N bit numbers, A[N-1:0], B[N-1:0] If (A(N-1) = ‘1’ and (B(N-1) = ‘0’) then AgtB = ‘1’; elsif ((A(N-1) = B(N-1)) and (A(N-2) = ‘1’ and (B(N-2)=‘0’) ) then AgtB = ‘1’;
A=01xx… B=00xxxxA=11xx… B=10xxxx
Look at “bit(i)”. The enable signal from previous bit is A= B up until now . If this is ‘1’, then we need to do a comparison.However, if “AgtB” is already true, then we don’t need to do comparison and can skip this comparison!