Deleted Added
sdiff udiff text old ( 9561:bc043a0455e3 ) new ( 9595:470016acf37d )
full compact
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;

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

234#include "mem/protocol/Types.hh"
235#include "mem/ruby/common/Consumer.hh"
236#include "mem/ruby/common/Global.hh"
237#include "mem/ruby/slicc_interface/AbstractController.hh"
238#include "params/$c_ident.hh"
239''')
240
241 seen_types = set()
242 for var in self.objects:
243 if var.type.ident not in seen_types and not var.type.isPrimitive:
244 code('#include "mem/protocol/${{var.type.c_ident}}.hh"')
245 seen_types.add(var.type.ident)
246
247 # for adding information to the protocol debug trace
248 code('''
249extern std::stringstream ${ident}_transitionComment;
250
251class $c_ident : public AbstractController
252{

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

326// Internal functions
327''')
328
329 for func in self.functions:
330 proto = func.prototype
331 if proto:
332 code('$proto')
333
334 if self.EntryType != None:
335 code('''
336
337// Set and Reset for cache_entry variable
338void set_cache_entry(${{self.EntryType.c_ident}}*& m_cache_entry_ptr, AbstractCacheEntry* m_new_cache_entry);
339void unset_cache_entry(${{self.EntryType.c_ident}}*& m_cache_entry_ptr);
340''')
341

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

383 code.write(path, '%s.hh' % c_ident)
384
385 def printControllerCC(self, path, includes):
386 '''Output the actions for performing the actions'''
387
388 code = self.symtab.codeFormatter()
389 ident = self.ident
390 c_ident = "%s_Controller" % self.ident
391
392 code('''
393/** \\file $c_ident.cc
394 *
395 * Auto generated C++ code started by $__file__:$__line__
396 * Created by slicc definition of Module "${{self.short}}"
397 */
398

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

510
511 code('m_num_controllers++;')
512 for var in self.objects:
513 if var.ident.find("mandatoryQueue") >= 0:
514 code('''
515m_${{var.c_ident}}_ptr = new ${{var.type.c_ident}}();
516m_${{var.c_ident}}_ptr->setReceiver(this);
517''')
518
519 code.dedent()
520 code('''
521}
522
523void
524$c_ident::init()
525{
526 MachineType machine_type;

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

544 if "network" not in var:
545 # Not a network port object
546 if "primitive" in vtype:
547 code('$vid = new ${{vtype.c_ident}};')
548 if "default" in var:
549 code('(*$vid) = ${{var["default"]}};')
550 else:
551 # Normal Object
552 # added by SS
553 if "factory" in var:
554 code('$vid = ${{var["factory"]}};')
555 elif var.ident.find("mandatoryQueue") < 0:
556 th = var.get("template", "")
557 expr = "%s = new %s%s" % (vid, vtype.c_ident, th)
558 args = ""
559 if "non_obj" not in vtype and not vtype.isEnumeration:
560 args = var.get("constructor", "")
561 code('$expr($args);')
562
563 code('assert($vid != NULL);')

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

588 code('$vid->setReceiver(this);')
589 elif vtype.c_ident == "TimerTable":
590 code('$vid->setClockObj(this);')
591
592 else:
593 # Network port object
594 network = var["network"]
595 ordered = var["ordered"]
596 vnet = var["virtual_network"]
597 vnet_type = var["vnet_type"]
598
599 assert var.machine is not None
600 code('''
601$vid = m_net_ptr->get${network}NetQueue(m_version + base, $ordered, $vnet, "$vnet_type");
602''')
603
604 code('assert($vid != NULL);')
605
606 # Set the end
607 if network == "To":
608 code('$vid->setSender(this);')
609 else:
610 code('$vid->setReceiver(this);')
611
612 # Set ordering
613 if "ordered" in var:
614 # A buffer
615 code('$vid->setOrdering(${{var["ordered"]}});')
616
617 # Set randomization
618 if "random" in var:
619 # A buffer

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

1002 if vtype.isBuffer:
1003 vid = "m_%s_ptr" % var.c_ident
1004 code('num_functional_writes += $vid->functionalWrite(pkt);')
1005 code('''
1006 return num_functional_writes;
1007}
1008''')
1009
1010 code.write(path, "%s.cc" % c_ident)
1011
1012 def printCWakeup(self, path, includes):
1013 '''Output the wakeup loop for the events'''
1014
1015 code = self.symtab.codeFormatter()
1016 ident = self.ident
1017

--- 714 unchanged lines hidden ---