// File: dramninjasUMD[P]BOBSim/DRAMChannel.cpp
// Function: BOBSim::DRAMChannel::AddTransaction(BOBSim::Transaction*, unsigned int)
bool DRAMChannel::AddTransaction(Transaction *trans, unsigned notused)
{
	if(DEBUG_CHANNEL)DEBUG("    In AddTransaction - got : "<<*trans);

	if(trans->transactionType==LOGIC_OPERATION)
	{
		if(SendToLogicLayer!=NULL)
		{
			(*SendToLogicLayer)(trans,0);
		}
		else
		{
			ERROR("== Logic Layers are not registered, yet receiving a logic operation.  Please register");
			exit(0);
		}
	}
	else if(trans->transactionType==LOGIC_RESPONSE)
	{
		if(pendingLogicResponse==NULL)
		{
			if (DEBUG_LOGIC) DEBUG("== Made it back to channel on cycle "<<currentClockCycle<<" : "<<*trans);
			pendingLogicResponse = trans;
		}
		else return false;
	}
	else
	{
		if(simpleController.waitingACTS<CHANNEL_WORK_Q_MAX)
		{
			simpleController.AddTransaction(trans);
		}
		else return false;
	}

	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
testb $0x1, 0x1e5c1(%rip)     # 0x38543
je 0x19fc0
leaq 0x1e3e9(%rip), %rax     # 0x38374
cmpl $0x0, (%rax)
je 0x19fbe
movq 0x1e031(%rip), %rdi     # 0x37fc8
leaq 0x116eb(%rip), %rsi     # 0x2b689
callq 0x31c0
movq %rax, %rdi
movq -0x18(%rbp), %rsi
callq 0x294b0
movq %rax, %rdi
movq 0x1dfef(%rip), %rsi     # 0x37fa8
callq 0x3200
jmp 0x19fc0
movq -0x18(%rbp), %rax
cmpl $0x3, (%rax)
jne 0x1a06b
movq -0x28(%rbp), %rax
cmpq $0x0, 0x258(%rax)
je 0x19ff4
movq -0x28(%rbp), %rax
movq 0x258(%rax), %rdi
movq -0x18(%rbp), %rsi
movq (%rdi), %rax
xorl %edx, %edx
callq *0x10(%rax)
jmp 0x1a066
movq 0x1dff5(%rip), %rdi     # 0x37ff0
leaq 0x1010e(%rip), %rsi     # 0x2a110
callq 0x31c0
movq %rax, %rdi
leaq 0x11641(%rip), %rsi     # 0x2b652
callq 0x31c0
movq %rax, %rdi
leaq 0x10099(%rip), %rsi     # 0x2a0b9
callq 0x31c0
movq %rax, %rdi
movl $0xbb, %esi
callq 0x3380
movq %rax, %rdi
leaq 0x100e5(%rip), %rsi     # 0x2a121
callq 0x31c0
movq %rax, %rdi
leaq 0x1165d(%rip), %rsi     # 0x2b6a8
callq 0x31c0
movq %rax, %rdi
movq 0x1df4e(%rip), %rsi     # 0x37fa8
callq 0x3200
xorl %edi, %edi
callq 0x3270
jmp 0x1a132
movq -0x18(%rbp), %rax
cmpl $0x4, (%rax)
jne 0x1a103
movq -0x28(%rbp), %rax
cmpq $0x0, 0x1f0(%rax)
jne 0x1a0fb
testb $0x1, 0x1e4b7(%rip)     # 0x38544
je 0x1a0ea
leaq 0x1e2de(%rip), %rax     # 0x38374
cmpl $0x0, (%rax)
je 0x1a0e8
movq 0x1df26(%rip), %rdi     # 0x37fc8
leaq 0x11655(%rip), %rsi     # 0x2b6fe
callq 0x31c0
movq %rax, %rdi
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x3070
movq %rax, %rdi
leaq 0x110a6(%rip), %rsi     # 0x2b16e
callq 0x31c0
movq %rax, %rdi
movq -0x18(%rbp), %rsi
callq 0x294b0
movq %rax, %rdi
movq 0x1dec5(%rip), %rsi     # 0x37fa8
callq 0x3200
jmp 0x1a0ea
movq -0x28(%rbp), %rax
movq -0x18(%rbp), %rcx
movq %rcx, 0x1f0(%rax)
jmp 0x1a101
movb $0x0, -0x1(%rbp)
jmp 0x1a136
jmp 0x1a130
movq -0x28(%rbp), %rax
movl 0x104(%rax), %eax
cmpl 0x1e24d(%rip), %eax     # 0x38360
jae 0x1a128
movq -0x28(%rbp), %rdi
addq $0x10, %rdi
movq -0x18(%rbp), %rsi
callq 0x271e0
jmp 0x1a12e
movb $0x0, -0x1(%rbp)
jmp 0x1a136
jmp 0x1a130
jmp 0x1a132
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)