Skip to content

Commit 4557a37

Browse files
author
ataberk
committed
Initial commit
0 parents  commit 4557a37

File tree

1,054 files changed

+393079
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,054 files changed

+393079
-0
lines changed

DRAMPower/.gitignore

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
drampower
2+
*.d
3+
*.o
4+
*.a
5+
test/libdrampowertest/library_test
6+
test/libdrampowertest/window_example
7+
*.gcno
8+
*.gcda
9+
traces/*
10+
traces.zip
11+
.sconf_temp/
12+
.sconsign.dblite
13+
*.swp
14+
*.swo
15+
cscope.*
16+
commands.trace
17+
coverage_report
18+
.DS_Store

DRAMPower/.gitlab-ci.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
before_script:
2+
- sudo apt-get install -y libxerces-c-dev wget unzip python
3+
4+
default_test:
5+
script:
6+
- make test COVERAGE=1

DRAMPower/.travis.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
os:
2+
- linux
3+
- osx
4+
matrix:
5+
allow_failures:
6+
- os: osx
7+
language: cpp
8+
compiler:
9+
- gcc
10+
- clang
11+
install:
12+
- echo "No install."
13+
before_install:
14+
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo pip install cpp-coveralls; fi
15+
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install -y libxerces-c-dev; fi
16+
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi
17+
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install xerces-c; fi
18+
script:
19+
- if [[ "$TRAVIS_OS_NAME" == "linux" && "$CXX" == "g++" ]]; then make test COVERAGE=1; fi
20+
- if [[ "$TRAVIS_OS_NAME" == "linux" && "$CXX" == "clang++" ]]; then make test; fi
21+
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then make test; fi
22+
after_success:
23+
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then coveralls --exclude lib --exclude tests --gcov-options '\-lp'; fi

DRAMPower/CMakeLists.txt

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Copyright (c) 2020, Fraunhofer IESE
2+
# All rights reserved.
3+
#
4+
# Redistribution and use in source and binary forms, with or without
5+
# modification, are permitted provided that the following conditions are
6+
# met:
7+
#
8+
# 1. Redistributions of source code must retain the above copyright notice,
9+
# this list of conditions and the following disclaimer.
10+
#
11+
# 2. Redistributions in binary form must reproduce the above copyright
12+
# notice, this list of conditions and the following disclaimer in the
13+
# documentation and/or other materials provided with the distribution.
14+
#
15+
# 3. Neither the name of the copyright holder nor the names of its
16+
# contributors may be used to endorse or promote products derived from
17+
# this software without specific prior written permission.
18+
#
19+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21+
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22+
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
23+
# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24+
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25+
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26+
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29+
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30+
#
31+
# Author: Matthias Jung
32+
33+
cmake_minimum_required(VERSION 3.10)
34+
35+
# Set the project name:
36+
project(DRAMPower)
37+
38+
# Configuration:
39+
include_directories(
40+
src/
41+
src/libdrampower
42+
)
43+
44+
# Build:
45+
add_library(DRAMPower
46+
src/libdrampower/LibDRAMPower.cc
47+
src/CommandAnalysis.cc
48+
src/MemArchitectureSpec.cc
49+
src/MemCommand.cc
50+
src/MemPowerSpec.cc
51+
src/MemTimingSpec.cc
52+
src/MemoryPowerModel.cc
53+
src/MemorySpecification.cc
54+
src/Parameter.cc
55+
src/Parametrisable.cc
56+
src/libdrampower/LibDRAMPower.cc
57+
src/CAHelpers.cc
58+
src/CmdHandlers.cc
59+
src/MemBankWiseParams.cc
60+
)

DRAMPower/ChangeLog

+121
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
Change Log:
2+
3+
DRAMPower v4.0 - * DRAMPower can now be compiled as a library. This enables a user
4+
to access the tool through an API and log commands and their
5+
corresponding time stamps, removing the need to store large
6+
command traces on disk. In addition, cycle counting variables
7+
have been changed to int64 to support longer simulations.
8+
The library can be compiled without Xerces to remove an optional
9+
dependency and reduce the size of the binary.
10+
* Improved robustness. The latest build is automatically checked
11+
out on a test server, compiled, and tested to verify that the
12+
output matches an expected reference. The code is also compiled
13+
with a large number of warning flags enabled and treats all
14+
warnings as errors.
15+
* Bug fix: Fixed bug in io/termination energy calculation.
16+
* Bug fix: Fixed bug in calculation of auto precharge cycle.
17+
18+
DRAMPower v3.1 - * Added IO and Termination Power measures from Micron's DRAM Power
19+
Calculator, for all supported DRAM generations. In the case of
20+
Wide IO DRAMs, these measures are already included in the provided
21+
current specifications. This feature enables support for multi-rank
22+
DRAM DIMMs (DDR2/3/4) and stacking of multiple Wide IO DRAM dies
23+
(equivalent to ranks). To indicate use of multi-rank DRAMs or
24+
multiple Wide IO DRAM dies/layers, the 'nbrOfRanks' parameter in
25+
the memory specification XMLs can be employed. Note: The DRAM
26+
command scheduler does not support multi-rank/multi-die DRAMs yet.
27+
Only the power estimation component of DRAMPower has been updated
28+
to support them. The current measures for dual-rank DRAMs only
29+
reflect those for the active rank and not the idle rank. The
30+
default state of the idle rank is assumed to be the same as the
31+
current memory state, for background power estimation. Hence,
32+
rank information in the command trace is not required.
33+
* Added warning messages: New warning messages are provided, to
34+
identify if the memory or bank state is inconsistent in the
35+
user-defined traces. Towards this, a state check is performed on
36+
every memory command issued.
37+
* Improved run-time options: Users can now point directly to the
38+
memory specification XML, instead of just the memory ID. Also,
39+
users can optionally include IO and termination power estimates
40+
(for both single and dual rank DRAMs) using '-r' flag in the
41+
command line options.
42+
* Bug fixes: (1) Refresh handler in the DRAM Command Scheduler was
43+
kept ON in the Self-Refresh mode, when it can be turned OFF. This
44+
bug has now been fixed. (2) Precharge All (PREA) always considered
45+
precharging of all banks. It has now been modified to consider
46+
precharging of the open/active banks alone.
47+
48+
DRAMPower v3.0 - * Added support for LPDDR3 and DDR4 memories, besides the already
49+
supported DDR2/DDR3, LPDDR/LPDDR2 and WIDE IO DRAM memories.
50+
* Added DRAM Command Scheduler: To support users of DRAMPower
51+
without access to DRAM controllers, we have added a simple DRAM
52+
command scheduler that dynamically schedules DRAM commands as if
53+
it were a memory controller. The scheduler assumes closed-page
54+
policy, employs ASAP scheduling for DRAM commands (i.e. schedules
55+
commands as soon as timing constraints are met), performs FCFS
56+
scheduling on DRAM transactions and supports all the different
57+
DRAM generations supported by the power model. The generated DRAM
58+
command schedule is also analyzable for real-time applications.
59+
Users can also select speculative usage of power-down or
60+
self-refresh modes (if needed) for idle periods between
61+
transactions. It should be noted that using this command scheduler
62+
is optional and it can be (de-)selected during run-time and users
63+
can switch back to the previously used DRAM command interface as
64+
in the earlier versions.
65+
* Improved run-time options: Users can specify the memory and the
66+
trace file to be used by DRAMPower using command line options.
67+
Additionally, if the DRAM command scheduler is being used, the
68+
users can specify the degree of bank interleaving required, the
69+
request size and power-down or self-refresh options. Also, for
70+
DDR4 memories the bank group interleaving can be specified using
71+
command line options.
72+
* Bug fixes: (1) For command traces ending with a RD/WR/RDA/WRA
73+
command, the tool did not consider completion of operations when
74+
estimating the total trace energy. The missing cycles are now
75+
taken into account.
76+
(2) The IDD5 (REF current) specification for WIDE IO SDR memory
77+
specifications only included 2 banks for refreshes instead of all
78+
four. We would like to thank David Roberts from AMD for spotting
79+
the issue in our DATE'13 article. These measures have been updated.
80+
(3) When estimating precharge cycle for commands with
81+
auto-precharge, (RDA/WRA), the command analysis tool employed the
82+
last activation cycle in the entire DRAM instead of the particular
83+
DRAM bank. This bug has been fixed in this release.
84+
85+
DRAMPower v2.1 - * Added support for variation-aware power estimation, for a
86+
selection of DDR3 memories manufactured using 50nm process
87+
technology, based on the Monte-Carlo analysis presented in our
88+
DAC'13 article.
89+
90+
DRAMPower v2.0 - * Added support for LPDDR/LPDDR2 and WIDE IO DRAM memories, besides
91+
the already supported DDR2/DDR3 memories.
92+
* Faster analysis: The trace analysis component in DRAMPower v2.0
93+
triggers the evaluation only during memory state transitions
94+
(between active, precharged, active and precharged power-down,
95+
refresh, self-refresh and power-up states) and not on every clock
96+
cycle, as was the case till the last version. This optimization
97+
speeds up the power simulations using DRAMPower by several times
98+
over cycle-accurate analysis, resulting in fast power analysis,
99+
without affecting the accuracy of the trace analysis or the
100+
reported power and energy estimates.
101+
* Verification effort: Our power model was verified by the
102+
Microelectronic System Design group at TU Kaiserslautern using
103+
circuit-level SPICE simulations of a DRAM cross-section. As a
104+
result of this verification effort, a couple of power equations
105+
have been modified for Refresh and Self-refresh operations. The
106+
difference between the power and energy estimates reported by our
107+
updated model and the equivalent circuit-level simulations is
108+
< 2% for all memory operations of any granularity for all memories
109+
supported by DRAMPower.
110+
111+
DRAMPower v1.2 - * Supports different power-down and self-refresh modes in DDR2 and
112+
DDR3 DRAM memories.
113+
* Bug fix: Refresh power consumption equation in DRAMPower v1,
114+
incorrectly subtracted IDD2n (precharge background current)
115+
instead of IDD3n (active background current) from IDD5 (total
116+
refresh current). This error has been rectified in this version.
117+
118+
DRAMPower v1.0 - * Performs cycle-accurate memory command trace analysis and estimates
119+
power and energy consumption numbers for the trace.
120+
* It supports the basic memory operations like read, write, refresh,
121+
activate and (auto) precharge in DDR2 and DDR3 memories.

DRAMPower/Makefile

+153
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
#/*
2+
# * Copyright (c) 2012-2014, TU Delft
3+
# * Copyright (c) 2012-2014, TU Eindhoven
4+
# * Copyright (c) 2012-2014, TU Kaiserslautern
5+
# * All rights reserved.
6+
# *
7+
# * Redistribution and use in source and binary forms, with or without
8+
# * modification, are permitted provided that the following conditions are
9+
# * met:
10+
# *
11+
# * 1. Redistributions of source code must retain the above copyright
12+
# * notice, this list of conditions and the following disclaimer.
13+
# *
14+
# * 2. Redistributions in binary form must reproduce the above copyright
15+
# * notice, this list of conditions and the following disclaimer in the
16+
# * documentation and/or other materials provided with the distribution.
17+
# *
18+
# * 3. Neither the name of the copyright holder nor the names of its
19+
# * contributors may be used to endorse or promote products derived from
20+
# * this software without specific prior written permission.
21+
# *
22+
# * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
23+
# * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
24+
# * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
25+
# * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26+
# * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27+
# * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
28+
# * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
29+
# * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
30+
# * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31+
# * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32+
# * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33+
# *
34+
# * Authors: Karthik Chandrasekar, Benny Akesson, Sven Goossens
35+
# *
36+
# */
37+
38+
include common.mk
39+
CXX := g++
40+
# Name of the generated binary.
41+
BINARY := drampower
42+
LIBS := src/libdrampower.a src/libdrampowerxml.a
43+
44+
# Identifies the source files and derives name of object files.
45+
46+
CLISOURCES := src/TraceParser.cc $(wildcard src/cli/*.cc)
47+
LIBSOURCES := $(wildcard src/libdrampower/*.cc) \
48+
src/CommandAnalysis.cc \
49+
src/CAHelpers.cc \
50+
src/CmdHandlers.cc \
51+
src/MemArchitectureSpec.cc\
52+
src/MemCommand.cc\
53+
src/MemoryPowerModel.cc\
54+
src/MemorySpecification.cc\
55+
src/MemPowerSpec.cc\
56+
src/MemTimingSpec.cc\
57+
src/Parameter.cc\
58+
src/Parametrisable.cc\
59+
src/MemBankWiseParams.cc
60+
61+
XMLPARSERSOURCES := $(wildcard src/xmlparser/*.cc)
62+
ALLSOURCES := $(wildcard src/cli/*.cc) $(wildcard src/*.cc) $(wildcard src/xmlparser/*.cc) $(wildcard src/libdrampower/*.cc)
63+
ALLHEADERS := $(wildcard src/*.h) $(wildcard src/xmlparser/*.h) $(wildcard src/libdrampower/*.h)
64+
65+
CLIOBJECTS := ${CLISOURCES:.cc=.o}
66+
XMLPARSEROBJECTS := ${XMLPARSERSOURCES:.cc=.o}
67+
LIBOBJECTS := ${LIBSOURCES:.cc=.o}
68+
ALLOBJECTS := ${ALLSOURCES:.cc=.o}
69+
70+
DEPENDENCIES := ${ALLSOURCES:.cc=.d}
71+
72+
# Warning flags for deprecated files
73+
DEPWARNFLAGS := -W -pedantic-errors -Wextra -Werror \
74+
-Wformat -Wformat-nonliteral -Wpointer-arith \
75+
-Wcast-align -Wall -Werror
76+
77+
# Sum up the flags.
78+
DEPCXXFLAGS := -O0 ${DEPWARNFLAGS} ${DBGCXXFLAGS} ${OPTCXXFLAGS} -std=c++0x
79+
80+
# Linker flags.
81+
LDFLAGS := -Wall -lstdc++
82+
83+
##########################################
84+
# Xerces settings
85+
##########################################
86+
87+
XERCES_ROOT ?= /usr
88+
XERCES_INC := $(XERCES_ROOT)/include
89+
XERCES_LIB := $(XERCES_ROOT)/lib
90+
XERCES_LDFLAGS := -L$(XERCES_LIB) -lxerces-c
91+
92+
##########################################
93+
# Targets
94+
##########################################
95+
96+
all: ${BINARY} src/libdrampower.a parserlib traces
97+
98+
$(BINARY): ${XMLPARSEROBJECTS} ${CLIOBJECTS} src/libdrampower.a
99+
$(CXX) ${CXXFLAGS} $(LDFLAGS) -o $@ $^ -Lsrc/ $(XERCES_LDFLAGS) -ldrampower
100+
101+
# From .cpp to .o. Dependency files are generated here
102+
%.o: %.cc
103+
$(CXX) ${CXXFLAGS} -MMD -MF $(subst .o,.d,$@) -iquote src -o $@ -c $<
104+
105+
src/libdrampower.a: ${LIBOBJECTS}
106+
ar -cvr src/libdrampower.a ${LIBOBJECTS}
107+
108+
parserlib: ${XMLPARSEROBJECTS}
109+
ar -cvr src/libdrampowerxml.a ${XMLPARSEROBJECTS}
110+
111+
clean:
112+
$(RM) $(ALLOBJECTS) $(DEPENDENCIES) $(BINARY) $(LIBS)
113+
$(MAKE) -C test/libdrampowertest clean
114+
$(RM) traces.zip
115+
116+
coverageclean:
117+
$(RM) ${ALLSOURCES:.cc=.gcno} ${ALLSOURCES:.cc=.gcda}
118+
$(MAKE) -C test/libdrampowertest coverageclean
119+
120+
pretty:
121+
uncrustify -c src/uncrustify.cfg $(ALLSOURCES) --no-backup
122+
uncrustify -c src/uncrustify.cfg $(ALLHEADERS) --no-backup
123+
124+
test: traces
125+
python test/test.py -v
126+
127+
traces.zip:
128+
wget --quiet --output-document=traces.zip https://github.com/Sv3n/DRAMPowerTraces/archive/master.zip
129+
130+
traces: traces.zip
131+
unzip traces.zip && mkdir -p traces && mv DRAMPowerTraces-master/traces/* traces/ && rm -rf DRAMPowerTraces-master
132+
133+
LCOV_OUTDIR = coverage_report
134+
coveragecheck: coveragecheckclean
135+
ifeq ($(CXX),g++)
136+
hash lcov 2>/dev/null || { echo >&2 "lcov could not be found. Aborting."; exit 1; }
137+
COVERAGE=1 $(MAKE) clean || { echo >&2 "make clean failed. Aborting."; exit 1; }
138+
COVERAGE=1 $(MAKE) || { echo >&2 "make failed. Aborting."; exit 1; }
139+
lcov --no-external -c -i -d . -o .coverage.base
140+
COVERAGE=1 $(MAKE) test || { echo >&2 "make test failed. Aborting."; exit 1; }
141+
lcov --no-external -c -d . -o .coverage.run
142+
lcov -d . -a .coverage.base -a .coverage.run -o .coverage.total
143+
genhtml -q --no-branch-coverage -o $(LCOV_OUTDIR) .coverage.total
144+
rm -f .coverage.base .coverage.run .coverage.total
145+
else
146+
@{ echo >&2 "The coveragecheck rule is not implemented for $(CXX). Aborting."; exit 1; }
147+
endif
148+
149+
coveragecheckclean:
150+
rm -rf $(LCOV_OUTDIR)
151+
152+
153+
-include $(DEPENDENCIES)

0 commit comments

Comments
 (0)