-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
402 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
import Minterm from './minterm'; | ||
/** | ||
* An implicant contains a set of one or more minterms. All minterms must be | ||
* unique. The total number of minterms must be a power of two, e.g. 1, 2, 4, 8 | ||
* etc. | ||
* | ||
* @export | ||
* @class Implicant | ||
*/ | ||
export default class Implicant { | ||
protected readonly minterms: Minterm[]; | ||
/** | ||
* Determine if two implicants can be combined. Will be `true` if there is | ||
* only one differing bit between them -- either a set bit or an uncommon | ||
* bit. | ||
* | ||
* @static | ||
* @param {Implicant} left | ||
* @param {Implicant} right | ||
* @returns {boolean} | ||
* | ||
* @memberOf Implicant | ||
*/ | ||
static canCombine(left: Implicant, right: Implicant): boolean; | ||
/** | ||
* Returns a new implicant with all the minterms of each given implicant | ||
* combined. | ||
* | ||
* @static | ||
* @param {Implicant} left | ||
* @param {Implicant} right | ||
* @returns {Implicant} | ||
* | ||
* @memberOf Implicant | ||
*/ | ||
static getCombinedImplicant(left: Implicant, right: Implicant): Implicant; | ||
/** | ||
* Check if two implicants have the same set of minterms. | ||
* | ||
* @static | ||
* @param {Implicant} left | ||
* @param {Implicant} right | ||
* @returns {boolean} | ||
* | ||
* @memberOf Implicant | ||
*/ | ||
static isEqual(left: Implicant, right: Implicant): boolean; | ||
/** | ||
* Creates an instance of Implicant. Must be given a set of minterms. | ||
* | ||
* @param {...Minterm[]} minterms | ||
* | ||
* @memberOf Implicant | ||
*/ | ||
constructor(...minterms: Minterm[]); | ||
/** | ||
* Get the array of minterms that make up this implicant. | ||
* | ||
* @returns {Minterm[]} | ||
* | ||
* @memberOf Implicant | ||
*/ | ||
getMinterms(): Minterm[]; | ||
/** | ||
* Returns a number representing all the common set bits between all | ||
* minterms in this implicant. | ||
* | ||
* @example | ||
* | ||
* new Implicant( | ||
* 0b1110, | ||
* 0b0111 | ||
* ).getCommonBits() === 0b0110 | ||
* | ||
* @returns {number} | ||
* | ||
* @memberOf Implicant | ||
*/ | ||
getCommonBits(): number; | ||
/** | ||
* Returns a number representing all the uncommon bits between all minterms | ||
* in this implicant. | ||
* | ||
* @example | ||
* | ||
* new Implicant( | ||
* 0b1110, | ||
* 0b0111 | ||
* ).getUncommonBits() === 0b1001 | ||
* | ||
* @returns {number} | ||
* | ||
* @memberOf Implicant | ||
* */ | ||
getUncommonBits(): number; | ||
/** | ||
* Check if the given minterm is one of the minterms in this implicant. | ||
* | ||
* @param {Minterm} minterm | ||
* @returns {boolean} | ||
* | ||
* @memberOf Implicant | ||
*/ | ||
hasMinterm(minterm: Minterm): boolean; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import Implicant from './implicant'; | ||
/** | ||
* Reduce all minterms until the prime implicants have been identified. | ||
* | ||
* @param {Minterm[]} minterms | ||
* @param {Minterm[]} dontcares | ||
* @returns {Implicant[]} | ||
*/ | ||
export declare const getPrimeImplicants: (minterms: number[], dontcares: number[]) => Implicant[]; | ||
/** | ||
* Determine which prime implicants have a minterm that no other prime implicant | ||
* has and is thus essential. | ||
* | ||
* @param {Implicant[]} implicants | ||
* @returns {Implicant[]} | ||
*/ | ||
export declare const getEssentialPrimeImplicants: (implicants: Implicant[], dontcares?: number[]) => Implicant[]; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
declare type Minterm = number; | ||
export default Minterm; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.