Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 781113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T20:10:58+00:00 2026-05-14T20:10:58+00:00

If I have a 32 bit two’s complement number and I want to know

  • 0

If I have a 32 bit two’s complement number and I want to know what is the easiest way to know of two numbers are equal… what would be the fastest bitwise operator to know this? I know xor’ing both numbers and check if the results are zero works well… any other one’s?

how about if a number is greater than 0?? I can check the 31’st bit to see if it’s greater or equal to 0..but how about bgtz?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T20:10:59+00:00Added an answer on May 14, 2026 at 8:10 pm

    Contrary to your comments, ‘==’ is part of Verilog, and unless my memory is a lot worse than usual tonight, it should synthesize just fine. Just for example, you could write something like:

    // warning: untested, incomplete and utterly useless in any case.
    // It's been a while since I wrote much Verilog, so my syntax is probably a bit off
    // anyway (might well be more like VHDL than it should be).
    //
    module add_when_equal(clock, a, b, x, y, z);
    input clock;
    input [31:0] a, b, x, y;
    output [31:0] z;
    reg [31:0] a, b, x, y, z;
    
    always begin: main
       @(posedge clock);
       if (a == b)
           z <= x + y;
    end
    endmodule;
    

    Verilog also supports the other comparison operators you’d normally expect (!=, <=, etc.). Synthesizers are fairly “smart”, so something like x != 0 will normally synthesize to an N-input OR gate instead of a comparator.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two bit masks (say A and B , and I want to
I have a bit of code for a dll that is needed by two
After two years of C#, my VB.NET is a bit rusty. I have two
This might be a bit of a silly question but; If I have two
I need to convert a C/C++ double to a 64 bit two's complement, where
I have this bit of javascript written with jQuery 1.2.5. It's contained inside the
I have a bit of code that basically reads an XML document using the
I have a bit of code that passes around a ton of objects and
I have a bit of a hybrid situation on my hands. I'm writing an
I have a bit of html like so: <a href=#somthing id=a1><img src=something /></a> <a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.