Thread: nebie help

  1. #1
    Registered User
    Join Date
    Feb 2006
    Posts
    3

    newbie help

    I'm to write an algorithm called "Quine-McKlusky" algorithm that minimizes logic function for digital hardware synthesis.

    I need to minimize codeword, that's in binary....

    for example, if I have

    1001 (in binary string)
    1011 (in binary sting)
    ------------
    10_1 (? )


    only the difference of 1 bit is detected and result should be 10_1. '_' indicating where the bit difference is located.

    which route should I go to achieve this?

    thinking I sould use array, since I my have hundreds of those to compare each other and store the result somewhere.

    thanks in advance.
    Last edited by yonjun; 02-26-2006 at 10:30 PM.

  2. #2
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663
    You should use a vector<string> to store your results. A vector is like an array, but it starts at size 0, and it grows to whatever size you need as you add elements.

  3. #3
    Registered User
    Join Date
    Feb 2006
    Posts
    3
    another,
    when I compare two binary strings given in the example, should I compare bit by bit as a character?

  4. #4
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,079
    You should compare the data as it is. Use bitwise OR and cast the return as an int. It will basically return the total of unmatched bits in decimal. There is no reason to turn a single byte into 8 bytes by converting it into a character string. Escpecially if you're trying to minimize codeword.
    Sent from my iPadŽ

  5. #5
    Registered User
    Join Date
    Feb 2006
    Posts
    3
    Quote Originally Posted by SlyMaelstrom
    You should compare the data as it is. Use bitwise OR and cast the return as an int. It will basically return the total of unmatched bits in decimal. There is no reason to turn a single byte into 8 bytes by converting it into a character string. Escpecially if you're trying to minimize codeword.

    OK.

    Is there a way to represent binary numbers in real binary? not like what I thought I should by representing it in strings of zeros and ones. Then just logical OR or AND will make my life easier.

    basically, I first have inputs in decimal as the min-terms of a function. Then I have to convert those minterms to binary codewords to compare each one of them to the others to detect the ones that are differ only by 1 bit.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. nebie simply needs help creating 2 dimensional char array
    By MegaManZZ in forum C++ Programming
    Replies: 13
    Last Post: 01-14-2008, 10:13 AM
  2. pointer functions - nebie question
    By bbresc512 in forum C Programming
    Replies: 3
    Last Post: 03-24-2006, 01:36 PM
  3. Nebie in need
    By Unregistered in forum C++ Programming
    Replies: 9
    Last Post: 08-01-2002, 11:36 PM
  4. Help! nebie help
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 11-11-2001, 11:27 AM