https://github.com/epiqc/ScaffCC
Raw File
Tip revision: fb0341d7eb6d3ae899a20f913e9f550f738d1bea authored by ah744 on 22 December 2016, 07:02:43 UTC
afree patch
Tip revision: fb0341d
rkqc_test.qasmh
-------QASM Generation Pass:

module assign_value_of_0_to_a_i16_i32_impl ( qbit target , int size  ) {
 	qbit ancilla_zero_zero[1];
	qbit ancilla_zero_garbage[1];
	CNOT ( target , ancilla_zero_garbage[0] );
 	CNOT ( ancilla_zero_garbage[0] , target );
 	CNOT ( ancilla_zero_zero[0] , target );
 }

module assign_value_of_1_to_a_i16_i32_impl ( qbit target , int size  ) {
 	qbit ancilla_one_one[1];
	qbit ancilla_zero_garbage[1];
	CNOT ( target , ancilla_zero_garbage[0] );
 	CNOT ( ancilla_zero_garbage[0] , target );
 	CNOT ( ancilla_one_one[0] , target );
 }

module assign_value_of_b_to_a_i16_i16_i32_impl ( qbit target , qbit control ) {
 	qbit ancilla_zg[1];
	CNOT ( target , ancilla_zg[0] );
 	CNOT ( ancilla_zg[0] , target );
 	CNOT ( control , target );
 }

module a_swap_b_i16_i16_i32_impl ( qbit target0 , qbit target1 ) {
 	CNOT ( target0 , target1 );
 	CNOT ( target1 , target0 );
 	CNOT ( target0 , target1 );
 }

module ToffoliImpl_Q_A_Q ( qbit target , qbit control1 , qbit control2 ) {
 	H ( target );
 	Tdag ( control1 );
 	T ( control2 );
 	T ( target );
 	CNOT ( control2 , control1 );
 	CNOT ( control1 , target );
 	Tdag ( control1 );
 	CNOT ( target , control2 );
 	CNOT ( control1 , control2 );
 	Tdag ( control1 );
 	Tdag ( control2 );
 	T ( target );
 	CNOT ( control1 , target );
 	S ( control1 );
 	CNOT ( target , control2 );
 	CNOT ( control2 , control1 );
 	H ( target );
 }

module a_eq_a_plus_b_i16_i16_i32_impl ( qbit target , qbit control , int size  ) {
 	qbit ancilla_zg[1];
	qbit ancilla_zz[1];
	CNOT ( target , ancilla_zg[0] );
 	CNOT ( control , ancilla_zz[0] );
 	CNOT ( target , control );
 	ToffoliImpl_Q_A_Q ( control , ancilla_zg[0] , target );
 	CNOT ( ancilla_zz[0] , ancilla_zg[0] );
 	CNOT ( ancilla_zz[0] , control );
 	CNOT ( ancilla_zz[0] , control );
 	CNOT ( control , ancilla_zz[0] );
 	CNOT ( ancilla_zz[0] , control );
 	CNOT ( ancilla_zg[0] , target );
 	CNOT ( target , ancilla_zg[0] );
 	CNOT ( ancilla_zg[0] , target );
 }

module reverseBits32 ( qbit* a ) {
 	assign_value_of_0_to_a_i16_i32_impl ( a[0] , 1 );
 	assign_value_of_1_to_a_i16_i32_impl ( a[0] , 1 );
 	assign_value_of_b_to_a_i16_i16_i32_impl ( a[0] , a[1] );
 	a_swap_b_i16_i16_i32_impl ( a[1] , a[0] );
 	a_eq_a_plus_b_i16_i16_i32_impl ( a[1] , a[0] , 1 );
 	assign_value_of_0_to_a_i16_i32_impl ( a[0] , 1 );
 	assign_value_of_1_to_a_i16_i32_impl ( a[1] , 1 );
 	assign_value_of_b_to_a_i16_i16_i32_impl ( a[1] , a[2] );
 	a_swap_b_i16_i16_i32_impl ( a[2] , a[1] );
 	a_eq_a_plus_b_i16_i16_i32_impl ( a[2] , a[1] , 1 );
 }

module main (  ) {
 	qbit h0[32];
	reverseBits32 ( h0 );
 }

--------End of QASM generation
back to top