// File: /workspace/github_cpp_makefile_star2_O2/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, %r15d
movl %r8d, %r13d
movl %ecx, %ebp
movl %edx, %r12d
movq %rdi, %rbx
movl 0x40(%rsp), %r14d
callq 0x1f3fe
leaq 0x42bae(%rip), %rax     # 0x60dc8
movq %rax, (%rbx)
movl %r12d, 0x2c(%rbx)
movl %ebp, 0x30(%rbx)
movl %r13d, 0x34(%rbx)
andl $0x0, 0x38(%rbx)
movl %r15d, 0x4(%rsp)
movl %r15d, 0x48(%rbx)
movl %r14d, 0x4c(%rbx)
movl 0x48(%rsp), %eax
movl %eax, 0x50(%rbx)
movl 0x50(%rsp), %eax
movl %eax, %r15d
movl %eax, 0x54(%rbx)
movdqa 0x80(%rsp), %xmm0
movdqu %xmm0, 0x80(%rbx)
movq 0x90(%rsp), %rax
movq %rax, 0x90(%rbx)
pcmpeqd %xmm0, %xmm0
orq $-0x1, 0xa8(%rbx)
movdqu %xmm0, 0x98(%rbx)
movl %r13d, %eax
shlq $0x3, %rax
testl %r13d, %r13d
pushq $-0x1
popq %rbp
cmovnsq %rax, %rbp
pxor %xmm0, %xmm0
movdqu %xmm0, 0xb0(%rbx)
movdqu %xmm0, 0xc0(%rbx)
movdqu %xmm0, 0xd0(%rbx)
movdqu %xmm0, 0xe0(%rbx)
movdqu %xmm0, 0xf0(%rbx)
andq $0x0, 0x100(%rbx)
movq %rbp, %rdi
callq 0x7030
movq %rax, %r12
movq %rax, 0x58(%rbx)
movq %rbp, %rdi
callq 0x7030
movq 0x78(%rsp), %rcx
movq 0x70(%rsp), %rdx
movq 0x68(%rsp), %rsi
movq 0x60(%rsp), %rdi
movq 0x58(%rsp), %r8
movq %rax, 0x60(%rbx)
xorl %r9d, %r9d
testl %r13d, %r13d
cmovlel %r9d, %r13d
cmpq %r9, %r13
je 0x1e31b
movq (%r8,%r9,8), %r10
movq %r10, (%r12,%r9,8)
movq (%rdi,%r9,8), %r10
movq %r10, (%rax,%r9,8)
incq %r9
jmp 0x1e301
movq %rsi, 0x68(%rbx)
movq %rdx, 0x70(%rbx)
movq %rcx, 0x78(%rbx)
movl 0x4(%rsp), %eax
movl %eax, 0x3c(%rbx)
movl %eax, %ebp
leaq (,%rbp,8), %rdi
callq 0x7030
movq %rax, 0x40(%rbx)
xorl %r14d, %r14d
pushq $0x60
popq %r12
cmpq %r14, %rbp
je 0x1e378
movq %r12, %rdi
callq 0x7370
movq %rax, %r13
movq %rax, %rdi
movl 0x40(%rsp), %esi
movl 0x48(%rsp), %edx
movl %r15d, %ecx
callq 0x1e100
movq 0x40(%rbx), %rax
movq %r13, (%rax,%r14,8)
incq %r14
jmp 0x1e348
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1e389
movq %rax, %r14
jmp 0x1e399
movq %rax, %r14
movq %r13, %rdi
callq 0x7340
leaq 0xf0(%rbx), %rdi
callq 0x1f55e
movq %rbx, %rdi
callq 0x11c8c
movq %r14, %rdi
callq 0x75d0
nop