Deleted Added
sdiff udiff text old ( 10078:9400a90ec5d1 ) new ( 10121:64545628f5a7 )
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;

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

346 if self.TBEType != None:
347 code('''
348
349// Set and Reset for tbe variable
350void set_tbe(${{self.TBEType.c_ident}}*& m_tbe_ptr, ${ident}_TBE* m_new_tbe);
351void unset_tbe(${{self.TBEType.c_ident}}*& m_tbe_ptr);
352''')
353
354 code('''
355
356// Actions
357''')
358 if self.TBEType != None and self.EntryType != None:
359 for action in self.actions.itervalues():
360 code('/** \\brief ${{action.desc}} */')
361 code('void ${{action.ident}}(${{self.TBEType.c_ident}}*& m_tbe_ptr, ${{self.EntryType.c_ident}}*& m_cache_entry_ptr, const Address& addr);')
362 elif self.TBEType != None:
363 for action in self.actions.itervalues():
364 code('/** \\brief ${{action.desc}} */')
365 code('void ${{action.ident}}(${{self.TBEType.c_ident}}*& m_tbe_ptr, const Address& addr);')
366 elif self.EntryType != None:
367 for action in self.actions.itervalues():
368 code('/** \\brief ${{action.desc}} */')
369 code('void ${{action.ident}}(${{self.EntryType.c_ident}}*& m_cache_entry_ptr, const Address& addr);')
370 else:
371 for action in self.actions.itervalues():
372 code('/** \\brief ${{action.desc}} */')
373 code('void ${{action.ident}}(const Address& addr);')
374
375 # the controller internal variables
376 code('''
377

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

429
430 # include object classes
431 seen_types = set()
432 for var in self.objects:
433 if var.type.ident not in seen_types and not var.type.isPrimitive:
434 code('#include "mem/protocol/${{var.type.c_ident}}.hh"')
435 seen_types.add(var.type.ident)
436
437 code('''
438$c_ident *
439${c_ident}Params::create()
440{
441 return new $c_ident(this);
442}
443
444int $c_ident::m_num_controllers = 0;

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

455#endif
456
457/** \\brief constructor */
458$c_ident::$c_ident(const Params *p)
459 : AbstractController(p)
460{
461 m_machineID.type = MachineType_${ident};
462 m_machineID.num = m_version;
463''')
464 num_in_ports = len(self.in_ports)
465 code(' m_in_ports = $num_in_ports;')
466 code.indent()
467
468 #
469 # After initializing the universal machine parameters, initialize the
470 # this machines config parameters. Also detemine if these configuration
471 # params include a sequencer. This information will be used later for
472 # contecting the sequencer back to the L1 cache controller.
473 #
474 contains_dma_sequencer = False
475 sequencers = []
476 for param in self.config_parameters:
477 if param.name == "dma_sequencer":
478 contains_dma_sequencer = True
479 elif re.compile("sequencer").search(param.name):
480 sequencers.append(param.name)
481 if param.pointer:
482 code('m_${{param.name}}_ptr = p->${{param.name}};')
483 else:
484 code('m_${{param.name}} = p->${{param.name}};')
485
486 #
487 # For the l1 cache controller, add the special atomic support which
488 # includes passing the sequencer a pointer to the controller.
489 #
490 for seq in sequencers:
491 code('''
492m_${{seq}}_ptr->setController(this);
493 ''')
494
495 #
496 # For the DMA controller, pass the sequencer a pointer to the
497 # controller.
498 #
499 if self.ident == "DMA":
500 if not contains_dma_sequencer:
501 self.error("The DMA controller must include the sequencer " \
502 "configuration parameter")
503
504 code('''
505m_dma_sequencer_ptr->setController(this);
506''')
507
508 code('m_num_controllers++;')
509 for var in self.objects:
510 if var.ident.find("mandatoryQueue") >= 0:
511 code('''
512m_${{var.c_ident}}_ptr = new ${{var.type.c_ident}}();
513m_${{var.c_ident}}_ptr->setReceiver(this);
514''')
515 else:
516 if "network" in var and "physical_network" in var and \

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

687
688 code.dedent()
689 code('''
690 AbstractController::init();
691 resetStats();
692}
693''')
694
695 has_mandatory_q = False
696 for port in self.in_ports:
697 if port.code.find("mandatoryQueue_ptr") >= 0:
698 has_mandatory_q = True
699
700 if has_mandatory_q:
701 mq_ident = "m_%s_mandatoryQueue_ptr" % self.ident
702 else:
703 mq_ident = "NULL"
704
705 seq_ident = "NULL"
706 for param in self.config_parameters:
707 if param.name == "sequencer":
708 assert(param.pointer)
709 seq_ident = "m_%s_ptr" % param.name
710
711 code('''
712

--- 827 unchanged lines hidden ---