125c125
< import optparse
---
> import argparse
128a129
> from m5.util import *
130,132c131,133
< # A single Hybrid Memory Cube (HMC)
< class HMCSystem(SubSystem):
< #*****************************CROSSBAR PARAMETERS*************************
---
>
> def add_options(parser):
> # *****************************CROSSBAR PARAMETERS*************************
134c135,136
< xbar_width = Param.Unsigned(32, "Data width of the main XBar (Bytes)")
---
> parser.add_argument("--xbar-width", default=32, action="store", type=int,
> help="Data width of the main XBar (Bytes)")
140,141c142,143
< xbar_frequency = Param.Frequency('1GHz', "Clock Frequency of the main "
< "XBar")
---
> parser.add_argument("--xbar-frequency", default='1GHz', type=str,
> help="Clock Frequency of the main XBar")
144c146,147
< xbar_frontend_latency = Param.Cycles(1, "Arbitration latency of the XBar")
---
> parser.add_argument("--xbar-frontend-latency", default=1, action="store",
> type=int, help="Arbitration latency of the XBar")
148c151,152
< xbar_forward_latency = Param.Cycles(2, "Forward latency of the XBar")
---
> parser.add_argument("--xbar-forward-latency", default=2, action="store",
> type=int, help="Forward latency of the XBar")
152c156,157
< xbar_response_latency = Param.Cycles(2, "Response latency of the XBar")
---
> parser.add_argument("--xbar-response-latency", default=2, action="store",
> type=int, help="Response latency of the XBar")
155,156c160,161
< number_mem_crossbar = Param.Unsigned(4, "Number of crossbar in HMC"
< )
---
> parser.add_argument("--number-mem-crossbar", default=4, action="store",
> type=int, help="Number of crossbar in HMC")
158c163
< #*****************************SERIAL LINK PARAMETERS***********************
---
> # *****************************SERIAL LINK PARAMETERS**********************
160c165,166
< num_links_controllers = Param.Unsigned(4, "Number of serial links")
---
> parser.add_argument("--num-links-controllers", default=4, action="store",
> type=int, help="Number of serial links")
164,165c170,172
< link_buffer_size_req = Param.Unsigned(10, "Number of packets to buffer "
< "at the request side of the serial link")
---
> parser.add_argument("--link-buffer-size-req", default=10, action="store",
> type=int, help="Number of packets to buffer at the\
> request side of the serial link")
169,170c176,178
< link_buffer_size_rsp = Param.Unsigned(10, "Number of packets to buffer "
< "at the response side of the serial link")
---
> parser.add_argument("--link-buffer-size-rsp", default=10, action="store",
> type=int, help="Number of packets to buffer at the\
> response side of the serial link")
174c182,183
< link_latency = Param.Latency('4.6ns', "Latency of the serial links")
---
> parser.add_argument("--link-latency", default='4.6ns', type=str,
> help="Latency of the serial links")
177,178c186,187
< link_frequency = Param.Frequency('10GHz', "Clock Frequency of the serial"
< "links")
---
> parser.add_argument("--link-frequency", default='10GHz', type=str,
> help="Clock Frequency of the serial links")
184,185c193,195
< link_controller_frequency = Param.Frequency('625MHz',
< "Clock Frequency of the link controller")
---
> parser.add_argument("--link-controller-frequency", default='625MHz',
> type=str, help="Clock Frequency of the link\
> controller")
190,191c200,202
< link_ctrl_latency = Param.Cycles(4, "The number of cycles required for the"
< "controller to process the packet")
---
> parser.add_argument("--link-ctrl-latency", default=4, action="store",
> type=int, help="The number of cycles required for the\
> controller to process the packet")
195,196c206,208
< total_ctrl_latency = Param.Latency('11ns', "The latency experienced by"
< "every packet regardless of size of packet")
---
> parser.add_argument("--total-ctrl-latency", default='11ns', type=str,
> help="The latency experienced by every packet\
> regardless of size of packet")
199c211,212
< num_lanes_per_link = Param.Unsigned( 16, "Number of lanes per each link")
---
> parser.add_argument("--num-lanes-per-link", default=16, action="store",
> type=int, help="Number of lanes per each link")
202c215,216
< num_serial_links = Param.Unsigned(4, "Number of serial links")
---
> parser.add_argument("--num-serial-links", default=4, action="store",
> type=int, help="Number of serial links")
205,206c219,221
< serial_link_speed = Param.UInt64(10, "Gbs/s speed of each lane of"
< "serial link")
---
> parser.add_argument("--serial-link-speed", default=10, action="store",
> type=int, help="Gbs/s speed of each lane of serial\
> link")
208c223,228
< #*****************************PERFORMANCE MONITORING************************
---
> # address range for each of the serial links
> parser.add_argument("--serial-link-addr-range", default='1GB', type=str,
> help="memory range for each of the serial links.\
> Default: 1GB")
>
> # *****************************PERFORMANCE MONITORING*********************
210,211c230,231
< enable_global_monitor = Param.Bool(False, "The main monitor behind the "
< "HMC Controller")
---
> parser.add_argument("--enable-global-monitor", action="store_true",
> help="The main monitor behind the HMC Controller")
214c234,235
< enable_link_monitor = Param.Bool(False, "The link monitors" )
---
> parser.add_argument("--enable-link-monitor", action="store_true",
> help="The link monitors")
217,218c238,239
< enable_link_aggr = Param.Bool(False, "The crossbar between port and "
< "Link Controller")
---
> parser.add_argument("--enable-link-aggr", action="store_true", help="The\
> crossbar between port and Link Controller")
220,221c241,243
< enable_buff_div = Param.Bool(True, "Memory Range of Buffer is"
< "divided between total range")
---
> parser.add_argument("--enable-buff-div", action="store_true",
> help="Memory Range of Buffer is ivided between total\
> range")
223c245
< #*****************************HMC ARCHITECTURE ************************
---
> # *****************************HMC ARCHITECTURE **************************
225,226c247,249
< mem_chunk = Param.Unsigned(4, "Chunk of memory range for each cross bar "
< "in arch 0")
---
> parser.add_argument("--mem-chunk", default=4, action="store", type=int,
> help="Chunk of memory range for each cross bar in\
> arch 0")
230,231c253,255
< xbar_buffer_size_req = Param.Unsigned(10, "Number of packets to buffer "
< "at the request side of the crossbar")
---
> parser.add_argument("--xbar-buffer-size-req", default=10, action="store",
> type=int, help="Number of packets to buffer at the\
> request side of the crossbar")
235,236c259,287
< xbar_buffer_size_resp = Param.Unsigned(10, "Number of packets to buffer "
< "at the response side of the crossbar")
---
> parser.add_argument("--xbar-buffer-size-resp", default=10, action="store",
> type=int, help="Number of packets to buffer at the\
> response side of the crossbar")
> # HMC device architecture. It affects the HMC host controller as well
> parser.add_argument("--arch", type=str, choices=["same", "distributed",
> "mixed"], default="distributed", help="same: HMC with\
> 4 links, all with same range.\ndistributed: HMC with\
> 4 links with distributed range.\nmixed: mixed with\
> same and distributed range.\nDefault: distributed")
> # HMC device - number of vaults
> parser.add_argument("--hmc-dev-num-vaults", default=16, action="store",
> type=int, help="number of independent vaults within\
> the HMC device. Note: each vault has a memory\
> controller (valut controller)\nDefault: 16")
> # HMC device - vault capacity or size
> parser.add_argument("--hmc-dev-vault-size", default='256MB', type=str,
> help="vault storage capacity in bytes. Default:\
> 256MB")
> parser.add_argument("--mem-type", type=str, choices=["HMC_2500_1x32"],
> default="HMC_2500_1x32", help="type of HMC memory to\
> use. Default: HMC_2500_1x32")
> parser.add_argument("--mem-channels", default=1, action="store", type=int,
> help="Number of memory channels")
> parser.add_argument("--mem-ranks", default=1, action="store", type=int,
> help="Number of ranks to iterate across")
> parser.add_argument("--burst-length", default=256, action="store",
> type=int, help="burst length in bytes. Note: the\
> cache line size will be set to this value.\nDefault:\
> 256")
238,239d288
< # configure host system with Serial Links
< def config_host_hmc(options, system):
241c290,291
< system.hmc_host=HMCSystem()
---
> # configure HMC host controller
> def config_hmc_host_ctrl(opt, system):
243,246c293,294
< try:
< system.hmc_host.enable_global_monitor = options.enable_global_monitor
< except:
< pass;
---
> # create HMC host controller
> system.hmc_host = SubSystem()
248,251c296,309
< try:
< system.hmc_host.enable_link_monitor = options.enable_link_monitor
< except:
< pass;
---
> # Create additional crossbar for arch1
> if opt.arch == "distributed" or opt.arch == "mixed":
> clk = '100GHz'
> vd = VoltageDomain(voltage='1V')
> # Create additional crossbar for arch1
> system.membus = NoncoherentXBar(width=8)
> system.membus.badaddr_responder = BadAddr()
> system.membus.default = Self.badaddr_responder.pio
> system.membus.width = 8
> system.membus.frontend_latency = 3
> system.membus.forward_latency = 4
> system.membus.response_latency = 2
> cd = SrcClockDomain(clock=clk, voltage_domain=vd)
> system.membus.clk_domain = cd
253,261c311,330
< # Serial link Controller with 16 SerDes links at 10 Gbps
< # with serial link ranges w.r.t to architecture
< system.hmc_host.seriallink = [SerialLink(ranges = options.ser_ranges[i],
< req_size=system.hmc_host.link_buffer_size_req,
< resp_size=system.hmc_host.link_buffer_size_rsp,
< num_lanes=system.hmc_host.num_lanes_per_link,
< link_speed=system.hmc_host.serial_link_speed,
< delay=system.hmc_host.total_ctrl_latency)
< for i in xrange(system.hmc_host.num_serial_links)]
---
> # create memory ranges for the serial links
> slar = convert.toMemorySize(opt.serial_link_addr_range)
> # Memmory ranges of serial link for arch-0. Same as the ranges of vault
> # controllers (4 vaults to 1 serial link)
> if opt.arch == "same":
> ser_ranges = [AddrRange(0, (4*slar)-1) for i in
> range(opt.num_serial_links)]
> # Memmory ranges of serial link for arch-1. Distributed range accross
> # links
> if opt.arch == "distributed":
> ser_ranges = [AddrRange(i*slar, ((i+1)*slar)-1) for i in
> range(opt.num_serial_links)]
> # Memmory ranges of serial link for arch-2 'Mixed' address distribution
> # over links
> if opt.arch == "mixed":
> ser_range0 = AddrRange(0, (1*slar)-1)
> ser_range1 = AddrRange(1*slar, 2*slar-1)
> ser_range2 = AddrRange(0, (4*slar)-1)
> ser_range3 = AddrRange(0, (4*slar)-1)
> ser_ranges = [ser_range0, ser_range1, ser_range2, ser_range3]
262a332,342
> # Serial link Controller with 16 SerDes links at 10 Gbps with serial link
> # ranges w.r.t to architecture
> sl = [SerialLink(ranges=ser_ranges[i],
> req_size=opt.link_buffer_size_req,
> resp_size=opt.link_buffer_size_rsp,
> num_lanes=opt.num_lanes_per_link,
> link_speed=opt.serial_link_speed,
> delay=opt.total_ctrl_latency) for i in
> xrange(opt.num_serial_links)]
> system.hmc_host.seriallink = sl
>
264,266c344,346
< if system.hmc_host.enable_global_monitor:
< system.hmc_host.lmonitor = [ CommMonitor()
< for i in xrange(system.hmc_host.num_serial_links)]
---
> if opt.enable_global_monitor:
> system.hmc_host.lmonitor = [CommMonitor() for i in
> xrange(opt.num_serial_links)]
269,272c349,353
< for i in xrange(system.hmc_host.num_serial_links):
< system.hmc_host.seriallink[i].clk_domain = SrcClockDomain(clock=system.
< hmc_host.link_controller_frequency, voltage_domain=
< VoltageDomain(voltage = '1V'))
---
> for i in xrange(opt.num_serial_links):
> clk = opt.link_controller_frequency
> vd = VoltageDomain(voltage='1V')
> scd = SrcClockDomain(clock=clk, voltage_domain=vd)
> system.hmc_host.seriallink[i].clk_domain = scd
276,281c357,363
< if options.arch == "distributed":
< for i in xrange(system.hmc_host.num_links_controllers):
< if system.hmc_host.enable_global_monitor:
< system.membus.master = system.hmc_host.lmonitor[i].slave
< system.hmc_host.lmonitor[i].master = \
< system.hmc_host.seriallink[i].slave
---
> hh = system.hmc_host
> if opt.arch == "distributed":
> mb = system.membus
> for i in xrange(opt.num_links_controllers):
> if opt.enable_global_monitor:
> mb.master = hh.lmonitor[i].slave
> hh.lmonitor[i].master = hh.seriallink[i].slave
283,300c365,372
< system.membus.master = system.hmc_host.seriallink[i].slave
< if options.arch == "mixed":
< if system.hmc_host.enable_global_monitor:
< system.membus.master = system.hmc_host.lmonitor[0].slave
< system.hmc_host.lmonitor[0].master = \
< system.hmc_host.seriallink[0].slave
<
< system.membus.master = system.hmc_host.lmonitor[1].slave
< system.hmc_host.lmonitor[1].master = \
< system.hmc_host.seriallink[1].slave
<
< system.tgen[2].port = system.hmc_host.lmonitor[2].slave
< system.hmc_host.lmonitor[2].master = \
< system.hmc_host.seriallink[2].slave
<
< system.tgen[3].port = system.hmc_host.lmonitor[3].slave
< system.hmc_host.lmonitor[3].master = \
< system.hmc_host.seriallink[3].slave
---
> mb.master = hh.seriallink[i].slave
> if opt.arch == "mixed":
> mb = system.membus
> if opt.enable_global_monitor:
> mb.master = hh.lmonitor[0].slave
> hh.lmonitor[0].master = hh.seriallink[0].slave
> mb.master = hh.lmonitor[1].slave
> hh.lmonitor[1].master = hh.seriallink[1].slave
302,313c374,375
< system.membus.master = system.hmc_host.seriallink[0].slave
< system.membus.master = system.hmc_host.seriallink[1].slave
< system.tgen[2].port = system.hmc_host.seriallink[2].slave
< system.tgen[3].port = system.hmc_host.seriallink[3].slave
< if options.arch == "same" :
< for i in xrange(system.hmc_host.num_links_controllers):
< if system.hmc_host.enable_global_monitor:
< system.tgen[i].port = system.hmc_host.lmonitor[i].slave
< system.hmc_host.lmonitor[i].master = \
< system.hmc_host.seriallink[i].slave
< else:
< system.tgen[i].port = system.hmc_host.seriallink[i].slave
---
> mb.master = hh.seriallink[0].slave
> mb.master = hh.seriallink[1].slave
314a377,381
> if opt.arch == "same":
> for i in xrange(opt.num_links_controllers):
> if opt.enable_global_monitor:
> hh.lmonitor[i].master = hh.seriallink[i].slave
>
317,318d383
< # Create an HMC device and attach it to the current system
< def config_hmc(options, system, hmc_host):
320,321c385,386
< # Create HMC device
< system.hmc_dev = HMCSystem()
---
> # Create an HMC device
> def config_hmc_dev(opt, system, hmc_host):
323,327c388,389
< # Global monitor
< try:
< system.hmc_dev.enable_global_monitor = options.enable_global_monitor
< except:
< pass;
---
> # create HMC device
> system.hmc_dev = SubSystem()
329,332c391,395
< try:
< system.hmc_dev.enable_link_monitor = options.enable_link_monitor
< except:
< pass;
---
> # create memory ranges for the vault controllers
> arv = convert.toMemorySize(opt.hmc_dev_vault_size)
> addr_ranges_vaults = [AddrRange(i*arv, ((i+1)*arv-1)) for i in
> range(opt.hmc_dev_num_vaults)]
> system.mem_ranges = addr_ranges_vaults
333a397,399
> if opt.enable_link_monitor:
> lm = [CommMonitor() for i in xrange(opt.num_links_controllers)]
> system.hmc_dev.lmonitor = lm
335,338d400
< if system.hmc_dev.enable_link_monitor:
< system.hmc_dev.lmonitor = [ CommMonitor()
< for i in xrange(system.hmc_dev.num_links_controllers)]
<
340,344c402,407
< system.hmc_dev.xbar = [ NoncoherentXBar(width=system.hmc_dev.xbar_width,
< frontend_latency=system.hmc_dev.xbar_frontend_latency,
< forward_latency=system.hmc_dev.xbar_forward_latency,
< response_latency=system.hmc_dev.xbar_response_latency )
< for i in xrange(system.hmc_host.number_mem_crossbar)]
---
> xb = [NoncoherentXBar(width=opt.xbar_width,
> frontend_latency=opt.xbar_frontend_latency,
> forward_latency=opt.xbar_forward_latency,
> response_latency=opt.xbar_response_latency) for i in
> xrange(opt.number_mem_crossbar)]
> system.hmc_dev.xbar = xb
346,349c409,413
< for i in xrange(system.hmc_dev.number_mem_crossbar):
< system.hmc_dev.xbar[i].clk_domain = SrcClockDomain(
< clock=system.hmc_dev.xbar_frequency,voltage_domain=
< VoltageDomain(voltage='1V'))
---
> for i in xrange(opt.number_mem_crossbar):
> clk = opt.xbar_frequency
> vd = VoltageDomain(voltage='1V')
> scd = SrcClockDomain(clock=clk, voltage_domain=vd)
> system.hmc_dev.xbar[i].clk_domain = scd
352,353c416,417
< for i in xrange(system.hmc_dev.num_serial_links):
< if system.hmc_dev.enable_link_monitor:
---
> for i in xrange(opt.num_serial_links):
> if opt.enable_link_monitor:
362c426
< if options.arch == "same":
---
> if opt.arch == "same":
366,369c430,432
< system.hmc_dev.buffers = [ Bridge(
< req_size=system.hmc_dev.xbar_buffer_size_req,
< resp_size=system.hmc_dev.xbar_buffer_size_resp)
< for i in xrange(numx * (system.hmc_dev.mem_chunk - 1))]
---
> system.hmc_dev.buffers = [Bridge(req_size=opt.xbar_buffer_size_req,
> resp_size=opt.xbar_buffer_size_resp)
> for i in xrange(numx*(opt.mem_chunk-1))]
387,388c450,451
< j * int(system.hmc_dev.mem_chunk):
< (j + 1) * int(system.hmc_dev.mem_chunk)]
---
> j * int(opt.mem_chunk):
> (j + 1) * int(opt.mem_chunk)]
401,402c464
< if options.arch == "mixed":
<
---
> if opt.arch == "mixed":
415d476
<
427d487
<