FF_1bit_SR.nsl


/* ************************************************************ */
declare FF_1bit_sr {

    input       D_in ;          // D input
    input       SR_in ;         // Synchronous RESET input
    input       ENB_in ;        // Data hold enable input

    output      Q_out ;         // Flip-Flop data output

}

/* ************************************************************ */
// Declare module
module FF_1bit_sr {

/* ************************************************************ */
// Internal operation signals
    reg         Dtype_FF ;          // Declare D-Type F/F

/* ************************************************************ */
// Equation

    {
/* **** Data output **** */
        Q_out = Dtype_FF ;

/* **** Flip-Flop equation **** */

/*
    // Statement variation #1
        if ( SR_in )
            Dtype_FF := 1'b0 ;              // Set INITIAL value
        else
            if ( ENB_in )
                Dtype_FF := D_in ;          // Capture NEW data
*/

/*
    // Statement variation #2
        if ( SR_in ) {
            Dtype_FF := 1'b0 ;              // Set INITIAL value
        } else {
            if ( ENB_in ) {
                Dtype_FF := D_in ;          // Capture NEW data
            } else {
                Dtype_FF := Dtype_FF ;      // Hold current value
            }
        }
*/

/*
    // Statement variation #3
        if ( SR_in ) {
            Dtype_FF := 1'b0 ;              // Set INITIAL value
        } else
            any {
                ENB_in  :   Dtype_FF := D_in ;      // Capture NEW data
//              else    :   Dtype_FF := Dtype_FF ;
                        // Hold current value ( Not need this statement )
            }
        }
*/

    // Statement variation #4
        alt {
            SR_in   : Dtype_FF := 1'b0 ;        // Set INITIAL value
            ENB_in  : Dtype_FF := D_in ;        // Capture NEW data
//          else    : Dtype_FF := Dtype_FF ;    // Hold current value
        }
    }
}
/* ************************************************************ */
PAGE TOP