// File: /workspace/github_cpp_makefile_star2_O1/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, %r14d
movl %r8d, %ebp
movl %ecx, %r12d
movl %edx, %r13d
movq %rdi, %rbx
movl 0x40(%rsp), %r15d
callq 0x165ce
leaq 0x4793d(%rip), %rax     # 0x6de28
movq %rax, (%rbx)
movl %r13d, 0x2c(%rbx)
movl %r12d, 0x30(%rbx)
movl %r14d, %r12d
movl %ebp, 0x34(%rbx)
movl $0x0, 0x38(%rbx)
movl %r14d, 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 %ebp, 0x4(%rsp)
movslq %ebp, %rax
leaq (,%rax,8), %rcx
testl %eax, %eax
movq $-0x1, %r13
cmovnsq %rcx, %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, %rbp
movq %rax, 0x58(%rbx)
movq %r13, %rdi
callq 0x7030
movq %rax, %r13
movq 0x78(%rsp), %rcx
movq 0x70(%rsp), %rdx
movq 0x68(%rsp), %rsi
movq %rax, 0x60(%rbx)
movl 0x4(%rsp), %eax
testl %eax, %eax
jle 0x2661a
movq 0x58(%rsp), %rsi
movq %rbp, %rdi
movl %r12d, %ebp
movl %eax, %r12d
shlq $0x3, %r12
movq %r12, %rdx
callq 0x7310
movq %r13, %rdi
movq 0x60(%rsp), %rsi
movq %r12, %rdx
movl %ebp, %r12d
callq 0x7310
movq 0x68(%rsp), %rsi
movq 0x70(%rsp), %rdx
movq 0x78(%rsp), %rcx
movq %rsi, 0x68(%rbx)
movq %rdx, 0x70(%rbx)
movq %rcx, 0x78(%rbx)
movl %r12d, 0x3c(%rbx)
movl %r12d, %r13d
leaq (,%r13,8), %rdi
callq 0x7030
movq %rax, 0x40(%rbx)
testl %r12d, %r12d
je 0x26674
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 0x263c0
movq 0x40(%rbx), %rax
movq %r12, (%rax,%rbp,8)
incq %rbp
cmpq %rbp, %r13
jne 0x26645
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x26685
movq %rax, %r14
jmp 0x26695
movq %rax, %r14
movq %r12, %rdi
callq 0x7370
movq 0xf0(%rbx), %rdi
testq %rdi, %rdi
je 0x266a6
callq 0x7370
leaq 0x473ab(%rip), %rax     # 0x6da58
movq %rax, (%rbx)
movq 0x8(%rbx), %rdi
addq $0x18, %rbx
cmpq %rbx, %rdi
je 0x266c2
callq 0x7370
movq %r14, %rdi
callq 0x7620