// File: /workspace/github_cpp_makefile_star2_O1/CMU-SAFARI[P]MQSim/src/ssd/ONFI_Channel_NVDDR2.cpp
// Function: SSD_Components::ONFI_Channel_NVDDR2::ONFI_Channel_NVDDR2(unsigned int, unsigned int, NVM::FlashMemory::Flash_Chip**, unsigned int, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long)
ONFI_Channel_NVDDR2::ONFI_Channel_NVDDR2(flash_channel_ID_type channelID, unsigned int chipCount, NVM::FlashMemory::Flash_Chip** flashChips, unsigned int ChannelWidth,
		sim_time_type t_RC, sim_time_type t_DSC,
		sim_time_type t_DBSY, sim_time_type t_CS, sim_time_type t_RR,
		sim_time_type t_WB, sim_time_type t_WC, sim_time_type t_ADL, sim_time_type t_CALS,
		sim_time_type t_DQSRE, sim_time_type t_RPRE, sim_time_type t_RHW, sim_time_type t_CCS,
		sim_time_type t_WPST, sim_time_type t_WPSTH)
		: ONFI_Channel_Base(channelID, chipCount, flashChips, ONFI_Protocol::NVDDR2),
		ChannelWidth(ChannelWidth),
		t_RC(t_RC), t_DSC(t_DSC), t_DBSY(t_DBSY), t_CS(t_CS), t_RR(t_RR), t_WB(t_WB), t_WC(t_WC), t_ADL(t_ADL),
		t_CALS(t_CALS), t_DQSRE(t_DQSRE), t_RPRE(t_RPRE), t_RHW(t_RHW), t_CCS(t_CCS), t_WPST(t_WPST), t_WPSTH(t_WPSTH)
	{
		ReadCommandTime[1] = t_CS + t_WC * 6 + t_WB + t_RR;
		ReadCommandTime[2] = t_CS + 6 * t_WC + t_DBSY + 6 * t_WC + t_WB + t_RR;
		ReadCommandTime[3] = t_CS + 6 * t_WC + t_DBSY + 6 * t_WC + t_DBSY + 6 * t_WC + t_WB + t_RR;
		ReadCommandTime[4] = t_CS + 6 * t_WC + t_DBSY + 6 * t_WC + t_DBSY + 6 * t_WC + t_DBSY + 6 * t_WC + t_WB + t_RR;
		ReadDataOutSetupTime = t_RPRE + t_DQSRE;
		ReadDataOutSetupTime_TwoPlane = t_RPRE + t_DQSRE + t_RHW + 6 * t_WC + t_CCS + t_RPRE + t_DQSRE;
		ReadDataOutSetupTime_ThreePlane = t_RPRE + t_DQSRE + t_RHW + 6 * t_WC + t_CCS + t_RPRE + t_DQSRE + t_RHW + 6 * t_WC + t_CCS + t_RPRE + t_DQSRE;
		ReadDataOutSetupTime_FourPlane = t_RPRE + t_DQSRE + t_RHW + 6 * t_WC + t_CCS + t_RPRE + t_DQSRE + t_RHW + 6 * t_WC + t_CCS + t_RPRE + t_DQSRE + t_RHW + 6 * t_WC + t_CCS + t_RPRE + t_DQSRE;
		TwoUnitDataInTime = t_RC;

		ProgramCommandTime[1] = t_CS + t_WC * 6 + t_ADL + t_WPST + t_WPSTH + t_WB;
		ProgramCommandTime[2] = t_CS + (t_WC * 5 + t_ADL + t_WPST + t_CALS + t_WB) + t_DBSY + (t_WC * 6 + t_ADL + t_WPST + t_WPSTH + t_WB);
		ProgramCommandTime[3] = t_CS + (t_WC * 5 + t_ADL + t_WPST + t_CALS + t_WB) + t_DBSY + (t_WC * 5 + t_ADL + t_WPST + t_CALS + t_WB) + t_DBSY + (t_WC * 6 + t_ADL + t_WPST + t_WPSTH + t_WB);
		ProgramCommandTime[4] = t_CS + (t_WC * 5 + t_ADL + t_WPST + t_CALS + t_WB) + t_DBSY + (t_WC * 5 + t_ADL + t_WPST + t_CALS + t_WB) + t_DBSY + (t_WC * 5 + t_ADL + t_WPST + t_CALS + t_WB) + t_DBSY + (t_WC * 6 + t_ADL + t_WPST + t_WPSTH + t_WB);
		TwoUnitDataOutTime = t_DSC;
		ProgramSuspendCommandTime = t_CS + t_WC * 3;

		EraseCommandTime[1] = t_CS + t_WC * 4 + t_WB;
		EraseCommandTime[2] = t_CS + t_WC * 4 + t_WB + (t_DBSY + t_WC * 4 + t_WB);
		EraseCommandTime[3] = t_CS + t_WC * 4 + t_WB + (t_DBSY + t_WC * 4 + t_WB) + (t_DBSY + t_WC * 4 + t_WB);
		EraseCommandTime[4] = t_CS + t_WC * 4 + t_WB + (t_DBSY + t_WC * 4 + t_WB) + (t_DBSY + t_WC * 4 + t_WB) + (t_DBSY + t_WC * 4 + t_WB);
		EraseSuspendCommandTime = t_CS + t_WC * 3;
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, 0x10(%rsp)
movl %r8d, 0xc(%rsp)
movq %rdi, %rbx
movq 0xa0(%rsp), %r14
movq 0x98(%rsp), %rbp
movq 0x88(%rsp), %r13
movq 0x70(%rsp), %r12
movq 0x68(%rsp), %r15
xorl %r8d, %r8d
callq 0x48d3c
movl 0xc(%rsp), %eax
movl %eax, 0xd8(%rbx)
movq 0x10(%rsp), %r11
movq %r11, 0xe0(%rbx)
movq 0x50(%rsp), %rax
movq %rax, 0xe8(%rbx)
movq 0x58(%rsp), %r8
movq %r8, 0xf0(%rbx)
movq 0x60(%rsp), %r10
movq %r10, 0xf8(%rbx)
movq %r15, 0x100(%rbx)
movq %r12, 0x108(%rbx)
movq 0x78(%rsp), %r9
movq %r9, 0x110(%rbx)
movq 0x80(%rsp), %rax
movq %rax, 0x118(%rbx)
movq %r13, 0x120(%rbx)
movq 0x90(%rsp), %rax
movq %rax, 0x128(%rbx)
movq %rbp, 0x130(%rbx)
movq %r14, 0x138(%rbx)
movq 0xa8(%rsp), %rax
movq %rax, 0x140(%rbx)
movq 0xb0(%rsp), %rax
movq %rax, 0x148(%rbx)
movq 0xb8(%rsp), %rax
movq %rax, 0x150(%rbx)
leaq (%r9,%r9), %rax
leaq (%rax,%rax,2), %rax
addq %r12, %r15
leaq (%rax,%r10), %rcx
leaq (%r15,%rcx), %rdx
movq %rdx, 0x30(%rbx)
leaq (%rax,%r8), %rdx
leaq (%rdx,%rcx), %rsi
leaq (%r15,%rsi), %rdi
movq %rdi, 0x38(%rbx)
addq %rsi, %rdx
leaq (%r15,%rdx), %rsi
movq %rsi, 0x40(%rbx)
addq %r8, %r15
movq %r8, %rdi
addq %rax, %r15
addq %rdx, %r15
movq %r15, 0x48(%rbx)
addq 0x90(%rsp), %rbp
addq %rbp, %r14
addq %rax, %r14
addq 0xa8(%rsp), %r14
movq %rbp, 0x50(%rbx)
addq %r14, %rbp
movq %rbp, 0x58(%rbx)
addq %r14, %rbp
movq %rbp, 0x60(%rbx)
addq %r14, %rbp
movq %rbp, 0x68(%rbx)
movq %r11, 0x70(%rbx)
movq 0x80(%rsp), %rsi
addq %r12, %rsi
movq 0xb0(%rsp), %r14
leaq (%rsi,%r14), %rdx
movq %rsi, %r11
movq 0xb8(%rsp), %r8
leaq (%rdx,%r8), %rsi
addq %rcx, %rsi
movq %rsi, 0x80(%rbx)
leaq (%r9,%r9,4), %rcx
addq %r11, %rcx
addq %r14, %r13
addq %rdi, %r13
addq %rcx, %r13
addq %rdx, %rax
leaq (%r10,%r13), %rcx
addq %r8, %rax
leaq (%rcx,%rax), %rdx
movq %rdx, 0x88(%rbx)
addq %r13, %rcx
leaq (%rcx,%rax), %rdx
movq %rdx, 0x90(%rbx)
addq %r13, %rax
addq %rcx, %rax
movq %rax, 0x98(%rbx)
movq 0x50(%rsp), %rax
movq %rax, 0x20(%rbx)
leaq (%r9,%r9,2), %rax
addq %r10, %rax
leaq (%r12,%r9,4), %rcx
addq %r10, %rcx
addq %rdi, %r12
leaq (%r12,%r9,4), %rdx
movq %rax, 0xa0(%rbx)
movq %rcx, 0xb0(%rbx)
addq %rdx, %rcx
movq %rcx, 0xb8(%rbx)
addq %rdx, %rcx
movq %rcx, 0xc0(%rbx)
addq %rdx, %rcx
movq %rcx, 0xc8(%rbx)
movq %rax, 0xd0(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop