??? 02/21/07 13:46 Read: times |
#133417 - Boolean Algebra with "dont cares" |
Basically, my goal is to convert 8051 machine bytes to a simplified set of expressions for my ROM.
here is my code: start: w1: jnb P3.4,w1 mov A,P1 movx @dptr,A inc dptr w2: jb P3.4,w2 ajmp start mov R7,A mov R7,A mov R7,A mov R7,A Here is a sample of the above program assembled in bits: /D /C /B /A 00110000 /D /C /B A 10110100 /D /C B /A 11111101 /D /C B A 11100101 /D C /B /A 10010000 /D C /B A 11110000 /D C B /A 10100011 /D C B A 00100000 D /C /B /A 10110100 D /C /B A 11111101 D /C B /A 00000001 D /C B A 00000000 D C /B /A 11111111 D C /B A 11111111 D C B /A 11111111 D C B A 11111111 The bits on the right represent the machine version of the script above. The letters on the left represent the address. a "/" before the letter means the inverse. For example, /D /C /B /A = 0000 and D C B A = 1111. The left-most character in any column is the MSB. Basically, I slice the bytes down vertically, so that I generate the individual truth tables for each byte where I perform the Quine McCluskey equation. For example, The addresses below on the left make the LSB true. Remember, this is my truth table for the LSB bit. I need to do one for all 8 bits. /D /C B /A 11111101 /D /C B A 11100101 /D C B /A 10100011 D /C /B A 11111101 D /C B /A 00000001 D C /B /A 11111111 D C /B A 11111111 D C B /A 11111111 D C B A 11111111 Any "Mov R7,A" instruction in my script (above near the top) is represented in the assembled code as "11111111". These byte will appear in all truth tables because all bits are "1". HOWEVER, I can include them anytime I want, and If I need to add more of them, I can. My objective is to create the most simplest boolean equation based on my code, but I don't know how many "don't cares" I need. As it stands now, I have my computer scan every single bit combination for the "don't care" status, but the problem is that this method will take a very long time. This means it will scan at least 256 to the exponent of 4 combinations. That's about 4294967296 combinations provided each bit is checked on the same combination. But then if I had bit 1 check combo 1, and bit 2 check combo 2, then I have to put 4294967296 to the exponent of 8. Seems to me that my only solution is to wait forever (literally), but rather than wait forever, I was wondering if there is a better way (mathematically) to assign the proper value for "Don't Cares" so that the equation is minimized. Ultimately, I want to end up with a hardwired rom using the lowest number of necessary logic gates. and of course, I don't care what happens if the 8051 microprocessor asks for addresses outside of my code. Can someone help me on this please? thanks. |