// File: /workspace/github_c_makefile_star2_O0/aquaxis[P]synverll/src/parser_ir_top.c
// Function: output_top_module
int output_top_module(FILE *fp, char *topname)
{
	fprintf(fp,"/*\n");
	fprintf(fp," * Copyright (C)2005-2015 AQUAXIS TECHNOLOGY.\n");
	fprintf(fp," *  Don't remove this header.\n");
	fprintf(fp," * When you use this source, there is a need to inherit this header.\n");
	fprintf(fp," *\n");
	fprintf(fp," * This software is released under the MIT License.\n");
	fprintf(fp," * http://opensource.org/licenses/mit-license.php\n");
	fprintf(fp," *\n");
	fprintf(fp," * For further information please contact.\n");
	fprintf(fp," *  URI:    http://www.aquaxis.com/\n");
	fprintf(fp," *  E-Mail: info(at)aquaxis.com\n");
	fprintf(fp," */\n");

	fprintf(fp,"module %s(\n", topname);

	fprintf(fp,"\tinput system_clock,\n");
	fprintf(fp,"\tinput system_reset,\n");
	fprintf(fp,"\tinput __func_start,\n");
	fprintf(fp,"\toutput __func_done,\n");
//	fprintf(fp,"\toutput __func_idle,\n");
	fprintf(fp,"\toutput __func_ready,\n\n");

if(use_gm_if){
	fprintf(fp,"\tinput [31:0] __gm_base,\n");
	fprintf(fp,"\toutput __gm_req,\n");
	fprintf(fp,"\toutput __gm_rnw,\n");
	fprintf(fp,"\tinput __gm_done,\n");
	fprintf(fp,"\toutput [31:0] __gm_adrs,\n");
	fprintf(fp,"\toutput [1:0] __gm_leng,\n");
	fprintf(fp,"\tinput [31:0] __gm_di,\n");
	fprintf(fp,"\toutput [31:0] __gm_do,\n\n");
}

	if(use_llvm_memcpy){
		fprintf(fp,"\toutput __llvm_memcpy_req,\n");
		fprintf(fp,"\tinput __llvm_memcpy_ready,\n");
		fprintf(fp,"\tinput __llvm_memcpy_done,\n");
		fprintf(fp,"\toutput [7:0] __llvm_memcpy_args_0,\n");
		fprintf(fp,"\toutput [7:0] __llvm_memcpy_args_1,\n");
		fprintf(fp,"\toutput [31:0] __llvm_memcpy_args_2,\n");
		fprintf(fp,"\toutput [31:0] __llvm_memcpy_args_3,\n");
		fprintf(fp,"\toutput [31:0] __llvm_memcpy_args_4,\n\n");
	}


	// ToDo:
	// 外部信号を入れる
	fprintf(fp,"\t// global signal\n");
	create_top_global(fp);
//	fprintf(fp,"\t// nowire\n");
	create_top_nowire(fp);

//	fprintf(fp,"\n\toutput dummy\n");

	fprintf(fp,");\n");

	// Wire宣言を入れる
	fprintf(fp,"// wire\n");
	create_top_wire(fp);
	fprintf(fp,"// connection\n");
	fprintf(fp,"%s", top_module_assign);

	fprintf(fp,"// system signal\n");
	create_top_nofunc(fp);

	fprintf(fp,"// modules\n");
	fprintf(fp,"%s", top_module_decl);

	fprintf(fp,"endmodule\n");

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x3b61(%rip), %rsi      # 0x13afc
movb $0x0, %al
callq 0x10e0
movq -0x8(%rbp), %rdi
leaq 0x3b53(%rip), %rsi      # 0x13b00
movb $0x0, %al
callq 0x10e0
movq -0x8(%rbp), %rdi
leaq 0x3b70(%rip), %rsi      # 0x13b2f
movb $0x0, %al
callq 0x10e0
movq -0x8(%rbp), %rdi
leaq 0x3b7d(%rip), %rsi      # 0x13b4e
movb $0x0, %al
callq 0x10e0
movq -0x8(%rbp), %rdi
leaq 0x3bb1(%rip), %rsi      # 0x13b94
movb $0x0, %al
callq 0x10e0
movq -0x8(%rbp), %rdi
leaq 0x3ba3(%rip), %rsi      # 0x13b98
movb $0x0, %al
callq 0x10e0
movq -0x8(%rbp), %rdi
leaq 0x3bc6(%rip), %rsi      # 0x13bcd
movb $0x0, %al
callq 0x10e0
movq -0x8(%rbp), %rdi
leaq 0x3b7b(%rip), %rsi      # 0x13b94
movb $0x0, %al
callq 0x10e0
movq -0x8(%rbp), %rdi
leaq 0x3bd5(%rip), %rsi      # 0x13c00
movb $0x0, %al
callq 0x10e0
movq -0x8(%rbp), %rdi
leaq 0x3bef(%rip), %rsi      # 0x13c2c
movb $0x0, %al
callq 0x10e0
movq -0x8(%rbp), %rdi
leaq 0x3c02(%rip), %rsi      # 0x13c51
movb $0x0, %al
callq 0x10e0
movq -0x8(%rbp), %rdi
leaq 0x3c11(%rip), %rsi      # 0x13c72
movb $0x0, %al
callq 0x10e0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rdx
leaq 0x3c00(%rip), %rsi      # 0x13c77
movb $0x0, %al
callq 0x10e0
movq -0x8(%rbp), %rdi
leaq 0x4d58(%rip), %rsi      # 0x14de1
movb $0x0, %al
callq 0x10e0
movq -0x8(%rbp), %rdi
leaq 0x4d5c(%rip), %rsi      # 0x14df7
movb $0x0, %al
callq 0x10e0
movq -0x8(%rbp), %rdi
leaq 0x3c02(%rip), %rsi      # 0x13caf
movb $0x0, %al
callq 0x10e0
movq -0x8(%rbp), %rdi
leaq 0x4d4e(%rip), %rsi      # 0x14e0d
movb $0x0, %al
callq 0x10e0
movq -0x8(%rbp), %rdi
leaq 0x4d52(%rip), %rsi      # 0x14e23
movb $0x0, %al
callq 0x10e0
cmpl $0x0, 0x84bd(%rip)      # 0x1859c
je 0x10175
movq -0x8(%rbp), %rdi
leaq 0x3c1e(%rip), %rsi      # 0x13d0e
movb $0x0, %al
callq 0x10e0
movq -0x8(%rbp), %rdi
leaq 0x4d39(%rip), %rsi      # 0x14e3b
movb $0x0, %al
callq 0x10e0
movq -0x8(%rbp), %rdi
leaq 0x4d3a(%rip), %rsi      # 0x14e4e
movb $0x0, %al
callq 0x10e0
movq -0x8(%rbp), %rdi
leaq 0x3c30(%rip), %rsi      # 0x13d56
movb $0x0, %al
callq 0x10e0
movq -0x8(%rbp), %rdi
leaq 0x4d29(%rip), %rsi      # 0x14e61
movb $0x0, %al
callq 0x10e0
movq -0x8(%rbp), %rdi
leaq 0x4d32(%rip), %rsi      # 0x14e7c
movb $0x0, %al
callq 0x10e0
movq -0x8(%rbp), %rdi
leaq 0x3c4a(%rip), %rsi      # 0x13da6
movb $0x0, %al
callq 0x10e0
movq -0x8(%rbp), %rdi
leaq 0x4d28(%rip), %rsi      # 0x14e96
movb $0x0, %al
callq 0x10e0
cmpl $0x0, 0x841c(%rip)      # 0x18598
je 0x10212
movq -0x8(%rbp), %rdi
leaq 0x4d23(%rip), %rsi      # 0x14eb0
movb $0x0, %al
callq 0x10e0
movq -0x8(%rbp), %rdi
leaq 0x4d2d(%rip), %rsi      # 0x14ecc
movb $0x0, %al
callq 0x10e0
movq -0x8(%rbp), %rdi
leaq 0x4d38(%rip), %rsi      # 0x14ee9
movb $0x0, %al
callq 0x10e0
movq -0x8(%rbp), %rdi
leaq 0x4d42(%rip), %rsi      # 0x14f05
movb $0x0, %al
callq 0x10e0
movq -0x8(%rbp), %rdi
leaq 0x4d55(%rip), %rsi      # 0x14f2a
movb $0x0, %al
callq 0x10e0
movq -0x8(%rbp), %rdi
leaq 0x4d68(%rip), %rsi      # 0x14f4f
movb $0x0, %al
callq 0x10e0
movq -0x8(%rbp), %rdi
leaq 0x4d7c(%rip), %rsi      # 0x14f75
movb $0x0, %al
callq 0x10e0
movq -0x8(%rbp), %rdi
leaq 0x4d90(%rip), %rsi      # 0x14f9b
movb $0x0, %al
callq 0x10e0
movq -0x8(%rbp), %rdi
leaq 0x4da5(%rip), %rsi      # 0x14fc2
movb $0x0, %al
callq 0x10e0
movq -0x8(%rbp), %rdi
callq 0xecd0
movq -0x8(%rbp), %rdi
callq 0xeae0
movq -0x8(%rbp), %rdi
leaq 0x428c(%rip), %rsi      # 0x144cd
movb $0x0, %al
callq 0x10e0
movq -0x8(%rbp), %rdi
leaq 0x4d82(%rip), %rsi      # 0x14fd5
movb $0x0, %al
callq 0x10e0
movq -0x8(%rbp), %rdi
callq 0xea90
movq -0x8(%rbp), %rdi
leaq 0x4d70(%rip), %rsi      # 0x14fde
movb $0x0, %al
callq 0x10e0
movq -0x8(%rbp), %rdi
movq 0x8328(%rip), %rdx      # 0x185a8
leaq 0x3741(%rip), %rsi      # 0x139c8
movb $0x0, %al
callq 0x10e0
movq -0x8(%rbp), %rdi
leaq 0x4d54(%rip), %rsi      # 0x14fed
movb $0x0, %al
callq 0x10e0
movq -0x8(%rbp), %rdi
callq 0xec10
movq -0x8(%rbp), %rdi
leaq 0x4d4b(%rip), %rsi      # 0x14fff
movb $0x0, %al
callq 0x10e0
movq -0x8(%rbp), %rdi
movq 0x82da(%rip), %rdx      # 0x185a0
leaq 0x36fb(%rip), %rsi      # 0x139c8
movb $0x0, %al
callq 0x10e0
movq -0x8(%rbp), %rdi
leaq 0x3e27(%rip), %rsi      # 0x14106
movb $0x0, %al
callq 0x10e0
xorl %eax, %eax
addq $0x10, %rsp
popq %rbp
retq
nop