Skip to content

About

automatically solve for the simplest Boolean logic expression of the J and K inputs of each JK flip-flop with respect to the current state Q and input X using the Karnaugh map simplification algorithm (Quine-McCluskey method).

Resources

Stars

36 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Sequence-Detector-Mealy-JKFF-Generator

The core function of this code is to automatically solve for the simplest Boolean logic expression of the J and K inputs of each JK flip-flop with respect to the current state Q and input X using the Karnaugh map simplification algorithm (Quine-McCluskey method). 1. Variable Correspondence: In the expression generated by the code: Q0, Q1, Q2: represent the current output of the state flip-flops (because the Moore state machine for detecting the "0100" pattern requires 5 states, and no. of JKFF = 3, so 3 flip-flops are automatically assigned). Q0 corresponds to the most significant bit (MSB) of the state code; Q1 corresponds to the middle bit; Q2 corresponds to the least significant bit (LSB). X: represents the sequence of bits of the current input (i.e., 0 or 1 in the serial input). 2. Output Interpretation: The JK EQUATIONS section printed in the terminal is the final answer you need, in the following form: J0 = ... / K0 = ...: The logic equation driving the 0th flip-flop (Q_0) J1 = ... / K1 = ...: The logic equation driving the 1st flip-flop (Q_1) J2 = ... / K2 = ...: The logic equation driving the 2nd flip-flop (Q_2) Operator Corresponding Gates in the Circuit: ~: NOT gate &: AND gate |: OR gate 3. Specific Implementation Flow Inside the Code: Automatically constructs the state transition and driving table: calculates the current state and the next state, and automatically extracts the minterms of J=1 and the don't cares of J=X based on the excitation table of the JK flip-flops. Including unassigned states: Unused states in the 3-bit binary representation (e.g., 101, 110, 111) are automatically treated as irrelevant terms (J_dc and K_dc) in simplification to obtain the simplest expression. Karnaugh map logic simplification: SymPy's SOPform(all_vars, minterms, dont_cares) is called to obtain the simplest sum-of-products form. The output Z = ~Q0 & Q1 & ~Q2 & ... at the end is the output equation for successful state detection (corresponding to the state when the target sequence is identified). These J, K, Z equations can be directly used to draw circuit diagrams or for hardware description language (such as Verilog/VHDL) modeling.

About

automatically solve for the simplest Boolean logic expression of the J and K inputs of each JK flip-flop with respect to the current state Q and input X using the Karnaugh map simplification algorithm (Quine-McCluskey method).

Resources

Stars

36 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages