DRAMCtrl.py revision 11679
111308Santhony.gutierrez@amd.com# Copyright (c) 2012-2016 ARM Limited
211308Santhony.gutierrez@amd.com# All rights reserved.
311308Santhony.gutierrez@amd.com#
411308Santhony.gutierrez@amd.com# The license below extends only to copyright in the software and shall
511308Santhony.gutierrez@amd.com# not be construed as granting a license to any other intellectual
611308Santhony.gutierrez@amd.com# property including but not limited to intellectual property relating
711308Santhony.gutierrez@amd.com# to a hardware implementation of the functionality of the software
811308Santhony.gutierrez@amd.com# licensed hereunder.  You may use the software subject to the license
911308Santhony.gutierrez@amd.com# terms below provided that you ensure that this notice is replicated
1011308Santhony.gutierrez@amd.com# unmodified and in its entirety in all distributions of the software,
1111308Santhony.gutierrez@amd.com# modified or unmodified, in source code or in binary form.
1211308Santhony.gutierrez@amd.com#
1311308Santhony.gutierrez@amd.com# Copyright (c) 2013 Amin Farmahini-Farahani
1411308Santhony.gutierrez@amd.com# Copyright (c) 2015 University of Kaiserslautern
1511308Santhony.gutierrez@amd.com# Copyright (c) 2015 The University of Bologna
1611308Santhony.gutierrez@amd.com# All rights reserved.
1711308Santhony.gutierrez@amd.com#
1811308Santhony.gutierrez@amd.com# Redistribution and use in source and binary forms, with or without
1911308Santhony.gutierrez@amd.com# modification, are permitted provided that the following conditions are
2011308Santhony.gutierrez@amd.com# met: redistributions of source code must retain the above copyright
2111308Santhony.gutierrez@amd.com# notice, this list of conditions and the following disclaimer;
2211308Santhony.gutierrez@amd.com# redistributions in binary form must reproduce the above copyright
2311308Santhony.gutierrez@amd.com# notice, this list of conditions and the following disclaimer in the
2411308Santhony.gutierrez@amd.com# documentation and/or other materials provided with the distribution;
2511308Santhony.gutierrez@amd.com# neither the name of the copyright holders nor the names of its
2611308Santhony.gutierrez@amd.com# contributors may be used to endorse or promote products derived from
2711308Santhony.gutierrez@amd.com# this software without specific prior written permission.
2811308Santhony.gutierrez@amd.com#
2911308Santhony.gutierrez@amd.com# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3011308Santhony.gutierrez@amd.com# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3111308Santhony.gutierrez@amd.com# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
3211308Santhony.gutierrez@amd.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3311308Santhony.gutierrez@amd.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3411308Santhony.gutierrez@amd.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3511308Santhony.gutierrez@amd.com# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3611308Santhony.gutierrez@amd.com# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3711308Santhony.gutierrez@amd.com# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3811308Santhony.gutierrez@amd.com# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3911308Santhony.gutierrez@amd.com# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4011308Santhony.gutierrez@amd.com#
4111308Santhony.gutierrez@amd.com# Authors: Andreas Hansson
4211308Santhony.gutierrez@amd.com#          Ani Udipi
4311308Santhony.gutierrez@amd.com#          Omar Naji
4411308Santhony.gutierrez@amd.com#          Matthias Jung
4511308Santhony.gutierrez@amd.com#          Erfan Azarkhish
4611308Santhony.gutierrez@amd.com
4711308Santhony.gutierrez@amd.comfrom m5.params import *
4811308Santhony.gutierrez@amd.comfrom AbstractMemory import *
4911308Santhony.gutierrez@amd.com
5011308Santhony.gutierrez@amd.com# Enum for memory scheduling algorithms, currently First-Come
5111308Santhony.gutierrez@amd.com# First-Served and a First-Row Hit then First-Come First-Served
5211308Santhony.gutierrez@amd.comclass MemSched(Enum): vals = ['fcfs', 'frfcfs']
5311308Santhony.gutierrez@amd.com
5411308Santhony.gutierrez@amd.com# Enum for the address mapping. With Ch, Ra, Ba, Ro and Co denoting
5511308Santhony.gutierrez@amd.com# channel, rank, bank, row and column, respectively, and going from
5611308Santhony.gutierrez@amd.com# MSB to LSB.  Available are RoRaBaChCo and RoRaBaCoCh, that are
5711308Santhony.gutierrez@amd.com# suitable for an open-page policy, optimising for sequential accesses
5811308Santhony.gutierrez@amd.com# hitting in the open row. For a closed-page policy, RoCoRaBaCh
5911308Santhony.gutierrez@amd.com# maximises parallelism.
6011308Santhony.gutierrez@amd.comclass AddrMap(Enum): vals = ['RoRaBaChCo', 'RoRaBaCoCh', 'RoCoRaBaCh']
6111308Santhony.gutierrez@amd.com
6211308Santhony.gutierrez@amd.com# Enum for the page policy, either open, open_adaptive, close, or
6311308Santhony.gutierrez@amd.com# close_adaptive.
6411308Santhony.gutierrez@amd.comclass PageManage(Enum): vals = ['open', 'open_adaptive', 'close',
6511308Santhony.gutierrez@amd.com                                'close_adaptive']
6611308Santhony.gutierrez@amd.com
6711308Santhony.gutierrez@amd.com# DRAMCtrl is a single-channel single-ported DRAM controller model
6811308Santhony.gutierrez@amd.com# that aims to model the most important system-level performance
6911308Santhony.gutierrez@amd.com# effects of a DRAM without getting into too much detail of the DRAM
7011308Santhony.gutierrez@amd.com# itself.
7111308Santhony.gutierrez@amd.comclass DRAMCtrl(AbstractMemory):
7211308Santhony.gutierrez@amd.com    type = 'DRAMCtrl'
7311308Santhony.gutierrez@amd.com    cxx_header = "mem/dram_ctrl.hh"
7411308Santhony.gutierrez@amd.com
7511308Santhony.gutierrez@amd.com    # single-ported on the system interface side, instantiate with a
7611308Santhony.gutierrez@amd.com    # bus in front of the controller for multiple ports
7711308Santhony.gutierrez@amd.com    port = SlavePort("Slave port")
7811308Santhony.gutierrez@amd.com
7911308Santhony.gutierrez@amd.com    # the basic configuration of the controller architecture, note
8011308Santhony.gutierrez@amd.com    # that each entry corresponds to a burst for the specific DRAM
8111308Santhony.gutierrez@amd.com    # configuration (e.g. x32 with burst length 8 is 32 bytes) and not
8211308Santhony.gutierrez@amd.com    # the cacheline size or request/packet size
8311308Santhony.gutierrez@amd.com    write_buffer_size = Param.Unsigned(64, "Number of write queue entries")
8411308Santhony.gutierrez@amd.com    read_buffer_size = Param.Unsigned(32, "Number of read queue entries")
8511308Santhony.gutierrez@amd.com
8611308Santhony.gutierrez@amd.com    # threshold in percent for when to forcefully trigger writes and
8711308Santhony.gutierrez@amd.com    # start emptying the write buffer
8811308Santhony.gutierrez@amd.com    write_high_thresh_perc = Param.Percent(85, "Threshold to force writes")
8911308Santhony.gutierrez@amd.com
9011308Santhony.gutierrez@amd.com    # threshold in percentage for when to start writes if the read
9111308Santhony.gutierrez@amd.com    # queue is empty
9211308Santhony.gutierrez@amd.com    write_low_thresh_perc = Param.Percent(50, "Threshold to start writes")
9311308Santhony.gutierrez@amd.com
9411308Santhony.gutierrez@amd.com    # minimum write bursts to schedule before switching back to reads
9511308Santhony.gutierrez@amd.com    min_writes_per_switch = Param.Unsigned(16, "Minimum write bursts before "
9611308Santhony.gutierrez@amd.com                                           "switching to reads")
9711308Santhony.gutierrez@amd.com
9811308Santhony.gutierrez@amd.com    # scheduler, address map and page policy
9911308Santhony.gutierrez@amd.com    mem_sched_policy = Param.MemSched('frfcfs', "Memory scheduling policy")
10011308Santhony.gutierrez@amd.com    addr_mapping = Param.AddrMap('RoRaBaCoCh', "Address mapping policy")
10111308Santhony.gutierrez@amd.com    page_policy = Param.PageManage('open_adaptive', "Page management policy")
10211308Santhony.gutierrez@amd.com
10311308Santhony.gutierrez@amd.com    # enforce a limit on the number of accesses per row
10411308Santhony.gutierrez@amd.com    max_accesses_per_row = Param.Unsigned(16, "Max accesses per row before "
10511308Santhony.gutierrez@amd.com                                          "closing");
10611308Santhony.gutierrez@amd.com
10711308Santhony.gutierrez@amd.com    # size of DRAM Chip in Bytes
10811308Santhony.gutierrez@amd.com    device_size = Param.MemorySize("Size of DRAM chip")
10911308Santhony.gutierrez@amd.com
11011308Santhony.gutierrez@amd.com    # pipeline latency of the controller and PHY, split into a
11111308Santhony.gutierrez@amd.com    # frontend part and a backend part, with reads and writes serviced
11211308Santhony.gutierrez@amd.com    # by the queues only seeing the frontend contribution, and reads
11311308Santhony.gutierrez@amd.com    # serviced by the memory seeing the sum of the two
11411308Santhony.gutierrez@amd.com    static_frontend_latency = Param.Latency("10ns", "Static frontend latency")
11511308Santhony.gutierrez@amd.com    static_backend_latency = Param.Latency("10ns", "Static backend latency")
11611308Santhony.gutierrez@amd.com
11711308Santhony.gutierrez@amd.com    # the physical organisation of the DRAM
11811308Santhony.gutierrez@amd.com    device_bus_width = Param.Unsigned("data bus width in bits for each DRAM "\
11911308Santhony.gutierrez@amd.com                                      "device/chip")
12011308Santhony.gutierrez@amd.com    burst_length = Param.Unsigned("Burst lenght (BL) in beats")
12111308Santhony.gutierrez@amd.com    device_rowbuffer_size = Param.MemorySize("Page (row buffer) size per "\
12211308Santhony.gutierrez@amd.com                                           "device/chip")
12311308Santhony.gutierrez@amd.com    devices_per_rank = Param.Unsigned("Number of devices/chips per rank")
12411308Santhony.gutierrez@amd.com    ranks_per_channel = Param.Unsigned("Number of ranks per channel")
12511308Santhony.gutierrez@amd.com
12611308Santhony.gutierrez@amd.com    # default to 0 bank groups per rank, indicating bank group architecture
12711308Santhony.gutierrez@amd.com    # is not used
12811308Santhony.gutierrez@amd.com    # update per memory class when bank group architecture is supported
12911308Santhony.gutierrez@amd.com    bank_groups_per_rank = Param.Unsigned(0, "Number of bank groups per rank")
13011308Santhony.gutierrez@amd.com    banks_per_rank = Param.Unsigned("Number of banks per rank")
13111308Santhony.gutierrez@amd.com    # only used for the address mapping as the controller by
13211308Santhony.gutierrez@amd.com    # construction is a single channel and multiple controllers have
13311308Santhony.gutierrez@amd.com    # to be instantiated for a multi-channel configuration
13411308Santhony.gutierrez@amd.com    channels = Param.Unsigned(1, "Number of channels")
13511308Santhony.gutierrez@amd.com
13611308Santhony.gutierrez@amd.com    # For power modelling we need to know if the DRAM has a DLL or not
13711308Santhony.gutierrez@amd.com    dll = Param.Bool(True, "DRAM has DLL or not")
13811308Santhony.gutierrez@amd.com
13911308Santhony.gutierrez@amd.com    # DRAMPower provides in addition to the core power, the possibility to
14011308Santhony.gutierrez@amd.com    # include RD/WR termination and IO power. This calculation assumes some
14111308Santhony.gutierrez@amd.com    # default values. The integration of DRAMPower with gem5 does not include
14211308Santhony.gutierrez@amd.com    # IO and RD/WR termination power by default. This might be added as an
14311308Santhony.gutierrez@amd.com    # additional feature in the future.
14411308Santhony.gutierrez@amd.com
14511308Santhony.gutierrez@amd.com    # timing behaviour and constraints - all in nanoseconds
14611308Santhony.gutierrez@amd.com
14711308Santhony.gutierrez@amd.com    # the base clock period of the DRAM
14811308Santhony.gutierrez@amd.com    tCK = Param.Latency("Clock period")
14911308Santhony.gutierrez@amd.com
15011308Santhony.gutierrez@amd.com    # the amount of time in nanoseconds from issuing an activate command
15111308Santhony.gutierrez@amd.com    # to the data being available in the row buffer for a read/write
15211308Santhony.gutierrez@amd.com    tRCD = Param.Latency("RAS to CAS delay")
15311308Santhony.gutierrez@amd.com
15411308Santhony.gutierrez@amd.com    # the time from issuing a read/write command to seeing the actual data
15511308Santhony.gutierrez@amd.com    tCL = Param.Latency("CAS latency")
15611308Santhony.gutierrez@amd.com
15711308Santhony.gutierrez@amd.com    # minimum time between a precharge and subsequent activate
15811308Santhony.gutierrez@amd.com    tRP = Param.Latency("Row precharge time")
15911308Santhony.gutierrez@amd.com
16011308Santhony.gutierrez@amd.com    # minimum time between an activate and a precharge to the same row
16111308Santhony.gutierrez@amd.com    tRAS = Param.Latency("ACT to PRE delay")
16211308Santhony.gutierrez@amd.com
16311308Santhony.gutierrez@amd.com    # minimum time between a write data transfer and a precharge
16411308Santhony.gutierrez@amd.com    tWR = Param.Latency("Write recovery time")
16511308Santhony.gutierrez@amd.com
16611308Santhony.gutierrez@amd.com    # minimum time between a read and precharge command
16711308Santhony.gutierrez@amd.com    tRTP = Param.Latency("Read to precharge")
16811308Santhony.gutierrez@amd.com
16911308Santhony.gutierrez@amd.com    # time to complete a burst transfer, typically the burst length
17011308Santhony.gutierrez@amd.com    # divided by two due to the DDR bus, but by making it a parameter
17111308Santhony.gutierrez@amd.com    # it is easier to also evaluate SDR memories like WideIO.
17211308Santhony.gutierrez@amd.com    # This parameter has to account for burst length.
17311308Santhony.gutierrez@amd.com    # Read/Write requests with data size larger than one full burst are broken
17411308Santhony.gutierrez@amd.com    # down into multiple requests in the controller
17511308Santhony.gutierrez@amd.com    # tBURST is equivalent to the CAS-to-CAS delay (tCCD)
17611308Santhony.gutierrez@amd.com    # With bank group architectures, tBURST represents the CAS-to-CAS
17711308Santhony.gutierrez@amd.com    # delay for bursts to different bank groups (tCCD_S)
17811308Santhony.gutierrez@amd.com    tBURST = Param.Latency("Burst duration (for DDR burst length / 2 cycles)")
17911308Santhony.gutierrez@amd.com
18011308Santhony.gutierrez@amd.com    # CAS-to-CAS delay for bursts to the same bank group
18111308Santhony.gutierrez@amd.com    # only utilized with bank group architectures; set to 0 for default case
18211308Santhony.gutierrez@amd.com    # tBURST is equivalent to tCCD_S; no explicit parameter required
18311308Santhony.gutierrez@amd.com    # for CAS-to-CAS delay for bursts to different bank groups
18411308Santhony.gutierrez@amd.com    tCCD_L = Param.Latency("0ns", "Same bank group CAS to CAS delay")
18511308Santhony.gutierrez@amd.com
18611308Santhony.gutierrez@amd.com    # time taken to complete one refresh cycle (N rows in all banks)
18711308Santhony.gutierrez@amd.com    tRFC = Param.Latency("Refresh cycle time")
18811308Santhony.gutierrez@amd.com
18911308Santhony.gutierrez@amd.com    # refresh command interval, how often a "ref" command needs
19011308Santhony.gutierrez@amd.com    # to be sent. It is 7.8 us for a 64ms refresh requirement
19111308Santhony.gutierrez@amd.com    tREFI = Param.Latency("Refresh command interval")
19211308Santhony.gutierrez@amd.com
19311308Santhony.gutierrez@amd.com    # write-to-read, same rank turnaround penalty
19411308Santhony.gutierrez@amd.com    tWTR = Param.Latency("Write to read, same rank switching time")
19511308Santhony.gutierrez@amd.com
19611308Santhony.gutierrez@amd.com    # read-to-write, same rank turnaround penalty
19711308Santhony.gutierrez@amd.com    tRTW = Param.Latency("Read to write, same rank switching time")
19811308Santhony.gutierrez@amd.com
19911308Santhony.gutierrez@amd.com    # rank-to-rank bus delay penalty
20011308Santhony.gutierrez@amd.com    # this does not correlate to a memory timing parameter and encompasses:
20111308Santhony.gutierrez@amd.com    # 1) RD-to-RD, 2) WR-to-WR, 3) RD-to-WR, and 4) WR-to-RD
20211308Santhony.gutierrez@amd.com    # different rank bus delay
20311308Santhony.gutierrez@amd.com    tCS = Param.Latency("Rank to rank switching time")
20411308Santhony.gutierrez@amd.com
20511308Santhony.gutierrez@amd.com    # minimum row activate to row activate delay time
20611308Santhony.gutierrez@amd.com    tRRD = Param.Latency("ACT to ACT delay")
20711308Santhony.gutierrez@amd.com
20811308Santhony.gutierrez@amd.com    # only utilized with bank group architectures; set to 0 for default case
20911308Santhony.gutierrez@amd.com    tRRD_L = Param.Latency("0ns", "Same bank group ACT to ACT delay")
21011308Santhony.gutierrez@amd.com
21111308Santhony.gutierrez@amd.com    # time window in which a maximum number of activates are allowed
21211308Santhony.gutierrez@amd.com    # to take place, set to 0 to disable
21311308Santhony.gutierrez@amd.com    tXAW = Param.Latency("X activation window")
21411308Santhony.gutierrez@amd.com    activation_limit = Param.Unsigned("Max number of activates in window")
21511308Santhony.gutierrez@amd.com
21611308Santhony.gutierrez@amd.com    # time to exit power-down mode
21711308Santhony.gutierrez@amd.com    # Exit power-down to next valid command delay
21811308Santhony.gutierrez@amd.com    tXP = Param.Latency("0ns", "Power-up Delay")
21911308Santhony.gutierrez@amd.com
22011308Santhony.gutierrez@amd.com    # Exit Powerdown to commands requiring a locked DLL
22111308Santhony.gutierrez@amd.com    tXPDLL = Param.Latency("0ns", "Power-up Delay with locked DLL")
22211308Santhony.gutierrez@amd.com
22311308Santhony.gutierrez@amd.com    # time to exit self-refresh mode
22411308Santhony.gutierrez@amd.com    tXS = Param.Latency("0ns", "Self-refresh exit latency")
22511308Santhony.gutierrez@amd.com
22611308Santhony.gutierrez@amd.com    # time to exit self-refresh mode with locked DLL
22711308Santhony.gutierrez@amd.com    tXSDLL = Param.Latency("0ns", "Self-refresh exit latency DLL")
22811308Santhony.gutierrez@amd.com
22911308Santhony.gutierrez@amd.com    # Currently rolled into other params
23011308Santhony.gutierrez@amd.com    ######################################################################
23111308Santhony.gutierrez@amd.com
23211308Santhony.gutierrez@amd.com    # tRC  - assumed to be tRAS + tRP
23311308Santhony.gutierrez@amd.com
23411308Santhony.gutierrez@amd.com    # Power Behaviour and Constraints
23511308Santhony.gutierrez@amd.com    # DRAMs like LPDDR and WideIO have 2 external voltage domains. These are
23611308Santhony.gutierrez@amd.com    # defined as VDD and VDD2. Each current is defined for each voltage domain
23711308Santhony.gutierrez@amd.com    # separately. For example, current IDD0 is active-precharge current for
23811308Santhony.gutierrez@amd.com    # voltage domain VDD and current IDD02 is active-precharge current for
23911308Santhony.gutierrez@amd.com    # voltage domain VDD2.
24011308Santhony.gutierrez@amd.com    # By default all currents are set to 0mA. Users who are only interested in
24111308Santhony.gutierrez@amd.com    # the performance of DRAMs can leave them at 0.
24211308Santhony.gutierrez@amd.com
24311308Santhony.gutierrez@amd.com    # Operating 1 Bank Active-Precharge current
24411308Santhony.gutierrez@amd.com    IDD0 = Param.Current("0mA", "Active precharge current")
24511308Santhony.gutierrez@amd.com
24611308Santhony.gutierrez@amd.com    # Operating 1 Bank Active-Precharge current multiple voltage Range
24711308Santhony.gutierrez@amd.com    IDD02 = Param.Current("0mA", "Active precharge current VDD2")
24811308Santhony.gutierrez@amd.com
24911308Santhony.gutierrez@amd.com    # Precharge Power-down Current: Slow exit
25011308Santhony.gutierrez@amd.com    IDD2P0 = Param.Current("0mA", "Precharge Powerdown slow")
25111308Santhony.gutierrez@amd.com
25211308Santhony.gutierrez@amd.com    # Precharge Power-down Current: Slow exit multiple voltage Range
25311308Santhony.gutierrez@amd.com    IDD2P02 = Param.Current("0mA", "Precharge Powerdown slow VDD2")
25411308Santhony.gutierrez@amd.com
25511308Santhony.gutierrez@amd.com    # Precharge Power-down Current: Fast exit
25611308Santhony.gutierrez@amd.com    IDD2P1 = Param.Current("0mA", "Precharge Powerdown fast")
25711308Santhony.gutierrez@amd.com
25811308Santhony.gutierrez@amd.com    # Precharge Power-down Current: Fast exit multiple voltage Range
25911308Santhony.gutierrez@amd.com    IDD2P12 = Param.Current("0mA", "Precharge Powerdown fast VDD2")
26011308Santhony.gutierrez@amd.com
26111308Santhony.gutierrez@amd.com    # Precharge Standby current
26211308Santhony.gutierrez@amd.com    IDD2N = Param.Current("0mA", "Precharge Standby current")
26311308Santhony.gutierrez@amd.com
26411308Santhony.gutierrez@amd.com    # Precharge Standby current multiple voltage range
26511308Santhony.gutierrez@amd.com    IDD2N2 = Param.Current("0mA", "Precharge Standby current VDD2")
26611308Santhony.gutierrez@amd.com
26711308Santhony.gutierrez@amd.com    # Active Power-down current: slow exit
26811308Santhony.gutierrez@amd.com    IDD3P0 = Param.Current("0mA", "Active Powerdown slow")
26911308Santhony.gutierrez@amd.com
27011308Santhony.gutierrez@amd.com    # Active Power-down current: slow exit multiple voltage range
27111308Santhony.gutierrez@amd.com    IDD3P02 = Param.Current("0mA", "Active Powerdown slow VDD2")
27211308Santhony.gutierrez@amd.com
27311308Santhony.gutierrez@amd.com    # Active Power-down current : fast exit
27411308Santhony.gutierrez@amd.com    IDD3P1 = Param.Current("0mA", "Active Powerdown fast")
27511308Santhony.gutierrez@amd.com
27611308Santhony.gutierrez@amd.com    # Active Power-down current : fast exit multiple voltage range
27711308Santhony.gutierrez@amd.com    IDD3P12 = Param.Current("0mA", "Active Powerdown fast VDD2")
27811308Santhony.gutierrez@amd.com
27911308Santhony.gutierrez@amd.com    # Active Standby current
28011308Santhony.gutierrez@amd.com    IDD3N = Param.Current("0mA", "Active Standby current")
28111308Santhony.gutierrez@amd.com
28211308Santhony.gutierrez@amd.com    # Active Standby current multiple voltage range
28311308Santhony.gutierrez@amd.com    IDD3N2 = Param.Current("0mA", "Active Standby current VDD2")
28411308Santhony.gutierrez@amd.com
28511308Santhony.gutierrez@amd.com    # Burst Read Operating Current
28611308Santhony.gutierrez@amd.com    IDD4R = Param.Current("0mA", "READ current")
28711308Santhony.gutierrez@amd.com
288    # Burst Read Operating Current multiple voltage range
289    IDD4R2 = Param.Current("0mA", "READ current VDD2")
290
291    # Burst Write Operating Current
292    IDD4W = Param.Current("0mA", "WRITE current")
293
294    # Burst Write Operating Current multiple voltage range
295    IDD4W2 = Param.Current("0mA", "WRITE current VDD2")
296
297    # Refresh Current
298    IDD5 = Param.Current("0mA", "Refresh current")
299
300    # Refresh Current multiple voltage range
301    IDD52 = Param.Current("0mA", "Refresh current VDD2")
302
303    # Self-Refresh Current
304    IDD6 = Param.Current("0mA", "Self-refresh Current")
305
306    # Self-Refresh Current multiple voltage range
307    IDD62 = Param.Current("0mA", "Self-refresh Current VDD2")
308
309    # Main voltage range of the DRAM
310    VDD = Param.Voltage("0V", "Main Voltage Range")
311
312    # Second voltage range defined by some DRAMs
313    VDD2 = Param.Voltage("0V", "2nd Voltage Range")
314
315# A single DDR3-1600 x64 channel (one command and address bus), with
316# timings based on a DDR3-1600 4 Gbit datasheet (Micron MT41J512M8) in
317# an 8x8 configuration.
318class DDR3_1600_x64(DRAMCtrl):
319    # size of device in bytes
320    device_size = '512MB'
321
322    # 8x8 configuration, 8 devices each with an 8-bit interface
323    device_bus_width = 8
324
325    # DDR3 is a BL8 device
326    burst_length = 8
327
328    # Each device has a page (row buffer) size of 1 Kbyte (1K columns x8)
329    device_rowbuffer_size = '1kB'
330
331    # 8x8 configuration, so 8 devices
332    devices_per_rank = 8
333
334    # Use two ranks
335    ranks_per_channel = 2
336
337    # DDR3 has 8 banks in all configurations
338    banks_per_rank = 8
339
340    # 800 MHz
341    tCK = '1.25ns'
342
343    # 8 beats across an x64 interface translates to 4 clocks @ 800 MHz
344    tBURST = '5ns'
345
346    # DDR3-1600 11-11-11
347    tRCD = '13.75ns'
348    tCL = '13.75ns'
349    tRP = '13.75ns'
350    tRAS = '35ns'
351    tRRD = '6ns'
352    tXAW = '30ns'
353    activation_limit = 4
354    tRFC = '260ns'
355
356    tWR = '15ns'
357
358    # Greater of 4 CK or 7.5 ns
359    tWTR = '7.5ns'
360
361    # Greater of 4 CK or 7.5 ns
362    tRTP = '7.5ns'
363
364    # Default same rank rd-to-wr bus turnaround to 2 CK, @800 MHz = 2.5 ns
365    tRTW = '2.5ns'
366
367    # Default different rank bus delay to 2 CK, @800 MHz = 2.5 ns
368    tCS = '2.5ns'
369
370    # <=85C, half for >85C
371    tREFI = '7.8us'
372
373    # active powerdown and precharge powerdown exit time
374    tXP = '6ns'
375
376    # self refresh exit time
377    tXS = '270ns'
378
379    # Current values from datasheet Die Rev E,J
380    IDD0 = '55mA'
381    IDD2N = '32mA'
382    IDD3N = '38mA'
383    IDD4W = '125mA'
384    IDD4R = '157mA'
385    IDD5 = '235mA'
386    IDD3P1 = '38mA'
387    IDD2P1 = '32mA'
388    IDD6 = '20mA'
389    VDD = '1.5V'
390
391# A single HMC-2500 x32 model based on:
392# [1] DRAMSpec: a high-level DRAM bank modelling tool
393# developed at the University of Kaiserslautern. This high level tool
394# uses RC (resistance-capacitance) and CV (capacitance-voltage) models to
395# estimate the DRAM bank latency and power numbers.
396# [2] High performance AXI-4.0 based interconnect for extensible smart memory
397# cubes (E. Azarkhish et. al)
398# Assumed for the HMC model is a 30 nm technology node.
399# The modelled HMC consists of 4 Gbit layers which sum up to 2GB of memory (4
400# layers).
401# Each layer has 16 vaults and each vault consists of 2 banks per layer.
402# In order to be able to use the same controller used for 2D DRAM generations
403# for HMC, the following analogy is done:
404# Channel (DDR) => Vault (HMC)
405# device_size (DDR) => size of a single layer in a vault
406# ranks per channel (DDR) => number of layers
407# banks per rank (DDR) => banks per layer
408# devices per rank (DDR) => devices per layer ( 1 for HMC).
409# The parameters for which no input is available are inherited from the DDR3
410# configuration.
411# This configuration includes the latencies from the DRAM to the logic layer
412# of the HMC
413class HMC_2500_x32(DDR3_1600_x64):
414    # size of device
415    # two banks per device with each bank 4MB [2]
416    device_size = '8MB'
417
418    # 1x32 configuration, 1 device with 32 TSVs [2]
419    device_bus_width = 32
420
421    # HMC is a BL8 device [2]
422    burst_length = 8
423
424    # Each device has a page (row buffer) size of 256 bytes [2]
425    device_rowbuffer_size = '256B'
426
427    # 1x32 configuration, so 1 device [2]
428    devices_per_rank = 1
429
430    # 4 layers so 4 ranks [2]
431    ranks_per_channel = 4
432
433    # HMC has 2 banks per layer [2]
434    # Each layer represents a rank. With 4 layers and 8 banks in total, each
435    # layer has 2 banks; thus 2 banks per rank.
436    banks_per_rank = 2
437
438    # 1250 MHz [2]
439    tCK = '0.8ns'
440
441    # 8 beats across an x32 interface translates to 4 clocks @ 1250 MHz
442    tBURST = '3.2ns'
443
444    # Values using DRAMSpec HMC model [1]
445    tRCD = '10.2ns'
446    tCL = '9.9ns'
447    tRP = '7.7ns'
448    tRAS = '21.6ns'
449
450    # tRRD depends on the power supply network for each vendor.
451    # We assume a tRRD of a double bank approach to be equal to 4 clock
452    # cycles (Assumption)
453    tRRD = '3.2ns'
454
455    # activation limit is set to 0 since there are only 2 banks per vault
456    # layer.
457    activation_limit = 0
458
459    # Values using DRAMSpec HMC model [1]
460    tRFC = '59ns'
461    tWR = '8ns'
462    tRTP = '4.9ns'
463
464    # Default different rank bus delay assumed to 1 CK for TSVs, @1250 MHz =
465    # 0.8 ns (Assumption)
466    tCS = '0.8ns'
467
468    # Value using DRAMSpec HMC model [1]
469    tREFI = '3.9us'
470
471    # The default page policy in the vault controllers is simple closed page
472    # [2] nevertheless 'close' policy opens and closes the row multiple times
473    # for bursts largers than 32Bytes. For this reason we use 'close_adaptive'
474    page_policy = 'close_adaptive'
475
476    # RoCoRaBaCh resembles the default address mapping in HMC
477    addr_mapping = 'RoCoRaBaCh'
478    min_writes_per_switch = 8
479
480    # These parameters do not directly correlate with buffer_size in real
481    # hardware. Nevertheless, their value has been tuned to achieve a
482    # bandwidth similar to the cycle-accurate model in [2]
483    write_buffer_size = 32
484    read_buffer_size = 32
485
486    # The static latency of the vault controllers is estimated to be smaller
487    # than a full DRAM channel controller
488    static_backend_latency='4ns'
489    static_frontend_latency='4ns'
490
491# A single DDR3-2133 x64 channel refining a selected subset of the
492# options for the DDR-1600 configuration, based on the same DDR3-1600
493# 4 Gbit datasheet (Micron MT41J512M8). Most parameters are kept
494# consistent across the two configurations.
495class DDR3_2133_x64(DDR3_1600_x64):
496    # 1066 MHz
497    tCK = '0.938ns'
498
499    # 8 beats across an x64 interface translates to 4 clocks @ 1066 MHz
500    tBURST = '3.752ns'
501
502    # DDR3-2133 14-14-14
503    tRCD = '13.09ns'
504    tCL = '13.09ns'
505    tRP = '13.09ns'
506    tRAS = '33ns'
507    tRRD = '5ns'
508    tXAW = '25ns'
509
510    # Current values from datasheet
511    IDD0 = '70mA'
512    IDD2N = '37mA'
513    IDD3N = '44mA'
514    IDD4W = '157mA'
515    IDD4R = '191mA'
516    IDD5 = '250mA'
517    IDD3P1 = '44mA'
518    IDD2P1 = '43mA'
519    IDD6 ='20mA'
520    VDD = '1.5V'
521
522# A single DDR4-2400 x64 channel (one command and address bus), with
523# timings based on a DDR4-2400 4 Gbit datasheet (Micron MT40A512M16)
524# in an 4x16 configuration.
525class DDR4_2400_x64(DRAMCtrl):
526    # size of device
527    device_size = '512MB'
528
529    # 4x16 configuration, 4 devices each with an 16-bit interface
530    device_bus_width = 16
531
532    # DDR4 is a BL8 device
533    burst_length = 8
534
535    # Each device has a page (row buffer) size of 2 Kbyte (1K columns x16)
536    device_rowbuffer_size = '2kB'
537
538    # 4x16 configuration, so 4 devices
539    devices_per_rank = 4
540
541    # Match our DDR3 configurations which is dual rank
542    ranks_per_channel = 2
543
544    # DDR4 has 2 (x16) or 4 (x4 and x8) bank groups
545    # Set to 2 for x16 case
546    bank_groups_per_rank = 2
547
548    # DDR4 has 16 banks(x4,x8) and 8 banks(x16) (4 bank groups in all
549    # configurations). Currently we do not capture the additional
550    # constraints incurred by the bank groups
551    banks_per_rank = 8
552
553    # override the default buffer sizes and go for something larger to
554    # accommodate the larger bank count
555    write_buffer_size = 128
556    read_buffer_size = 64
557
558    # 1200 MHz
559    tCK = '0.833ns'
560
561    # 8 beats across an x64 interface translates to 4 clocks @ 1200 MHz
562    # tBURST is equivalent to the CAS-to-CAS delay (tCCD)
563    # With bank group architectures, tBURST represents the CAS-to-CAS
564    # delay for bursts to different bank groups (tCCD_S)
565    tBURST = '3.333ns'
566
567    # @2400 data rate, tCCD_L is 6 CK
568    # CAS-to-CAS delay for bursts to the same bank group
569    # tBURST is equivalent to tCCD_S; no explicit parameter required
570    # for CAS-to-CAS delay for bursts to different bank groups
571    tCCD_L = '5ns';
572
573    # DDR4-2400 16-16-16
574    tRCD = '13.32ns'
575    tCL = '13.32ns'
576    tRP = '13.32ns'
577    tRAS = '35ns'
578
579    # RRD_S (different bank group) for 2K page is MAX(4 CK, 5.3ns)
580    tRRD = '5.3ns'
581
582    # RRD_L (same bank group) for 2K page is MAX(4 CK, 6.4ns)
583    tRRD_L = '6.4ns';
584
585    tXAW = '30ns'
586    activation_limit = 4
587    tRFC = '260ns'
588
589    tWR = '15ns'
590
591    # Here using the average of WTR_S and WTR_L
592    tWTR = '5ns'
593
594    # Greater of 4 CK or 7.5 ns
595    tRTP = '7.5ns'
596
597    # Default same rank rd-to-wr bus turnaround to 2 CK, @1200 MHz = 1.666 ns
598    tRTW = '1.666ns'
599
600    # Default different rank bus delay to 2 CK, @1200 MHz = 1.666 ns
601    tCS = '1.666ns'
602
603    # <=85C, half for >85C
604    tREFI = '7.8us'
605
606    # active powerdown and precharge powerdown exit time
607    tXP = '6ns'
608
609    # self refresh exit time
610    tXS = '120ns'
611
612    # Current values from datasheet
613    IDD0 = '70mA'
614    IDD02 = '4.6mA'
615    IDD2N = '50mA'
616    IDD3N = '67mA'
617    IDD3N2 = '3mA'
618    IDD4W = '302mA'
619    IDD4R = '230mA'
620    IDD5 = '192mA'
621    IDD3P1 = '44mA'
622    IDD2P1 = '32mA'
623    IDD6 = '20mA'
624    VDD = '1.2V'
625    VDD2 = '2.5V'
626
627# A single LPDDR2-S4 x32 interface (one command/address bus), with
628# default timings based on a LPDDR2-1066 4 Gbit part (Micron MT42L128M32D1)
629# in a 1x32 configuration.
630class LPDDR2_S4_1066_x32(DRAMCtrl):
631    # No DLL in LPDDR2
632    dll = False
633
634    # size of device
635    device_size = '512MB'
636
637    # 1x32 configuration, 1 device with a 32-bit interface
638    device_bus_width = 32
639
640    # LPDDR2_S4 is a BL4 and BL8 device
641    burst_length = 8
642
643    # Each device has a page (row buffer) size of 1KB
644    # (this depends on the memory density)
645    device_rowbuffer_size = '1kB'
646
647    # 1x32 configuration, so 1 device
648    devices_per_rank = 1
649
650    # Use a single rank
651    ranks_per_channel = 1
652
653    # LPDDR2-S4 has 8 banks in all configurations
654    banks_per_rank = 8
655
656    # 533 MHz
657    tCK = '1.876ns'
658
659    # Fixed at 15 ns
660    tRCD = '15ns'
661
662    # 8 CK read latency, 4 CK write latency @ 533 MHz, 1.876 ns cycle time
663    tCL = '15ns'
664
665    # Pre-charge one bank 15 ns (all banks 18 ns)
666    tRP = '15ns'
667
668    tRAS = '42ns'
669    tWR = '15ns'
670
671    tRTP = '7.5ns'
672
673    # 8 beats across an x32 DDR interface translates to 4 clocks @ 533 MHz.
674    # Note this is a BL8 DDR device.
675    # Requests larger than 32 bytes are broken down into multiple requests
676    # in the controller
677    tBURST = '7.5ns'
678
679    # LPDDR2-S4, 4 Gbit
680    tRFC = '130ns'
681    tREFI = '3.9us'
682
683    # active powerdown and precharge powerdown exit time
684    tXP = '7.5ns'
685
686    # self refresh exit time
687    tXS = '140ns'
688
689    # Irrespective of speed grade, tWTR is 7.5 ns
690    tWTR = '7.5ns'
691
692    # Default same rank rd-to-wr bus turnaround to 2 CK, @533 MHz = 3.75 ns
693    tRTW = '3.75ns'
694
695    # Default different rank bus delay to 2 CK, @533 MHz = 3.75 ns
696    tCS = '3.75ns'
697
698    # Activate to activate irrespective of density and speed grade
699    tRRD = '10.0ns'
700
701    # Irrespective of density, tFAW is 50 ns
702    tXAW = '50ns'
703    activation_limit = 4
704
705    # Current values from datasheet
706    IDD0 = '15mA'
707    IDD02 = '70mA'
708    IDD2N = '2mA'
709    IDD2N2 = '30mA'
710    IDD3N = '2.5mA'
711    IDD3N2 = '30mA'
712    IDD4W = '10mA'
713    IDD4W2 = '190mA'
714    IDD4R = '3mA'
715    IDD4R2 = '220mA'
716    IDD5 = '40mA'
717    IDD52 = '150mA'
718    IDD3P1 = '1.2mA'
719    IDD3P12 = '8mA'
720    IDD2P1 = '0.6mA'
721    IDD2P12 = '0.8mA'
722    IDD6 = '1mA'
723    IDD62 = '3.2mA'
724    VDD = '1.8V'
725    VDD2 = '1.2V'
726
727# A single WideIO x128 interface (one command and address bus), with
728# default timings based on an estimated WIO-200 8 Gbit part.
729class WideIO_200_x128(DRAMCtrl):
730    # No DLL for WideIO
731    dll = False
732
733    # size of device
734    device_size = '1024MB'
735
736    # 1x128 configuration, 1 device with a 128-bit interface
737    device_bus_width = 128
738
739    # This is a BL4 device
740    burst_length = 4
741
742    # Each device has a page (row buffer) size of 4KB
743    # (this depends on the memory density)
744    device_rowbuffer_size = '4kB'
745
746    # 1x128 configuration, so 1 device
747    devices_per_rank = 1
748
749    # Use one rank for a one-high die stack
750    ranks_per_channel = 1
751
752    # WideIO has 4 banks in all configurations
753    banks_per_rank = 4
754
755    # 200 MHz
756    tCK = '5ns'
757
758    # WIO-200
759    tRCD = '18ns'
760    tCL = '18ns'
761    tRP = '18ns'
762    tRAS = '42ns'
763    tWR = '15ns'
764    # Read to precharge is same as the burst
765    tRTP = '20ns'
766
767    # 4 beats across an x128 SDR interface translates to 4 clocks @ 200 MHz.
768    # Note this is a BL4 SDR device.
769    tBURST = '20ns'
770
771    # WIO 8 Gb
772    tRFC = '210ns'
773
774    # WIO 8 Gb, <=85C, half for >85C
775    tREFI = '3.9us'
776
777    # Greater of 2 CK or 15 ns, 2 CK @ 200 MHz = 10 ns
778    tWTR = '15ns'
779
780    # Default same rank rd-to-wr bus turnaround to 2 CK, @200 MHz = 10 ns
781    tRTW = '10ns'
782
783    # Default different rank bus delay to 2 CK, @200 MHz = 10 ns
784    tCS = '10ns'
785
786    # Activate to activate irrespective of density and speed grade
787    tRRD = '10.0ns'
788
789    # Two instead of four activation window
790    tXAW = '50ns'
791    activation_limit = 2
792
793    # The WideIO specification does not provide current information
794
795# A single LPDDR3 x32 interface (one command/address bus), with
796# default timings based on a LPDDR3-1600 4 Gbit part (Micron
797# EDF8132A1MC) in a 1x32 configuration.
798class LPDDR3_1600_x32(DRAMCtrl):
799    # No DLL for LPDDR3
800    dll = False
801
802    # size of device
803    device_size = '512MB'
804
805    # 1x32 configuration, 1 device with a 32-bit interface
806    device_bus_width = 32
807
808    # LPDDR3 is a BL8 device
809    burst_length = 8
810
811    # Each device has a page (row buffer) size of 4KB
812    device_rowbuffer_size = '4kB'
813
814    # 1x32 configuration, so 1 device
815    devices_per_rank = 1
816
817    # Technically the datasheet is a dual-rank package, but for
818    # comparison with the LPDDR2 config we stick to a single rank
819    ranks_per_channel = 1
820
821    # LPDDR3 has 8 banks in all configurations
822    banks_per_rank = 8
823
824    # 800 MHz
825    tCK = '1.25ns'
826
827    tRCD = '18ns'
828
829    # 12 CK read latency, 6 CK write latency @ 800 MHz, 1.25 ns cycle time
830    tCL = '15ns'
831
832    tRAS = '42ns'
833    tWR = '15ns'
834
835    # Greater of 4 CK or 7.5 ns, 4 CK @ 800 MHz = 5 ns
836    tRTP = '7.5ns'
837
838    # Pre-charge one bank 18 ns (all banks 21 ns)
839    tRP = '18ns'
840
841    # 8 beats across a x32 DDR interface translates to 4 clocks @ 800 MHz.
842    # Note this is a BL8 DDR device.
843    # Requests larger than 32 bytes are broken down into multiple requests
844    # in the controller
845    tBURST = '5ns'
846
847    # LPDDR3, 4 Gb
848    tRFC = '130ns'
849    tREFI = '3.9us'
850
851    # active powerdown and precharge powerdown exit time
852    tXP = '7.5ns'
853
854    # self refresh exit time
855    tXS = '140ns'
856
857    # Irrespective of speed grade, tWTR is 7.5 ns
858    tWTR = '7.5ns'
859
860    # Default same rank rd-to-wr bus turnaround to 2 CK, @800 MHz = 2.5 ns
861    tRTW = '2.5ns'
862
863    # Default different rank bus delay to 2 CK, @800 MHz = 2.5 ns
864    tCS = '2.5ns'
865
866    # Activate to activate irrespective of density and speed grade
867    tRRD = '10.0ns'
868
869    # Irrespective of size, tFAW is 50 ns
870    tXAW = '50ns'
871    activation_limit = 4
872
873    # Current values from datasheet
874    IDD0 = '8mA'
875    IDD02 = '60mA'
876    IDD2N = '0.8mA'
877    IDD2N2 = '26mA'
878    IDD3N = '2mA'
879    IDD3N2 = '34mA'
880    IDD4W = '2mA'
881    IDD4W2 = '190mA'
882    IDD4R = '2mA'
883    IDD4R2 = '230mA'
884    IDD5 = '28mA'
885    IDD52 = '150mA'
886    IDD3P1 = '1.4mA'
887    IDD3P12 = '11mA'
888    IDD2P1 = '0.8mA'
889    IDD2P12 = '1.8mA'
890    IDD6 = '0.5mA'
891    IDD62 = '1.8mA'
892    VDD = '1.8V'
893    VDD2 = '1.2V'
894
895# A single GDDR5 x64 interface, with
896# default timings based on a GDDR5-4000 1 Gbit part (SK Hynix
897# H5GQ1H24AFR) in a 2x32 configuration.
898class GDDR5_4000_x64(DRAMCtrl):
899    # size of device
900    device_size = '128MB'
901
902    # 2x32 configuration, 1 device with a 32-bit interface
903    device_bus_width = 32
904
905    # GDDR5 is a BL8 device
906    burst_length = 8
907
908    # Each device has a page (row buffer) size of 2Kbits (256Bytes)
909    device_rowbuffer_size = '256B'
910
911    # 2x32 configuration, so 2 devices
912    devices_per_rank = 2
913
914    # assume single rank
915    ranks_per_channel = 1
916
917    # GDDR5 has 4 bank groups
918    bank_groups_per_rank = 4
919
920    # GDDR5 has 16 banks with 4 bank groups
921    banks_per_rank = 16
922
923    # 1000 MHz
924    tCK = '1ns'
925
926    # 8 beats across an x64 interface translates to 2 clocks @ 1000 MHz
927    # Data bus runs @2000 Mhz => DDR ( data runs at 4000 MHz )
928    # 8 beats at 4000 MHz = 2 beats at 1000 MHz
929    # tBURST is equivalent to the CAS-to-CAS delay (tCCD)
930    # With bank group architectures, tBURST represents the CAS-to-CAS
931    # delay for bursts to different bank groups (tCCD_S)
932    tBURST = '2ns'
933
934    # @1000MHz data rate, tCCD_L is 3 CK
935    # CAS-to-CAS delay for bursts to the same bank group
936    # tBURST is equivalent to tCCD_S; no explicit parameter required
937    # for CAS-to-CAS delay for bursts to different bank groups
938    tCCD_L = '3ns';
939
940    tRCD = '12ns'
941
942    # tCL is not directly found in datasheet and assumed equal tRCD
943    tCL = '12ns'
944
945    tRP = '12ns'
946    tRAS = '28ns'
947
948    # RRD_S (different bank group)
949    # RRD_S is 5.5 ns in datasheet.
950    # rounded to the next multiple of tCK
951    tRRD = '6ns'
952
953    # RRD_L (same bank group)
954    # RRD_L is 5.5 ns in datasheet.
955    # rounded to the next multiple of tCK
956    tRRD_L = '6ns'
957
958    tXAW = '23ns'
959
960    # tXAW < 4 x tRRD.
961    # Therefore, activation limit is set to 0
962    activation_limit = 0
963
964    tRFC = '65ns'
965    tWR = '12ns'
966
967    # Here using the average of WTR_S and WTR_L
968    tWTR = '5ns'
969
970    # Read-to-Precharge 2 CK
971    tRTP = '2ns'
972
973    # Assume 2 cycles
974    tRTW = '2ns'
975
976# A single HBM x128 interface (one command and address bus), with
977# default timings based on data publically released
978# ("HBM: Memory Solution for High Performance Processors", MemCon, 2014),
979# IDD measurement values, and by extrapolating data from other classes.
980# Architecture values based on published HBM spec
981# A 4H stack is defined, 2Gb per die for a total of 1GB of memory.
982class HBM_1000_4H_x128(DRAMCtrl):
983    # HBM gen1 supports up to 8 128-bit physical channels
984    # Configuration defines a single channel, with the capacity
985    # set to (full_ stack_capacity / 8) based on 2Gb dies
986    # To use all 8 channels, set 'channels' parameter to 8 in
987    # system configuration
988
989    # 128-bit interface legacy mode
990    device_bus_width = 128
991
992    # HBM supports BL4 and BL2 (legacy mode only)
993    burst_length = 4
994
995    # size of channel in bytes, 4H stack of 2Gb dies is 1GB per stack;
996    # with 8 channels, 128MB per channel
997    device_size = '128MB'
998
999    device_rowbuffer_size = '2kB'
1000
1001    # 1x128 configuration
1002    devices_per_rank = 1
1003
1004    # HBM does not have a CS pin; set rank to 1
1005    ranks_per_channel = 1
1006
1007    # HBM has 8 or 16 banks depending on capacity
1008    # 2Gb dies have 8 banks
1009    banks_per_rank = 8
1010
1011    # depending on frequency, bank groups may be required
1012    # will always have 4 bank groups when enabled
1013    # current specifications do not define the minimum frequency for
1014    # bank group architecture
1015    # setting bank_groups_per_rank to 0 to disable until range is defined
1016    bank_groups_per_rank = 0
1017
1018    # 500 MHz for 1Gbps DDR data rate
1019    tCK = '2ns'
1020
1021    # use values from IDD measurement in JEDEC spec
1022    # use tRP value for tRCD and tCL similar to other classes
1023    tRP = '15ns'
1024    tRCD = '15ns'
1025    tCL = '15ns'
1026    tRAS = '33ns'
1027
1028    # BL2 and BL4 supported, default to BL4
1029    # DDR @ 500 MHz means 4 * 2ns / 2 = 4ns
1030    tBURST = '4ns'
1031
1032    # value for 2Gb device from JEDEC spec
1033    tRFC = '160ns'
1034
1035    # value for 2Gb device from JEDEC spec
1036    tREFI = '3.9us'
1037
1038    # extrapolate the following from LPDDR configs, using ns values
1039    # to minimize burst length, prefetch differences
1040    tWR = '18ns'
1041    tRTP = '7.5ns'
1042    tWTR = '10ns'
1043
1044    # start with 2 cycles turnaround, similar to other memory classes
1045    # could be more with variations across the stack
1046    tRTW = '4ns'
1047
1048    # single rank device, set to 0
1049    tCS = '0ns'
1050
1051    # from MemCon example, tRRD is 4ns with 2ns tCK
1052    tRRD = '4ns'
1053
1054    # from MemCon example, tFAW is 30ns with 2ns tCK
1055    tXAW = '30ns'
1056    activation_limit = 4
1057
1058    # 4tCK
1059    tXP = '8ns'
1060
1061    # start with tRFC + tXP -> 160ns + 8ns = 168ns
1062    tXS = '168ns'
1063
1064# A single HBM x64 interface (one command and address bus), with
1065# default timings based on HBM gen1 and data publically released
1066# A 4H stack is defined, 8Gb per die for a total of 4GB of memory.
1067# Note: This defines a pseudo-channel with a unique controller
1068# instantiated per pseudo-channel
1069# Stay at same IO rate (1Gbps) to maintain timing relationship with
1070# HBM gen1 class (HBM_1000_4H_x128) where possible
1071class HBM_1000_4H_x64(HBM_1000_4H_x128):
1072    # For HBM gen2 with pseudo-channel mode, configure 2X channels.
1073    # Configuration defines a single pseudo channel, with the capacity
1074    # set to (full_ stack_capacity / 16) based on 8Gb dies
1075    # To use all 16 pseudo channels, set 'channels' parameter to 16 in
1076    # system configuration
1077
1078    # 64-bit pseudo-channle interface
1079    device_bus_width = 64
1080
1081    # HBM pseudo-channel only supports BL4
1082    burst_length = 4
1083
1084    # size of channel in bytes, 4H stack of 8Gb dies is 4GB per stack;
1085    # with 16 channels, 256MB per channel
1086    device_size = '256MB'
1087
1088    # page size is halved with pseudo-channel; maintaining the same same number
1089    # of rows per pseudo-channel with 2X banks across 2 channels
1090    device_rowbuffer_size = '1kB'
1091
1092    # HBM has 8 or 16 banks depending on capacity
1093    # Starting with 4Gb dies, 16 banks are defined
1094    banks_per_rank = 16
1095
1096    # reset tRFC for larger, 8Gb device
1097    # use HBM1 4Gb value as a starting point
1098    tRFC = '260ns'
1099
1100    # start with tRFC + tXP -> 160ns + 8ns = 168ns
1101    tXS = '268ns'
1102    # Default different rank bus delay to 2 CK, @1000 MHz = 2 ns
1103    tCS = '2ns'
1104    tREFI = '3.9us'
1105
1106    # active powerdown and precharge powerdown exit time
1107    tXP = '10ns'
1108
1109    # self refresh exit time
1110    tXS = '65ns'
1111