--------------- QMC v7 By Ziga Mirai 8 July 2005 --------------- This is (an attempt of) a basic implementation of Quine-McCluskey Boolean expression minimization method. [I started with this project to help me understand K-map minimization method better and to replace it by a more systematic approach that i could apply to expressions with more than five bit min-terms (i.e. five variables). There are more complex methods available but for the purpose of learning this one suffices.] Files: * QMC.89z ASM QMC function QMCr.89z same, but it writes result into 'result' variable * NML2Str.89z ASM NM_List_to_string function NML2StrR.89z same, but it writes result into 'result' variable * NMM2S.89F BASIC NM_Matrix_to_string function QMC\ QMC.tpr TIGCC v0.93 project file (library v2.41) QMC.c C source code (QMC method) QMC.h C source code (functions closely related to QMC) SizeableShortArray1.h C source code (what it says implemented) PomozneF.h C source code (estack manipulation functions) NML2Str\ NML2Str.tpr TIGCC v0.93 project file (library v2.41) NML2Str.c C source code (NM_List_to_string function) PomozneF.h C source code (estack manipulation functions) QMC_ENG\*.* C source code (comments translated to English) NML2Str_ENG\*.* -||- Usage: QMC(Minterms_list, Dontcares_list, [nRand]) ------------------------------------------- The function QMC takes two arguments: minterms list and dontcareterms list. 16-bit minterms can be input. Plus an optional argument nRand (see notes below). It returns a matrix in which the first row contains a list of prime implicant numbers and the second row their corresponding bit masks. There can be more than one minimal solution. In that case matrix contains nSolutions*2 rows. For example: qmc({0,1,3},{}) gives [1,3; 1,2] (one solution) qmc({0,1,2,5,6,7},{}) gives [2,5,7; 2,4,1; 1,6,7; 1,4,2] (two solutions) NML2Str(2byN_matrix, nBits) --------------------------- The function NML2Str transforms a 2byN matrix of prime implicants (numbers and masks) to a logical expression string. It takes two arguments: matrix and nBits, where nBits tell how many bits will be taken into consideration (e.g. 4 bits for 4 variable expression). For example: NML2Str([1,3; 1,2],3) gives "C'B' + C'A" NMM2S(matrix, nBits) -------------------- This is a BASIC function that uses NML2Str to convert matrix with more than two rows into matrix of strings. For example: NMM2S([2,5,7; 2,4,1; 1,6,7; 1,4,2],3) gives ["C'A' + B'A + CB"; "C'B' + BA' + CA"] Notes: During execution QMC function displays a string in bottom left corner of a screen. During first part (finding prime implicants), it displays dnnn:mmm which means that a table of mmm implicants is currently being scanned and that the nnn-th is about to be compared with all others. During second part (finding minimum cover), it displays knnn:mmm Ppp nll which means that nnn-th combination of all possible mmm is being examined, that the current best solution contains pp product terms and that ll solutions of this size have been found (the number of different solutions (that is actualy returned) is smaller). Optional argument nRand: during second part the algorithm iterates through all possible covers of a given minterms set to find the minimum cover. If there are too many possible covers it may be more reasonable to search for a minimum cover only among lesser number of covers picked out randomly. nRand>0 will cause finding the minimum cover among only nRand randomly chosen covers. Pressing the 'ESC' key returns the current best solution. Pressing the 'ON' key stops execution. Bugs reporting: Please report bugs, and minterms and dontcares lists that cause QMC to give a wrong solution, to below address. cmzm@email.si