Exemple #1
0
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; 
	
	dram_out_queue.sort();
	mem_req_s *req = dram_out_queue.front(); 
	dram_out_queue.pop_front(); 

	/* insert into cache */
	cache_insert(data_cache,req->m_addr);

	/* 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); 
  
}
Exemple #3
0
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);
  
}