// File: /workspace/github_cpp_makefile_star2_O2/NishadSaraf[P]Championship-Simulator/inc/cache.h
// Function: CACHE::CACHE(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned int, int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int)
CACHE(string v1, uint32_t v2, int v3, uint32_t v4, uint32_t v5, uint32_t v6, uint32_t v7, uint32_t v8) 
        : NAME(v1), NUM_SET(v2), NUM_WAY(v3), NUM_LINE(v4), WQ_SIZE(v5), RQ_SIZE(v6), PQ_SIZE(v7), MSHR_SIZE(v8) {

        LATENCY = 0;

        // cache block
        block = new BLOCK* [NUM_SET];
        for (uint32_t i=0; i<NUM_SET; i++) {
            block[i] = new BLOCK[NUM_WAY]; 

            for (uint32_t j=0; j<NUM_WAY; j++) {
                block[i][j].lru = j;
            }
        }

        for (uint32_t i=0; i<NUM_CPUS; i++) {
            upper_level_icache[i] = NULL;
            upper_level_dcache[i] = NULL;

            for (uint32_t j=0; j<NUM_TYPES; j++) {
                sim_access[i][j] = 0;
                sim_hit[i][j] = 0;
                sim_miss[i][j] = 0;
                roi_access[i][j] = 0;
                roi_hit[i][j] = 0;
                roi_miss[i][j] = 0;
            }
        }

        lower_level = NULL;
        extra_interface = NULL;
        fill_level = -1;
        MAX_READ = 1;
        MAX_FILL = 1;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movl %r9d, 0x8(%rsp)
movl %r8d, %r15d
movl %ecx, %r12d
movl %edx, %r13d
movq %rsi, %rbp
movq %rdi, %rbx
callq 0xdcb0
leaq 0x83c5(%rip), %rax      # 0x15c10
addq $0x10, %rax
movq %rax, (%rbx)
leaq 0x7350(%rbx), %r14
movq %r14, %rdi
movq %rbp, %rsi
callq 0x22b0
movl 0x120(%rsp), %eax
movl 0x118(%rsp), %ecx
movl 0x110(%rsp), %edx
movl %r13d, 0x7370(%rbx)
movl %r12d, 0x7374(%rbx)
movl %r15d, 0x7378(%rbx)
movl 0x8(%rsp), %esi
movl %esi, 0x737c(%rbx)
movl %edx, 0x7380(%rbx)
movl %ecx, 0x7384(%rbx)
movl %eax, 0x7388(%rbx)
leaq 0x3285(%rip), %rdx      # 0x10b36
leaq 0xb8(%rsp), %rdi
movq %r14, %rsi
movq %r14, 0x30(%rsp)
callq 0xde59
leaq 0x73a8(%rbx), %r15
movl 0x737c(%rbx), %edx
leaq 0xb8(%rsp), %rsi
movq %r15, %rdi
callq 0xde92
leaq 0xb8(%rsp), %rdi
callq 0x2100
leaq 0x3689(%rip), %rdx      # 0x10f80
leaq 0x98(%rsp), %rdi
movq %r14, %rsi
movq %r15, 0x8(%rsp)
callq 0xde59
leaq 0x9048(%rbx), %r12
movl 0x7380(%rbx), %edx
leaq 0x98(%rsp), %rsi
movq %r12, %rdi
callq 0xde92
leaq 0x98(%rsp), %rdi
callq 0x2100
leaq 0x3647(%rip), %rdx      # 0x10f84
leaq 0x78(%rsp), %rdi
movq %r14, %rsi
movq %r12, 0x28(%rsp)
callq 0xde59
leaq 0xace8(%rbx), %r13
movl 0x7384(%rbx), %edx
leaq 0x78(%rsp), %rsi
movq %r13, %rdi
callq 0xde92
leaq 0x78(%rsp), %rdi
callq 0x2100
leaq 0x360e(%rip), %rdx      # 0x10f88
leaq 0x58(%rsp), %rdi
movq %r14, %rsi
movq %r13, 0x20(%rsp)
callq 0xde59
leaq 0xc988(%rbx), %rbp
movl 0x7388(%rbx), %edx
leaq 0x58(%rsp), %rsi
movq %rbp, %rdi
callq 0xde92
leaq 0x58(%rsp), %rdi
callq 0x2100
leaq 0x35d7(%rip), %rdx      # 0x10f8e
leaq 0x38(%rsp), %rdi
movq %r14, %rsi
movq %rbp, 0x18(%rsp)
callq 0xde59
leaq 0xe628(%rbx), %rdi
leaq 0x38(%rsp), %rsi
movq %rdi, 0x10(%rsp)
movl $0x100, %edx            # imm = 0x100
callq 0xde92
leaq 0x38(%rsp), %rdi
callq 0x2100
xorps %xmm0, %xmm0
movups %xmm0, 0x102d8(%rbx)
movups %xmm0, 0x102c8(%rbx)
andl $0x0, 0x738c(%rbx)
movl 0x7370(%rbx), %r14d
leaq (,%r14,8), %rdi
callq 0x2030
movq %rax, %r12
movq %rax, 0x7390(%rbx)
movl 0x7374(%rbx), %ebp
imulq $0x50, %rbp, %r13
xorl %r15d, %r15d
cmpq %r14, %r15
je 0xda99
movq %r13, %rdi
callq 0x2030
testq %rbp, %rbp
xorps %xmm0, %xmm0
je 0xda6f
movq %rax, %rcx
addq %r13, %rcx
movq %rax, %rdx
movups %xmm0, (%rdx)
andl $0x0, 0x10(%rdx)
movups %xmm0, 0x18(%rdx)
andl $0x0, 0x48(%rdx)
movups %xmm0, 0x28(%rdx)
movups %xmm0, 0x38(%rdx)
addq $0x50, %rdx
cmpq %rcx, %rdx
jne 0xda4f
movq %rax, (%r12,%r15,8)
movq 0x7390(%rbx), %r12
pushq $0x48
popq %rax
xorl %ecx, %ecx
cmpq %rcx, %rbp
je 0xda94
movq (%r12,%r15,8), %rdx
movl %ecx, (%rdx,%rax)
incq %rcx
addq $0x50, %rax
jmp 0xda7f
incq %r15
jmp 0xda31
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rbx)
pushq $-0x20
popq %rax
testq %rax, %rax
je 0xdae4
andq $0x0, 0x10308(%rbx,%rax)
andq $0x0, 0x10328(%rbx,%rax)
andq $0x0, 0x10348(%rbx,%rax)
andq $0x0, 0x10368(%rbx,%rax)
andq $0x0, 0x10388(%rbx,%rax)
andq $0x0, 0x103a8(%rbx,%rax)
addq $0x8, %rax
jmp 0xdaa3
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rbx)
movabsq $0x1ffffffff, %rax      # imm = 0x1FFFFFFFF
movq %rax, 0x7398(%rbx)
movl $0x1, 0x73a0(%rbx)
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xdb89
movq %rax, %r14
leaq 0x38(%rsp), %rdi
callq 0x2100
jmp 0xdb96
movq %rax, %r14
jmp 0xdb96
movq %rax, %r14
leaq 0x58(%rsp), %rdi
callq 0x2100
jmp 0xdba0
movq %rax, %r14
jmp 0xdba0
movq %rax, %r14
leaq 0x78(%rsp), %rdi
callq 0x2100
jmp 0xdbaa
movq %rax, %r14
jmp 0xdbaa
movq %rax, %r14
leaq 0x98(%rsp), %rdi
callq 0x2100
jmp 0xdbb4
movq %rax, %r14
jmp 0xdbb4
movq %rax, %r14
leaq 0xb8(%rsp), %rdi
callq 0x2100
jmp 0xdbbe
movq %rax, %r14
jmp 0xdbbe
movq %rax, %r14
jmp 0xdbc8
movq %rax, %r14
movq 0x10(%rsp), %rdi
callq 0xdf54
movq 0x18(%rsp), %rdi
callq 0xdf54
movq 0x20(%rsp), %rdi
callq 0xdf54
movq 0x28(%rsp), %rdi
callq 0xdf54
movq 0x8(%rsp), %rdi
callq 0xdf54
movq 0x30(%rsp), %rdi
callq 0x2100
movq %rbx, %rdi
callq 0xdf72
movq %r14, %rdi
callq 0x23a0