// File: /workspace/github_cpp_makefile_star2_O1/dramninjasUMD[P]BOBSim/DRAMChannel.cpp
// Function: BOBSim::DRAMChannel::ReceiveOnDataBus(BOBSim::BusPacket*, unsigned int)
void DRAMChannel::ReceiveOnDataBus(BusPacket *busPacket, unsigned id)
{
	if(!(busPacket->busPacketType==READ_DATA ||
	        busPacket->busPacketType==WRITE_DATA))
	{
		ERROR("== Error - Trying to put non-data packet on data bus:" << *busPacket);
		exit(0);
	}

	if(inFlightDataPacket!=NULL)
	{
		ERROR("== Error - Bus collision while trying to receive from a rank in channel "<<channelID);
		ERROR("           Incoming Packet : "<<*busPacket);
		ERROR("           Existing Packet : "<<*inFlightDataPacket);
		ERROR("               (Time Left) : "<<inFlightDataCountdown);
		ERROR("           Clock Cycle : "<<currentClockCycle);
		exit(0);
	}
	if(DEBUG_CHANNEL) DEBUG("     == Putting data on bus [rank "<<id<<"] : " << *busPacket);

	inFlightDataPacket = busPacket;
	inFlightDataCountdown = busPacket->burstLength;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movl 0x4(%rsi), %eax
addl $-0x7, %eax
cmpl $0x2, %eax
jae 0xcfe8
movq %rdi, %rbx
cmpq $0x0, 0x270(%rdi)
jne 0xd054
movq %r14, 0x270(%rbx)
movl 0x24(%r14), %eax
movl %eax, 0x278(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xc001(%rip), %rdi      # 0x18ff0
leaq 0x6182(%rip), %rsi      # 0x13178
callq 0x31c0
leaq 0x7239(%rip), %rsi      # 0x1423b
movq %rax, %rdi
callq 0x31c0
leaq 0x6110(%rip), %rsi      # 0x13121
movq %rax, %rdi
callq 0x31c0
movq %rax, %rdi
movl $0xf4, %esi
callq 0x3330
leaq 0x615c(%rip), %rsi      # 0x13189
movq %rax, %rdi
callq 0x31c0
leaq 0x72eb(%rip), %rsi      # 0x14327
movq %rax, %rdi
callq 0x31c0
movq %rax, %rdi
movq %r14, %rsi
callq 0xc9a7
jmp 0xd260
movq 0xbf95(%rip), %rdi      # 0x18ff0
leaq 0x6116(%rip), %r12      # 0x13178
movq %r12, %rsi
callq 0x31c0
leaq 0x71ca(%rip), %rbp      # 0x1423b
movq %rax, %rdi
movq %rbp, %rsi
callq 0x31c0
leaq 0x609e(%rip), %r13      # 0x13121
movq %rax, %rdi
movq %r13, %rsi
callq 0x31c0
movq %rax, %rdi
movl $0xfa, %esi
callq 0x3330
leaq 0x60e7(%rip), %r15      # 0x13189
movq %rax, %rdi
movq %r15, %rsi
callq 0x31c0
leaq 0x72a9(%rip), %rsi      # 0x1435d
movq %rax, %rdi
callq 0x31c0
movl 0x1e0(%rbx), %esi
movq %rax, %rdi
callq 0x3260
movq %rax, %rdi
callq 0x30d0
movq 0xbf17(%rip), %rdi      # 0x18ff0
movq %r12, %rsi
callq 0x31c0
movq %rax, %rdi
movq %rbp, %rsi
movq %rbp, %r12
callq 0x31c0
movq %rax, %rdi
movq %r13, %rsi
movq %r13, %rbp
callq 0x31c0
movq %rax, %rdi
movl $0xfb, %esi
callq 0x3330
movq %rax, %rdi
movq %r15, %rsi
callq 0x31c0
leaq 0x728a(%rip), %rsi      # 0x143a6
movq %rax, %rdi
callq 0x31c0
movq %rax, %rdi
movq %r14, %rsi
callq 0xc9a7
movq %rax, %rdi
callq 0x30d0
movq 0xbeb2(%rip), %r14      # 0x18ff0
movq %r14, %rdi
leaq 0x6030(%rip), %r15      # 0x13178
movq %r15, %rsi
callq 0x31c0
movq %rax, %rdi
movq %r12, %rsi
movq %r12, %r13
callq 0x31c0
movq %rax, %rdi
movq %rbp, %rsi
callq 0x31c0
movq %rax, %rdi
movl $0xfc, %esi
callq 0x3330
movq %rax, %rdi
leaq 0x6009(%rip), %r12      # 0x13189
movq %r12, %rsi
callq 0x31c0
leaq 0x7235(%rip), %rsi      # 0x143c4
movq %rax, %rdi
callq 0x31c0
movq 0x270(%rbx), %rsi
movq %rax, %rdi
callq 0xc9a7
movq %rax, %rdi
callq 0x30d0
movq %r14, %rdi
movq %r15, %rsi
callq 0x31c0
movq %rax, %rdi
movq %r13, %rsi
callq 0x31c0
movq %rax, %rdi
movq %rbp, %rsi
callq 0x31c0
movq %rax, %rdi
movl $0xfd, %esi
callq 0x3330
movq %rax, %rdi
movq %r12, %rsi
callq 0x31c0
leaq 0x71f4(%rip), %rsi      # 0x143e2
movq %rax, %rdi
callq 0x31c0
movl 0x278(%rbx), %esi
movq %rax, %rdi
callq 0x3260
movq %rax, %rdi
callq 0x30d0
movq %r14, %rdi
movq %r15, %rsi
callq 0x31c0
movq %rax, %rdi
movq %r13, %rsi
callq 0x31c0
movq %rax, %rdi
movq %rbp, %rsi
callq 0x31c0
movq %rax, %rdi
movl $0xfe, %esi
callq 0x3330
movq %rax, %rdi
movq %r12, %rsi
callq 0x31c0
leaq 0x71b4(%rip), %rsi      # 0x14400
movq %rax, %rdi
callq 0x31c0
movq 0x8(%rbx), %rsi
movq %rax, %rdi
callq 0x3060
movq %rax, %rdi
callq 0x30d0
xorl %edi, %edi
callq 0x3220
nop