// File: /workspace/github_cpp_makefile_star2_O1/gvaumour[P]cache-simulator/src/Predictor.cc
// Function: Predictor::reportMiss(unsigned long, int)
bool
Predictor::reportMiss(uint64_t block_addr , int id_set)
{

	stats_total_miss++;
	
	/* Miss classification between cold/conflict/capacity */
	if(simu_parameters.simulate_conflicts)
	{
		//DPRINTF(DebugFUcache , "Predictor::reportMiss block %#lx \n" , block_addr);
		if(m_accessedBlocks.count(block_addr) == 0)
		{
			stats_cold_miss++;
			//DPRINTF(DebugFUcache , "Predictor::reportMiss block not been accessed \n" );
		}
		else
		{
			bool find = false;
			for(unsigned i = 0; i < m_NVM_FU.size() && !find; i++)
			{
				if(m_NVM_FU[i]->addr == block_addr)
				{
					stats_nvm_conflict_miss++;
					find = true;
					break;
				}
			}
			for(unsigned i = 0; i < m_SRAM_FU.size() && !find; i++)
			{
				if(m_SRAM_FU[i]->addr == block_addr)
				{
					stats_sram_conflict_miss++;
					find = true;
					break;
				}
			}
			if(!find)
				stats_capacity_miss++;
		}
	 }
	 
	/************************************************************/
	bool sram_error = hitInSRAMMissingTags(block_addr, id_set);
	if(sram_error)
	{
		stats_SRAM_errors[stats_SRAM_errors.size()-1]++;	
		
		if(simu_parameters.enableDatasetSpilling)
		{
			int starting_set = (id_set/m_nb_MTcouters_sampling) * m_nb_MTcouters_sampling; 
			for(int i = starting_set ; i < starting_set + m_nb_MTcouters_sampling ; i++)
				m_SRAM_MT_counters[id_set]++;
		
		}
	}
	/*
	if(simu_parameters.enableDatasetSpilling)
	{	
		bool nvm_error = hitInNVMMissingTags(block_addr , id_set);
		if(nvm_error)
			m_NVM_MT_counters[id_set]++;
	}*/
	
	bool bypass_error = checkBypassTag(block_addr , id_set);
	if( bypass_error )
		stats_BP_errors[stats_BP_errors.size()-1]++;
	
	
	return sram_error;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rdi, %rbx
incq 0x1d8(%rdi)
movq %rsi, %r14
leaq 0x1ed45(%rip), %r15     # 0x45f50
cmpb $0x1, 0x88(%r15)
jne 0x27305
movq 0x198(%rbx), %rdx
leaq 0x190(%rbx), %rax
movq %rax, %rcx
testq %rdx, %rdx
je 0x2724a
movq %rax, %rcx
xorl %esi, %esi
cmpq %r14, 0x20(%rdx)
setb %sil
cmovaeq %rdx, %rcx
movq 0x10(%rdx,%rsi,8), %rdx
testq %rdx, %rdx
jne 0x27232
movq %rax, %rdx
cmpq %rax, %rcx
je 0x2725d
cmpq %r14, 0x20(%rcx)
cmovaq %rax, %rcx
movq %rcx, %rdx
cmpq %rax, %rdx
je 0x272f5
movq 0x158(%rbx), %rcx
movq 0x160(%rbx), %rdx
subq %rcx, %rdx
setne %al
je 0x272a9
movq (%rcx), %rsi
cmpq %r14, (%rsi)
je 0x272a2
sarq $0x3, %rdx
movl $0x1, %esi
movl %esi, %esi
cmpq %rsi, %rdx
seta %al
jbe 0x272a9
movq (%rcx,%rsi,8), %rdi
incl %esi
cmpq %r14, (%rdi)
jne 0x2728d
incq 0x1c0(%rbx)
movq 0x170(%rbx), %rcx
movq 0x178(%rbx), %rdx
subq %rcx, %rdx
sete %sil
orb %al, %sil
jne 0x272ea
sarq $0x3, %rdx
movl $0x1, %esi
xorl %edi, %edi
movq (%rcx,%rdi,8), %rdi
cmpq %r14, (%rdi)
je 0x272fc
movl %esi, %edi
cmpq %rdi, %rdx
setbe %r8b
orb %al, %r8b
incl %esi
testb %r8b, %r8b
je 0x272ce
movl $0x1b8, %ecx            # imm = 0x1B8
testb %al, %al
je 0x27301
jmp 0x27305
movl $0x1d0, %ecx            # imm = 0x1D0
jmp 0x27301
movl $0x1c8, %ecx            # imm = 0x1C8
incq (%rbx,%rcx)
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x273ca
movl %eax, %ecx
movslq %ebp, %rsi
testb %al, %al
je 0x27369
movq 0x200(%rbx), %rax
incl -0x4(%rax)
cmpb $0x1, 0x158(%r15)
jne 0x27369
movl 0x138(%rbx), %edi
testl %edi, %edi
jle 0x27369
movq 0xb8(%rbx), %r8
movq (%r8,%rsi,8), %r9
movl %esi, %eax
cltd
idivl %edi
movl %esi, %eax
subl %edx, %eax
addl %eax, %edi
incl %eax
cmpl %eax, %edi
cmovgl %edi, %eax
movl %esi, %edi
notl %edi
addl %edx, %edi
addl %eax, %edi
leaq (%r9,%rdi), %rax
incq %rax
movq %rax, (%r8,%rsi,8)
movq 0x140(%rbx), %rdx
leaq (%rsi,%rsi,2), %rsi
movq (%rdx,%rsi,8), %rax
movq 0x8(%rdx,%rsi,8), %rdx
subq %rax, %rdx
setne %sil
je 0x273ad
movq (%rax), %rdi
cmpq %r14, (%rdi)
je 0x273ad
sarq $0x3, %rdx
movl $0x1, %edi
movl %edi, %edi
cmpq %rdi, %rdx
seta %sil
jbe 0x273ad
movq (%rax,%rdi,8), %r8
incl %edi
cmpq %r14, (%r8)
jne 0x27397
testb %sil, %sil
je 0x273bc
movq 0x218(%rbx), %rax
incl -0x4(%rax)
movl %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop