Skip to content

Commit

Permalink
0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
j- committed Feb 18, 2017
1 parent 07440e7 commit b0570ff
Show file tree
Hide file tree
Showing 11 changed files with 402 additions and 18 deletions.
105 changes: 105 additions & 0 deletions dist/implicant.d.ts
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;
}
175 changes: 175 additions & 0 deletions dist/implicant.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions dist/index.d.ts
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[];
83 changes: 83 additions & 0 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions dist/minterm.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare type Minterm = number;
export default Minterm;
2 changes: 2 additions & 0 deletions dist/minterm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b0570ff

Please sign in to comment.