"git@developer.sourcefind.cn:modelzoo/resnet50_tensorflow.git" did not exist on "294579cafdfe7445dd1035bbdd8840570b8873ad"
Commit 40546917 authored by Jonas Kaufmann's avatar Jonas Kaufmann Committed by Antoine Kaufmann
Browse files

sims/external/simics: add SimBricks memory adapter

parent 8422c890
...@@ -2,5 +2,6 @@ installdir/ ...@@ -2,5 +2,6 @@ installdir/
intel-simics-package-manager*.tar.gz intel-simics-package-manager*.tar.gz
latest latest
package-manager/ package-manager/
project/
ready ready
simics-6-packages*.ispm simics-6-packages*.ispm
../simics-qsp-x86-6.0.65
../simics-qsp-cpu-6.0.12
# -*- Makefile ; coding: utf-8 -*-
# Simics module makefile
MODULE_CLASSES=simbricks_mem
MODULE_COMPONENTS=simbricks_mem_comp
SRC_FILES = simbricks_mem.c
PYTHON_FILES = simbricks_mem_comp.py module_load.py
# SIMBRICKS_LIB needs to be set by caller
MODULE_CFLAGS := -I"$(SIMBRICKS_LIB)"
MODULE_LDFLAGS := -L"$(SIMBRICKS_LIB)" -lsimbricks
SIMICS_API := 6
THREAD_SAFE:=yes
ifeq ($(MODULE_MAKEFILE),)
$(error Make sure you compile your module from the project directory)
else
include $(MODULE_MAKEFILE)
endif
# Copyright (c) 2020-2023 Max Planck Institute for Software Systems
# Copyright (c) 2020-2023 National University of Singapore
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
import cli
class_name = 'simbricks_mem'
# info command prints static information
def get_info(obj):
return []
# status command prints dynamic information
def get_status(obj):
return [(
'Attributes',
[('socket', obj.socket), ('mem_latency', obj.mem_latency),
('sync_period', obj.sync_period)]
)]
cli.new_info_command(class_name, get_info)
cli.new_status_command(class_name, get_status)
from . import simbricks_mem_comp
simbricks_mem_comp.simbricks_mem_comp.register()
This diff is collapsed.
# SimBricks Memory Adapter Component
#
# Copyright (c) 2020-2023 Max Planck Institute for Software Systems
# Copyright (c) 2020-2023 National University of Singapore
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
import simics
from comp import SimpleConfigAttribute, StandardComponent
class simbricks_mem_comp(StandardComponent):
"""SimBricks memory adapter component."""
def setup(self):
super().setup()
if not self.instantiated.val:
self.add_objects()
def add_objects(self):
simbricks_mem_dev = self.add_pre_obj(
'simbricks_mem_dev', 'simbricks_mem'
)
simbricks_mem_dev.socket = self.socket.val
simbricks_mem_dev.mem_latency = self.mem_latency.val
simbricks_mem_dev.sync_period = self.sync_period.val
if self.cache_size.val is not None:
simbricks_mem_dev.cache_size = self.cache_size.val
if self.cache_line_size.val is not None:
simbricks_mem_dev.cache_line_size = self.cache_line_size.val
class basename(StandardComponent.basename):
"""The default name for the created component."""
val = 'simbricks_mem_comp'
class socket(SimpleConfigAttribute(None, 's', simics.Sim_Attr_Required)):
"""Socket Path for SimBricks messages."""
class mem_latency(
SimpleConfigAttribute(None, 'i', simics.Sim_Attr_Required)
):
"""Latency in nanoseconds from host to memory."""
class sync_period(
SimpleConfigAttribute(None, 'i', simics.Sim_Attr_Required)
):
"""Period for sending SimBricks synchronization messages in
nanoseconds."""
class cache_size(
SimpleConfigAttribute(None, 'i', simics.Sim_Attr_Optional)
):
"""Number of cache lines."""
class cache_line_size(
SimpleConfigAttribute(None, 'i', simics.Sim_Attr_Optional)
):
"""Size of each cache line in bytes."""
...@@ -30,6 +30,9 @@ SIMICS_ISPM_DOWNLOAD ?= $(SIMICS_DIR)simics-6-packages.ispm ...@@ -30,6 +30,9 @@ SIMICS_ISPM_DOWNLOAD ?= $(SIMICS_DIR)simics-6-packages.ispm
SIMICS_ISPM := $(SIMICS_DIR)package-manager/ispm SIMICS_ISPM := $(SIMICS_DIR)package-manager/ispm
SIMICS_INSTALLDIR := $(SIMICS_DIR)installdir SIMICS_INSTALLDIR := $(SIMICS_DIR)installdir
SIMICS_INSTALL := $(SIMICS_INSTALLDIR)/simics-latest SIMICS_INSTALL := $(SIMICS_INSTALLDIR)/simics-latest
SIMICS_BIN := $(SIMICS_INSTALL)/bin
SIMICS_MODULES := $(SIMICS_DIR)modules
SIMICS_PROJECT := $(SIMICS_DIR)project
$(SIMICS_PKGMGR_DOWNLOAD): $(SIMICS_PKGMGR_DOWNLOAD):
$(error Download intel-simics-package-manager-(version).tar.gz from \ $(error Download intel-simics-package-manager-(version).tar.gz from \
...@@ -54,9 +57,20 @@ $(SIMICS_INSTALL): $(SIMICS_ISPM) $(SIMICS_ISPM_DOWNLOAD) ...@@ -54,9 +57,20 @@ $(SIMICS_INSTALL): $(SIMICS_ISPM) $(SIMICS_ISPM_DOWNLOAD)
SIMICS_LATEST=`ls -d $(SIMICS_INSTALLDIR)/simics-?.*/ | tail -n 1`; \ SIMICS_LATEST=`ls -d $(SIMICS_INSTALLDIR)/simics-?.*/ | tail -n 1`; \
ln -sf `basename $$SIMICS_LATEST` $(@) ln -sf `basename $$SIMICS_LATEST` $(@)
$(d)ready: $(SIMICS_INSTALL)
$(SIMICS_PROJECT)/GNUmakefile: $(SIMICS_INSTALL)
mkdir -p $(SIMICS_PROJECT)
mkdir -p $(SIMICS_PROJECT)/modules
ln -rs $(SIMICS_MODULES)/* $(SIMICS_PROJECT)/modules/
ln -rs $(SIMICS_DIR)/.package-list $(SIMICS_PROJECT)/
$(SIMICS_BIN)/project-setup --ignore-existing-files $(SIMICS_PROJECT)
$(d)ready: $(SIMICS_PROJECT)/GNUmakefile $(lib_simbricks)
$(MAKE) -C $(SIMICS_PROJECT) SIMBRICKS_LIB="$(abspath $(lib_dir))"
touch $@ touch $@
DISTCLEAN := $(SIMICS_PKGMGR_DOWNLOAD) $(SIMICS_ISPM_DOWNLOAD) \ DISTCLEAN := $(SIMICS_PKGMGR_DOWNLOAD) $(SIMICS_ISPM_DOWNLOAD) \
$(d)package-manager $(SIMICS_INSTALL) $(SIMICS_INSTALLDIR) $(d)ready $(d)package-manager $(SIMICS_INSTALL) $(SIMICS_INSTALLDIR) \
$(SIMICS_PROJECT) $(d)ready
include mk/subdir_post.mk include mk/subdir_post.mk
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment