// File: /workspace/github_cpp_makefile_star2_O2/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 0x9dca
movq %rdi, %rbx
cmpq $0x0, 0x270(%rdi)
jne 0x9e36
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 0xc21f(%rip), %rdi      # 0x15ff0
leaq 0x53a8(%rip), %rsi      # 0xf180
callq 0x2180
leaq 0x6467(%rip), %rsi      # 0x1024b
movq %rax, %rdi
callq 0x2180
leaq 0x5336(%rip), %rsi      # 0xf129
movq %rax, %rdi
callq 0x2180
movq %rax, %rdi
movl $0xf4, %esi
callq 0x22e0
leaq 0x5382(%rip), %rsi      # 0xf191
movq %rax, %rdi
callq 0x2180
leaq 0x6519(%rip), %rsi      # 0x10337
movq %rax, %rdi
callq 0x2180
movq %rax, %rdi
movq %r14, %rsi
callq 0x98b8
jmp 0xa042
movq 0xc1b3(%rip), %rdi      # 0x15ff0
leaq 0x533c(%rip), %r12      # 0xf180
movq %r12, %rsi
callq 0x2180
leaq 0x63f8(%rip), %rbp      # 0x1024b
movq %rax, %rdi
movq %rbp, %rsi
callq 0x2180
leaq 0x52c4(%rip), %r13      # 0xf129
movq %rax, %rdi
movq %r13, %rsi
callq 0x2180
movq %rax, %rdi
movl $0xfa, %esi
callq 0x22e0
leaq 0x530d(%rip), %r15      # 0xf191
movq %rax, %rdi
movq %r15, %rsi
callq 0x2180
leaq 0x64d7(%rip), %rsi      # 0x1036d
movq %rax, %rdi
callq 0x2180
movl 0x1e0(%rbx), %esi
movq %rax, %rdi
callq 0x2210
movq %rax, %rdi
callq 0x20b0
movq 0xc135(%rip), %rdi      # 0x15ff0
movq %r12, %rsi
callq 0x2180
movq %rax, %rdi
movq %rbp, %rsi
movq %rbp, %r12
callq 0x2180
movq %rax, %rdi
movq %r13, %rsi
movq %r13, %rbp
callq 0x2180
movq %rax, %rdi
movl $0xfb, %esi
callq 0x22e0
movq %rax, %rdi
movq %r15, %rsi
callq 0x2180
leaq 0x64b8(%rip), %rsi      # 0x103b6
movq %rax, %rdi
callq 0x2180
movq %rax, %rdi
movq %r14, %rsi
callq 0x98b8
movq %rax, %rdi
callq 0x20b0
movq 0xc0d0(%rip), %r14      # 0x15ff0
movq %r14, %rdi
leaq 0x5256(%rip), %r15      # 0xf180
movq %r15, %rsi
callq 0x2180
movq %rax, %rdi
movq %r12, %rsi
movq %r12, %r13
callq 0x2180
movq %rax, %rdi
movq %rbp, %rsi
callq 0x2180
movq %rax, %rdi
movl $0xfc, %esi
callq 0x22e0
movq %rax, %rdi
leaq 0x522f(%rip), %r12      # 0xf191
movq %r12, %rsi
callq 0x2180
leaq 0x6463(%rip), %rsi      # 0x103d4
movq %rax, %rdi
callq 0x2180
movq 0x270(%rbx), %rsi
movq %rax, %rdi
callq 0x98b8
movq %rax, %rdi
callq 0x20b0
movq %r14, %rdi
movq %r15, %rsi
callq 0x2180
movq %rax, %rdi
movq %r13, %rsi
callq 0x2180
movq %rax, %rdi
movq %rbp, %rsi
callq 0x2180
movq %rax, %rdi
movl $0xfd, %esi
callq 0x22e0
movq %rax, %rdi
movq %r12, %rsi
callq 0x2180
leaq 0x6422(%rip), %rsi      # 0x103f2
movq %rax, %rdi
callq 0x2180
movl 0x278(%rbx), %esi
movq %rax, %rdi
callq 0x2210
movq %rax, %rdi
callq 0x20b0
movq %r14, %rdi
movq %r15, %rsi
callq 0x2180
movq %rax, %rdi
movq %r13, %rsi
callq 0x2180
movq %rax, %rdi
movq %rbp, %rsi
callq 0x2180
movq %rax, %rdi
movl $0xfe, %esi
callq 0x22e0
movq %rax, %rdi
movq %r12, %rsi
callq 0x2180
leaq 0x63e2(%rip), %rsi      # 0x10410
movq %rax, %rdi
callq 0x2180
movq 0x8(%rbx), %rsi
movq %rax, %rdi
callq 0x2050
movq %rax, %rdi
callq 0x20b0
xorl %edi, %edi
callq 0x21d0
nop