FF_4bit_AR.nsl


/* ************************************************************ */
declare FF_4bit_ar {

    input       D_in[4] ;
    input       ENB_in ;

    output      Q_out[4] ;

}

/* ************************************************************ */
// Declare module
module FF_4bit_ar {

/* ************************************************************ */
// Internal operation signals
    reg         Dtype_FF[4] = 4'b1010 ; // Declare D-Type F/F with init value

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

    {
/* **** Data output **** */
        Q_out = Dtype_FF ;          // Q_out = Dtype_FF[3:0] ; is acceptable
                                    // Q_out[3:0] = .... is not acceptable

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

    // Statement variation #1
        if ( ENB_in )
            Dtype_FF := D_in ;          // Capture NEW data

/*
    //  **** ERROR!!!!!  Flip-Flop equation ****
        if ( ENB_in ) {
            Dtype_FF[3] := D_in[3] ;    // Capture NEW data. Bit3
            Dtype_FF[2] := D_in[2] ;    // Capture NEW data. Bit2
            Dtype_FF[1] := D_in[1] ;    // Capture NEW data. Bit1
            Dtype_FF[0] := D_in[0] ;    // Capture NEW data. Bit0
        }
*/
    }
}
/* ************************************************************ */
PAGE TOP