Skip to content
Open
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file shouldn't be committed.

I strongly suggest creating a PR like this, then looking at it yourself and doing a "self review" to fix some of these low hanging fruits

"files.associations": {
"cctype": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"csetjmp": "cpp",
"csignal": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"array": "cpp",
"atomic": "cpp",
"hash_map": "cpp",
"hash_set": "cpp",
"strstream": "cpp",
"*.tcc": "cpp",
"bitset": "cpp",
"chrono": "cpp",
"cinttypes": "cpp",
"complex": "cpp",
"condition_variable": "cpp",
"cstdint": "cpp",
"deque": "cpp",
"forward_list": "cpp",
"list": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"map": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"ratio": "cpp",
"regex": "cpp",
"set": "cpp",
"string": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"fstream": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"mutex": "cpp",
"new": "cpp",
"ostream": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"thread": "cpp",
"cfenv": "cpp",
"typeindex": "cpp",
"typeinfo": "cpp",
"valarray": "cpp",
"variant": "cpp",
"bit": "cpp",
"shared_mutex": "cpp"
}
}
53 changes: 53 additions & 0 deletions simple.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
from m5.objects import *
import m5

system = System()
system.clk_domain = SrcClockDomain()
system.clk_domain.clock = "4GHz"
system.clk_domain.voltage_domain = VoltageDomain()
system.mem_mode = 'timing'

system.generator = PyTrafficGen()

system.mem_ctrl = DcacheCtrl()
system.mem_ctrl.dram = DDR3_1600_8x8(range=AddrRange('1GB'), in_addr_map=False)
system.mem_ctrl.nvm = NVM_2400_1x64(range=AddrRange('1GB'))

system.mem_ctrl.dram.tREFI = "1000"
system.mem_ctrl.orb_max_size = "512"
system.mem_ctrl.crb_max_size = "32"
#system.mem_ctrl.static_frontend_latency = "0ns"

system.mem_ranges = [AddrRange('1GB')]

system.generator.port = system.mem_ctrl.port

def createRandomTraffic(tgen):
yield tgen.createRandom(100000000000, # duration
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know you're changing this a lot. I would suggest making this an argument to the script with optparse

0, # min_addr
16700000, # max_adr
64, # block_size
1000, # min_period
1000, # max_period
100, # rd_perc
0) # data_limit
yield tgen.createExit(0)

def createLinearTraffic(tgen):
yield tgen.createLinear(100000000000, # duration
0, # min_addr
16700000, # max_adr
64, # block_size
1000, # min_period
1000, # max_period
100, # rd_perc
0) # data_limit
yield tgen.createExit(0)


root = Root(full_system=False, system=system)

m5.instantiate()
system.generator.start(createRandomTraffic(system.generator))
#system.generator.start(createLinearTraffic(system.generator))
Comment on lines +52 to +53
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be an option, too.

Whatever things in this script that you want to change frequently should be command line options. That's the purpose of command line options :)

exit_event = m5.simulate()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a newline at the end of the file. You should configure your editor to automatically add newlines at the end of the file and remove all trailing whitespace.

66 changes: 66 additions & 0 deletions src/mem/DCMemInterface.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
from m5.params import *
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a copyright.

from m5.proxy import *

from m5.objects.AbstractMemory import AbstractMemory

# Enum for the address mapping. With Ch, Ra, Ba, Ro and Co denoting
# channel, rank, bank, row and column, respectively, and going from
# MSB to LSB. Available are RoRaBaChCo and RoRaBaCoCh, that are
# suitable for an open-page policy, optimising for sequential accesses
# hitting in the open row. For a closed-page policy, RoCoRaBaCh
# maximises parallelism.
class AddrMap(Enum): vals = ['RoRaBaChCo', 'RoRaBaCoCh', 'RoCoRaBaCh']

class DCMemInterface(AbstractMemory):
type = 'DCMemInterface'
abstract = True
cxx_header = "mem/dcmem_interface.hh"

# Allow the interface to set required controller buffer sizes
# each entry corresponds to a burst for the specific memory channel
# configuration (e.g. x32 with burst length 8 is 32 bytes) and not
# the cacheline size or request/packet size
write_buffer_size = Param.Unsigned(64, "Number of write queue entries")
read_buffer_size = Param.Unsigned(32, "Number of read queue entries")

# scheduler, address map
addr_mapping = Param.AddrMap('RoRaBaCoCh', "Address mapping policy")

# size of memory device in Bytes
device_size = Param.MemorySize("Size of memory device")
# the physical organisation of the memory
device_bus_width = Param.Unsigned("data bus width in bits for each "\
"memory device/chip")
burst_length = Param.Unsigned("Burst lenght (BL) in beats")
device_rowbuffer_size = Param.MemorySize("Page (row buffer) size per "\
"device/chip")
devices_per_rank = Param.Unsigned("Number of devices/chips per rank")
ranks_per_channel = Param.Unsigned("Number of ranks per channel")
banks_per_rank = Param.Unsigned("Number of banks per rank")

# timing behaviour and constraints - all in nanoseconds

# the base clock period of the memory
tCK = Param.Latency("Clock period")

# time to complete a burst transfer, typically the burst length
# divided by two due to the DDR bus, but by making it a parameter
# it is easier to also evaluate SDR memories like WideIO and new
# interfaces, emerging technologies.
# This parameter has to account for burst length.
# Read/Write requests with data size larger than one full burst are broken
# down into multiple requests in the controller
tBURST = Param.Latency("Burst duration "
"(typically burst length / 2 cycles)")

# write-to-read, same rank turnaround penalty
tWTR = Param.Latency("Write to read, same rank switching time")

# read-to-write, same rank turnaround penalty
tRTW = Param.Latency("Read to write, same rank switching time")

# rank-to-rank bus delay penalty
# this does not correlate to a memory timing parameter and encompasses:
# 1) RD-to-RD, 2) WR-to-WR, 3) RD-to-WR, and 4) WR-to-RD
# different rank bus delay
tCS = Param.Latency("Rank to rank switching time")
Loading