new public void tick()
        {
            //must be the very first thing that's done
            cycles++;
            meta_mctrl.tick(cid);
            wbthrottle.tick();
            mwbmode.tick(cid);

            //load stats
            for (int p = 0; p < Config.N; p++)
            {
                //read load
                if (rload_per_proc[p] > 0)
                {
                    Stat.mctrls2[cid].rbinaryloadtick_per_proc[p].Collect();
                }
                Stat.mctrls2[cid].rloadtick_per_proc[p].Collect(rload_per_proc[p]);

                //write load
                if (wload_per_proc[p] > 0)
                {
                    Stat.mctrls2[cid].wbinaryloadtick_per_proc[p].Collect();
                }
                Stat.mctrls2[cid].wloadtick_per_proc[p].Collect(wload_per_proc[p]);
            }

            //busy/idle stats
            if (rload > 0)
            {
                read_loaded_time++;
                if (read_unloaded_time > 0)
                {
                    //Stat.mctrls2[cid].read_unloaded_time.Collect(read_unloaded_time);
                }
                read_unloaded_time = 0;
            }
            else
            {
                read_unloaded_time++;
                if (read_loaded_time > 0)
                {
                    //Stat.mctrls2[cid].read_loaded_time.Collect(read_loaded_time);
                }
                read_loaded_time = 0;
            }

            /*** writeback mode ***/
            update_wb_mode();

            /*
             * if (wb_mode && cid == 0) {
             *  Console.WriteLine("==={0}==============================================", cycles);
             *  Console.WriteLine("Reads to Drain:  {0}", reads_to_drain);
             *  Console.WriteLine("Writes Serviced: {0}", ((DecoupledWBFullServeN) mwbmode).serve_cnt[0]);
             *  uint r = 0;
             *  for (uint b = 0; b < bmax; b++) {
             *      Console.Write("{0}\t", b);
             *      foreach (Cmd cmd in cmdqs[r, b]) {
             *          Console.Write("{0} {1}\t", cmd.type.ToString(), can_schedule_cmd(cmd));
             *      }
             *      Console.WriteLine();
             *  }
             * }
             */

            /*** clock factor ***/
            if (cycles % Config.mem.clock_factor != 0)
            {
                return;
            }

            if ((Config.proc.cache_insertion_policy == "PFA") && (cycles % (6 * Config.mem.clock_factor) == 0))
            {
                int indexi, indexj;
                for (indexi = 0; indexi < rmax; indexi++)
                {
                    for (indexj = 0; indexj < bmax; indexj++)
                    {
                        Measurement.read_MLP_cal(ref readqs[indexi, indexj]);
                        Measurement.write_MLP_cal(ref writeqs[indexi, indexj]);
                        Measurement.MLP_cal(ref inflightqs[indexi, indexj]);
                    }
                }
            }

            /*** serve completed request ***/
            if (bus_q.Count > 0 && bus_q[0].ts <= cycles)
            {
                MemAddr addr = bus_q[0].addr;
                bus_q.RemoveAt(0);

                List <Req> inflight_q = inflightqs[addr.rid, addr.bid];


                Dbg.Assert(inflight_q.Count > 0);

                Dbg.Assert(addr == inflight_q[0].addr);
                Req req = inflight_q[0];
                inflight_q.RemoveAt(0);

                if (Config.proc.cache_insertion_policy == "PFA")
                {
                    Measurement.DramBankPidDeUpdate(req);
                }

                dequeue_req(req);
            }

            Cmd best_cmd = find_best_cmd();
            Req best_req = find_best_req();

            //nothing to issue
            if (best_cmd == null && best_req == null)
            {
                if (Config.proc.cache_insertion_policy == "PFA")
                {
                    CheckBusConflict();
                }
                return;
            }

            //arbitrate between command and request
            bool is_issue_req = false;

            if (best_req != null && best_cmd == null)
            {
                is_issue_req = true;
            }
            else if (best_req == null && best_cmd != null)
            {
                is_issue_req = false;
            }
            else
            {
                if (best_req == __better_req(best_cmd.req, best_req))
                {
                    is_issue_req = true;
                }
                else
                {
                    is_issue_req = false;
                }
            }

            //issue command or request
            if (is_issue_req)
            {
                if (!best_req.migrated_request)
                {
                    if (Config.proc.cache_insertion_policy == "RBLA")
                    {
                        RowStat.UpdateDict(RowStat.DramDict, best_req, this);
                    }
                    else if (Config.proc.cache_insertion_policy == "PFA")
                    {
                        RowStat.UpdateDict(RowStat.DramDict, best_req, this);
//                       Measurement.DramBankPidEnUpdate(best_req);
                    }
//                    if (Config.proc.cache_insertion_policy == "PFA")
//                        Measurement.DramBankPidEnUpdate(best_req);
                }

                if (Config.proc.cache_insertion_policy == "PFA")
                {
                    Measurement.DramBankPidEnUpdate(best_req);
                }

                issue_req(best_req);
            }
            else
            {
                issue_cmd(best_cmd);
            }

            if (Config.proc.cache_insertion_policy == "PFA")
            {
                CheckBusConflict();
            }
        }