///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2006 Xilinx, Inc.
// All Right Reserved.
///////////////////////////////////////////////////////////////////////////////
//   ____  ____
//  /   /\/   /
// /___/  \  /    Vendor      : Xilinx
// \   \   \/     Version     : Jade (J.23)
//  \   \         Description : Xilinx HDL Macro Library
//  /   /                       J-K Flip-Flop with Clock Enable and Synchronous Reset and Set
// /___/   /\     Filename    : FJKRSE.v
// \   \  /  \    Timestamp   : Tue Jul 18 2006
//  \___\/\___\
//
// Revision:
//    07/18/06 - Initial version.
// End Revision

`timescale 100 ps / 10 ps

module FJKRSE(Q, C, CE, J, K, R, S);
   
   output             Q;

   input 	      C;	
   input 	      CE;	
   input              J;
   input              K;
   input 	      R;	
   input 	      S;	
   
   parameter INIT = 1'b0;
   reg                Q = INIT;

   always @(posedge C)
     begin
	if (R)
	  Q <= 1'b0;
        else if (S)
          Q <= 1'b1;
	else if (CE)
        begin
          if(!J)
          begin
            if(K)
            Q <= 1'b0;
          end
          else
          begin
            if(!K)
            Q <= 1'b1;
            else 
            Q <= !Q;
          end
        end
     end
   
endmodule
