// File: dramninjasUMD[P]BOBSim/DRAMChannel.cpp
// Function: BOBSim::DRAMChannel::ReceiveOnCmdBus(BOBSim::BusPacket*, unsigned int)
void DRAMChannel::ReceiveOnCmdBus(BusPacket *busPacket, unsigned id)
{
	if(inFlightCommandPacket!=NULL)
	{
		ERROR("== Error - Bus collision while trying to receive from controller");
		ERROR("   Existing : "<<*inFlightCommandPacket);
		ERROR("   Incoming : "<<*busPacket);
		exit(0);
	}

	if(DEBUG_CHANNEL) DEBUG("     == Putting command on bus : " << *busPacket);

	//Report the time we waited in the queue
	if(busPacket->busPacketType==ACTIVATE)
	{
		(*ReportCallback)(busPacket, 0);
	}
	//Report the WRITE is finally going
	else if(busPacket->busPacketType==WRITE_P)
	{
		(*ReportCallback)(busPacket, 0);
	}

	inFlightCommandPacket = busPacket;
	inFlightCommandCountdown = tCMDS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, 0x260(%rax)
je 0x19eb0
movq 0x1e2a0(%rip), %rdi     # 0x37ff0
leaq 0x103b9(%rip), %rsi     # 0x2a110
callq 0x31c0
movq %rax, %rdi
leaq 0x118ec(%rip), %rsi     # 0x2b652
callq 0x31c0
movq %rax, %rdi
leaq 0x10344(%rip), %rsi     # 0x2a0b9
callq 0x31c0
movq %rax, %rdi
movl $0xd8, %esi
callq 0x3380
movq %rax, %rdi
leaq 0x10390(%rip), %rsi     # 0x2a121
callq 0x31c0
movq %rax, %rdi
leaq 0x11983(%rip), %rsi     # 0x2b723
callq 0x31c0
movq %rax, %rdi
movq 0x1e1f9(%rip), %rsi     # 0x37fa8
callq 0x3200
movq 0x1e235(%rip), %rdi     # 0x37ff0
leaq 0x1034e(%rip), %rsi     # 0x2a110
callq 0x31c0
movq %rax, %rdi
leaq 0x11881(%rip), %rsi     # 0x2b652
callq 0x31c0
movq %rax, %rdi
leaq 0x102d9(%rip), %rsi     # 0x2a0b9
callq 0x31c0
movq %rax, %rdi
movl $0xd9, %esi
callq 0x3380
movq %rax, %rdi
leaq 0x10325(%rip), %rsi     # 0x2a121
callq 0x31c0
movq %rax, %rdi
leaq 0x11959(%rip), %rsi     # 0x2b764
callq 0x31c0
movq %rax, %rdi
movq -0x20(%rbp), %rax
movq 0x260(%rax), %rsi
callq 0x18f90
movq %rax, %rdi
movq 0x1e17b(%rip), %rsi     # 0x37fa8
callq 0x3200
movq 0x1e1b7(%rip), %rdi     # 0x37ff0
leaq 0x102d0(%rip), %rsi     # 0x2a110
callq 0x31c0
movq %rax, %rdi
leaq 0x11803(%rip), %rsi     # 0x2b652
callq 0x31c0
movq %rax, %rdi
leaq 0x1025b(%rip), %rsi     # 0x2a0b9
callq 0x31c0
movq %rax, %rdi
movl $0xda, %esi
callq 0x3380
movq %rax, %rdi
leaq 0x102a7(%rip), %rsi     # 0x2a121
callq 0x31c0
movq %rax, %rdi
leaq 0x118ea(%rip), %rsi     # 0x2b773
callq 0x31c0
movq %rax, %rdi
movq -0x10(%rbp), %rsi
callq 0x18f90
movq %rax, %rdi
movq 0x1e104(%rip), %rsi     # 0x37fa8
callq 0x3200
xorl %edi, %edi
callq 0x3270
testb $0x1, 0x1e68c(%rip)     # 0x38543
je 0x19ef5
leaq 0x1e4b4(%rip), %rax     # 0x38374
cmpl $0x0, (%rax)
je 0x19ef3
movq 0x1e0fc(%rip), %rdi     # 0x37fc8
leaq 0x118af(%rip), %rsi     # 0x2b782
callq 0x31c0
movq %rax, %rdi
movq -0x10(%rbp), %rsi
callq 0x18f90
movq %rax, %rdi
movq 0x1e0ba(%rip), %rsi     # 0x37fa8
callq 0x3200
jmp 0x19ef5
movq -0x10(%rbp), %rax
cmpl $0x4, 0x4(%rax)
jne 0x19f18
movq -0x20(%rbp), %rax
movq 0x250(%rax), %rdi
movq -0x10(%rbp), %rsi
movq (%rdi), %rax
xorl %edx, %edx
callq *0x10(%rax)
jmp 0x19f3b
movq -0x10(%rbp), %rax
cmpl $0x3, 0x4(%rax)
jne 0x19f39
movq -0x20(%rbp), %rax
movq 0x250(%rax), %rdi
movq -0x10(%rbp), %rsi
movq (%rdi), %rax
xorl %edx, %edx
callq *0x10(%rax)
jmp 0x19f3b
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
movq %rcx, 0x260(%rax)
movl 0x1e414(%rip), %ecx     # 0x38364
movl %ecx, 0x268(%rax)
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)