configs: Use absolute import paths
[gem5.git] / configs / example / arm / dist_bigLITTLE.py
1 # Copyright (c) 2016-2017 ARM Limited
2 # All rights reserved.
3 #
4 # The license below extends only to copyright in the software and shall
5 # not be construed as granting a license to any other intellectual
6 # property including but not limited to intellectual property relating
7 # to a hardware implementation of the functionality of the software
8 # licensed hereunder. You may use the software subject to the license
9 # terms below provided that you ensure that this notice is replicated
10 # unmodified and in its entirety in all distributions of the software,
11 # modified or unmodified, in source code or in binary form.
12 #
13 # Redistribution and use in source and binary forms, with or without
14 # modification, are permitted provided that the following conditions are
15 # met: redistributions of source code must retain the above copyright
16 # notice, this list of conditions and the following disclaimer;
17 # redistributions in binary form must reproduce the above copyright
18 # notice, this list of conditions and the following disclaimer in the
19 # documentation and/or other materials provided with the distribution;
20 # neither the name of the copyright holders nor the names of its
21 # contributors may be used to endorse or promote products derived from
22 # this software without specific prior written permission.
23 #
24 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 #
36 # Authors: Gabor Dozsa
37
38 # This configuration file extends the example ARM big.LITTLE(tm)
39 # configuration to enabe dist-gem5 siulations of big.LITTLE systems.
40
41 from __future__ import print_function
42 from __future__ import absolute_import
43
44 import argparse
45 import os
46
47 import m5
48 from m5.objects import *
49
50 import fs_bigLITTLE as bL
51 m5.util.addToPath("../../dist")
52 import sw
53
54
55 def addOptions(parser):
56 # Options for distributed simulation (i.e. dist-gem5)
57 parser.add_argument("--dist", action="store_true", help="Distributed gem5"\
58 " simulation.")
59 parser.add_argument("--is-switch", action="store_true",
60 help="Select the network switch simulator process for"\
61 " a distributed gem5 run.")
62 parser.add_argument("--dist-rank", default=0, action="store", type=int,
63 help="Rank of this system within the dist gem5 run.")
64 parser.add_argument("--dist-size", default=0, action="store", type=int,
65 help="Number of gem5 processes within the dist gem5"\
66 " run.")
67 parser.add_argument("--dist-server-name",
68 default="127.0.0.1",
69 action="store", type=str,
70 help="Name of the message server host\nDEFAULT:"\
71 " localhost")
72 parser.add_argument("--dist-server-port",
73 default=2200,
74 action="store", type=int,
75 help="Message server listen port\nDEFAULT: 2200")
76 parser.add_argument("--dist-sync-repeat",
77 default="0us",
78 action="store", type=str,
79 help="Repeat interval for synchronisation barriers"\
80 " among dist-gem5 processes\nDEFAULT:"\
81 " --ethernet-linkdelay")
82 parser.add_argument("--dist-sync-start",
83 default="1000000000000t",
84 action="store", type=str,
85 help="Time to schedule the first dist synchronisation"\
86 " barrier\nDEFAULT:1000000000000t")
87 parser.add_argument("--ethernet-linkspeed", default="10Gbps",
88 action="store", type=str,
89 help="Link speed in bps\nDEFAULT: 10Gbps")
90 parser.add_argument("--ethernet-linkdelay", default="10us",
91 action="store", type=str,
92 help="Link delay in seconds\nDEFAULT: 10us")
93 parser.add_argument("--etherdump", action="store", type=str, default="",
94 help="Specify the filename to dump a pcap capture of"\
95 " the ethernet traffic")
96 # Used by util/dist/gem5-dist.sh
97 parser.add_argument("--checkpoint-dir", type=str,
98 default=m5.options.outdir,
99 help="Directory to save/read checkpoints")
100
101
102 def addEthernet(system, options):
103 # create NIC
104 dev = IGbE_e1000()
105 system.attach_pci(dev)
106 system.ethernet = dev
107
108 # create distributed ethernet link
109 system.etherlink = DistEtherLink(speed = options.ethernet_linkspeed,
110 delay = options.ethernet_linkdelay,
111 dist_rank = options.dist_rank,
112 dist_size = options.dist_size,
113 server_name = options.dist_server_name,
114 server_port = options.dist_server_port,
115 sync_start = options.dist_sync_start,
116 sync_repeat = options.dist_sync_repeat)
117 system.etherlink.int0 = Parent.system.ethernet.interface
118 if options.etherdump:
119 system.etherdump = EtherDump(file=options.etherdump)
120 system.etherlink.dump = system.etherdump
121
122
123 def main():
124 parser = argparse.ArgumentParser(
125 description="Generic ARM big.LITTLE configuration with "\
126 "dist-gem5 support")
127 bL.addOptions(parser)
128 addOptions(parser)
129 options = parser.parse_args()
130
131 if options.is_switch:
132 root = Root(full_system = True,
133 system = sw.build_switch(options))
134 else:
135 root = bL.build(options)
136 addEthernet(root.system, options)
137
138 bL.instantiate(options, checkpoint_dir=options.checkpoint_dir)
139 bL.run(options.checkpoint_dir)
140
141
142 if __name__ == "__m5_main__":
143 main()