// File: /workspace/github_cpp_makefile_star2_O3/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 0xcdfc
movq %rdi, %rbx
cmpq $0x0, 0x270(%rdi)
jne 0xce68
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 0xc1ed(%rip), %rdi      # 0x18ff0
leaq 0x63be(%rip), %rsi      # 0x131c8
callq 0x31c0
leaq 0x74c5(%rip), %rsi      # 0x142db
movq %rax, %rdi
callq 0x31c0
leaq 0x634c(%rip), %rsi      # 0x13171
movq %rax, %rdi
callq 0x31c0
movq %rax, %rdi
movl $0xf4, %esi
callq 0x3330
leaq 0x6398(%rip), %rsi      # 0x131d9
movq %rax, %rdi
callq 0x31c0
leaq 0x7577(%rip), %rsi      # 0x143c7
movq %rax, %rdi
callq 0x31c0
movq %rax, %rdi
movq %r14, %rsi
callq 0xc7bb
jmp 0xd074
movq 0xc181(%rip), %rdi      # 0x18ff0
leaq 0x6352(%rip), %r12      # 0x131c8
movq %r12, %rsi
callq 0x31c0
leaq 0x7456(%rip), %rbp      # 0x142db
movq %rax, %rdi
movq %rbp, %rsi
callq 0x31c0
leaq 0x62da(%rip), %r13      # 0x13171
movq %rax, %rdi
movq %r13, %rsi
callq 0x31c0
movq %rax, %rdi
movl $0xfa, %esi
callq 0x3330
leaq 0x6323(%rip), %r15      # 0x131d9
movq %rax, %rdi
movq %r15, %rsi
callq 0x31c0
leaq 0x7535(%rip), %rsi      # 0x143fd
movq %rax, %rdi
callq 0x31c0
movl 0x1e0(%rbx), %esi
movq %rax, %rdi
callq 0x3260
movq %rax, %rdi
callq 0x30d0
movq 0xc103(%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 0x7516(%rip), %rsi      # 0x14446
movq %rax, %rdi
callq 0x31c0
movq %rax, %rdi
movq %r14, %rsi
callq 0xc7bb
movq %rax, %rdi
callq 0x30d0
movq 0xc09e(%rip), %r14      # 0x18ff0
movq %r14, %rdi
leaq 0x626c(%rip), %r15      # 0x131c8
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 0x6245(%rip), %r12      # 0x131d9
movq %r12, %rsi
callq 0x31c0
leaq 0x74c1(%rip), %rsi      # 0x14464
movq %rax, %rdi
callq 0x31c0
movq 0x270(%rbx), %rsi
movq %rax, %rdi
callq 0xc7bb
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 0x7480(%rip), %rsi      # 0x14482
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 0x7440(%rip), %rsi      # 0x144a0
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