// File: /workspace/github_cpp_makefile_star2_O3/CMU-SAFARI[P]MQSim/src/nvm_chip/flash_memory/Flash_Chip.cpp
// Function: NVM::FlashMemory::Flash_Chip::Flash_Chip(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned int, unsigned int, Flash_Technology_Type, unsigned int, unsigned int, unsigned int, unsigned int, unsigned long*, unsigned long*, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long)
Flash_Chip::Flash_Chip(const sim_object_id_type& id, flash_channel_ID_type channelID, flash_chip_ID_type localChipID,
			Flash_Technology_Type flash_technology, 
			unsigned int dieNo, unsigned int PlaneNoPerDie, unsigned int Block_no_per_plane, unsigned int Page_no_per_block,
			sim_time_type* readLatency, sim_time_type* programLatency, sim_time_type eraseLatency,
			sim_time_type suspendProgramLatency, sim_time_type suspendEraseLatency,
			sim_time_type commProtocolDelayRead, sim_time_type commProtocolDelayWrite, sim_time_type commProtocolDelayErase)
			: NVM_Chip(id), ChannelID(channelID), ChipID(localChipID), flash_technology(flash_technology),
			status(Internal_Status::IDLE), die_no(dieNo), plane_no_in_die(PlaneNoPerDie), block_no_in_plane(Block_no_per_plane), page_no_per_block(Page_no_per_block),
			_RBSignalDelayRead(commProtocolDelayRead), _RBSignalDelayWrite(commProtocolDelayWrite), _RBSignalDelayErase(commProtocolDelayErase),
			lastTransferStart(INVALID_TIME), executionStartTime(INVALID_TIME), expectedFinishTime(INVALID_TIME),
			STAT_readCount(0), STAT_progamCount(0), STAT_eraseCount(0),
			STAT_totalSuspensionCount(0), STAT_totalResumeCount(0),
			STAT_totalExecTime(0), STAT_totalXferTime(0), STAT_totalOverlappedXferExecTime(0)
		{
			int bits_per_cell = static_cast<int>(flash_technology);
			_readLatency = new sim_time_type[bits_per_cell];
			_programLatency = new sim_time_type[bits_per_cell];
			for (int i = 0; i < bits_per_cell; i++) {
				_readLatency[i] = readLatency[i];
				_programLatency[i] = programLatency[i];
			}
			_eraseLatency = eraseLatency;
			_suspendProgramLatency = suspendProgramLatency;
			_suspendEraseLatency = suspendEraseLatency;
			idleDieNo = dieNo;
			Dies = new Die*[dieNo];
			for (unsigned int dieID = 0; dieID < dieNo; dieID++) {
				Dies[dieID] = new Die(PlaneNoPerDie, Block_no_per_plane, Page_no_per_block);
			}
		}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r9d, %ebp
movl %r8d, %r13d
movl %ecx, %r12d
movl %edx, %r14d
movq %rdi, %rbx
movl 0x40(%rsp), %r15d
callq 0x164ce
leaq 0x47ab9(%rip), %rax     # 0x6de20
movq %rax, (%rbx)
movl %r14d, 0x2c(%rbx)
movl %r12d, 0x30(%rbx)
movl %r13d, 0x34(%rbx)
movl $0x0, 0x38(%rbx)
movl %ebp, (%rsp)
movl %ebp, 0x48(%rbx)
movl %r15d, 0x4c(%rbx)
movl 0x48(%rsp), %eax
movl %eax, %r15d
movl %eax, 0x50(%rbx)
movl 0x50(%rsp), %eax
movl %eax, %r14d
movl %eax, 0x54(%rbx)
movdqa 0x80(%rsp), %xmm0
movdqu %xmm0, 0x80(%rbx)
movq 0x90(%rsp), %rax
movq %rax, 0x90(%rbx)
pcmpeqd %xmm0, %xmm0
movdqu %xmm0, 0x98(%rbx)
movl %r13d, %r12d
shlq $0x3, %r12
movl %r13d, 0x4(%rsp)
testl %r13d, %r13d
movq $-0x1, %r13
cmovnsq %r12, %r13
movq $-0x1, 0xa8(%rbx)
pxor %xmm0, %xmm0
movdqu %xmm0, 0xb0(%rbx)
movdqu %xmm0, 0xc0(%rbx)
movdqu %xmm0, 0xd0(%rbx)
movdqu %xmm0, 0xe0(%rbx)
movdqu %xmm0, 0xf0(%rbx)
movq $0x0, 0x100(%rbx)
movq %r13, %rdi
callq 0x7030
movq %rax, 0x58(%rbx)
movq %r13, %rdi
movq %rax, %rbp
callq 0x7030
movq %rax, %r13
movq 0x78(%rsp), %rcx
movq 0x70(%rsp), %rax
movq 0x68(%rsp), %rdx
movq %r13, 0x60(%rbx)
cmpl $0x0, 0x4(%rsp)
jle 0x26487
movq 0x58(%rsp), %rsi
movq %rbp, %rdi
movq %r12, %rdx
movq %rcx, %rbp
callq 0x7310
movq %r13, %rdi
movq 0x60(%rsp), %rsi
movq %r12, %rdx
callq 0x7310
movq 0x68(%rsp), %rdx
movq %rbp, %rcx
movq 0x70(%rsp), %rax
movq %rdx, 0x68(%rbx)
movq %rax, 0x70(%rbx)
movq %rcx, 0x78(%rbx)
movl (%rsp), %eax
movl %eax, 0x3c(%rbx)
movl %eax, %r13d
leaq (,%r13,8), %rdi
callq 0x7030
movq %rax, 0x40(%rbx)
cmpl $0x0, (%rsp)
je 0x264e4
xorl %ebp, %ebp
movl $0x60, %edi
callq 0x73a0
movq %rax, %r12
movq %rax, %rdi
movl 0x40(%rsp), %esi
movl %r15d, %edx
movl %r14d, %ecx
callq 0x2623c
movq 0x40(%rbx), %rax
movq %r12, (%rax,%rbp,8)
incq %rbp
cmpq %rbp, %r13
jne 0x264b5
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x264f5
movq %rax, %r14
jmp 0x26505
movq %rax, %r14
movq %r12, %rdi
callq 0x7370
movq 0xf0(%rbx), %rdi
testq %rdi, %rdi
je 0x26516
callq 0x7370
leaq 0x4754b(%rip), %rax     # 0x6da68
movq %rax, (%rbx)
movq 0x8(%rbx), %rdi
addq $0x18, %rbx
cmpq %rbx, %rdi
je 0x26532
callq 0x7370
movq %r14, %rdi
callq 0x7620