module ACLKGen(PHI1, PHI2, ACLK1, nACLK2, RES);

	input PHI1;
	input PHI2;
	output ACLK1;
	output nACLK2;
	input RES;

	wire n_latch1_out;
	wire n_latch2_out;
	wire latch1_in;

	dlatch phi1_latch (
		.d(latch1_in),
		.en(PHI1),
		.nq(n_latch1_out) );

	dlatch phi2_latch (
		.d(n_latch1_out),
		.en(PHI2),
		.nq(n_latch2_out) );

	nor (latch1_in, RES, n_latch2_out);

	wire n1;
	nor (n1, ~PHI1, latch1_in);
	nor (ACLK1, ~PHI1, n_latch2_out);
	not (nACLK2, n1);

endmodule // ACLKGen