StateMachine.py (7566:6919df046bba) StateMachine.py (7567:238f99c9f441)
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;

--- 224 unchanged lines hidden (view full) ---

233 $c_ident(const Params *p);
234 static int getNumControllers();
235 void init();
236 MessageBuffer* getMandatoryQueue() const;
237 const int & getVersion() const;
238 const std::string toString() const;
239 const std::string getName() const;
240 const MachineType getMachineType() 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;

--- 224 unchanged lines hidden (view full) ---

233 $c_ident(const Params *p);
234 static int getNumControllers();
235 void init();
236 MessageBuffer* getMandatoryQueue() const;
237 const int & getVersion() const;
238 const std::string toString() const;
239 const std::string getName() const;
240 const MachineType getMachineType() const;
241 void stallBuffer(MessageBuffer* buf, Address addr);
242 void wakeUpBuffers(Address addr);
241 void initNetworkPtr(Network* net_ptr) { m_net_ptr = net_ptr; }
242 void print(std::ostream& out) const;
243 void printConfig(std::ostream& out) const;
244 void wakeup();
245 void printStats(std::ostream& out) const;
246 void clearStats();
247 void blockOnQueue(Address addr, MessageBuffer* port);
248 void unblock(Address addr);

--- 26 unchanged lines hidden (view full) ---

275int m_buffer_size;
276int m_recycle_latency;
277std::map<std::string, std::string> m_cfg;
278NodeID m_version;
279Network* m_net_ptr;
280MachineID m_machineID;
281bool m_is_blocking;
282std::map<Address, MessageBuffer*> m_block_map;
243 void initNetworkPtr(Network* net_ptr) { m_net_ptr = net_ptr; }
244 void print(std::ostream& out) const;
245 void printConfig(std::ostream& out) const;
246 void wakeup();
247 void printStats(std::ostream& out) const;
248 void clearStats();
249 void blockOnQueue(Address addr, MessageBuffer* port);
250 void unblock(Address addr);

--- 26 unchanged lines hidden (view full) ---

277int m_buffer_size;
278int m_recycle_latency;
279std::map<std::string, std::string> m_cfg;
280NodeID m_version;
281Network* m_net_ptr;
282MachineID m_machineID;
283bool m_is_blocking;
284std::map<Address, MessageBuffer*> m_block_map;
285typedef std::vector<MessageBuffer*> MsgVecType;
286typedef m5::hash_map< Address, MsgVecType* > WaitingBufType;
287WaitingBufType m_waiting_buffers;
288int m_max_in_port_rank;
289int m_cur_in_port_rank;
283static ${ident}_ProfileDumper s_profileDumper;
284${ident}_Profiler m_profiler;
285static int m_num_controllers;
286
287// Internal functions
288''')
289
290 for func in self.functions:

--- 82 unchanged lines hidden (view full) ---

373{
374 m_version = p->version;
375 m_transitions_per_cycle = p->transitions_per_cycle;
376 m_buffer_size = p->buffer_size;
377 m_recycle_latency = p->recycle_latency;
378 m_number_of_TBEs = p->number_of_TBEs;
379 m_is_blocking = false;
380''')
290static ${ident}_ProfileDumper s_profileDumper;
291${ident}_Profiler m_profiler;
292static int m_num_controllers;
293
294// Internal functions
295''')
296
297 for func in self.functions:

--- 82 unchanged lines hidden (view full) ---

380{
381 m_version = p->version;
382 m_transitions_per_cycle = p->transitions_per_cycle;
383 m_buffer_size = p->buffer_size;
384 m_recycle_latency = p->recycle_latency;
385 m_number_of_TBEs = p->number_of_TBEs;
386 m_is_blocking = false;
387''')
388 #
389 # max_port_rank is used to size vectors and thus should be one plus the
390 # largest port rank
391 #
392 max_port_rank = self.in_ports[0].pairs["max_port_rank"] + 1
393 code(' m_max_in_port_rank = $max_port_rank;')
381 code.indent()
382
383 #
384 # After initializing the universal machine parameters, initialize the
385 # this machines config parameters. Also detemine if these configuration
386 # params include a sequencer. This information will be used later for
387 # contecting the sequencer back to the L1 cache controller.
388 #

--- 227 unchanged lines hidden (view full) ---

616
617const MachineType
618$c_ident::getMachineType() const
619{
620 return MachineType_${ident};
621}
622
623void
394 code.indent()
395
396 #
397 # After initializing the universal machine parameters, initialize the
398 # this machines config parameters. Also detemine if these configuration
399 # params include a sequencer. This information will be used later for
400 # contecting the sequencer back to the L1 cache controller.
401 #

--- 227 unchanged lines hidden (view full) ---

629
630const MachineType
631$c_ident::getMachineType() const
632{
633 return MachineType_${ident};
634}
635
636void
637$c_ident::stallBuffer(MessageBuffer* buf, Address addr)
638{
639 if (m_waiting_buffers.count(addr) == 0) {
640 MsgVecType* msgVec = new MsgVecType;
641 msgVec->resize(m_max_in_port_rank, NULL);
642 m_waiting_buffers[addr] = msgVec;
643 }
644 (*(m_waiting_buffers[addr]))[m_cur_in_port_rank] = buf;
645}
646
647void
648$c_ident::wakeUpBuffers(Address addr)
649{
650 //
651 // Wake up all possible lower rank (i.e. lower priority) buffers that could
652 // be waiting on this message.
653 //
654 for (int in_port_rank = m_cur_in_port_rank - 1;
655 in_port_rank >= 0;
656 in_port_rank--) {
657 if ((*(m_waiting_buffers[addr]))[in_port_rank] != NULL) {
658 (*(m_waiting_buffers[addr]))[in_port_rank]->reanalyzeMessages(addr);
659 }
660 }
661 delete m_waiting_buffers[addr];
662 m_waiting_buffers.erase(addr);
663}
664
665void
624$c_ident::blockOnQueue(Address addr, MessageBuffer* port)
625{
626 m_is_blocking = true;
627 m_block_map[addr] = port;
628}
629
630void
631$c_ident::unblock(Address addr)

--- 120 unchanged lines hidden (view full) ---

752 code.indent()
753 code.indent()
754
755 # InPorts
756 #
757 for port in self.in_ports:
758 code.indent()
759 code('// ${ident}InPort $port')
666$c_ident::blockOnQueue(Address addr, MessageBuffer* port)
667{
668 m_is_blocking = true;
669 m_block_map[addr] = port;
670}
671
672void
673$c_ident::unblock(Address addr)

--- 120 unchanged lines hidden (view full) ---

794 code.indent()
795 code.indent()
796
797 # InPorts
798 #
799 for port in self.in_ports:
800 code.indent()
801 code('// ${ident}InPort $port')
802 if port.pairs.has_key("rank"):
803 code('m_cur_in_port_rank = ${{port.pairs["rank"]}};')
804 else:
805 code('m_cur_in_port_rank = 0;')
760 code('${{port["c_code_in_port"]}}')
761 code.dedent()
762
763 code('')
764
765 code.dedent()
766 code.dedent()
767 code('''

--- 568 unchanged lines hidden ---
806 code('${{port["c_code_in_port"]}}')
807 code.dedent()
808
809 code('')
810
811 code.dedent()
812 code.dedent()
813 code('''

--- 568 unchanged lines hidden ---