void memory_c::fill_queue() { /* For Lab #2, you need to fill out this function */ /* CAUTION!: This function is not completed. Please complete this function */ if (dram_out_queue.empty()) return; mem_req_s *req = dram_out_queue.front(); dcache_insert(req->m_addr); // insert into dcache dram_out_queue.pop_front(); /* search for matching mshr entry */ m_mshr_entry_s *entry = search_matching_mshr(req->m_addr); while(entry->req_ops.size()) { Op *w_op = entry->req_ops.front(); broadcast_rdy_op(w_op); entry->req_ops.pop_front(); } /* The following code will free mshr entry */ list<m_mshr_entry_s *>::iterator mii = search_matching_mshr_itr(req->m_addr); m_mshr.erase(mii); free_mshr_entry(entry); }
void memory_c::fill_queue(void) { /* For Lab #2, you need to fill out this function */ /* CAUTION!: This function is not completed. Please complete this function */ if (dram_out_queue.empty()) return; mem_req_s *req = dram_out_queue.front(); dram_out_queue.pop_front(); /* search for matching mshr entry */ if(!(req->m_state == MEM_DRAM_OUT)) return; // cout << "\nIN fill queue"; //req->m_state = MEM_DRAM_OUT; // cout << "\nnumber of entries in out queue " << dram_out_queue.size(); m_mshr_entry_s *entry = search_matching_mshr(req->m_addr); dcache_insert(req->m_addr); // cout << "\ninserted into dcache " << req->m_addr; //in insert insert the physical address , insert the PTE as well. // cout << "\nNumber of entries in req ops " << entry->req_ops.size(); while(entry->req_ops.size()) { Op *w_op = new Op; w_op = entry->req_ops.front(); // if(w_op->mem_type == 1) // dcache_insert(w_op->ld_vaddr); // if(w_op->mem_type == 2) // dcache_insert(w_op->st_vaddr); //cout << "broadcastin now\n"; w_op->write_flag = false; //if(entry->m_mem_req->m_type == MRT_DSTORE) // w_op = NULL; broadcast_rdy_op(w_op); entry->req_ops.pop_front(); } //dcache_insert(req->m_addr); //insert the value into the DCACHE /* The following code will free mshr entry */ list<m_mshr_entry_s *>::iterator mii = search_matching_mshr_itr(req->m_addr); m_mshr.erase(mii); free_mshr_entry(entry); }
uint32_t inode_get_idx_by_path(const char *path) { struct inode_dir_ctx *dctx = inode_dir_ctx_get(); uint32_t inode_idx = 0; struct ext4_inode inode; /* Paths from fuse are always absolute */ assert(IS_PATH_SEPARATOR(path[0])); DEBUG("Looking up: %s", path); struct dcache_entry *dc_entry = get_cached_inode_num(&path); inode_idx = dcache_get_inode(dc_entry); DEBUG("Looking up after dcache: %s", path); do { uint32_t offset = 0; struct ext4_dir_entry_2 *dentry = NULL; path = skip_trailing_backslash(path); uint8_t path_len = get_path_token_len(path); if (path_len == 0) break; inode_get_by_number(inode_idx, &inode); inode_dir_ctx_reset(dctx, &inode); while ((dentry = inode_dentry_get(&inode, offset, dctx))) { offset += dentry->rec_len; if (!dentry->inode) continue; if (path_len != dentry->name_len) continue; if (memcmp(path, dentry->name, dentry->name_len)) continue; inode_idx = dentry->inode; DEBUG("Lookup following inode %d", inode_idx); if (S_ISDIR(inode.i_mode)) { dc_entry = dcache_insert(dc_entry, path, path_len, inode_idx); } break; } /* Couldn't find the entry at all */ if (dentry == NULL) { break; } } while((path = strchr(path, '/'))); inode_dir_ctx_put(dctx); return inode_idx; }
void memory_c::fill_queue() { //static bool delay_pte_load_done = false; /* For Lab #2, you need to fill out this function */ /* CAUTION!: This function is not completed. Please complete this function */ // if(delay_pte_load_done) // { // pte_load_done = true; // delay_pte_load_done = false; // } while(!temp_mem_queue.empty()) { Op *WB_op = temp_mem_queue.front(); fill_retire_queue(WB_op); temp_mem_queue.pop_front(); } if (dram_out_queue.empty()) return; mem_req_s *req = dram_out_queue.front(); dram_out_queue.pop_front(); /* search for matching mshr entry */ m_mshr_entry_s *entry = search_matching_mshr(req->m_addr); dcache_insert(req->m_addr); while(entry->req_ops.size()) { Op *w_op = entry->req_ops.front(); if(w_op->opcode == OP_LD_PTE) { pte_load_done = true; } else broadcast_rdy_op(w_op); entry->req_ops.pop_front(); } /* The following code will free mshr entry */ list<m_mshr_entry_s *>::iterator mii = search_matching_mshr_itr(req->m_addr); m_mshr.erase(mii); free_mshr_entry(entry); }