StateMachine.py (9366:bf8eb26c7b7e) StateMachine.py (9465:4ae4f3f4b870)
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;

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

522 code('''
523}
524
525void
526$c_ident::init()
527{
528 MachineType machine_type;
529 int base;
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;

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

522 code('''
523}
524
525void
526$c_ident::init()
527{
528 MachineType machine_type;
529 int base;
530 machine_type = string_to_MachineType("${{var.machine.ident}}");
531 base = MachineType_base_number(machine_type);
530
531 m_machineID.type = MachineType_${ident};
532 m_machineID.num = m_version;
533
534 // initialize objects
535 m_profiler.setVersion(m_version);
536 s_profileDumper.registerProfiler(&m_profiler);
537

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

587 # Network port object
588 network = var["network"]
589 ordered = var["ordered"]
590 vnet = var["virtual_network"]
591 vnet_type = var["vnet_type"]
592
593 assert var.machine is not None
594 code('''
532
533 m_machineID.type = MachineType_${ident};
534 m_machineID.num = m_version;
535
536 // initialize objects
537 m_profiler.setVersion(m_version);
538 s_profileDumper.registerProfiler(&m_profiler);
539

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

589 # Network port object
590 network = var["network"]
591 ordered = var["ordered"]
592 vnet = var["virtual_network"]
593 vnet_type = var["vnet_type"]
594
595 assert var.machine is not None
596 code('''
595machine_type = string_to_MachineType("${{var.machine.ident}}");
596base = MachineType_base_number(machine_type);
597$vid = m_net_ptr->get${network}NetQueue(m_version + base, $ordered, $vnet, "$vnet_type");
598''')
599
600 code('assert($vid != NULL);')
601
602 # Set ordering
603 if "ordered" in var:
604 # A buffer

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

633 else:
634 code('$vid->setRecycleLatency(m_recycle_latency);')
635
636 # Set the prefetchers
637 code()
638 for prefetcher in self.prefetchers:
639 code('${{prefetcher.code}}.setController(this);')
640
597$vid = m_net_ptr->get${network}NetQueue(m_version + base, $ordered, $vnet, "$vnet_type");
598''')
599
600 code('assert($vid != NULL);')
601
602 # Set ordering
603 if "ordered" in var:
604 # A buffer

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

633 else:
634 code('$vid->setRecycleLatency(m_recycle_latency);')
635
636 # Set the prefetchers
637 code()
638 for prefetcher in self.prefetchers:
639 code('${{prefetcher.code}}.setController(this);')
640
641 # Set the queue consumers
642 code()
643 for port in self.in_ports:
641 code()
642 for port in self.in_ports:
643 # Set the queue consumers
644 code('${{port.code}}.setConsumer(this);')
644 code('${{port.code}}.setConsumer(this);')
645
646 # Set the queue descriptions
647 code()
648 for port in self.in_ports:
645 # Set the queue descriptions
649 code('${{port.code}}.setDescription("[Version " + to_string(m_version) + ", $ident, $port]");')
646 code('${{port.code}}.setDescription("[Version " + to_string(m_version) + ", $ident, $port]");')
647 # Set the clock object
648 code('${{port.code}}.setClockObj(this);')
650
651 # Initialize the transition profiling
652 code()
653 for trans in self.transitions:
654 # Figure out if we stall
655 stall = False
656 for action in trans.actions:
657 if action.ident == "z_stall":

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

1134 code('${ident}_State state = getState(m_cache_entry_ptr, addr);')
1135 else:
1136 code('${ident}_State state = getState(addr);')
1137
1138 code('''
1139 ${ident}_State next_state = state;
1140
1141 DPRINTF(RubyGenerated, "%s, Time: %lld, state: %s, event: %s, addr: %s\\n",
649
650 # Initialize the transition profiling
651 code()
652 for trans in self.transitions:
653 # Figure out if we stall
654 stall = False
655 for action in trans.actions:
656 if action.ident == "z_stall":

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

1133 code('${ident}_State state = getState(m_cache_entry_ptr, addr);')
1134 else:
1135 code('${ident}_State state = getState(addr);')
1136
1137 code('''
1138 ${ident}_State next_state = state;
1139
1140 DPRINTF(RubyGenerated, "%s, Time: %lld, state: %s, event: %s, addr: %s\\n",
1142 *this, g_system_ptr->getTime(), ${ident}_State_to_string(state),
1141 *this, curCycle(), ${ident}_State_to_string(state),
1143 ${ident}_Event_to_string(event), addr);
1144
1145 TransitionResult result =
1146''')
1147 if self.TBEType != None and self.EntryType != None:
1148 code('doTransitionWorker(event, state, next_state, m_tbe_ptr, m_cache_entry_ptr, addr);')
1149 elif self.TBEType != None:
1150 code('doTransitionWorker(event, state, next_state, m_tbe_ptr, addr);')

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

1307 for trans in transitions:
1308 code(' case HASH_FUN($trans):')
1309 code(' $case')
1310
1311 code('''
1312 default:
1313 fatal("Invalid transition\\n"
1314 "%s time: %d addr: %s event: %s state: %s\\n",
1142 ${ident}_Event_to_string(event), addr);
1143
1144 TransitionResult result =
1145''')
1146 if self.TBEType != None and self.EntryType != None:
1147 code('doTransitionWorker(event, state, next_state, m_tbe_ptr, m_cache_entry_ptr, addr);')
1148 elif self.TBEType != None:
1149 code('doTransitionWorker(event, state, next_state, m_tbe_ptr, addr);')

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

1306 for trans in transitions:
1307 code(' case HASH_FUN($trans):')
1308 code(' $case')
1309
1310 code('''
1311 default:
1312 fatal("Invalid transition\\n"
1313 "%s time: %d addr: %s event: %s state: %s\\n",
1315 name(), g_system_ptr->getTime(), addr, event, state);
1314 name(), curCycle(), addr, event, state);
1316 }
1317 return TransitionResult_Valid;
1318}
1319''')
1320 code.write(path, "%s_Transitions.cc" % self.ident)
1321
1322 def printProfileDumperHH(self, path):
1323 code = self.symtab.codeFormatter()

--- 395 unchanged lines hidden ---
1315 }
1316 return TransitionResult_Valid;
1317}
1318''')
1319 code.write(path, "%s_Transitions.cc" % self.ident)
1320
1321 def printProfileDumperHH(self, path):
1322 code = self.symtab.codeFormatter()

--- 395 unchanged lines hidden ---