|
//
// Title : (109) Dual JK-FFs with Preset and Clear
// File name : 109.v
// Date : 2000/12/08 Ver1.0
// Company : Future Technology Ltd.
//
//----------------------------------------------------------
// Module
//----------------------------------------------------------
module U109 (
XCLR,
XPR,
CLK,
J,
K,
Q
);
input XCLR;
input XPR;
input CLK;
input J;
input K;
output Q;
//----------------------------------------------------------
// Using register
//----------------------------------------------------------
reg Q;
always@(posedge CLK or negedge XCLR or negedge XPR)begin
if(XCLR==1'b0)begin
Q <= 1'b0;
end else if(XPR==1'b0)begin
Q <= 1'b1;
end else if(J==1'b1 && K==1'b0)begin
Q <= 1'b1;
end else if(J==1'b0 && K==1'b1)begin
Q <= 1'b0;
end else if(J==1'b1 && K==1'b1)begin
Q <= ~Q;
end
end
endmodule
|