/// <summary> /// 注册动画对应的触发事件 /// </summary> void RegisterAnimation(int key, SkillEffectPlayer effect_player) { TriggerSetting[] trigger_settings = effect_player.TriggerSettings; if (trigger_settings == null) { return; } // 根据TriggerSettings来进行动画事件的注册 for (int i = 0; i < trigger_settings.GetLength(0); ++i) { int tigger_int = key * 100 + i; // 获取AnimationClip TriggerSetting trigger_setting = trigger_settings[i]; AnimationClip animation_clip = trigger_setting.Animation; if (animation_clip == null) { GameDebug.LogError(effect_player.gameObject.name + "'s animationclip is null"); continue; } // 初始化回调相关参数 CallBackInfo info = new CallBackInfo(); info.mTime = trigger_setting.StartFrame * 0.0333f; info.mCallBack = effect_player.OnFrameHit; info.mParam = trigger_setting; // 注册回调事件 RegisterEvent(tigger_int, animation_clip.name, info); } }
public void OnHit(int param) { CallBackInfo info = GetCallBackInfos(param); if (info != null) { info.mCallBack(info.mParam); } }
public CallBackData(CallBackInfo info) { if (info == null) { throw new ArgumentNullException(nameof(info)); } this.ActorId = info.ActorId; this.ServiceUri = info.ServiceUri; }
public Transaction(Transaction t) { transactionType = t.transactionType; callback = t.callback; // address = t.address; data = t.data; address = t.address; timeAdded = t.timeAdded; timeReturned = t.timeReturned; // pid = t.pid; }
public BusPacket(BusPacketType packtype, UInt64 physicalAddr, uint col, uint rw, int r, uint b, UInt64 dat, CallBackInfo callback_, Stream dramsim_log_) { dramsim_log = dramsim_log_; callback = callback_; busPacketType = packtype; column = col; row = rw; bank = b; physicalAddress = physicalAddr; data = dat; }
private void handle_write_callback(CallBackInfo callback) { if (callback != null) { foreach (var id in callback.stage_id) { pipeline[id].status = Status.Complete; } } bandwidth_bit += 64; }
// friend ostream &operator<<(ostream &os, const Transaction &t); //functions public Transaction(TransactionType transType, UInt64 addr, UInt64 dat, CallBackInfo call_)// UInt64 addr, UInt64 dat, UInt64 block, int pid_,bool pim_) { callback = call_; data = dat; // block_addr = block; transactionType = transType; address = call_.address; address = addr; //pid = pid_; //pim = pim_; }
public bool addTransaction(bool isWrite, UInt64 addr, CallBackInfo callback) { TransactionType type = isWrite ? TransactionType.DATA_WRITE : TransactionType.DATA_READ; Transaction trans = new Transaction(type, addr, 0, callback); // push_back in memoryController will make a copy of this during // addTransaction so it's kosher for the reference to be local if (memoryController.WillAcceptTransaction()) { return(memoryController.addTransaction(ref trans)); } else { pendingTransactions.PushBack(trans); return(true); } }
public MailData(MailInfo info, CallBackInfo callBack) { if (info == null) { throw new ArgumentNullException(nameof(info)); } this.Id = info.Id; this.From = info.From; this.BccAddresses = info.BccAddresses; this.Body = info.Body; this.CCAddresses = info.CCAddresses; this.IsHtml = info.IsHtml; this.Subject = info.Subject; this.TOAddresses = info.TOAddresses; if (callBack != null) { this.CallBack = new CallBackData(callBack); } }
public void UpdateGui(CallBackInfo info) { if (System.Threading.Thread.CurrentThread == this.Dispatcher.Thread) { // Update the GUI //txtShoeCount.Text = info.NumCards.ToString(); //sliderDecks.Value = info.NumDecks; //txtDeckCount.Text = (info.NumDecks == 1 ? "1 Deck" : info.NumDecks + " Decks"); if (info.EmptyHand) { cardListBox.Items.Clear(); //txtHandCount.Text = "0"; } } else { // Not the dispatcher thread that's running this method! this.Dispatcher.BeginInvoke(new ClientUpdateDelegate(UpdateGui), info); } }
public async Task <MailServiceError> SendMailAsync(MailInfo mail, CallBackInfo callback, CancellationToken cancellationToken) { if (mail == null) { throw new ArgumentNullException(nameof(mail)); } MailServiceError checkMail = mail.Check(); if (checkMail == MailServiceError.Ok) { MailData mailData = new MailData(mail, callback); using (var trx = this.StateManager.CreateTransaction()) { await this.mailQueue.EnqueueAsync(trx, mailData); await trx.CommitAsync(); } } return(checkMail); }
/// <summary> /// Read Complete Callback /// </summary> /// <param name="block_addr">Block address</param> /// <param name="addr_">Actual address</param> public void handle_read_callback(CallBackInfo callback) { var block_addr = callback.block_addr; var addr_ = callback.address; if (Coherence.consistency == Consistency.SpinLock) { Coherence.spin_lock.relese_lock(addr_); } ins_w.set_ready(block_addr, this.cycle); MSHR.RemoveAll(x => x.block_addr == block_addr); if (PIMConfigs.use_l1_cache) { if (!L1Cache.search_block(block_addr, General.RequestType.READ)) { L1Cache.add(block_addr, General.RequestType.READ, this.pid); } bandwidth_bit = bandwidth_bit + PIMConfigs.l1_cacheline_size * 8; } Coherence.spin_lock.relese_lock(callback.address); }
public void Disconnected(CallBackInfo info) { Log.Information("CallBackController-Disconnected({status},{message},{exception})", info.Status, info.Message, info.Exception); }
public void Connected(CallBackInfo info) { Log.Information("CallBackController-Connected({status},{message})", info.Status, info.Message); }
public override void Step() { cycle++; //get requests MemRequest req_ = new MemRequest(); while (Mctrl.get_req(this.pid, ref req_)) { TransationQueue.Add(req_); } if (Config.use_pim) { while (PIMMctrl.get_req(this.pid, ref req_)) { TransationQueue.Add(req_); } } //marge same requests bool restart = false; while (!restart) { restart = true; for (int i = 0; i < TransationQueue.Count; i++) { for (int j = 0; j < TransationQueue.Count; j++) { if (i != j && TransationQueue[i].address == TransationQueue[j].address && TransationQueue[i].pim == TransationQueue[j].pim) { foreach (var id in TransationQueue[j].pid) { TransationQueue[i].pid.Add(id); } TransationQueue.RemoveAt(j); restart = false; continue; } } } } //update memory if (!pendingTrans) { if (TransationQueue.Count() > 0) { MemRequest req = TransationQueue[0]; switch (req.memtype) { case MemReqType.READ: transType = TransactionType.DATA_READ; break; case MemReqType.WRITE: transType = TransactionType.DATA_WRITE; break; case MemReqType.RETURN_DATA: transType = TransactionType.RETURN_DATA; break; case MemReqType.FLUSH: transType = TransactionType.DATA_WRITE; break; case MemReqType.LOAD: transType = TransactionType.DATA_READ; break; case MemReqType.STORE: transType = TransactionType.DATA_WRITE; break; default: transType = TransactionType.RETURN_DATA; break; } TransationQueue.RemoveAt(0); if (transType != TransactionType.DATA_READ && transType != TransactionType.DATA_WRITE) { return; } CallBackInfo callback = new CallBackInfo(); callback.address = req.address; callback.block_addr = req.block_addr; callback.pid = req.pid; callback.pim = req.pim; if (req.memtype == MemReqType.FLUSH) { callback.flush = true; transType = TransactionType.DATA_WRITE; } if (req.memtype == MemReqType.LOAD) { callback.load = true; transType = TransactionType.DATA_READ; callback.stage_id = req.stage_id; } if (req.memtype == MemReqType.STORE) { callback.store = true; transType = TransactionType.DATA_WRITE; callback.stage_id = req.stage_id; } trans = new Transaction(transType, req.address, req.data, callback);//addr, data, req.block_addr, req.pid, req.pim); if (Config.DEBUG_MEMORY) { DEBUG.WriteLine("--DDR[" + this.pid + "] ADD transaction: [" + req.address.ToString("X") + "]"); } alignTransactionAddress(ref trans); if (cycle >= clockCycle) { if (!memorySystem.addTransaction(ref trans)) { pendingTrans = true; } else { if (Config.dram_config.RETURN_TRANSACTIONS) { transactionReceiver.add_pending(trans, cycle); } //#endif // the memory system accepted our request so now it takes ownership of it trans = null; } } else { pendingTrans = true; } } } else { if (pendingTrans && cycle >= clockCycle) { pendingTrans = !memorySystem.addTransaction(ref trans); if (!pendingTrans) { //#ifdef RETURN_TRANSACTIONS transactionReceiver.add_pending(trans, cycle); //#endif trans = null; } } } memorySystem.update(); }
public bool addTransaction(bool isWrite, UInt64 addr, CallBackInfo callback) { uint channelNumber = findChannelNumber(addr); return(channels[(int)channelNumber].addTransaction(isWrite, addr, callback)); }
/// <summary> /// 注册动画触发事件 /// </summary> /// <param name="id"></param> /// <param name="ani"></param> /// <param name="kInfo"></param> void RegisterEvent(int id, string ani, CallBackInfo call_Info) { CallBackInfo info = GetCallBackInfos(id); if (info == null) { mEventMap.Add(id, call_Info); } else { GameDebug.LogError("[RegisterEvent]Has same id"); } if (m_AnimationClips == null) { GameDebug.LogError("[RegisterEvent]m_AnimationClips is null"); return; } // 注册AnimationEvent AnimationClip[] clips = m_AnimationClips; //int count = 0; bool is_find = false; for (int i = 0; i < clips.Length; ++i) { AnimationClip clip = clips[i]; if (clip.name == ani) { is_find = false; // 当前clip中是否已经注册过该事件 var clip_events = clip.events; if (clip_events != null) { for (int find_index = 0; find_index < clip_events.Length; ++find_index) { var clip_event = clip_events[find_index]; if (clip_event.functionName == "OnHit" && clip_event.intParameter == id) { is_find = true; break; } } } if (is_find) { break; } float hitTime = call_Info.mTime; AnimationEvent ent = new AnimationEvent(); ent.messageOptions = SendMessageOptions.DontRequireReceiver; ent.time = hitTime != 0 ? hitTime : 0.001f + hitTime; // 不能与OnPlayBegin同一时间,不然有可能OnHit不会被调用 ent.functionName = "OnHit"; ent.intParameter = id; clip.AddEvent(ent); // count++; // if(count > 1) // { // GameDebug.LogError("count = " + count + " clip.name = " + clip.name); // } } } }
public override void Step() { cycle++; current_statue = Macros.HMC_OK; MemRequest req_ = new MemRequest(); while (Mctrl.get_req(this.pid, ref req_)) { TransationQueue.Add(req_); } if (Config.use_pim) { while (PIMMctrl.get_req(this.pid, ref req_)) { TransationQueue.Add(req_); } } bool restart = false; while (!restart) { restart = true; for (int i = 0; i < TransationQueue.Count; i++) { for (int j = 0; j < TransationQueue.Count; j++) { if (i != j && TransationQueue[i].address == TransationQueue[j].address && TransationQueue[i].pim == TransationQueue[j].pim) { foreach (var id in TransationQueue[j].pid) { TransationQueue[i].pid.Add(id); } TransationQueue.RemoveAt(j); restart = false; continue; } } } } if (TransationQueue.Count() > 0) { MemRequest req = TransationQueue[0]; UInt64[] packet = new UInt64[Macros.HMC_MAX_UQ_PACKET]; hmc_rqst type = hmc_rqst.RD64; UInt64 d_response_head = 0; UInt64 d_response_tail = 0; hmc_response d_type = hmc_response.MD_RD_RS; uint d_length = 0; UInt16 d_tag = 0; uint d_rtn_tag = 0; uint d_src_link = 0; uint d_rrp = 0; uint d_frp = 0; uint d_seq = 0; uint d_dinv = 0; uint d_errstat = 0; uint d_rtc = 0; UInt32 d_crc = 0; zero_packet(ref packet); switch (req.memtype) { case MemReqType.READ: type = hmc_rqst.RD64; break; case MemReqType.WRITE: type = hmc_rqst.WR64; break; case MemReqType.FLUSH: type = hmc_rqst.WR64; break; case MemReqType.LOAD: type = hmc_rqst.RD64; break; case MemReqType.STORE: type = hmc_rqst.WR64; break; case MemReqType.RETURN_DATA: default: break; } if (current_statue != Macros.HMC_STALL) { uint cub = 0; uint link = 0; ulong[] payload = { 0x00L, 0x00L, 0x00L, 0x00L, 0x00L, 0x00L, 0x00L, 0x00L }; UInt64 head = 0x00L; UInt64 tail = 0x00L; hmc.hmcsim_build_memrequest( cub, req.address, tag, type, link, payload, ref head, ref tail); /* * read packets have: * head + * tail * */ tag++; if (type == hmc_rqst.RD64) { packet[0] = head; packet[1] = tail; } if (type == hmc_rqst.WR64) { packet[0] = head; packet[1] = 0x05L; packet[2] = 0x06L; packet[3] = 0x07L; packet[4] = 0x08L; packet[5] = 0x09L; packet[6] = 0x0AL; packet[7] = 0x0BL; packet[8] = 0x0CL; packet[9] = tail; } current_statue = hmc.hmcsim_send(packet); if (current_statue == 0) { var newitem = new CallBackInfo(req.address, req.block_addr, req.pim, req.pid); if (req.memtype == MemReqType.FLUSH) { newitem.flush = true; } if (req.memtype == MemReqType.LOAD) { newitem.load = true; newitem.stage_id = req.stage_id; } if (req.memtype == MemReqType.STORE) { newitem.store = true; newitem.stage_id = req.stage_id; } callback.Add(new Tuple <ulong, CallBackInfo>(tag - 1, newitem)); TransationQueue.RemoveAt(0); current_statue = Macros.HMC_OK; while (current_statue != Macros.HMC_STALL) { int stall_sig = 0; for (int z = 0; z < hmc.num_links; z++) { int res = hmc.hmcsim_recv(cub, (uint)z, ref packet); if (res == Macros.HMC_STALL) { stall_sig++; } else { /* successfully received a packet */ if (Config.DEBUG_MEMORY) { DEBUG.WriteLine("SUCCESS : RECEIVED A SUCCESSFUL PACKET RESPONSE"); } hmc.hmcsim_decode_memresponse( packet, ref d_response_head, ref d_response_tail, ref d_type, ref d_length, ref d_tag, ref d_rtn_tag, ref d_src_link, ref d_rrp, ref d_frp, ref d_seq, ref d_dinv, ref d_errstat, ref d_rtc, ref d_crc); if (Config.DEBUG_MEMORY) { DEBUG.WriteLine("RECV tag=" + d_tag + "; rtn_tag=" + d_rtn_tag); } // all_recv++; var item = callback.FindIndex(s => s.Item1 == d_tag); if (item < 0) { //read none if (Config.DEBUG_MEMORY) { DEBUG.WriteLine(""); } } if (d_type == hmc_response.RD_RS) { if (callback[item].Item2.load) { foreach (var pimunit in (callback[item].Item2.getsource() as List <ComputationalUnit>)) { pimunit.read_callback(callback[item].Item2); } goto end; } if (!callback[item].Item2.pim) { foreach (var proc in (callback[item].Item2.getsource() as List <Proc>)) { proc.read_callback(callback[item].Item2); } } else { if (PIMConfigs.unit_type == PIM_Unit_Type.Processors) { foreach (var pimproc in (callback[item].Item2.getsource() as List <PIMProc>)) { pimproc.read_callback(callback[item].Item2); } } else { foreach (var pimunit in (callback[item].Item2.getsource() as List <ComputationalUnit>)) { pimunit.read_callback(callback[item].Item2); } } } } else { if (d_type == hmc_response.WR_RS) { if (callback[item].Item2.store) { foreach (var pimunit in (callback[item].Item2.getsource() as List <ComputationalUnit>)) { pimunit.write_callback(callback[item].Item2); } goto end; } if (callback[item].Item2.flush) { Coherence.flush_queue.Remove(callback[item].Item2.block_addr); DEBUG.WriteLine("-- Flushed data : [" + callback[item].Item2.block_addr + "] [" + callback[item].Item2.address + "]"); } else { if (!callback[item].Item2.pim) { foreach (var proc in (callback[item].Item2.getsource() as List <Proc>)) { proc.write_callback(callback[item].Item2); } } else { if (PIMConfigs.unit_type == PIM_Unit_Type.Processors) { foreach (var pimproc in (callback[item].Item2.getsource() as List <PIMProc>)) { pimproc.write_callback(callback[item].Item2); } } else { foreach (var pimunit in (callback[item].Item2.getsource() as List <ComputationalUnit>)) { pimunit.write_callback(callback[item].Item2); } } } } } else { //error Environment.Exit(0); } } //if (Coherence.consistency == Consistency.SpinLock) //{ // if (callback[item].Item5) // { // Coherence.spin_lock.relese_lock(callback[item].Item4); // } //} end: callback.RemoveAt(item); } /* * zero the packet * */ zero_packet(ref packet); } if (stall_sig == hmc.num_links) { /* * if all links returned stalls, * then we're done receiving packets * */ if (Config.DEBUG_MEMORY) { DEBUG.WriteLine("STALLED : STALLED IN RECEIVING"); } current_statue = Macros.HMC_STALL; } stall_sig = 0; } } else { // hmc.hmcsim_clock(); } hmc.hmcsim_clock(); } } else { uint cub = 0; UInt64[] packet = new UInt64[Macros.HMC_MAX_UQ_PACKET]; uint d_length = 0; UInt16 d_tag = 0; uint d_rtn_tag = 0; uint d_src_link = 0; uint d_rrp = 0; uint d_frp = 0; uint d_seq = 0; uint d_dinv = 0; uint d_errstat = 0; uint d_rtc = 0; UInt32 d_crc = 0; UInt64 d_response_head = 0; UInt64 d_response_tail = 0; hmc_response d_type = hmc_response.MD_RD_RS; zero_packet(ref packet); for (int z = 0; z < hmc.num_links; z++) { int res = hmc.hmcsim_recv(cub, (uint)z, ref packet); if (res == Macros.HMC_STALL) { //stall_sig++; } else { /* successfully received a packet */ if (Config.DEBUG_MEMORY) { DEBUG.WriteLine("SUCCESS : RECEIVED A SUCCESSFUL PACKET RESPONSE"); } hmc.hmcsim_decode_memresponse( packet, ref d_response_head, ref d_response_tail, ref d_type, ref d_length, ref d_tag, ref d_rtn_tag, ref d_src_link, ref d_rrp, ref d_frp, ref d_seq, ref d_dinv, ref d_errstat, ref d_rtc, ref d_crc); if (Config.DEBUG_MEMORY) { DEBUG.WriteLine("RECV tag=" + d_tag + "; rtn_tag=" + d_rtn_tag); } var item = callback.FindIndex(s => s.Item1 == d_tag); if (item < 0) { //error if (Config.DEBUG_MEMORY) { DEBUG.WriteLine(""); } } if (d_type == hmc_response.RD_RS) { if (callback[item].Item2.load) { foreach (var pimunit in (callback[item].Item2.getsource() as List <ComputationalUnit>)) { pimunit.read_callback(callback[item].Item2); } goto endr; } if (!callback[item].Item2.pim) { foreach (var procs in (callback[item].Item2.getsource() as List <Proc>)) { procs.read_callback(callback[item].Item2); } } else { if (PIMConfigs.unit_type == PIM_Unit_Type.Processors) { foreach (var pimproc in (callback[item].Item2.getsource() as List <ComputationalUnit>)) { (pimproc as PIMProc).read_callback(callback[item].Item2); } } else { foreach (var pimunit in (callback[item].Item2.getsource() as List <ComputationalUnit>)) { pimunit.read_callback(callback[item].Item2); } } } } else { if (d_type == hmc_response.WR_RS) { if (callback[item].Item2.store) { foreach (var pimunit in (callback[item].Item2.getsource() as List <ComputationalUnit>)) { pimunit.write_callback(callback[item].Item2); } goto endr; } if (callback[item].Item2.flush) { Coherence.flush_queue.Remove(callback[item].Item2.block_addr); DEBUG.WriteLine("-- Flushed data : [" + callback[item].Item2.block_addr + "] [" + callback[item].Item2.address + "]"); } else { if (!callback[item].Item2.pim) { foreach (var proc in (callback[item].Item2.getsource() as List <Proc>)) { proc.write_callback(callback[item].Item2); } } else { if (PIMConfigs.unit_type == PIM_Unit_Type.Processors) { foreach (var pimproc in (callback[item].Item2.getsource() as List <ComputationalUnit>)) { (pimproc as PIMProc).write_callback(callback[item].Item2); } } else { foreach (var pimunit in (callback[item].Item2.getsource() as List <ComputationalUnit>)) { pimunit.write_callback(callback[item].Item2); } } } } } else { //error Environment.Exit(0); } } //if (Coherence.consistency == Consistency.SpinLock) //{ // if (callback[item].Item5) // { // Coherence.spin_lock.relese_lock(callback[item].Item4); // } //} endr: callback.RemoveAt(item); // all_recv++; } /* * zero the packet * */ zero_packet(ref packet); } hmc.hmcsim_clock(); } }
public void write_complete(uint id, UInt64 addr, UInt64 done_cycle, CallBackInfo callback)//UInt64 address, UInt64 block_addr, UInt64 done_cycle,bool pim_) { int it = find(pendingWriteRequests, addr); if (it == pendingWriteRequests.Count()) { if (Config.DEBUG_MEMORY) { DEBUG.WriteLine("ERROR : Cant find a pending read for this one"); } Environment.Exit(1); } else { if (pendingWriteRequests.ElementAt(it).Value.Count() == 0) { if (Config.DEBUG_MEMORY) { DEBUG.WriteLine("ERROR : Nothing here, either"); } Environment.Exit(1); } } UInt64 added_cycle = pendingWriteRequests[addr].First(); UInt64 latency = done_cycle - added_cycle; // for (int i = 0; i < proc.Count(); i++) if (callback.store) { foreach (var pimunit in (callback.getsource() as List <ComputationalUnit>)) { pimunit.write_callback(callback); } goto endw; } // proc[(int)id].write_callback(callback.block_addr, callback.address); if (callback.flush) { Coherence.flush_queue.Remove(callback.block_addr); DEBUG.WriteLine("-- Flushed data : [" + callback.block_addr + "] [" + callback.address + "]"); goto endw; } else { if (!callback.pim) { foreach (var proc in (callback.getsource() as List <Proc>)) { proc.write_callback(callback); } goto endw; } else { if (PIMConfigs.unit_type == PIM_Unit_Type.Processors) { foreach (var pimproc in (callback.getsource() as List <ComputationalUnit>)) { (pimproc as PIMProc).write_callback(callback); } goto endw; } else { foreach (var pimunit in (callback.getsource() as List <ComputationalUnit>)) { pimunit.write_callback(callback); } } } } //if (Coherence. consistency == Consistency.SpinLock) // { // if (callback.pim) // { // Coherence.spin_lock.relese_lock(callback.address); // } // } endw: pendingWriteRequests[addr].RemoveAt(0); if (pendingWriteRequests[addr].Count() == 0) { pendingWriteRequests.Remove(addr); } if (Config.DEBUG_MEMORY) { DEBUG.WriteLine("Write Callback: 0x" + addr.ToString("X") + " latency=" + latency + "cycles (" + done_cycle + "->" + added_cycle + ")"); } }
private void handle_write_callback(CallBackInfo callback) { bandwidth_bit += 64; }