// File: /workspace/github_cpp_makefile_star2_O2/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 %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, 0x8(%rsp)
incq 0x1d8(%rdi)
movl %edx, %ebp
leaq 0x1e371(%rip), %r12     # 0x3df50
cmpb $0x1, 0x88(%r12)
jne 0x1fc86
leaq 0x188(%rbx), %rdi
leaq 0x8(%rsp), %rsi
callq 0x177ca
testq %rax, %rax
je 0x1fc71
movq 0x158(%rbx), %rcx
movq 0x160(%rbx), %rax
subq %rcx, %rax
sarq $0x3, %rax
xorl %esi, %esi
movq 0x8(%rsp), %r14
movl %esi, %edx
cmpq %rdx, %rax
jbe 0x1fc3a
movq (%rcx,%rdx,8), %rdi
leal 0x1(%rdx), %esi
cmpq %r14, (%rdi)
jne 0x1fc20
incq 0x1c0(%rbx)
cmpq %rdx, %rax
ja 0x1fc86
movq 0x170(%rbx), %rax
movq 0x178(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
xorl %edx, %edx
movl %edx, %edx
cmpq %rdx, %rcx
jbe 0x1fc7f
movq (%rax,%rdx,8), %rsi
incl %edx
cmpq %r14, (%rsi)
jne 0x1fc56
incq 0x1c8(%rbx)
jmp 0x1fc86
incq 0x1d0(%rbx)
movq 0x8(%rsp), %r14
jmp 0x1fc86
incq 0x1b8(%rbx)
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x1fd06
movl %eax, %r15d
testb %al, %al
je 0x1fcdb
movq 0x200(%rbx), %rax
incl -0x4(%rax)
cmpb $0x1, 0x158(%r12)
jne 0x1fcdb
movl 0x138(%rbx), %ecx
movl %ebp, %eax
cltd
idivl %ecx
movl %ebp, %eax
subl %edx, %eax
addl %eax, %ecx
movslq %ebp, %rdx
movq 0xb8(%rbx), %rsi
cmpl %ecx, %eax
jge 0x1fcd6
incq (%rsi,%rdx,8)
incl %eax
jmp 0x1fcca
movq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x1fb7e
testb %al, %al
je 0x1fcf6
movq 0x218(%rbx), %rax
incl -0x4(%rax)
movl %r15d, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq