// File: estwings57[P]CasHMC/sources/CommandQueue.cpp
// Function: CasHMC::CommandQueue::CommandQueue(std::basic_ofstream<char, std::char_traits<char>>&, std::basic_ofstream<char, std::char_traits<char>>&, unsigned int, CasHMC::VaultController*)
CommandQueue::CommandQueue(ofstream &debugOut_, ofstream &stateOut_, unsigned id, VaultController *parent):
	SimulatorObject(debugOut_, stateOut_),
	cmdQueID(id),
	vaultContP(parent)
{
	classID << cmdQueID;
	header = "        (CQ_" + classID.str();
	
	refreshWaiting = false;
	issuedBank = 0;
	
	atomicLock = vector<bool>(NUM_BANKS,false);
	atomicLockTag = vector<unsigned>(NUM_BANKS,0);
	tFAWCountdown.reserve(4);
	rowAccessCounter = vector<unsigned>(NUM_BANKS,0);
	if(QUE_PER_BANK) {
		bufPopDelayPerBank = vector<int>(NUM_BANKS, 0);
		queue = vector< vector<DRAMCommand *> >(NUM_BANKS, vector<DRAMCommand *>());
		for(int b=0; b<NUM_BANKS; b++) {
			queue[b].reserve(MAX_CMD_QUE);
		}
	}
	else {
		bufPopDelayPerBank = vector<int>(1, 0);
		queue = vector< vector<DRAMCommand *> >(1, vector<DRAMCommand *>());
		queue[0].reserve(MAX_CMD_QUE);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x290, %rsp            # imm = 0x290
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq %r8, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x1b0(%rbp)
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x21ff0
movq -0x1b0(%rbp), %rdi
leaq 0x49564(%rip), %rax     # 0x65978
movq %rax, (%rdi)
movl -0x1c(%rbp), %eax
movl %eax, 0x1c8(%rdi)
movq -0x28(%rbp), %rax
movq %rax, 0x1d8(%rdi)
addq $0x1e0, %rdi            # imm = 0x1E0
movq %rdi, -0x1e0(%rbp)
callq 0x22080
movq -0x1b0(%rbp), %rdi
addq $0x208, %rdi            # imm = 0x208
movq %rdi, -0x1d8(%rbp)
callq 0x18070
movq -0x1b0(%rbp), %rdi
addq $0x220, %rdi            # imm = 0x220
movq %rdi, -0x1d0(%rbp)
callq 0x220a0
movq -0x1b0(%rbp), %rdi
addq $0x238, %rdi            # imm = 0x238
movq %rdi, -0x1c8(%rbp)
callq 0x220c0
movq -0x1b0(%rbp), %rdi
addq $0x250, %rdi            # imm = 0x250
movq %rdi, -0x1c0(%rbp)
callq 0x18070
movq -0x1b0(%rbp), %rdi
addq $0x268, %rdi            # imm = 0x268
movq %rdi, -0x1b8(%rbp)
callq 0x18070
movq -0x1b0(%rbp), %rax
movq %rax, %rdi
addq $0x50, %rdi
movl 0x1c8(%rax), %esi
callq 0x44c0
jmp 0x1c4db
movq -0x1b0(%rbp), %rsi
addq $0x40, %rsi
leaq -0x78(%rbp), %rdi
callq 0x4370
jmp 0x1c4f1
leaq 0x3644c(%rip), %rsi     # 0x52944
leaq -0x58(%rbp), %rdi
leaq -0x78(%rbp), %rdx
callq 0x179c0
jmp 0x1c507
movq -0x1b0(%rbp), %rdi
addq $0x20, %rdi
leaq -0x58(%rbp), %rsi
movq %rsi, -0x1f8(%rbp)
callq 0x4470
movq -0x1f8(%rbp), %rdi
callq 0x46e8
leaq -0x78(%rbp), %rdi
callq 0x46e8
movq -0x1b0(%rbp), %rax
movb $0x0, 0x1d0(%rax)
movl $0x0, 0x1cc(%rax)
leaq 0x4a0ca(%rip), %rax     # 0x66620
movslq (%rax), %rax
movq %rax, -0x1f0(%rbp)
movb $0x0, -0xa1(%rbp)
leaq -0xa2(%rbp), %rdi
movq %rdi, -0x1e8(%rbp)
callq 0x220e0
movq -0x1f0(%rbp), %rsi
movq -0x1e8(%rbp), %rcx
leaq -0xa0(%rbp), %rdi
leaq -0xa1(%rbp), %rdx
callq 0x22100
jmp 0x1c59d
movq -0x1b0(%rbp), %rdi
addq $0x1e0, %rdi            # imm = 0x1E0
leaq -0xa0(%rbp), %rsi
movq %rsi, -0x210(%rbp)
callq 0x22180
movq -0x210(%rbp), %rdi
callq 0x221f0
leaq -0xa2(%rbp), %rdi
callq 0x22210
leaq 0x4a043(%rip), %rax     # 0x66620
movslq (%rax), %rax
movq %rax, -0x208(%rbp)
movl $0x0, -0xc4(%rbp)
leaq -0xc5(%rbp), %rdi
movq %rdi, -0x200(%rbp)
callq 0x18090
movq -0x208(%rbp), %rsi
movq -0x200(%rbp), %rcx
leaq -0xc0(%rbp), %rdi
leaq -0xc4(%rbp), %rdx
callq 0x180b0
jmp 0x1c627
movq -0x1b0(%rbp), %rdi
addq $0x208, %rdi            # imm = 0x208
leaq -0xc0(%rbp), %rsi
movq %rsi, -0x218(%rbp)
callq 0x18130
movq -0x218(%rbp), %rdi
callq 0x18160
leaq -0xc5(%rbp), %rdi
callq 0x181c0
movq -0x1b0(%rbp), %rdi
addq $0x250, %rdi            # imm = 0x250
movl $0x4, %esi
callq 0x22230
jmp 0x1c67a
leaq 0x49f9f(%rip), %rax     # 0x66620
movslq (%rax), %rax
movq %rax, -0x228(%rbp)
movl $0x0, -0xe4(%rbp)
leaq -0xe5(%rbp), %rdi
movq %rdi, -0x220(%rbp)
callq 0x18090
movq -0x228(%rbp), %rsi
movq -0x220(%rbp), %rcx
leaq -0xe0(%rbp), %rdi
leaq -0xe4(%rbp), %rdx
callq 0x180b0
jmp 0x1c6cb
movq -0x1b0(%rbp), %rdi
addq $0x268, %rdi            # imm = 0x268
leaq -0xe0(%rbp), %rsi
callq 0x18130
leaq -0xe0(%rbp), %rdi
callq 0x18160
leaq -0xe5(%rbp), %rdi
callq 0x181c0
leaq 0x49f2c(%rip), %rax     # 0x66630
testb $0x1, (%rax)
je 0x1c971
leaq 0x49f0c(%rip), %rax     # 0x66620
movslq (%rax), %rax
movq %rax, -0x238(%rbp)
movl $0x0, -0x104(%rbp)
leaq -0x105(%rbp), %rdi
movq %rdi, -0x230(%rbp)
callq 0x22330
movq -0x238(%rbp), %rsi
movq -0x230(%rbp), %rcx
leaq -0x100(%rbp), %rdi
leaq -0x104(%rbp), %rdx
callq 0x22350
jmp 0x1c75e
movq -0x1b0(%rbp), %rdi
addq $0x220, %rdi            # imm = 0x220
leaq -0x100(%rbp), %rsi
movq %rsi, -0x258(%rbp)
callq 0x223d0
movq -0x258(%rbp), %rdi
callq 0x22400
leaq -0x105(%rbp), %rdi
callq 0x22460
leaq 0x49e82(%rip), %rax     # 0x66620
movslq (%rax), %rax
movq %rax, -0x250(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x140(%rbp)
movq $0x0, -0x130(%rbp)
leaq -0x140(%rbp), %rdi
movq %rdi, -0x248(%rbp)
callq 0x22480
leaq -0x141(%rbp), %rdi
movq %rdi, -0x240(%rbp)
callq 0x224a0
movq -0x250(%rbp), %rsi
movq -0x248(%rbp), %rdx
movq -0x240(%rbp), %rcx
leaq -0x120(%rbp), %rdi
callq 0x224c0
jmp 0x1c806
movq -0x1b0(%rbp), %rdi
addq $0x238, %rdi            # imm = 0x238
leaq -0x120(%rbp), %rsi
callq 0x22540
leaq -0x120(%rbp), %rdi
callq 0x22570
leaq -0x141(%rbp), %rdi
callq 0x225d0
leaq -0x140(%rbp), %rdi
callq 0x225f0
movl $0x0, -0x148(%rbp)
movl -0x148(%rbp), %eax
leaq 0x49dc5(%rip), %rcx     # 0x66620
cmpl (%rcx), %eax
jge 0x1c96c
movq -0x1b0(%rbp), %rdi
addq $0x238, %rdi            # imm = 0x238
movslq -0x148(%rbp), %rsi
callq 0x22650
movq %rax, %rdi
leaq 0x49ce1(%rip), %rax     # 0x66568
movslq (%rax), %rsi
callq 0x22670
jmp 0x1c891
jmp 0x1c893
movl -0x148(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x148(%rbp)
jmp 0x1c84e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x1caff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x46e8
jmp 0x1caff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0xa2(%rbp), %rdi
callq 0x22210
jmp 0x1caff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0xc5(%rbp), %rdi
callq 0x181c0
jmp 0x1caff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0xe5(%rbp), %rdi
callq 0x181c0
jmp 0x1caff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x105(%rbp), %rdi
callq 0x22460
jmp 0x1caff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x141(%rbp), %rdi
callq 0x225d0
leaq -0x140(%rbp), %rdi
callq 0x225f0
jmp 0x1caff
jmp 0x1caf6
movl $0x0, -0x164(%rbp)
leaq -0x165(%rbp), %rdi
movq %rdi, -0x260(%rbp)
callq 0x22330
movq -0x260(%rbp), %rcx
leaq -0x160(%rbp), %rdi
movl $0x1, %esi
leaq -0x164(%rbp), %rdx
callq 0x22350
jmp 0x1c9af
movq -0x1b0(%rbp), %rdi
addq $0x220, %rdi            # imm = 0x220
leaq -0x160(%rbp), %rsi
movq %rsi, -0x278(%rbp)
callq 0x223d0
movq -0x278(%rbp), %rdi
callq 0x22400
leaq -0x165(%rbp), %rdi
callq 0x22460
xorps %xmm0, %xmm0
movaps %xmm0, -0x1a0(%rbp)
movq $0x0, -0x190(%rbp)
leaq -0x1a0(%rbp), %rdi
movq %rdi, -0x270(%rbp)
callq 0x22480
leaq -0x1a1(%rbp), %rdi
movq %rdi, -0x268(%rbp)
callq 0x224a0
movq -0x270(%rbp), %rdx
movq -0x268(%rbp), %rcx
leaq -0x180(%rbp), %rdi
movl $0x1, %esi
callq 0x224c0
jmp 0x1ca44
movq -0x1b0(%rbp), %rdi
addq $0x238, %rdi            # imm = 0x238
movq %rdi, -0x280(%rbp)
leaq -0x180(%rbp), %rsi
movq %rsi, -0x288(%rbp)
callq 0x22540
movq -0x288(%rbp), %rdi
callq 0x22570
leaq -0x1a1(%rbp), %rdi
callq 0x225d0
leaq -0x1a0(%rbp), %rdi
callq 0x225f0
movq -0x280(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x22650
movq %rax, %rdi
leaq 0x49abe(%rip), %rax     # 0x66568
movslq (%rax), %rsi
callq 0x22670
jmp 0x1cab4
jmp 0x1caf6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x165(%rbp), %rdi
callq 0x22460
jmp 0x1caff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x1a1(%rbp), %rdi
callq 0x225d0
leaq -0x1a0(%rbp), %rdi
callq 0x225f0
jmp 0x1caff
addq $0x290, %rsp            # imm = 0x290
popq %rbp
retq
movq -0x1b8(%rbp), %rdi
callq 0x18160
movq -0x1c0(%rbp), %rdi
callq 0x18160
movq -0x1c8(%rbp), %rdi
callq 0x22570
movq -0x1d0(%rbp), %rdi
callq 0x22400
movq -0x1d8(%rbp), %rdi
callq 0x18160
movq -0x1e0(%rbp), %rdi
callq 0x221f0
movq -0x1b0(%rbp), %rdi
callq 0x22e30
movq -0x30(%rbp), %rdi
callq 0x4630
nopl (%rax)