StateMachine.py (9595:470016acf37d) | StateMachine.py (9596:aa73a81cf92c) |
---|---|
1# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 2# Copyright (c) 2009 The Hewlett-Packard Development Company 3# All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions are 7# met: redistributions of source code must retain the above copyright 8# notice, this list of conditions and the following disclaimer; --- 248 unchanged lines hidden (view full) --- 257 typedef ${c_ident}Params Params; 258 $c_ident(const Params *p); 259 static int getNumControllers(); 260 void init(); 261 MessageBuffer* getMandatoryQueue() const; 262 const int & getVersion() const; 263 const std::string toString() const; 264 const std::string getName() const; | 1# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 2# Copyright (c) 2009 The Hewlett-Packard Development Company 3# All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions are 7# met: redistributions of source code must retain the above copyright 8# notice, this list of conditions and the following disclaimer; --- 248 unchanged lines hidden (view full) --- 257 typedef ${c_ident}Params Params; 258 $c_ident(const Params *p); 259 static int getNumControllers(); 260 void init(); 261 MessageBuffer* getMandatoryQueue() const; 262 const int & getVersion() const; 263 const std::string toString() const; 264 const std::string getName() const; |
265 void stallBuffer(MessageBuffer* buf, Address addr); 266 void wakeUpBuffers(Address addr); 267 void wakeUpAllBuffers(); | |
268 void initNetworkPtr(Network* net_ptr) { m_net_ptr = net_ptr; } 269 void print(std::ostream& out) const; 270 void wakeup(); 271 void printStats(std::ostream& out) const; 272 void clearStats(); 273 void blockOnQueue(Address addr, MessageBuffer* port); 274 void unblock(Address addr); 275 void recordCacheTrace(int cntrl, CacheRecorder* tr); --- 468 unchanged lines hidden (view full) --- 744 745const string 746$c_ident::getName() const 747{ 748 return m_name; 749} 750 751void | 265 void initNetworkPtr(Network* net_ptr) { m_net_ptr = net_ptr; } 266 void print(std::ostream& out) const; 267 void wakeup(); 268 void printStats(std::ostream& out) const; 269 void clearStats(); 270 void blockOnQueue(Address addr, MessageBuffer* port); 271 void unblock(Address addr); 272 void recordCacheTrace(int cntrl, CacheRecorder* tr); --- 468 unchanged lines hidden (view full) --- 741 742const string 743$c_ident::getName() const 744{ 745 return m_name; 746} 747 748void |
752$c_ident::stallBuffer(MessageBuffer* buf, Address addr) 753{ 754 if (m_waiting_buffers.count(addr) == 0) { 755 MsgVecType* msgVec = new MsgVecType; 756 msgVec->resize(m_max_in_port_rank, NULL); 757 m_waiting_buffers[addr] = msgVec; 758 } 759 (*(m_waiting_buffers[addr]))[m_cur_in_port_rank] = buf; 760} 761 762void 763$c_ident::wakeUpBuffers(Address addr) 764{ 765 if (m_waiting_buffers.count(addr) > 0) { 766 // 767 // Wake up all possible lower rank (i.e. lower priority) buffers that could 768 // be waiting on this message. 769 // 770 for (int in_port_rank = m_cur_in_port_rank - 1; 771 in_port_rank >= 0; 772 in_port_rank--) { 773 if ((*(m_waiting_buffers[addr]))[in_port_rank] != NULL) { 774 (*(m_waiting_buffers[addr]))[in_port_rank]->reanalyzeMessages(addr); 775 } 776 } 777 delete m_waiting_buffers[addr]; 778 m_waiting_buffers.erase(addr); 779 } 780} 781 782void 783$c_ident::wakeUpAllBuffers() 784{ 785 // 786 // Wake up all possible buffers that could be waiting on any message. 787 // 788 789 std::vector<MsgVecType*> wokeUpMsgVecs; 790 791 if(m_waiting_buffers.size() > 0) { 792 for (WaitingBufType::iterator buf_iter = m_waiting_buffers.begin(); 793 buf_iter != m_waiting_buffers.end(); 794 ++buf_iter) { 795 for (MsgVecType::iterator vec_iter = buf_iter->second->begin(); 796 vec_iter != buf_iter->second->end(); 797 ++vec_iter) { 798 if (*vec_iter != NULL) { 799 (*vec_iter)->reanalyzeAllMessages(); 800 } 801 } 802 wokeUpMsgVecs.push_back(buf_iter->second); 803 } 804 805 for (std::vector<MsgVecType*>::iterator wb_iter = wokeUpMsgVecs.begin(); 806 wb_iter != wokeUpMsgVecs.end(); 807 ++wb_iter) { 808 delete (*wb_iter); 809 } 810 811 m_waiting_buffers.clear(); 812 } 813} 814 815void | |
816$c_ident::blockOnQueue(Address addr, MessageBuffer* port) 817{ 818 m_is_blocking = true; 819 m_block_map[addr] = port; 820} 821 822void 823$c_ident::unblock(Address addr) --- 945 unchanged lines hidden --- | 749$c_ident::blockOnQueue(Address addr, MessageBuffer* port) 750{ 751 m_is_blocking = true; 752 m_block_map[addr] = port; 753} 754 755void 756$c_ident::unblock(Address addr) --- 945 unchanged lines hidden --- |