HMC.py revision 11551
111183Serfan.azarkhish@unibo.it# Copyright (c) 2012-2013 ARM Limited 211183Serfan.azarkhish@unibo.it# All rights reserved. 311183Serfan.azarkhish@unibo.it# 411183Serfan.azarkhish@unibo.it# The license below extends only to copyright in the software and shall 511183Serfan.azarkhish@unibo.it# not be construed as granting a license to any other intellectual 611183Serfan.azarkhish@unibo.it# property including but not limited to intellectual property relating 711183Serfan.azarkhish@unibo.it# to a hardware implementation of the functionality of the software 811183Serfan.azarkhish@unibo.it# licensed hereunder. You may use the software subject to the license 911183Serfan.azarkhish@unibo.it# terms below provided that you ensure that this notice is replicated 1011183Serfan.azarkhish@unibo.it# unmodified and in its entirety in all distributions of the software, 1111183Serfan.azarkhish@unibo.it# modified or unmodified, in source code or in binary form. 1211183Serfan.azarkhish@unibo.it# 1311183Serfan.azarkhish@unibo.it# Copyright (c) 2015 The University of Bologna 1411183Serfan.azarkhish@unibo.it# All rights reserved. 1511183Serfan.azarkhish@unibo.it# 1611183Serfan.azarkhish@unibo.it# Redistribution and use in source and binary forms, with or without 1711183Serfan.azarkhish@unibo.it# modification, are permitted provided that the following conditions are 1811183Serfan.azarkhish@unibo.it# met: redistributions of source code must retain the above copyright 1911183Serfan.azarkhish@unibo.it# notice, this list of conditions and the following disclaimer; 2011183Serfan.azarkhish@unibo.it# redistributions in binary form must reproduce the above copyright 2111183Serfan.azarkhish@unibo.it# notice, this list of conditions and the following disclaimer in the 2211183Serfan.azarkhish@unibo.it# documentation and/or other materials provided with the distribution; 2311183Serfan.azarkhish@unibo.it# neither the name of the copyright holders nor the names of its 2411183Serfan.azarkhish@unibo.it# contributors may be used to endorse or promote products derived from 2511183Serfan.azarkhish@unibo.it# this software without specific prior written permission. 2611183Serfan.azarkhish@unibo.it# 2711183Serfan.azarkhish@unibo.it# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 2811183Serfan.azarkhish@unibo.it# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 2911183Serfan.azarkhish@unibo.it# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 3011183Serfan.azarkhish@unibo.it# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 3111183Serfan.azarkhish@unibo.it# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 3211183Serfan.azarkhish@unibo.it# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 3311183Serfan.azarkhish@unibo.it# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 3411183Serfan.azarkhish@unibo.it# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 3511183Serfan.azarkhish@unibo.it# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 3611183Serfan.azarkhish@unibo.it# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 3711183Serfan.azarkhish@unibo.it# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3811183Serfan.azarkhish@unibo.it# 3911183Serfan.azarkhish@unibo.it# Authors: Erfan Azarkhish 4011551Sabdul.mutaal@gmail.com# Abdul Mutaal Ahmad 4111183Serfan.azarkhish@unibo.it 4211183Serfan.azarkhish@unibo.it# A Simplified model of a complete HMC device. Based on: 4311183Serfan.azarkhish@unibo.it# [1] http://www.hybridmemorycube.org/specification-download/ 4411183Serfan.azarkhish@unibo.it# [2] High performance AXI-4.0 based interconnect for extensible smart memory 4511183Serfan.azarkhish@unibo.it# cubes(E. Azarkhish et. al) 4611183Serfan.azarkhish@unibo.it# [3] Low-Power Hybrid Memory Cubes With Link Power Management and Two-Level 4711183Serfan.azarkhish@unibo.it# Prefetching (J. Ahn et. al) 4811183Serfan.azarkhish@unibo.it# [4] Memory-centric system interconnect design with Hybrid Memory Cubes 4911183Serfan.azarkhish@unibo.it# (G. Kim et. al) 5011183Serfan.azarkhish@unibo.it# [5] Near Data Processing, Are we there yet? (M. Gokhale) 5111183Serfan.azarkhish@unibo.it# http://www.cs.utah.edu/wondp/gokhale.pdf 5211551Sabdul.mutaal@gmail.com# [6] openHMC - A Configurable Open-Source Hybrid Memory Cube Controller 5311551Sabdul.mutaal@gmail.com# (J. Schmidt) 5411551Sabdul.mutaal@gmail.com# [7] Hybrid Memory Cube performance characterization on data-centric 5511551Sabdul.mutaal@gmail.com# workloads (M. Gokhale) 5611183Serfan.azarkhish@unibo.it# 5711183Serfan.azarkhish@unibo.it# This script builds a complete HMC device composed of vault controllers, 5811183Serfan.azarkhish@unibo.it# serial links, the main internal crossbar, and an external hmc controller. 5911183Serfan.azarkhish@unibo.it# 6011183Serfan.azarkhish@unibo.it# - VAULT CONTROLLERS: 6111183Serfan.azarkhish@unibo.it# Instances of the HMC_2500_x32 class with their functionality specified in 6211183Serfan.azarkhish@unibo.it# dram_ctrl.cc 6311183Serfan.azarkhish@unibo.it# 6411183Serfan.azarkhish@unibo.it# - THE MAIN XBAR: 6511183Serfan.azarkhish@unibo.it# This component is simply an instance of the NoncoherentXBar class, and its 6611183Serfan.azarkhish@unibo.it# parameters are tuned to [2]. 6711183Serfan.azarkhish@unibo.it# 6811551Sabdul.mutaal@gmail.com# - SERIAL LINKS CONTROLLER: 6911183Serfan.azarkhish@unibo.it# SerialLink is a simple variation of the Bridge class, with the ability to 7011551Sabdul.mutaal@gmail.com# account for the latency of packet serialization and controller latency. We 7111551Sabdul.mutaal@gmail.com# assume that the serializer component at the transmitter side does not need 7211551Sabdul.mutaal@gmail.com# to receive the whole packet to start the serialization. But the 7311551Sabdul.mutaal@gmail.com# deserializer waits for the complete packet to check its integrity first. 7411551Sabdul.mutaal@gmail.com# 7511183Serfan.azarkhish@unibo.it# * Bandwidth of the serial links is not modeled in the SerialLink component 7611551Sabdul.mutaal@gmail.com# itself. 7711183Serfan.azarkhish@unibo.it# 7811551Sabdul.mutaal@gmail.com# * Latency of serial link controller is composed of SerDes latency + link 7911551Sabdul.mutaal@gmail.com# controller 8011551Sabdul.mutaal@gmail.com# 8111183Serfan.azarkhish@unibo.it# * It is inferred from the standard [1] and the literature [3] that serial 8211183Serfan.azarkhish@unibo.it# links share the same address range and packets can travel over any of 8311183Serfan.azarkhish@unibo.it# them so a load distribution mechanism is required among them. 8411551Sabdul.mutaal@gmail.com# 8511551Sabdul.mutaal@gmail.com# ----------------------------------------- 8611551Sabdul.mutaal@gmail.com# | Host/HMC Controller | 8711551Sabdul.mutaal@gmail.com# | ---------------------- | 8811551Sabdul.mutaal@gmail.com# | | Link Aggregator | opt | 8911551Sabdul.mutaal@gmail.com# | ---------------------- | 9011551Sabdul.mutaal@gmail.com# | ---------------------- | 9111551Sabdul.mutaal@gmail.com# | | Serial Link + Ser | * 4 | 9211551Sabdul.mutaal@gmail.com# | ---------------------- | 9311551Sabdul.mutaal@gmail.com# |--------------------------------------- 9411551Sabdul.mutaal@gmail.com# ----------------------------------------- 9511551Sabdul.mutaal@gmail.com# | Device 9611551Sabdul.mutaal@gmail.com# | ---------------------- | 9711551Sabdul.mutaal@gmail.com# | | Xbar | * 4 | 9811551Sabdul.mutaal@gmail.com# | ---------------------- | 9911551Sabdul.mutaal@gmail.com# | ---------------------- | 10011551Sabdul.mutaal@gmail.com# | | Vault Controller | * 16 | 10111551Sabdul.mutaal@gmail.com# | ---------------------- | 10211551Sabdul.mutaal@gmail.com# | ---------------------- | 10311551Sabdul.mutaal@gmail.com# | | Memory | | 10411551Sabdul.mutaal@gmail.com# | ---------------------- | 10511551Sabdul.mutaal@gmail.com# |---------------------------------------| 10611551Sabdul.mutaal@gmail.com# 10711551Sabdul.mutaal@gmail.com# In this version we have present 3 different HMC archiecture along with 10811551Sabdul.mutaal@gmail.com# alongwith their corresponding test script. 10911551Sabdul.mutaal@gmail.com# 11011551Sabdul.mutaal@gmail.com# same: It has 4 crossbars in HMC memory. All the crossbars are connected 11111551Sabdul.mutaal@gmail.com# to each other, providing complete memory range. This archicture also covers 11211551Sabdul.mutaal@gmail.com# the added latency for sending a request to non-local vault(bridge in b/t 11311551Sabdul.mutaal@gmail.com# crossbars). All the 4 serial links can access complete memory. So each 11411551Sabdul.mutaal@gmail.com# link can be connected to separate processor. 11511551Sabdul.mutaal@gmail.com# 11611551Sabdul.mutaal@gmail.com# distributed: It has 4 crossbars inside the HMC. Crossbars are not 11711551Sabdul.mutaal@gmail.com# connected.Through each crossbar only local vaults can be accessed. But to 11811551Sabdul.mutaal@gmail.com# support this architecture we need a crossbar between serial links and 11911551Sabdul.mutaal@gmail.com# processor. 12011551Sabdul.mutaal@gmail.com# 12111551Sabdul.mutaal@gmail.com# mixed: This is a hybrid architecture. It has 4 crossbars inside the HMC. 12211551Sabdul.mutaal@gmail.com# 2 Crossbars are connected to only local vaults. From other 2 crossbar, a 12311551Sabdul.mutaal@gmail.com# request can be forwarded to any other vault. 12411183Serfan.azarkhish@unibo.it 12511183Serfan.azarkhish@unibo.itimport optparse 12611183Serfan.azarkhish@unibo.it 12711183Serfan.azarkhish@unibo.itimport m5 12811183Serfan.azarkhish@unibo.itfrom m5.objects import * 12911183Serfan.azarkhish@unibo.it 13011183Serfan.azarkhish@unibo.it# A single Hybrid Memory Cube (HMC) 13111292Sandreas.hansson@arm.comclass HMCSystem(SubSystem): 13211183Serfan.azarkhish@unibo.it #*****************************CROSSBAR PARAMETERS************************* 13311183Serfan.azarkhish@unibo.it # Flit size of the main interconnect [1] 13411292Sandreas.hansson@arm.com xbar_width = Param.Unsigned(32, "Data width of the main XBar (Bytes)") 13511183Serfan.azarkhish@unibo.it 13611183Serfan.azarkhish@unibo.it # Clock frequency of the main interconnect [1] 13711183Serfan.azarkhish@unibo.it # This crossbar, is placed on the logic-based of the HMC and it has its 13811183Serfan.azarkhish@unibo.it # own voltage and clock domains, different from the DRAM dies or from the 13911183Serfan.azarkhish@unibo.it # host. 14011183Serfan.azarkhish@unibo.it xbar_frequency = Param.Frequency('1GHz', "Clock Frequency of the main " 14111183Serfan.azarkhish@unibo.it "XBar") 14211183Serfan.azarkhish@unibo.it 14311183Serfan.azarkhish@unibo.it # Arbitration latency of the HMC XBar [1] 14411183Serfan.azarkhish@unibo.it xbar_frontend_latency = Param.Cycles(1, "Arbitration latency of the XBar") 14511183Serfan.azarkhish@unibo.it 14611183Serfan.azarkhish@unibo.it # Latency to forward a packet via the interconnect [1](two levels of FIFOs 14711183Serfan.azarkhish@unibo.it # at the input and output of the inteconnect) 14811183Serfan.azarkhish@unibo.it xbar_forward_latency = Param.Cycles(2, "Forward latency of the XBar") 14911183Serfan.azarkhish@unibo.it 15011183Serfan.azarkhish@unibo.it # Latency to forward a response via the interconnect [1](two levels of 15111183Serfan.azarkhish@unibo.it # FIFOs at the input and output of the inteconnect) 15211183Serfan.azarkhish@unibo.it xbar_response_latency = Param.Cycles(2, "Response latency of the XBar") 15311183Serfan.azarkhish@unibo.it 15411551Sabdul.mutaal@gmail.com # number of cross which connects 16 Vaults to serial link[7] 15511551Sabdul.mutaal@gmail.com number_mem_crossbar = Param.Unsigned(4, "Number of crossbar in HMC" 15611551Sabdul.mutaal@gmail.com ) 15711551Sabdul.mutaal@gmail.com 15811551Sabdul.mutaal@gmail.com #*****************************SERIAL LINK PARAMETERS*********************** 15911551Sabdul.mutaal@gmail.com # Number of serial links controllers [1] 16011551Sabdul.mutaal@gmail.com num_links_controllers = Param.Unsigned(4, "Number of serial links") 16111183Serfan.azarkhish@unibo.it 16211183Serfan.azarkhish@unibo.it # Number of packets (not flits) to store at the request side of the serial 16311183Serfan.azarkhish@unibo.it # link. This number should be adjusted to achive required bandwidth 16411551Sabdul.mutaal@gmail.com link_buffer_size_req = Param.Unsigned(10, "Number of packets to buffer " 16511183Serfan.azarkhish@unibo.it "at the request side of the serial link") 16611183Serfan.azarkhish@unibo.it 16711183Serfan.azarkhish@unibo.it # Number of packets (not flits) to store at the response side of the serial 16811183Serfan.azarkhish@unibo.it # link. This number should be adjusted to achive required bandwidth 16911551Sabdul.mutaal@gmail.com link_buffer_size_rsp = Param.Unsigned(10, "Number of packets to buffer " 17011183Serfan.azarkhish@unibo.it "at the response side of the serial link") 17111183Serfan.azarkhish@unibo.it 17211183Serfan.azarkhish@unibo.it # Latency of the serial link composed by SER/DES latency (1.6ns [4]) plus 17311183Serfan.azarkhish@unibo.it # the PCB trace latency (3ns Estimated based on [5]) 17411183Serfan.azarkhish@unibo.it link_latency = Param.Latency('4.6ns', "Latency of the serial links") 17511183Serfan.azarkhish@unibo.it 17611551Sabdul.mutaal@gmail.com # Clock frequency of the each serial link(SerDes) [1] 17711183Serfan.azarkhish@unibo.it link_frequency = Param.Frequency('10GHz', "Clock Frequency of the serial" 17811183Serfan.azarkhish@unibo.it "links") 17911183Serfan.azarkhish@unibo.it 18011551Sabdul.mutaal@gmail.com # Clock frequency of serial link Controller[6] 18111551Sabdul.mutaal@gmail.com # clk_hmc[Mhz]= num_lanes_per_link * lane_speed [Gbits/s] / 18211551Sabdul.mutaal@gmail.com # data_path_width * 10^6 18311551Sabdul.mutaal@gmail.com # clk_hmc[Mhz]= 16 * 10 Gbps / 256 * 10^6 = 625 Mhz 18411551Sabdul.mutaal@gmail.com link_controller_frequency = Param.Frequency('625MHz', 18511551Sabdul.mutaal@gmail.com "Clock Frequency of the link controller") 18611551Sabdul.mutaal@gmail.com 18711551Sabdul.mutaal@gmail.com # Latency of the serial link controller to process the packets[1][6] 18811551Sabdul.mutaal@gmail.com # (ClockDomain = 625 Mhz ) 18911551Sabdul.mutaal@gmail.com # used here for calculations only 19011551Sabdul.mutaal@gmail.com link_ctrl_latency = Param.Cycles(4, "The number of cycles required for the" 19111551Sabdul.mutaal@gmail.com "controller to process the packet") 19211551Sabdul.mutaal@gmail.com 19311551Sabdul.mutaal@gmail.com # total_ctrl_latency = link_ctrl_latency + link_latency 19411551Sabdul.mutaal@gmail.com # total_ctrl_latency = 4(Cycles) * 1.6 ns + 4.6 ns 19511551Sabdul.mutaal@gmail.com total_ctrl_latency = Param.Latency('11ns', "The latency experienced by" 19611551Sabdul.mutaal@gmail.com "every packet regardless of size of packet") 19711551Sabdul.mutaal@gmail.com 19811183Serfan.azarkhish@unibo.it # Number of parallel lanes in each serial link [1] 19911551Sabdul.mutaal@gmail.com num_lanes_per_link = Param.Unsigned( 16, "Number of lanes per each link") 20011183Serfan.azarkhish@unibo.it 20111183Serfan.azarkhish@unibo.it # Number of serial links [1] 20211551Sabdul.mutaal@gmail.com num_serial_links = Param.Unsigned(4, "Number of serial links") 20311183Serfan.azarkhish@unibo.it 20411551Sabdul.mutaal@gmail.com # speed of each lane of serial link - SerDes serial interface 10 Gb/s 20511551Sabdul.mutaal@gmail.com serial_link_speed = Param.UInt64(10, "Gbs/s speed of each lane of" 20611551Sabdul.mutaal@gmail.com "serial link") 20711183Serfan.azarkhish@unibo.it 20811551Sabdul.mutaal@gmail.com #*****************************PERFORMANCE MONITORING************************ 20911183Serfan.azarkhish@unibo.it # The main monitor behind the HMC Controller 21011551Sabdul.mutaal@gmail.com enable_global_monitor = Param.Bool(False, "The main monitor behind the " 21111183Serfan.azarkhish@unibo.it "HMC Controller") 21211183Serfan.azarkhish@unibo.it 21311183Serfan.azarkhish@unibo.it # The link performance monitors 21411551Sabdul.mutaal@gmail.com enable_link_monitor = Param.Bool(False, "The link monitors" ) 21511183Serfan.azarkhish@unibo.it 21611551Sabdul.mutaal@gmail.com # link aggregator enable - put a cross between buffers & links 21711551Sabdul.mutaal@gmail.com enable_link_aggr = Param.Bool(False, "The crossbar between port and " 21811551Sabdul.mutaal@gmail.com "Link Controller") 21911183Serfan.azarkhish@unibo.it 22011551Sabdul.mutaal@gmail.com enable_buff_div = Param.Bool(True, "Memory Range of Buffer is" 22111551Sabdul.mutaal@gmail.com "divided between total range") 22211183Serfan.azarkhish@unibo.it 22311551Sabdul.mutaal@gmail.com #*****************************HMC ARCHITECTURE ************************ 22411551Sabdul.mutaal@gmail.com # Memory chunk for 16 vault - numbers of vault / number of crossbars 22511551Sabdul.mutaal@gmail.com mem_chunk = Param.Unsigned(4, "Chunk of memory range for each cross bar " 22611551Sabdul.mutaal@gmail.com "in arch 0") 22711551Sabdul.mutaal@gmail.com 22811551Sabdul.mutaal@gmail.com # size of req buffer within crossbar, used for modelling extra latency 22911551Sabdul.mutaal@gmail.com # when the reuqest go to non-local vault 23011551Sabdul.mutaal@gmail.com xbar_buffer_size_req = Param.Unsigned(10, "Number of packets to buffer " 23111551Sabdul.mutaal@gmail.com "at the request side of the crossbar") 23211551Sabdul.mutaal@gmail.com 23311551Sabdul.mutaal@gmail.com # size of response buffer within crossbar, used for modelling extra latency 23411551Sabdul.mutaal@gmail.com # when the response received from non-local vault 23511551Sabdul.mutaal@gmail.com xbar_buffer_size_resp = Param.Unsigned(10, "Number of packets to buffer " 23611551Sabdul.mutaal@gmail.com "at the response side of the crossbar") 23711551Sabdul.mutaal@gmail.com 23811551Sabdul.mutaal@gmail.com# configure host system with Serial Links 23911551Sabdul.mutaal@gmail.comdef config_host_hmc(options, system): 24011551Sabdul.mutaal@gmail.com 24111551Sabdul.mutaal@gmail.com system.hmc_host=HMCSystem() 24211551Sabdul.mutaal@gmail.com 24311183Serfan.azarkhish@unibo.it try: 24411551Sabdul.mutaal@gmail.com system.hmc_host.enable_global_monitor = options.enable_global_monitor 24511183Serfan.azarkhish@unibo.it except: 24611183Serfan.azarkhish@unibo.it pass; 24711183Serfan.azarkhish@unibo.it 24811183Serfan.azarkhish@unibo.it try: 24911551Sabdul.mutaal@gmail.com system.hmc_host.enable_link_monitor = options.enable_link_monitor 25011183Serfan.azarkhish@unibo.it except: 25111183Serfan.azarkhish@unibo.it pass; 25211183Serfan.azarkhish@unibo.it 25311551Sabdul.mutaal@gmail.com # Serial link Controller with 16 SerDes links at 10 Gbps 25411551Sabdul.mutaal@gmail.com # with serial link ranges w.r.t to architecture 25511551Sabdul.mutaal@gmail.com system.hmc_host.seriallink = [SerialLink(ranges = options.ser_ranges[i], 25611551Sabdul.mutaal@gmail.com req_size=system.hmc_host.link_buffer_size_req, 25711551Sabdul.mutaal@gmail.com resp_size=system.hmc_host.link_buffer_size_rsp, 25811551Sabdul.mutaal@gmail.com num_lanes=system.hmc_host.num_lanes_per_link, 25911551Sabdul.mutaal@gmail.com link_speed=system.hmc_host.serial_link_speed, 26011551Sabdul.mutaal@gmail.com delay=system.hmc_host.total_ctrl_latency) 26111551Sabdul.mutaal@gmail.com for i in xrange(system.hmc_host.num_serial_links)] 26211183Serfan.azarkhish@unibo.it 26311551Sabdul.mutaal@gmail.com # enable global monitor 26411551Sabdul.mutaal@gmail.com if system.hmc_host.enable_global_monitor: 26511551Sabdul.mutaal@gmail.com system.hmc_host.lmonitor = [ CommMonitor() 26611551Sabdul.mutaal@gmail.com for i in xrange(system.hmc_host.num_serial_links)] 26711183Serfan.azarkhish@unibo.it 26811551Sabdul.mutaal@gmail.com # set the clock frequency for serial link 26911551Sabdul.mutaal@gmail.com for i in xrange(system.hmc_host.num_serial_links): 27011551Sabdul.mutaal@gmail.com system.hmc_host.seriallink[i].clk_domain = SrcClockDomain(clock=system. 27111551Sabdul.mutaal@gmail.com hmc_host.link_controller_frequency, voltage_domain= 27211551Sabdul.mutaal@gmail.com VoltageDomain(voltage = '1V')) 27311183Serfan.azarkhish@unibo.it 27411551Sabdul.mutaal@gmail.com # Connect membus/traffic gen to Serial Link Controller for differrent HMC 27511551Sabdul.mutaal@gmail.com # architectures 27611551Sabdul.mutaal@gmail.com if options.arch == "distributed": 27711551Sabdul.mutaal@gmail.com for i in xrange(system.hmc_host.num_links_controllers): 27811551Sabdul.mutaal@gmail.com if system.hmc_host.enable_global_monitor: 27911551Sabdul.mutaal@gmail.com system.membus.master = system.hmc_host.lmonitor[i].slave 28011551Sabdul.mutaal@gmail.com system.hmc_host.lmonitor[i].master = \ 28111551Sabdul.mutaal@gmail.com system.hmc_host.seriallink[i].slave 28211551Sabdul.mutaal@gmail.com else: 28311551Sabdul.mutaal@gmail.com system.membus.master = system.hmc_host.seriallink[i].slave 28411551Sabdul.mutaal@gmail.com if options.arch == "mixed": 28511551Sabdul.mutaal@gmail.com if system.hmc_host.enable_global_monitor: 28611551Sabdul.mutaal@gmail.com system.membus.master = system.hmc_host.lmonitor[0].slave 28711551Sabdul.mutaal@gmail.com system.hmc_host.lmonitor[0].master = \ 28811551Sabdul.mutaal@gmail.com system.hmc_host.seriallink[0].slave 28911183Serfan.azarkhish@unibo.it 29011551Sabdul.mutaal@gmail.com system.membus.master = system.hmc_host.lmonitor[1].slave 29111551Sabdul.mutaal@gmail.com system.hmc_host.lmonitor[1].master = \ 29211551Sabdul.mutaal@gmail.com system.hmc_host.seriallink[1].slave 29311183Serfan.azarkhish@unibo.it 29411551Sabdul.mutaal@gmail.com system.tgen[2].port = system.hmc_host.lmonitor[2].slave 29511551Sabdul.mutaal@gmail.com system.hmc_host.lmonitor[2].master = \ 29611551Sabdul.mutaal@gmail.com system.hmc_host.seriallink[2].slave 29711183Serfan.azarkhish@unibo.it 29811551Sabdul.mutaal@gmail.com system.tgen[3].port = system.hmc_host.lmonitor[3].slave 29911551Sabdul.mutaal@gmail.com system.hmc_host.lmonitor[3].master = \ 30011551Sabdul.mutaal@gmail.com system.hmc_host.seriallink[3].slave 30111551Sabdul.mutaal@gmail.com else: 30211551Sabdul.mutaal@gmail.com system.membus.master = system.hmc_host.seriallink[0].slave 30311551Sabdul.mutaal@gmail.com system.membus.master = system.hmc_host.seriallink[1].slave 30411551Sabdul.mutaal@gmail.com system.tgen[2].port = system.hmc_host.seriallink[2].slave 30511551Sabdul.mutaal@gmail.com system.tgen[3].port = system.hmc_host.seriallink[3].slave 30611551Sabdul.mutaal@gmail.com if options.arch == "same" : 30711551Sabdul.mutaal@gmail.com for i in xrange(system.hmc_host.num_links_controllers): 30811551Sabdul.mutaal@gmail.com if system.hmc_host.enable_global_monitor: 30911551Sabdul.mutaal@gmail.com system.tgen[i].port = system.hmc_host.lmonitor[i].slave 31011551Sabdul.mutaal@gmail.com system.hmc_host.lmonitor[i].master = \ 31111551Sabdul.mutaal@gmail.com system.hmc_host.seriallink[i].slave 31211551Sabdul.mutaal@gmail.com else: 31311551Sabdul.mutaal@gmail.com system.tgen[i].port = system.hmc_host.seriallink[i].slave 31411183Serfan.azarkhish@unibo.it 31511551Sabdul.mutaal@gmail.com return system 31611551Sabdul.mutaal@gmail.com 31711551Sabdul.mutaal@gmail.com# Create an HMC device and attach it to the current system 31811551Sabdul.mutaal@gmail.comdef config_hmc(options, system, hmc_host): 31911551Sabdul.mutaal@gmail.com 32011551Sabdul.mutaal@gmail.com # Create HMC device 32111551Sabdul.mutaal@gmail.com system.hmc_dev = HMCSystem() 32211551Sabdul.mutaal@gmail.com 32311551Sabdul.mutaal@gmail.com # Global monitor 32411551Sabdul.mutaal@gmail.com try: 32511551Sabdul.mutaal@gmail.com system.hmc_dev.enable_global_monitor = options.enable_global_monitor 32611551Sabdul.mutaal@gmail.com except: 32711551Sabdul.mutaal@gmail.com pass; 32811551Sabdul.mutaal@gmail.com 32911551Sabdul.mutaal@gmail.com try: 33011551Sabdul.mutaal@gmail.com system.hmc_dev.enable_link_monitor = options.enable_link_monitor 33111551Sabdul.mutaal@gmail.com except: 33211551Sabdul.mutaal@gmail.com pass; 33311551Sabdul.mutaal@gmail.com 33411551Sabdul.mutaal@gmail.com 33511551Sabdul.mutaal@gmail.com if system.hmc_dev.enable_link_monitor: 33611551Sabdul.mutaal@gmail.com system.hmc_dev.lmonitor = [ CommMonitor() 33711551Sabdul.mutaal@gmail.com for i in xrange(system.hmc_dev.num_links_controllers)] 33811551Sabdul.mutaal@gmail.com 33911551Sabdul.mutaal@gmail.com # 4 HMC Crossbars located in its logic-base (LoB) 34011551Sabdul.mutaal@gmail.com system.hmc_dev.xbar = [ NoncoherentXBar(width=system.hmc_dev.xbar_width, 34111551Sabdul.mutaal@gmail.com frontend_latency=system.hmc_dev.xbar_frontend_latency, 34211551Sabdul.mutaal@gmail.com forward_latency=system.hmc_dev.xbar_forward_latency, 34311551Sabdul.mutaal@gmail.com response_latency=system.hmc_dev.xbar_response_latency ) 34411551Sabdul.mutaal@gmail.com for i in xrange(system.hmc_host.number_mem_crossbar)] 34511551Sabdul.mutaal@gmail.com 34611551Sabdul.mutaal@gmail.com for i in xrange(system.hmc_dev.number_mem_crossbar): 34711551Sabdul.mutaal@gmail.com system.hmc_dev.xbar[i].clk_domain = SrcClockDomain( 34811551Sabdul.mutaal@gmail.com clock=system.hmc_dev.xbar_frequency,voltage_domain= 34911551Sabdul.mutaal@gmail.com VoltageDomain(voltage='1V')) 35011551Sabdul.mutaal@gmail.com 35111551Sabdul.mutaal@gmail.com # Attach 4 serial link to 4 crossbar/s 35211551Sabdul.mutaal@gmail.com for i in xrange(system.hmc_dev.num_serial_links): 35311551Sabdul.mutaal@gmail.com if system.hmc_dev.enable_link_monitor: 35411551Sabdul.mutaal@gmail.com system.hmc_host.seriallink[i].master = \ 35511551Sabdul.mutaal@gmail.com system.hmc_dev.lmonitor[i].slave 35611551Sabdul.mutaal@gmail.com system.hmc_dev.lmonitor[i].master = system.hmc_dev.xbar[i].slave 35711183Serfan.azarkhish@unibo.it else: 35811551Sabdul.mutaal@gmail.com system.hmc_host.seriallink[i].master = system.hmc_dev.xbar[i].slave 35911551Sabdul.mutaal@gmail.com 36011551Sabdul.mutaal@gmail.com # Connecting xbar with each other for request arriving at the wrong xbar, 36111551Sabdul.mutaal@gmail.com # then it will be forward to correct xbar. Bridge is used to connect xbars 36211551Sabdul.mutaal@gmail.com if options.arch == "same": 36311551Sabdul.mutaal@gmail.com numx = len(system.hmc_dev.xbar) 36411551Sabdul.mutaal@gmail.com 36511551Sabdul.mutaal@gmail.com # create a list of buffers 36611551Sabdul.mutaal@gmail.com system.hmc_dev.buffers = [ Bridge( 36711551Sabdul.mutaal@gmail.com req_size=system.hmc_dev.xbar_buffer_size_req, 36811551Sabdul.mutaal@gmail.com resp_size=system.hmc_dev.xbar_buffer_size_resp) 36911551Sabdul.mutaal@gmail.com for i in xrange(numx * (system.hmc_dev.mem_chunk - 1))] 37011551Sabdul.mutaal@gmail.com 37111551Sabdul.mutaal@gmail.com # Buffer iterator 37211551Sabdul.mutaal@gmail.com it = iter(range(len(system.hmc_dev.buffers))) 37311551Sabdul.mutaal@gmail.com 37411551Sabdul.mutaal@gmail.com # necesarry to add system_port to one of the xbar 37511551Sabdul.mutaal@gmail.com system.system_port = system.hmc_dev.xbar[3].slave 37611551Sabdul.mutaal@gmail.com 37711551Sabdul.mutaal@gmail.com # iterate over all the crossbars and connect them as required 37811551Sabdul.mutaal@gmail.com for i in range(numx): 37911551Sabdul.mutaal@gmail.com for j in range(numx): 38011551Sabdul.mutaal@gmail.com # connect xbar to all other xbars except itself 38111551Sabdul.mutaal@gmail.com if i != j: 38211551Sabdul.mutaal@gmail.com # get the next index of buffer 38311551Sabdul.mutaal@gmail.com index = it.next() 38411551Sabdul.mutaal@gmail.com 38511551Sabdul.mutaal@gmail.com # Change the default values for ranges of bridge 38611551Sabdul.mutaal@gmail.com system.hmc_dev.buffers[index].ranges = system.mem_ranges[ 38711551Sabdul.mutaal@gmail.com j * int(system.hmc_dev.mem_chunk): 38811551Sabdul.mutaal@gmail.com (j + 1) * int(system.hmc_dev.mem_chunk)] 38911551Sabdul.mutaal@gmail.com 39011551Sabdul.mutaal@gmail.com # Connect the bridge between corssbars 39111551Sabdul.mutaal@gmail.com system.hmc_dev.xbar[i].master = system.hmc_dev.buffers[ 39211551Sabdul.mutaal@gmail.com index].slave 39311551Sabdul.mutaal@gmail.com system.hmc_dev.buffers[ 39411551Sabdul.mutaal@gmail.com index].master = system.hmc_dev.xbar[j].slave 39511551Sabdul.mutaal@gmail.com else: 39611551Sabdul.mutaal@gmail.com # Don't connect the xbar to itself 39711551Sabdul.mutaal@gmail.com pass 39811551Sabdul.mutaal@gmail.com 39911551Sabdul.mutaal@gmail.com # Two crossbars are connected to all other crossbars-Other 2 vault 40011551Sabdul.mutaal@gmail.com # can only direct traffic to it local vaults 40111551Sabdul.mutaal@gmail.com if options.arch == "mixed": 40211551Sabdul.mutaal@gmail.com 40311551Sabdul.mutaal@gmail.com system.hmc_dev.buffer30 = Bridge(ranges=system.mem_ranges[0:4]) 40411551Sabdul.mutaal@gmail.com system.hmc_dev.xbar[3].master = system.hmc_dev.buffer30.slave 40511551Sabdul.mutaal@gmail.com system.hmc_dev.buffer30.master = system.hmc_dev.xbar[0].slave 40611551Sabdul.mutaal@gmail.com 40711551Sabdul.mutaal@gmail.com system.hmc_dev.buffer31 = Bridge(ranges=system.mem_ranges[4:8]) 40811551Sabdul.mutaal@gmail.com system.hmc_dev.xbar[3].master = system.hmc_dev.buffer31.slave 40911551Sabdul.mutaal@gmail.com system.hmc_dev.buffer31.master = system.hmc_dev.xbar[1].slave 41011551Sabdul.mutaal@gmail.com 41111551Sabdul.mutaal@gmail.com system.hmc_dev.buffer32 = Bridge(ranges=system.mem_ranges[8:12]) 41211551Sabdul.mutaal@gmail.com system.hmc_dev.xbar[3].master = system.hmc_dev.buffer32.slave 41311551Sabdul.mutaal@gmail.com system.hmc_dev.buffer32.master = system.hmc_dev.xbar[2].slave 41411551Sabdul.mutaal@gmail.com 41511551Sabdul.mutaal@gmail.com 41611551Sabdul.mutaal@gmail.com system.hmc_dev.buffer20 = Bridge(ranges=system.mem_ranges[0:4]) 41711551Sabdul.mutaal@gmail.com system.hmc_dev.xbar[2].master = system.hmc_dev.buffer20.slave 41811551Sabdul.mutaal@gmail.com system.hmc_dev.buffer20.master = system.hmc_dev.xbar[0].slave 41911551Sabdul.mutaal@gmail.com 42011551Sabdul.mutaal@gmail.com system.hmc_dev.buffer21 = Bridge(ranges=system.mem_ranges[4:8]) 42111551Sabdul.mutaal@gmail.com system.hmc_dev.xbar[2].master = system.hmc_dev.buffer21.slave 42211551Sabdul.mutaal@gmail.com system.hmc_dev.buffer21.master = system.hmc_dev.xbar[1].slave 42311551Sabdul.mutaal@gmail.com 42411551Sabdul.mutaal@gmail.com system.hmc_dev.buffer23 = Bridge(ranges=system.mem_ranges[12:16]) 42511551Sabdul.mutaal@gmail.com system.hmc_dev.xbar[2].master = system.hmc_dev.buffer23.slave 42611551Sabdul.mutaal@gmail.com system.hmc_dev.buffer23.master = system.hmc_dev.xbar[3].slave 42711551Sabdul.mutaal@gmail.com 428