From 275d2779656fd2dd72762b2eb16a738d1b3b2b18 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Sat, 8 Dec 2018 02:05:34 -0800 Subject: systemc: Fix style issues in the TLM header files. Change-Id: Id12ffb9b56b3887afcf30120f81ce5eb75a5987b Reviewed-on: https://gem5-review.googlesource.com/c/15057 Reviewed-by: Anthony Gutierrez Maintainer: Anthony Gutierrez --- src/systemc/ext/tlm_core/Makefile.am | 97 -- src/systemc/ext/tlm_core/Makefile.in | 799 -------------- .../ext/tlm_core/tlm_1/tlm_analysis/tlm_analysis.h | 16 +- .../tlm_1/tlm_analysis/tlm_analysis_fifo.h | 46 +- .../tlm_core/tlm_1/tlm_analysis/tlm_analysis_if.h | 19 +- .../tlm_1/tlm_analysis/tlm_analysis_port.h | 88 +- .../tlm_1/tlm_analysis/tlm_analysis_triple.h | 60 +- .../ext/tlm_core/tlm_1/tlm_analysis/tlm_write_if.h | 24 +- .../tlm_req_rsp/tlm_1_interfaces/tlm_core_ifs.h | 169 ++- .../tlm_req_rsp/tlm_1_interfaces/tlm_fifo_ifs.h | 75 +- .../tlm_1_interfaces/tlm_master_slave_ifs.h | 75 +- .../tlm_1/tlm_req_rsp/tlm_1_interfaces/tlm_tag.h | 16 +- .../tlm_1/tlm_req_rsp/tlm_adapters/tlm_adapters.h | 131 ++- .../tlm_channels/tlm_fifo/circular_buffer.h | 343 +++--- .../tlm_req_rsp/tlm_channels/tlm_fifo/tlm_fifo.h | 274 +++-- .../tlm_channels/tlm_fifo/tlm_fifo_peek.h | 110 +- .../tlm_channels/tlm_fifo/tlm_fifo_put_get.h | 136 +-- .../tlm_channels/tlm_fifo/tlm_fifo_resize.h | 106 +- .../tlm_req_rsp_channels/tlm_put_get_imp.h | 159 +-- .../tlm_req_rsp_channels/tlm_req_rsp_channels.h | 223 ++-- .../tlm_1/tlm_req_rsp/tlm_ports/tlm_event_finder.h | 67 +- .../tlm_req_rsp/tlm_ports/tlm_nonblocking_port.h | 104 +- .../ext/tlm_core/tlm_1/tlm_req_rsp/tlm_req_rsp.h | 12 +- .../tlm_2/tlm_2_interfaces/tlm_2_interfaces.h | 7 +- .../ext/tlm_core/tlm_2/tlm_2_interfaces/tlm_dmi.h | 172 +-- .../tlm_2/tlm_2_interfaces/tlm_fw_bw_ifs.h | 99 +- .../tlm_core/tlm_2/tlm_generic_payload/tlm_array.h | 96 +- .../tlm_2/tlm_generic_payload/tlm_endian_conv.h | 1147 +++++++++++--------- .../tlm_generic_payload/tlm_generic_payload.h | 11 +- .../tlm_core/tlm_2/tlm_generic_payload/tlm_gp.h | 376 ++++--- .../tlm_2/tlm_generic_payload/tlm_helpers.h | 80 +- .../tlm_core/tlm_2/tlm_generic_payload/tlm_phase.h | 117 +- .../tlm_2/tlm_quantum/tlm_global_quantum.h | 76 +- .../ext/tlm_core/tlm_2/tlm_quantum/tlm_quantum.h | 6 +- .../tlm_2/tlm_sockets/tlm_base_socket_if.h | 33 +- .../tlm_2/tlm_sockets/tlm_initiator_socket.h | 362 +++--- .../ext/tlm_core/tlm_2/tlm_sockets/tlm_sockets.h | 6 +- .../tlm_core/tlm_2/tlm_sockets/tlm_target_socket.h | 398 ++++--- src/systemc/ext/tlm_core/tlm_2/tlm_version.h | 169 ++- 39 files changed, 2665 insertions(+), 3639 deletions(-) delete mode 100644 src/systemc/ext/tlm_core/Makefile.am delete mode 100644 src/systemc/ext/tlm_core/Makefile.in (limited to 'src/systemc/ext/tlm_core') diff --git a/src/systemc/ext/tlm_core/Makefile.am b/src/systemc/ext/tlm_core/Makefile.am deleted file mode 100644 index 38098a88f..000000000 --- a/src/systemc/ext/tlm_core/Makefile.am +++ /dev/null @@ -1,97 +0,0 @@ -## **************************************************************************** -## -## Licensed to Accellera Systems Initiative Inc. (Accellera) under one or -## more contributor license agreements. See the NOTICE file distributed -## with this work for additional information regarding copyright ownership. -## Accellera licenses this file to you under the Apache License, Version 2.0 -## (the "License"); you may not use this file except in compliance with the -## License. You may obtain a copy of the License at -## -## http://www.apache.org/licenses/LICENSE-2.0 -## -## Unless required by applicable law or agreed to in writing, software -## distributed under the License is distributed on an "AS IS" BASIS, -## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -## implied. See the License for the specific language governing -## permissions and limitations under the License. -## -## **************************************************************************** -## -## src/tlm_core/Makefile.am -- -## Process this file with automake to produce a Makefile.in file. -## -## Original Author: Philipp A. Hartmann, OFFIS, 2013-05-17 -## -## **************************************************************************** -## -## MODIFICATION LOG - modifiers, enter your name, affiliation, date and -## changes you are making here. -## -## Name, Affiliation, Date: -## Description of Modification: -## -## **************************************************************************** - -include $(top_srcdir)/config/Make-rules.sysc - -H_FILES = \ - tlm_2/tlm_version.h \ - tlm_2/tlm_2_interfaces/tlm_2_interfaces.h \ - tlm_2/tlm_2_interfaces/tlm_dmi.h \ - tlm_2/tlm_2_interfaces/tlm_fw_bw_ifs.h \ - \ - tlm_2/tlm_generic_payload/tlm_array.h \ - tlm_2/tlm_generic_payload/tlm_endian_conv.h \ - tlm_2/tlm_generic_payload/tlm_generic_payload.h \ - tlm_2/tlm_generic_payload/tlm_gp.h \ - tlm_2/tlm_generic_payload/tlm_helpers.h \ - tlm_2/tlm_generic_payload/tlm_phase.h \ - \ - tlm_2/tlm_quantum/tlm_global_quantum.h \ - tlm_2/tlm_quantum/tlm_quantum.h \ - \ - tlm_2/tlm_sockets/tlm_base_socket_if.h \ - tlm_2/tlm_sockets/tlm_initiator_socket.h \ - tlm_2/tlm_sockets/tlm_sockets.h \ - tlm_2/tlm_sockets/tlm_target_socket.h \ - \ - tlm_1/tlm_analysis/tlm_analysis.h \ - tlm_1/tlm_analysis/tlm_analysis_fifo.h \ - tlm_1/tlm_analysis/tlm_analysis_if.h \ - tlm_1/tlm_analysis/tlm_analysis_port.h \ - tlm_1/tlm_analysis/tlm_analysis_triple.h \ - tlm_1/tlm_analysis/tlm_write_if.h \ - \ - tlm_1/tlm_req_rsp/tlm_req_rsp.h \ - tlm_1/tlm_req_rsp/tlm_1_interfaces/tlm_core_ifs.h \ - tlm_1/tlm_req_rsp/tlm_1_interfaces/tlm_fifo_ifs.h \ - tlm_1/tlm_req_rsp/tlm_1_interfaces/tlm_master_slave_ifs.h \ - tlm_1/tlm_req_rsp/tlm_1_interfaces/tlm_tag.h \ - \ - tlm_1/tlm_req_rsp/tlm_adapters/tlm_adapters.h \ - \ - tlm_1/tlm_req_rsp/tlm_channels/tlm_fifo/circular_buffer.h \ - tlm_1/tlm_req_rsp/tlm_channels/tlm_fifo/tlm_fifo.h \ - tlm_1/tlm_req_rsp/tlm_channels/tlm_fifo/tlm_fifo_peek.h \ - tlm_1/tlm_req_rsp/tlm_channels/tlm_fifo/tlm_fifo_put_get.h \ - tlm_1/tlm_req_rsp/tlm_channels/tlm_fifo/tlm_fifo_resize.h \ - tlm_1/tlm_req_rsp/tlm_channels/tlm_req_rsp_channels/tlm_put_get_imp.h \ - tlm_1/tlm_req_rsp/tlm_channels/tlm_req_rsp_channels/tlm_req_rsp_channels.h \ - \ - tlm_1/tlm_req_rsp/tlm_ports/tlm_event_finder.h \ - tlm_1/tlm_req_rsp/tlm_ports/tlm_nonblocking_port.h - -CXX_FILES = \ - tlm_2/tlm_generic_payload/tlm_gp.cpp \ - tlm_2/tlm_generic_payload/tlm_phase.cpp \ - tlm_2/tlm_quantum/tlm_global_quantum.cpp - -EXTRA_DIST += \ - tlm_1/README.txt \ - tlm_2/README.txt - -localincludedir = $(includedir)/tlm_core -nobase_localinclude_HEADERS = $(H_FILES) - -noinst_LTLIBRARIES = libtlm_core.la -libtlm_core_la_SOURCES = $(NO_H_FILES) $(CXX_FILES) diff --git a/src/systemc/ext/tlm_core/Makefile.in b/src/systemc/ext/tlm_core/Makefile.in deleted file mode 100644 index 0202a6b90..000000000 --- a/src/systemc/ext/tlm_core/Makefile.in +++ /dev/null @@ -1,799 +0,0 @@ -# Makefile.in generated by automake 1.14 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2013 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# top-level SystemC include directory is added in Make-rules.{sysc,examples} - -# build flags - - -VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -DIST_COMMON = $(top_srcdir)/config/Make-rules.sysc \ - $(top_srcdir)/config/Make-rules.common $(srcdir)/Makefile.in \ - $(srcdir)/Makefile.am $(top_srcdir)/config/depcomp \ - $(nobase_localinclude_HEADERS) -@WANT_DEBUG_TRUE@am__append_1 = $(DEBUG_CXXFLAGS) -@WANT_DEBUG_TRUE@am__append_2 = $(DEBUG_CXXFLAGS) -@WANT_DEBUG_TRUE@am__append_3 = $(DEBUG_CXXFLAGS) -@WANT_OPTIMIZE_TRUE@am__append_4 = $(OPT_CXXFLAGS) -@WANT_OPTIMIZE_TRUE@am__append_5 = $(OPT_CXXFLAGS) - -# either for async_update locking or pthread processes -@USES_PTHREADS_LIB_TRUE@am__append_6 = $(PTHREAD_CFLAGS) -@USES_PTHREADS_LIB_TRUE@am__append_7 = $(PTHREAD_CFLAGS) -@USES_PTHREADS_LIB_TRUE@am__append_8 = $(PTHREAD_LIBS) -@DISABLE_ASYNC_UPDATES_TRUE@am__append_9 = -DSC_DISABLE_ASYNC_UPDATES -@ENABLE_CALLBACKS_TRUE@am__append_10 = -DSC_ENABLE_SIMULATION_PHASE_CALLBACKS -@ENABLE_CALLBACKS_TRACING_TRUE@am__append_11 = -DSC_ENABLE_SIMULATION_PHASE_CALLBACKS_TRACING -@WANT_PTHREADS_THREADS_TRUE@am__append_12 = -DSC_USE_PTHREADS -@DISABLE_VCD_SCOPES_TRUE@am__append_13 = -DSC_DISABLE_VCD_SCOPES -subdir = src/tlm_core -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/config/ax_check_define.m4 \ - $(top_srcdir)/config/ax_pthread.m4 \ - $(top_srcdir)/config/libtool.m4 \ - $(top_srcdir)/config/ltoptions.m4 \ - $(top_srcdir)/config/ltsugar.m4 \ - $(top_srcdir)/config/ltversion.m4 \ - $(top_srcdir)/config/lt~obsolete.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -LTLIBRARIES = $(noinst_LTLIBRARIES) -libtlm_core_la_LIBADD = -am__dirstamp = $(am__leading_dot)dirstamp -am__objects_1 = tlm_2/tlm_generic_payload/tlm_gp.lo \ - tlm_2/tlm_generic_payload/tlm_phase.lo \ - tlm_2/tlm_quantum/tlm_global_quantum.lo -am_libtlm_core_la_OBJECTS = $(am__objects_1) -libtlm_core_la_OBJECTS = $(am_libtlm_core_la_OBJECTS) -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -DEFAULT_INCLUDES = -I.@am__isrc@ -depcomp = $(SHELL) $(top_srcdir)/config/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CXXFLAGS) $(CXXFLAGS) -AM_V_CXX = $(am__v_CXX_@AM_V@) -am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) -am__v_CXX_0 = @echo " CXX " $@; -am__v_CXX_1 = -CXXLD = $(CXX) -CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ - $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) -am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) -am__v_CXXLD_0 = @echo " CXXLD " $@; -am__v_CXXLD_1 = -SOURCES = $(libtlm_core_la_SOURCES) -DIST_SOURCES = $(libtlm_core_la_SOURCES) -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__uninstall_files_from_dir = { \ - test -z "$$files" \ - || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && rm -f $$files; }; \ - } -am__installdirs = "$(DESTDIR)$(localincludedir)" -HEADERS = $(nobase_localinclude_HEADERS) -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCAS = @CCAS@ -CCASDEPMODE = @CCASDEPMODE@ -CCASFLAGS = @CCASFLAGS@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEBUG_CXXFLAGS = @DEBUG_CXXFLAGS@ -DEFS = $(PKGCONFIG_DEFINES) $(EXTRA_DEFINES) -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -EXPLICIT_LPTHREAD = @EXPLICIT_LPTHREAD@ -EXTRA_ASFLAGS = @EXTRA_ASFLAGS@ -EXTRA_CFLAGS = @EXTRA_CFLAGS@ -EXTRA_CXXFLAGS = @EXTRA_CXXFLAGS@ -EXTRA_LDFLAGS = @EXTRA_LDFLAGS@ -FGREP = @FGREP@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LDFLAG_RPATH = @LDFLAG_RPATH@ -LIBCONFIG_DEFINES = @LIBCONFIG_DEFINES@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIB_ARCH_SUFFIX = @LIB_ARCH_SUFFIX@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OPT_CXXFLAGS = @OPT_CXXFLAGS@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PKGCONFIG_CFLAGS = @PKGCONFIG_CFLAGS@ -PKGCONFIG_DEFINES = @PKGCONFIG_DEFINES@ -PKGCONFIG_LDPRIV = @PKGCONFIG_LDPRIV@ -PTHREAD_CC = @PTHREAD_CC@ -PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ -PTHREAD_LIBS = @PTHREAD_LIBS@ -QT_ARCH = @QT_ARCH@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -TARGET_ARCH = @TARGET_ARCH@ -TLM_PACKAGE_VERSION = @TLM_PACKAGE_VERSION@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -ax_pthread_config = @ax_pthread_config@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -examplesdir = @examplesdir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libarchdir = @libarchdir@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -rootdocdir = @rootdocdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -AM_CPPFLAGS = -I$(top_srcdir)/src -AM_CFLAGS = $(EXTRA_CFLAGS) $(am__append_2) $(am__append_5) \ - $(am__append_7) -AM_CXXFLAGS = $(EXTRA_CXXFLAGS) $(am__append_1) $(am__append_4) \ - $(am__append_6) -AM_CCASFLAGS = $(EXTRA_ASFLAGS) $(am__append_3) -AM_LDFLAGS = $(EXTRA_LDFLAGS) $(am__append_8) - -# always add fix-point support -EXTRA_DEFINES = -DSC_INCLUDE_FX -DSC_BUILD $(am__append_9) \ - $(am__append_10) $(am__append_11) $(am__append_12) \ - $(am__append_13) - -# initialize some useful variables (filled later) -CLEANFILES = -EXTRA_DIST = tlm_1/README.txt tlm_2/README.txt -H_FILES = \ - tlm_2/tlm_version.h \ - tlm_2/tlm_2_interfaces/tlm_2_interfaces.h \ - tlm_2/tlm_2_interfaces/tlm_dmi.h \ - tlm_2/tlm_2_interfaces/tlm_fw_bw_ifs.h \ - \ - tlm_2/tlm_generic_payload/tlm_array.h \ - tlm_2/tlm_generic_payload/tlm_endian_conv.h \ - tlm_2/tlm_generic_payload/tlm_generic_payload.h \ - tlm_2/tlm_generic_payload/tlm_gp.h \ - tlm_2/tlm_generic_payload/tlm_helpers.h \ - tlm_2/tlm_generic_payload/tlm_phase.h \ - \ - tlm_2/tlm_quantum/tlm_global_quantum.h \ - tlm_2/tlm_quantum/tlm_quantum.h \ - \ - tlm_2/tlm_sockets/tlm_base_socket_if.h \ - tlm_2/tlm_sockets/tlm_initiator_socket.h \ - tlm_2/tlm_sockets/tlm_sockets.h \ - tlm_2/tlm_sockets/tlm_target_socket.h \ - \ - tlm_1/tlm_analysis/tlm_analysis.h \ - tlm_1/tlm_analysis/tlm_analysis_fifo.h \ - tlm_1/tlm_analysis/tlm_analysis_if.h \ - tlm_1/tlm_analysis/tlm_analysis_port.h \ - tlm_1/tlm_analysis/tlm_analysis_triple.h \ - tlm_1/tlm_analysis/tlm_write_if.h \ - \ - tlm_1/tlm_req_rsp/tlm_req_rsp.h \ - tlm_1/tlm_req_rsp/tlm_1_interfaces/tlm_core_ifs.h \ - tlm_1/tlm_req_rsp/tlm_1_interfaces/tlm_fifo_ifs.h \ - tlm_1/tlm_req_rsp/tlm_1_interfaces/tlm_master_slave_ifs.h \ - tlm_1/tlm_req_rsp/tlm_1_interfaces/tlm_tag.h \ - \ - tlm_1/tlm_req_rsp/tlm_adapters/tlm_adapters.h \ - \ - tlm_1/tlm_req_rsp/tlm_channels/tlm_fifo/circular_buffer.h \ - tlm_1/tlm_req_rsp/tlm_channels/tlm_fifo/tlm_fifo.h \ - tlm_1/tlm_req_rsp/tlm_channels/tlm_fifo/tlm_fifo_peek.h \ - tlm_1/tlm_req_rsp/tlm_channels/tlm_fifo/tlm_fifo_put_get.h \ - tlm_1/tlm_req_rsp/tlm_channels/tlm_fifo/tlm_fifo_resize.h \ - tlm_1/tlm_req_rsp/tlm_channels/tlm_req_rsp_channels/tlm_put_get_imp.h \ - tlm_1/tlm_req_rsp/tlm_channels/tlm_req_rsp_channels/tlm_req_rsp_channels.h \ - \ - tlm_1/tlm_req_rsp/tlm_ports/tlm_event_finder.h \ - tlm_1/tlm_req_rsp/tlm_ports/tlm_nonblocking_port.h - -CXX_FILES = \ - tlm_2/tlm_generic_payload/tlm_gp.cpp \ - tlm_2/tlm_generic_payload/tlm_phase.cpp \ - tlm_2/tlm_quantum/tlm_global_quantum.cpp - -localincludedir = $(includedir)/tlm_core -nobase_localinclude_HEADERS = $(H_FILES) -noinst_LTLIBRARIES = libtlm_core.la -libtlm_core_la_SOURCES = $(NO_H_FILES) $(CXX_FILES) -all: all-am - -.SUFFIXES: -.SUFFIXES: .cpp .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/config/Make-rules.sysc $(top_srcdir)/config/Make-rules.common $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/tlm_core/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign src/tlm_core/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; -$(top_srcdir)/config/Make-rules.sysc $(top_srcdir)/config/Make-rules.common: - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; \ - locs=`for p in $$list; do echo $$p; done | \ - sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ - sort -u`; \ - test -z "$$locs" || { \ - echo rm -f $${locs}; \ - rm -f $${locs}; \ - } -tlm_2/tlm_generic_payload/$(am__dirstamp): - @$(MKDIR_P) tlm_2/tlm_generic_payload - @: > tlm_2/tlm_generic_payload/$(am__dirstamp) -tlm_2/tlm_generic_payload/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) tlm_2/tlm_generic_payload/$(DEPDIR) - @: > tlm_2/tlm_generic_payload/$(DEPDIR)/$(am__dirstamp) -tlm_2/tlm_generic_payload/tlm_gp.lo: \ - tlm_2/tlm_generic_payload/$(am__dirstamp) \ - tlm_2/tlm_generic_payload/$(DEPDIR)/$(am__dirstamp) -tlm_2/tlm_generic_payload/tlm_phase.lo: \ - tlm_2/tlm_generic_payload/$(am__dirstamp) \ - tlm_2/tlm_generic_payload/$(DEPDIR)/$(am__dirstamp) -tlm_2/tlm_quantum/$(am__dirstamp): - @$(MKDIR_P) tlm_2/tlm_quantum - @: > tlm_2/tlm_quantum/$(am__dirstamp) -tlm_2/tlm_quantum/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) tlm_2/tlm_quantum/$(DEPDIR) - @: > tlm_2/tlm_quantum/$(DEPDIR)/$(am__dirstamp) -tlm_2/tlm_quantum/tlm_global_quantum.lo: \ - tlm_2/tlm_quantum/$(am__dirstamp) \ - tlm_2/tlm_quantum/$(DEPDIR)/$(am__dirstamp) - -libtlm_core.la: $(libtlm_core_la_OBJECTS) $(libtlm_core_la_DEPENDENCIES) $(EXTRA_libtlm_core_la_DEPENDENCIES) - $(AM_V_CXXLD)$(CXXLINK) $(libtlm_core_la_OBJECTS) $(libtlm_core_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -rm -f tlm_2/tlm_generic_payload/*.$(OBJEXT) - -rm -f tlm_2/tlm_generic_payload/*.lo - -rm -f tlm_2/tlm_quantum/*.$(OBJEXT) - -rm -f tlm_2/tlm_quantum/*.lo - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@tlm_2/tlm_generic_payload/$(DEPDIR)/tlm_gp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@tlm_2/tlm_generic_payload/$(DEPDIR)/tlm_phase.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@tlm_2/tlm_quantum/$(DEPDIR)/tlm_global_quantum.Plo@am__quote@ - -.cpp.o: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< - -.cpp.obj: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.cpp.lo: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -rm -rf tlm_2/tlm_generic_payload/.libs tlm_2/tlm_generic_payload/_libs - -rm -rf tlm_2/tlm_quantum/.libs tlm_2/tlm_quantum/_libs -install-nobase_localincludeHEADERS: $(nobase_localinclude_HEADERS) - @$(NORMAL_INSTALL) - @list='$(nobase_localinclude_HEADERS)'; test -n "$(localincludedir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(localincludedir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(localincludedir)" || exit 1; \ - fi; \ - $(am__nobase_list) | while read dir files; do \ - xfiles=; for file in $$files; do \ - if test -f "$$file"; then xfiles="$$xfiles $$file"; \ - else xfiles="$$xfiles $(srcdir)/$$file"; fi; done; \ - test -z "$$xfiles" || { \ - test "x$$dir" = x. || { \ - echo " $(MKDIR_P) '$(DESTDIR)$(localincludedir)/$$dir'"; \ - $(MKDIR_P) "$(DESTDIR)$(localincludedir)/$$dir"; }; \ - echo " $(INSTALL_HEADER) $$xfiles '$(DESTDIR)$(localincludedir)/$$dir'"; \ - $(INSTALL_HEADER) $$xfiles "$(DESTDIR)$(localincludedir)/$$dir" || exit $$?; }; \ - done - -uninstall-nobase_localincludeHEADERS: - @$(NORMAL_UNINSTALL) - @list='$(nobase_localinclude_HEADERS)'; test -n "$(localincludedir)" || list=; \ - $(am__nobase_strip_setup); files=`$(am__nobase_strip)`; \ - dir='$(DESTDIR)$(localincludedir)'; $(am__uninstall_files_from_dir) - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: ctags-am - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-am - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) $(HEADERS) -installdirs: - for dir in "$(DESTDIR)$(localincludedir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -rm -f tlm_2/tlm_generic_payload/$(DEPDIR)/$(am__dirstamp) - -rm -f tlm_2/tlm_generic_payload/$(am__dirstamp) - -rm -f tlm_2/tlm_quantum/$(DEPDIR)/$(am__dirstamp) - -rm -f tlm_2/tlm_quantum/$(am__dirstamp) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -rf tlm_2/tlm_generic_payload/$(DEPDIR) tlm_2/tlm_quantum/$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: install-nobase_localincludeHEADERS - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf tlm_2/tlm_generic_payload/$(DEPDIR) tlm_2/tlm_quantum/$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-nobase_localincludeHEADERS - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \ - ctags-am distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-nobase_localincludeHEADERS \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ - uninstall-nobase_localincludeHEADERS - - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/src/systemc/ext/tlm_core/tlm_1/tlm_analysis/tlm_analysis.h b/src/systemc/ext/tlm_core/tlm_1/tlm_analysis/tlm_analysis.h index 777f7141a..661399c60 100644 --- a/src/systemc/ext/tlm_core/tlm_1/tlm_analysis/tlm_analysis.h +++ b/src/systemc/ext/tlm_core/tlm_1/tlm_analysis/tlm_analysis.h @@ -17,17 +17,13 @@ *****************************************************************************/ -#ifndef __TLM_ANALYSIS_H__ -#define __TLM_ANALYSIS_H__ +#ifndef __SYSTEMC_EXT_TLM_CORE_TLM_1_TLM_ANALYSIS_TLM_ANALYSIS_H__ +#define __SYSTEMC_EXT_TLM_CORE_TLM_1_TLM_ANALYSIS_TLM_ANALYSIS_H__ - -#include "tlm_core/tlm_1/tlm_analysis/tlm_write_if.h" +#include "tlm_core/tlm_1/tlm_analysis/tlm_analysis_fifo.h" #include "tlm_core/tlm_1/tlm_analysis/tlm_analysis_if.h" - -#include "tlm_core/tlm_1/tlm_analysis/tlm_analysis_triple.h" #include "tlm_core/tlm_1/tlm_analysis/tlm_analysis_port.h" -#include "tlm_core/tlm_1/tlm_analysis/tlm_analysis_fifo.h" - -#endif - +#include "tlm_core/tlm_1/tlm_analysis/tlm_analysis_triple.h" +#include "tlm_core/tlm_1/tlm_analysis/tlm_write_if.h" +#endif /* __SYSTEMC_EXT_TLM_CORE_TLM_1_TLM_ANALYSIS_TLM_ANALYSIS_H__ */ diff --git a/src/systemc/ext/tlm_core/tlm_1/tlm_analysis/tlm_analysis_fifo.h b/src/systemc/ext/tlm_core/tlm_1/tlm_analysis/tlm_analysis_fifo.h index 1f01b2a8e..84807031f 100644 --- a/src/systemc/ext/tlm_core/tlm_1/tlm_analysis/tlm_analysis_fifo.h +++ b/src/systemc/ext/tlm_core/tlm_1/tlm_analysis/tlm_analysis_fifo.h @@ -17,38 +17,30 @@ *****************************************************************************/ -#ifndef __TLM_ANALYSIS_FIFO_H__ -#define __TLM_ANALYSIS_FIFO_H__ +#ifndef __SYSTEMC_EXT_TLM_CORE_TLM_1_TLM_ANALYSIS_TLM_ANALYSIS_FIFO_H__ +#define __SYSTEMC_EXT_TLM_CORE_TLM_1_TLM_ANALYSIS_TLM_ANALYSIS_FIFO_H__ -#include "tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_fifo/tlm_fifo.h" #include "tlm_core/tlm_1/tlm_analysis/tlm_analysis_if.h" #include "tlm_core/tlm_1/tlm_analysis/tlm_analysis_triple.h" +#include "tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_fifo/tlm_fifo.h" -namespace tlm { - -template< typename T > -class tlm_analysis_fifo : - public tlm_fifo< T > , - public virtual tlm_analysis_if< T > , - public virtual tlm_analysis_if< tlm_analysis_triple< T > > { - - public: - - // analysis fifo is an unbounded tlm_fifo - - tlm_analysis_fifo( const char *nm ) : tlm_fifo( nm , -16 ) {} - tlm_analysis_fifo() : tlm_fifo( -16 ) {} - - void write( const tlm_analysis_triple &t ) { - nb_put( t ); - } - - void write( const T &t ) { - nb_put( t ); - } - +namespace tlm +{ + +template +class tlm_analysis_fifo : public tlm_fifo, + public virtual tlm_analysis_if, + public virtual tlm_analysis_if> +{ + public: + // analysis fifo is an unbounded tlm_fifo + tlm_analysis_fifo(const char *nm) : tlm_fifo(nm, -16) {} + tlm_analysis_fifo() : tlm_fifo(-16) {} + + void write(const tlm_analysis_triple &t) { nb_put(t); } + void write(const T &t) { nb_put(t); } }; } // namespace tlm -#endif +#endif /* __SYSTEMC_EXT_TLM_CORE_TLM_1_TLM_ANALYSIS_TLM_ANALYSIS_FIFO_H__ */ diff --git a/src/systemc/ext/tlm_core/tlm_1/tlm_analysis/tlm_analysis_if.h b/src/systemc/ext/tlm_core/tlm_1/tlm_analysis/tlm_analysis_if.h index bc24fee54..d1b91effc 100644 --- a/src/systemc/ext/tlm_core/tlm_1/tlm_analysis/tlm_analysis_if.h +++ b/src/systemc/ext/tlm_core/tlm_1/tlm_analysis/tlm_analysis_if.h @@ -17,23 +17,22 @@ *****************************************************************************/ -#ifndef __TLM_ANALYSIS_IF_H__ -#define __TLM_ANALYSIS_IF_H__ +#ifndef __SYSTEMC_EXT_TLM_CORE_TLM_1_TLM_ANALYSIS_TLM_ANALYSIS_IF_H__ +#define __SYSTEMC_EXT_TLM_CORE_TLM_1_TLM_ANALYSIS_TLM_ANALYSIS_IF_H__ #include "tlm_core/tlm_1/tlm_analysis/tlm_write_if.h" -namespace tlm { +namespace tlm +{ -template < typename T > +template class tlm_analysis_if : public virtual tlm_write_if -{ -}; +{}; -template < typename T > +template class tlm_delayed_analysis_if : public virtual tlm_delayed_write_if -{ -}; +{}; } // namespace tlm -#endif +#endif /* __SYSTEMC_EXT_TLM_CORE_TLM_1_TLM_ANALYSIS_TLM_ANALYSIS_IF_H__ */ diff --git a/src/systemc/ext/tlm_core/tlm_1/tlm_analysis/tlm_analysis_port.h b/src/systemc/ext/tlm_core/tlm_1/tlm_analysis/tlm_analysis_port.h index 999092538..5195417a8 100644 --- a/src/systemc/ext/tlm_core/tlm_1/tlm_analysis/tlm_analysis_port.h +++ b/src/systemc/ext/tlm_core/tlm_1/tlm_analysis/tlm_analysis_port.h @@ -17,68 +17,62 @@ *****************************************************************************/ -#ifndef __TLM_ANALYSIS_PORT_H__ -#define __TLM_ANALYSIS_PORT_H__ +#ifndef __SYSTEMC_EXT_TLM_CORE_TLM_1_TLM_ANALYSIS_TLM_ANALYSIS_PORT_H__ +#define __SYSTEMC_EXT_TLM_CORE_TLM_1_TLM_ANALYSIS_TLM_ANALYSIS_PORT_H__ -#include "tlm_core/tlm_1/tlm_analysis/tlm_analysis_if.h" -#include #include +#include -namespace tlm { - +#include "tlm_core/tlm_1/tlm_analysis/tlm_analysis_if.h" -template < typename T> -class tlm_analysis_port : - public sc_core::sc_object , - public virtual tlm_analysis_if< T > +namespace tlm { - public: - tlm_analysis_port() : sc_core::sc_object() {} - tlm_analysis_port( const char *nm ) : sc_core::sc_object( nm ) {} - // bind and () work for both interfaces and analysis ports, since - // analysis ports implement the analysis interface - - virtual void bind( tlm_analysis_if &_if ) { - m_interfaces.push_back( &_if ); - } - - void operator() ( tlm_analysis_if &_if ) { bind( _if ); } - - virtual bool unbind( tlm_analysis_if &_if ) { +template +class tlm_analysis_port : public sc_core::sc_object, + public virtual tlm_analysis_if +{ + public: + tlm_analysis_port() : sc_core::sc_object() {} + tlm_analysis_port(const char *nm) : sc_core::sc_object(nm) {} - typename std::deque< tlm_analysis_if * >::iterator i - = std::remove( m_interfaces.begin(), m_interfaces.end(), &_if ); + // bind and () work for both interfaces and analysis ports, since + // analysis ports implement the analysis interface. - if( i != m_interfaces.end() ) { - m_interfaces.erase(i, m_interfaces.end() ); - return 1; + virtual void + bind(tlm_analysis_if &_if) + { + m_interfaces.push_back(&_if); } - return 0; - - } - - void write( const T &t ) { - typename std::deque< tlm_analysis_if * >::iterator i; - - for( i = m_interfaces.begin(); - i != m_interfaces.end(); - i++ ) { - - (*i)->write( t ); - + void operator() (tlm_analysis_if &_if) { bind(_if); } + virtual bool + unbind(tlm_analysis_if &_if) + { + typename std::deque *>::iterator i = + std::remove(m_interfaces.begin(), m_interfaces.end(), &_if); + + if (i != m_interfaces.end()) { + m_interfaces.erase(i, m_interfaces.end()); + return 1; + } + return 0; } - } + void + write(const T &t) + { + typename std::deque *>::iterator i; - private: - std::deque< tlm_analysis_if * > m_interfaces; + for (i = m_interfaces.begin(); i != m_interfaces.end(); i++) { + (*i)->write(t); + } + } + private: + std::deque *> m_interfaces; }; } // namespace tlm -#endif - - +#endif /* __SYSTEMC_EXT_TLM_CORE_TLM_1_TLM_ANALYSIS_TLM_ANALYSIS_PORT_H__ */ diff --git a/src/systemc/ext/tlm_core/tlm_1/tlm_analysis/tlm_analysis_triple.h b/src/systemc/ext/tlm_core/tlm_1/tlm_analysis/tlm_analysis_triple.h index f65a25a2e..9727f23e5 100644 --- a/src/systemc/ext/tlm_core/tlm_1/tlm_analysis/tlm_analysis_triple.h +++ b/src/systemc/ext/tlm_core/tlm_1/tlm_analysis/tlm_analysis_triple.h @@ -17,37 +17,37 @@ *****************************************************************************/ -#ifndef __TLM_ANALYSIS_TRIPLE_H__ -#define __TLM_ANALYSIS_TRIPLE_H__ - -//#include - -namespace tlm { - -template< typename T> -struct tlm_analysis_triple { - - sc_core::sc_time start_time; - T transaction; - sc_core::sc_time end_time; - - tlm_analysis_triple() {} - - tlm_analysis_triple( const tlm_analysis_triple &triple ) { - start_time = triple.start_time; - transaction = triple.transaction; - end_time = triple.end_time; - } - - tlm_analysis_triple( const T &t ) { - transaction = t; - } - - operator T() { return transaction; } - operator const T &() const { return transaction; } - +#ifndef __SYSTEMC_EXT_TLM_CORE_TLM_1_TLM_ANALYSIS_TLM_ANALYSIS_TRIPLE_H__ +#define __SYSTEMC_EXT_TLM_CORE_TLM_1_TLM_ANALYSIS_TLM_ANALYSIS_TRIPLE_H__ + +namespace tlm +{ + +template +struct tlm_analysis_triple +{ + sc_core::sc_time start_time; + T transaction; + sc_core::sc_time end_time; + + tlm_analysis_triple() {} + + tlm_analysis_triple(const tlm_analysis_triple &triple) + { + start_time = triple.start_time; + transaction = triple.transaction; + end_time = triple.end_time; + } + + tlm_analysis_triple(const T &t) + { + transaction = t; + } + + operator T() { return transaction; } + operator const T &() const { return transaction; } }; } // namespace tlm -#endif +#endif /* __SYSTEMC_EXT_TLM_CORE_TLM_1_TLM_ANALYSIS_TLM_ANALYSIS_TRIPLE_H__ */ diff --git a/src/systemc/ext/tlm_core/tlm_1/tlm_analysis/tlm_write_if.h b/src/systemc/ext/tlm_core/tlm_1/tlm_analysis/tlm_write_if.h index b66a591bc..3d77f880d 100644 --- a/src/systemc/ext/tlm_core/tlm_1/tlm_analysis/tlm_write_if.h +++ b/src/systemc/ext/tlm_core/tlm_1/tlm_analysis/tlm_write_if.h @@ -17,26 +17,28 @@ *****************************************************************************/ -#ifndef __TLM_WRITE_IF_H__ -#define __TLM_WRITE_IF_H__ +#ifndef __SYSTEMC_EXT_TLM_CORE_TLM_1_TLM_ANALYSIS_TLM_WRITE_IF_H__ +#define __SYSTEMC_EXT_TLM_CORE_TLM_1_TLM_ANALYSIS_TLM_WRITE_IF_H__ #include -namespace tlm { +namespace tlm +{ template -class tlm_write_if : public virtual sc_core::sc_interface { -public: - virtual void write(const T& t) = 0; +class tlm_write_if : public virtual sc_core::sc_interface +{ + public: + virtual void write(const T &t) = 0; }; template -class tlm_delayed_write_if : public virtual sc_core::sc_interface { -public: - virtual void write(const T& t, const sc_core::sc_time& time) = 0; +class tlm_delayed_write_if : public virtual sc_core::sc_interface +{ + public: + virtual void write(const T &t, const sc_core::sc_time &time) = 0; }; } // namespace tlm - -#endif +#endif /* __SYSTEMC_EXT_TLM_CORE_TLM_1_TLM_ANALYSIS_TLM_WRITE_IF_H__ */ diff --git a/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_1_interfaces/tlm_core_ifs.h b/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_1_interfaces/tlm_core_ifs.h index 4c1340338..2cd919bd2 100644 --- a/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_1_interfaces/tlm_core_ifs.h +++ b/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_1_interfaces/tlm_core_ifs.h @@ -17,133 +17,122 @@ *****************************************************************************/ -// -// Note to the LRM writer : This is the core of the TLM standard -// - - -#ifndef __TLM_CORE_IFS_H__ -#define __TLM_CORE_IFS_H__ - -//#include +#ifndef \ + __SYSTEMC_EXT_TLM_CORE_TLM_1_TLM_REQ_RSP_TLM1_INTERFACES_TLM_CORE_IFS_H__ +#define \ + __SYSTEMC_EXT_TLM_CORE_TLM_1_TLM_REQ_RSP_TLM1_INTERFACES_TLM_CORE_IFS_H__ #include "tlm_core/tlm_1/tlm_req_rsp/tlm_1_interfaces/tlm_tag.h" -namespace tlm { - -// bidirectional blocking interfaces +namespace tlm +{ -template < typename REQ , typename RSP > +// Bidirectional blocking interfaces. +template class tlm_transport_if : public virtual sc_core::sc_interface { -public: - virtual RSP transport( const REQ & ) = 0; - - virtual void transport( const REQ &req , RSP &rsp ) { - rsp = transport( req ); - } - + public: + virtual RSP transport(const REQ &) = 0; + + virtual void + transport(const REQ &req, RSP &rsp) + { + rsp = transport(req); + } }; - -// uni-directional blocking interfaces - -template < typename T > +// Uni-directional blocking interfaces. +template class tlm_blocking_get_if : public virtual sc_core::sc_interface { -public: - virtual T get( tlm_tag *t = 0 ) = 0; - virtual void get( T &t ) { t = get(); } - + public: + virtual T get(tlm_tag *t=nullptr) = 0; + virtual void get(T &t) { t = get(); } }; -template < typename T > +template class tlm_blocking_put_if : public virtual sc_core::sc_interface { -public: - virtual void put( const T &t ) = 0; + public: + virtual void put(const T &t) = 0; }; -// uni-directional non blocking interfaces +// Uni-directional non blocking interfaces. -template < typename T > +template class tlm_nonblocking_get_if : public virtual sc_core::sc_interface { -public: - virtual bool nb_get( T &t ) = 0; - virtual bool nb_can_get( tlm_tag *t = 0 ) const = 0; - virtual const sc_core::sc_event &ok_to_get( tlm_tag *t = 0 ) const = 0; + public: + virtual bool nb_get(T &t) = 0; + virtual bool nb_can_get(tlm_tag *t=nullptr) const = 0; + virtual const sc_core::sc_event & + ok_to_get(tlm_tag *t=nullptr) const = 0; }; -template < typename T > +template class tlm_nonblocking_put_if : public virtual sc_core::sc_interface { -public: - virtual bool nb_put( const T &t ) = 0; - virtual bool nb_can_put( tlm_tag *t = 0 ) const = 0; - virtual const sc_core::sc_event &ok_to_put( tlm_tag *t = 0 ) const = 0; + public: + virtual bool nb_put(const T &t) = 0; + virtual bool nb_can_put(tlm_tag *t=nullptr) const = 0; + virtual const sc_core::sc_event & + ok_to_put(tlm_tag *t=nullptr) const = 0; }; +// Combined uni-directional blocking and non blocking. +template +class tlm_get_if : public virtual tlm_blocking_get_if, + public virtual tlm_nonblocking_get_if +{}; -// combined uni-directional blocking and non blocking +template +class tlm_put_if : public virtual tlm_blocking_put_if, + public virtual tlm_nonblocking_put_if +{}; -template < typename T > -class tlm_get_if : - public virtual tlm_blocking_get_if< T > , - public virtual tlm_nonblocking_get_if< T > {}; - -template < typename T > -class tlm_put_if : - public virtual tlm_blocking_put_if< T > , - public virtual tlm_nonblocking_put_if< T > {}; - - -// peek interfaces - -template < typename T > +// Peek interfaces. +template class tlm_blocking_peek_if : public virtual sc_core::sc_interface { -public: - virtual T peek( tlm_tag *t = 0 ) const = 0; - virtual void peek( T &t ) const { t = peek(); } - + public: + virtual T peek(tlm_tag *t=nullptr) const = 0; + virtual void peek(T &t) const { t = peek(); } }; -template < typename T > +template class tlm_nonblocking_peek_if : public virtual sc_core::sc_interface { -public: - virtual bool nb_peek( T &t ) const = 0; - virtual bool nb_can_peek( tlm_tag *t = 0 ) const = 0; - virtual const sc_core::sc_event &ok_to_peek( tlm_tag *t = 0 ) const = 0; + public: + virtual bool nb_peek(T &t) const = 0; + virtual bool nb_can_peek(tlm_tag *t=nullptr) const = 0; + virtual const sc_core::sc_event & + ok_to_peek(tlm_tag *t=nullptr) const = 0; }; -template < typename T > +template class tlm_peek_if : - public virtual tlm_blocking_peek_if< T > , - public virtual tlm_nonblocking_peek_if< T > {}; - -// get_peek interfaces - -template < typename T > -class tlm_blocking_get_peek_if : - public virtual tlm_blocking_get_if , - public virtual tlm_blocking_peek_if {}; - -template < typename T > -class tlm_nonblocking_get_peek_if : - public virtual tlm_nonblocking_get_if , - public virtual tlm_nonblocking_peek_if {}; - - -template < typename T > -class tlm_get_peek_if : - public virtual tlm_get_if , - public virtual tlm_peek_if , - public virtual tlm_blocking_get_peek_if , - public virtual tlm_nonblocking_get_peek_if - {}; + public virtual tlm_blocking_peek_if, + public virtual tlm_nonblocking_peek_if +{}; + +// Get_peek interfaces. +template +class tlm_blocking_get_peek_if : public virtual tlm_blocking_get_if, + public virtual tlm_blocking_peek_if +{}; + +template +class tlm_nonblocking_get_peek_if : public virtual tlm_nonblocking_get_if, + public virtual tlm_nonblocking_peek_if +{}; + +template +class tlm_get_peek_if : public virtual tlm_get_if, + public virtual tlm_peek_if, public virtual tlm_blocking_get_peek_if, + public virtual tlm_nonblocking_get_peek_if +{}; } // namespace tlm #endif +/* __SYSTEMC_EXT_TLM_CORE_TLM_1_TLM_REQ_RSP_TLM1_INTERFACES_TLM_CORE_IFS_H__ */ diff --git a/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_1_interfaces/tlm_fifo_ifs.h b/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_1_interfaces/tlm_fifo_ifs.h index d9b2b985b..57418ae92 100644 --- a/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_1_interfaces/tlm_fifo_ifs.h +++ b/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_1_interfaces/tlm_fifo_ifs.h @@ -17,17 +17,15 @@ *****************************************************************************/ -// -// Note to the LRM writer : These interfaces are channel specific interfaces -// useful in the context of tlm_fifo. -// - -#ifndef __TLM_FIFO_IFS_H__ -#define __TLM_FIFO_IFS_H__ +#ifndef \ + __SYSTEMC_EXT_TLM_CORE_TLM_1_TLM_REQ_RSP_TLM_1_INTERFACES_TLM_FIFO_IFS_H__ +#define \ + __SYSTEMC_EXT_TLM_CORE_TLM_1_TLM_REQ_RSP_TLM_1_INTERFACES_TLM_FIFO_IFS_H__ #include "tlm_core/tlm_1/tlm_req_rsp/tlm_1_interfaces/tlm_core_ifs.h" -namespace tlm { +namespace tlm +{ // // Fifo specific interfaces @@ -35,51 +33,50 @@ namespace tlm { // Fifo Debug Interface -template< typename T > +template class tlm_fifo_debug_if : public virtual sc_core::sc_interface { -public: - virtual int used() const = 0; - virtual int size() const = 0; - virtual void debug() const = 0; - - // - // non blocking peek and poke - no notification - // - // n is index of data : - // 0 <= n < size(), where 0 is most recently written, and size() - 1 - // is oldest ie the one about to be read. - // - - virtual bool nb_peek( T & , int n ) const = 0; - virtual bool nb_poke( const T & , int n = 0 ) = 0; - + public: + virtual int used() const = 0; + virtual int size() const = 0; + virtual void debug() const = 0; + + // + // non blocking peek and poke - no notification + // + // n is index of data : + // 0 <= n < size(), where 0 is most recently written, and size() - 1 + // is oldest ie the one about to be read. + // + + virtual bool nb_peek(T &, int n) const = 0; + virtual bool nb_poke(const T&, int n=0) = 0; }; // fifo interfaces = extended + debug -template < typename T > -class tlm_fifo_put_if : - public virtual tlm_put_if , - public virtual tlm_fifo_debug_if {}; +template +class tlm_fifo_put_if : public virtual tlm_put_if, + public virtual tlm_fifo_debug_if +{}; -template < typename T > +template class tlm_fifo_get_if : - public virtual tlm_get_peek_if , - public virtual tlm_fifo_debug_if {}; + public virtual tlm_get_peek_if, + public virtual tlm_fifo_debug_if +{}; class tlm_fifo_config_size_if : public virtual sc_core::sc_interface { -public: - virtual void nb_expand( unsigned int n = 1 ) = 0; - virtual void nb_unbound( unsigned int n = 16 ) = 0; - - virtual bool nb_reduce( unsigned int n = 1 ) = 0; - virtual bool nb_bound( unsigned int n ) = 0; + public: + virtual void nb_expand(unsigned int n=1) = 0; + virtual void nb_unbound(unsigned int n=16) = 0; + virtual bool nb_reduce(unsigned int n=1) = 0; + virtual bool nb_bound(unsigned int n) = 0; }; } // namespace tlm #endif - +/* __SYSTEMC_EXT_TLM_CORE_TLM_1_TLM_REQ_RSP_TLM_1_INTERFACES_TLM_FIFO_IFS_H__*/ diff --git a/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_1_interfaces/tlm_master_slave_ifs.h b/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_1_interfaces/tlm_master_slave_ifs.h index 5bac3c877..29a89de47 100644 --- a/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_1_interfaces/tlm_master_slave_ifs.h +++ b/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_1_interfaces/tlm_master_slave_ifs.h @@ -17,57 +17,62 @@ *****************************************************************************/ -#ifndef __TLM_MASTER_SLAVE_IFS_H__ -#define __TLM_MASTER_SLAVE_IFS_H__ +#ifndef \ + __TLM_CORE_TLM_1_TLM_REQ_RSP_TLM_1_INTERFACES_TLM_MASTER_SLAVE_IFS_H__ +#define \ + __TLM_CORE_TLM_1_TLM_REQ_RSP_TLM_1_INTERFACES_TLM_MASTER_SLAVE_IFS_H__ #include "tlm_core/tlm_1/tlm_req_rsp/tlm_1_interfaces/tlm_core_ifs.h" -namespace tlm { +namespace tlm +{ // // req/rsp combined interfaces // -// blocking - -template < typename REQ , typename RSP> +// Blocking. +template class tlm_blocking_master_if : - public virtual tlm_blocking_put_if< REQ > , - public virtual tlm_blocking_get_peek_if< RSP > {}; + public virtual tlm_blocking_put_if, + public virtual tlm_blocking_get_peek_if +{}; -template < typename REQ , typename RSP> +template class tlm_blocking_slave_if : - public virtual tlm_blocking_put_if< RSP > , - public virtual tlm_blocking_get_peek_if< REQ > {}; - -// nonblocking + public virtual tlm_blocking_put_if, + public virtual tlm_blocking_get_peek_if +{}; -template < typename REQ , typename RSP > +// Nonblocking. +template class tlm_nonblocking_master_if : - public virtual tlm_nonblocking_put_if< REQ > , - public virtual tlm_nonblocking_get_peek_if< RSP > {}; + public virtual tlm_nonblocking_put_if, + public virtual tlm_nonblocking_get_peek_if +{}; -template < typename REQ , typename RSP > +template class tlm_nonblocking_slave_if : - public virtual tlm_nonblocking_put_if< RSP > , - public virtual tlm_nonblocking_get_peek_if< REQ > {}; - -// combined - -template < typename REQ , typename RSP > -class tlm_master_if : - public virtual tlm_put_if< REQ > , - public virtual tlm_get_peek_if< RSP > , - public virtual tlm_blocking_master_if< REQ , RSP > , - public virtual tlm_nonblocking_master_if< REQ , RSP > {}; - -template < typename REQ , typename RSP > -class tlm_slave_if : - public virtual tlm_put_if< RSP > , - public virtual tlm_get_peek_if< REQ > , - public virtual tlm_blocking_slave_if< REQ , RSP > , - public virtual tlm_nonblocking_slave_if< REQ , RSP > {}; + public virtual tlm_nonblocking_put_if, + public virtual tlm_nonblocking_get_peek_if +{}; + +// Combined. +template +class tlm_master_if : public virtual tlm_put_if, + public virtual tlm_get_peek_if , + public virtual tlm_blocking_master_if, + public virtual tlm_nonblocking_master_if +{}; + +template +class tlm_slave_if : public virtual tlm_put_if, + public virtual tlm_get_peek_if, + public virtual tlm_blocking_slave_if, + public virtual tlm_nonblocking_slave_if +{}; } // namespace tlm #endif +/* __TLM_CORE_TLM_1_TLM_REQ_RSP_TLM_1_INTERFACES_TLM_MASTER_SLAVE_IFS_H__ */ diff --git a/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_1_interfaces/tlm_tag.h b/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_1_interfaces/tlm_tag.h index 230b77d17..b19c904fb 100644 --- a/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_1_interfaces/tlm_tag.h +++ b/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_1_interfaces/tlm_tag.h @@ -17,15 +17,17 @@ *****************************************************************************/ -// -// Note to the LRM writer : This is part of the core TLM standard -// +#ifndef __SYSTEMC_EXT_TLM_CORE_TLM_1_TLM_REQ_RSP_TLM_1_INTERFACES_TLM_TAG_H__ +#define __SYSTEMC_EXT_TLM_CORE_TLM_1_TLM_REQ_RSP_TLM_1_INTERFACES_TLM_TAG_H__ -#ifndef __TLM_TAG_H__ -#define __TLM_TAG_H__ +namespace tlm +{ + +template +class tlm_tag +{}; -namespace tlm { -template class tlm_tag {}; } #endif +/* __SYSTEMC_EXT_TLM_CORE_TLM_1_TLM_REQ_RSP_TLM_1_INTERFACES_TLM_TAG_H__ */ diff --git a/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_adapters/tlm_adapters.h b/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_adapters/tlm_adapters.h index 13207187a..c81df4b15 100644 --- a/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_adapters/tlm_adapters.h +++ b/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_adapters/tlm_adapters.h @@ -17,89 +17,84 @@ *****************************************************************************/ -#ifndef __TLM_ADAPTERS_H__ -#define __TLM_ADAPTERS_H__ +#ifndef __SYSTEMC_EXT_TLM_CORE_TLM_1_TLM_REQ_RSP_TLM_ADAPTERS_H__ +#define __SYSTEMC_EXT_TLM_CORE_TLM_1_TLM_REQ_RSP_TLM_ADAPTERS_H__ #include "tlm_core/tlm_1/tlm_req_rsp/tlm_1_interfaces/tlm_master_slave_ifs.h" -namespace tlm { - -template< typename REQ , typename RSP > -class tlm_transport_to_master : - public sc_core::sc_module , - public virtual tlm_transport_if< REQ , RSP > +namespace tlm { -public: - sc_core::sc_export< tlm_transport_if< REQ , RSP > > target_export; - sc_core::sc_port< tlm_master_if< REQ , RSP > > master_port; - - tlm_transport_to_master( sc_core::sc_module_name nm ) : - sc_core::sc_module( nm ) { - - target_export( *this ); - - } - - tlm_transport_to_master() : - sc_core::sc_module( sc_core::sc_module_name( sc_core::sc_gen_unique_name( "transport_to_master" ) ) ){ - - target_export( *this ); - - } - RSP transport( const REQ &req ) { - - mutex.lock(); - - master_port->put( req ); - rsp = master_port->get(); +template +class tlm_transport_to_master : public sc_core::sc_module, + public virtual tlm_transport_if +{ + public: + sc_core::sc_export> target_export; + sc_core::sc_port> master_port; + + tlm_transport_to_master(sc_core::sc_module_name nm) : + sc_core::sc_module(nm) + { + target_export( *this ); + } - mutex.unlock(); - return rsp; + tlm_transport_to_master() : + sc_core::sc_module(sc_core::sc_module_name( + sc_core::sc_gen_unique_name("transport_to_master"))) + { + target_export( *this ); + } - } + RSP + transport(const REQ &req) + { + mutex.lock(); + master_port->put(req); + rsp = master_port->get(); -private: - sc_core::sc_mutex mutex; - RSP rsp; + mutex.unlock(); + return rsp; + } + private: + sc_core::sc_mutex mutex; + RSP rsp; }; -template< typename REQ , typename RSP > +template class tlm_slave_to_transport : public sc_core::sc_module { -public: - - SC_HAS_PROCESS( tlm_slave_to_transport ); - - sc_core::sc_port< tlm_slave_if< REQ , RSP > > slave_port; - sc_core::sc_port< tlm_transport_if< REQ , RSP > > initiator_port; - - tlm_slave_to_transport( sc_core::sc_module_name nm ) : sc_core::sc_module( nm ) - {} - - tlm_slave_to_transport() : - sc_core::sc_module( sc_core::sc_module_name( sc_core::sc_gen_unique_name("slave_to_transport") ) ) - {} - -private: - void run() { - - REQ req; - RSP rsp; - - while( true ) { - - slave_port->get( req ); - rsp = initiator_port->transport( req ); - slave_port->put( rsp ); - + public: + SC_HAS_PROCESS(tlm_slave_to_transport); + + sc_core::sc_port> slave_port; + sc_core::sc_port> initiator_port; + + tlm_slave_to_transport(sc_core::sc_module_name nm) : + sc_core::sc_module(nm) + {} + + tlm_slave_to_transport() : + sc_core::sc_module(sc_core::sc_module_name( + sc_core::sc_gen_unique_name("slave_to_transport"))) + {} + + private: + void + run() + { + REQ req; + RSP rsp; + + while (true) { + slave_port->get(req); + rsp = initiator_port->transport(req); + slave_port->put(rsp); + } } - - } - }; } // namespace tlm -#endif +#endif /* __SYSTEMC_EXT_TLM_CORE_TLM_1_TLM_REQ_RSP_TLM_ADAPTERS_H__*/ diff --git a/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_fifo/circular_buffer.h b/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_fifo/circular_buffer.h index 50309e31b..c00fe4881 100644 --- a/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_fifo/circular_buffer.h +++ b/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_fifo/circular_buffer.h @@ -17,252 +17,239 @@ *****************************************************************************/ -// -// To the LRM writer : this class is purely an artifact of the implementation. -// - -#ifndef __CIRCULAR_BUFFER_H__ -#define __CIRCULAR_BUFFER_H__ +#ifndef \ + __TLM_CORE_TLM_1_TLM_REQ_RSP_TLM_CHANNELS_TLM_FIFO_CIRCULAR_BUFFER_H__ +#define \ + __TLM_CORE_TLM_1_TLM_REQ_RSP_TLM_CHANNELS_TLM_FIFO_CIRCULAR_BUFFER_H__ #include -namespace tlm { +namespace tlm +{ -template < typename T > +template class circular_buffer { -public: - - explicit - circular_buffer( int size = 0 ); - ~circular_buffer(); - - void resize( int size ); - void clear(); - - T read(); - void write( const T & ); - - bool is_empty() const { return used() == 0; } - bool is_full() const { return free() == 0; } - - int size() const { return m_size; } - int used() const { return m_used; } - int free() const { return m_free; } - - const T& read_data() const - { return buf_read( m_buf, m_ri ); } - - const T& peek_data( int i ) const - { return buf_read( m_buf, (m_ri + i) % size() ); } - - T & poke_data( int i ) - { return buf_read( m_buf , (m_wi + i) % size() ); } - - void debug() const; - -private: - void increment_write_pos( int i = 1 ); - void increment_read_pos( int i = 1 ); - - void init(); - - circular_buffer( const circular_buffer &b ); // disabled - circular_buffer &operator=( const circular_buffer & ); // disabled - - void* buf_alloc( int size ); - void buf_free( void*& buf ); - void buf_write( void* buf, int n, const T & t ); - T& buf_read( void* buf, int n ) const; - void buf_clear( void* buf, int n ); - -private: - int m_size; // size of the buffer - void* m_buf; // the buffer - int m_free; // number of free spaces - int m_used; // number of used spaces - int m_ri; // index of next read - int m_wi; // index of next write - + public: + explicit circular_buffer(int size=0); + ~circular_buffer(); + + void resize(int size); + void clear(); + + T read(); + void write(const T &); + + bool is_empty() const { return used() == 0; } + bool is_full() const { return free() == 0; } + + int size() const { return m_size; } + int used() const { return m_used; } + int free() const { return m_free; } + + const T &read_data() const { return buf_read(m_buf, m_ri); } + const T & + peek_data(int i) const + { + return buf_read(m_buf, (m_ri + i) % size()); + } + + T & + poke_data(int i) + { + return buf_read(m_buf, (m_wi + i) % size()); + } + + void debug() const; + + private: + void increment_write_pos(int i=1); + void increment_read_pos(int i=1); + + void init(); + + // Disabled. + circular_buffer(const circular_buffer &b); + circular_buffer &operator = (const circular_buffer &); + + void *buf_alloc(int size); + void buf_free(void *&buf); + void buf_write(void *buf, int n, const T &t); + T &buf_read(void *buf, int n) const; + void buf_clear(void *buf, int n); + + private: + int m_size; // size of the buffer + void *m_buf; // the buffer + int m_free; // number of free spaces + int m_used; // number of used spaces + int m_ri; // index of next read + int m_wi; // index of next write }; -template< typename T > +template void circular_buffer::debug() const { - - std::cout << "Buffer debug" << std::endl; - std::cout << "Size : " << size() << std::endl; - std::cout << "Free/Used " << free() << "/" << used() << std::endl; - std::cout << "Indices : r/w = " << m_ri << "/" << m_wi << std::endl; - - if( is_empty() ) { - - std::cout << "empty" << std::endl; - - } - - if( is_full() ) { - - std::cout << "full" << std::endl; - - } - - std::cout << "Data : " << std::endl; - for( int i = 0; i < used(); i++ ) { - - std::cout << peek_data( i ) << std::endl; - - } - - + std::cout << "Buffer debug" << std::endl; + std::cout << "Size : " << size() << std::endl; + std::cout << "Free/Used " << free() << "/" << used() << std::endl; + std::cout << "Indices : r/w = " << m_ri << "/" << m_wi << std::endl; + + if (is_empty()) { + std::cout << "empty" << std::endl; + } + + if (is_full()) { + std::cout << "full" << std::endl; + } + + std::cout << "Data : " << std::endl; + for (int i = 0; i < used(); i++) { + std::cout << peek_data( i ) << std::endl; + } } -template < typename T > -circular_buffer::circular_buffer( int size ) - : m_size(size) - , m_buf(0) +template +circular_buffer::circular_buffer(int size) : m_size(size), m_buf(0) { - init(); - + init(); } -template < typename T > +template void circular_buffer::clear() { - for( int i=0; i < used(); i++ ) { - buf_clear( m_buf, (m_ri + i) % m_size ); - } - m_free = m_size; - m_used = m_ri = m_wi = 0; + for (int i = 0; i < used(); i++) { + buf_clear(m_buf, (m_ri + i) % m_size); + } + m_free = m_size; + m_used = m_ri = m_wi = 0; } -template < typename T > +template circular_buffer::~circular_buffer() { - clear(); - buf_free( m_buf ); + clear(); + buf_free(m_buf); } -template < typename T > +template void -circular_buffer::resize( int size ) +circular_buffer::resize(int size) { + int i; + void *new_buf = buf_alloc(size); - int i; - void * new_buf = buf_alloc(size); - - for( i = 0; i < size && i < used(); i++ ) { + for (i = 0; i < size && i < used(); i++) { + buf_write(new_buf, i, peek_data(i)); + buf_clear(m_buf, (m_ri + i) % m_size); + } - buf_write( new_buf, i, peek_data( i ) ); - buf_clear( m_buf, (m_ri + i) % m_size ); + buf_free(m_buf); - } + m_size = size; + m_ri = 0; + m_wi = i % m_size; + m_used = i; + m_free = m_size - m_used; - buf_free( m_buf ); - - m_size = size; - m_ri = 0; - m_wi = i % m_size; - m_used = i; - m_free = m_size - m_used; - - m_buf = new_buf; + m_buf = new_buf; } -template < typename T > +template void -circular_buffer::init() { - - if( m_size > 0 ) { - m_buf = buf_alloc( m_size ); - } - - m_free = m_size; - m_used = 0; - m_ri = 0; - m_wi = 0; - +circular_buffer::init() +{ + if (m_size > 0) { + m_buf = buf_alloc(m_size); + } + + m_free = m_size; + m_used = 0; + m_ri = 0; + m_wi = 0; } -template < typename T > +template T circular_buffer::read() { - T t = read_data(); + T t = read_data(); - buf_clear( m_buf, m_ri ); - increment_read_pos(); + buf_clear(m_buf, m_ri); + increment_read_pos(); - return t; + return t; } -template < typename T > +template void -circular_buffer::write( const T &t ) +circular_buffer::write(const T &t) { - buf_write( m_buf, m_wi, t ); - increment_write_pos(); + buf_write(m_buf, m_wi, t); + increment_write_pos(); } - -template < typename T > +template void -circular_buffer::increment_write_pos( int i ) { - - m_wi = ( m_wi + i ) % m_size; - m_used += i; - m_free -= i; - +circular_buffer::increment_write_pos(int i) +{ + m_wi = (m_wi + i) % m_size; + m_used += i; + m_free -= i; } -template < typename T > +template void -circular_buffer::increment_read_pos( int i ) { - - m_ri = ( m_ri + i ) % m_size; - m_used -= i; - m_free += i; - +circular_buffer::increment_read_pos(int i) +{ + m_ri = (m_ri + i) % m_size; + m_used -= i; + m_free += i; } -template < typename T > -inline void* -circular_buffer::buf_alloc( int size ) - { return new unsigned char[ size * sizeof(T) ]; } +template +inline void * +circular_buffer::buf_alloc(int size) +{ + return new unsigned char [size * sizeof(T)]; +} -template < typename T > +template inline void -circular_buffer::buf_free( void* & buf ) - { delete [] static_cast(buf); buf = 0; } +circular_buffer::buf_free(void *&buf) +{ + delete [] static_cast(buf); + buf = nullptr; +} -template < typename T > +template inline void -circular_buffer::buf_write( void* buf, int n, const T & t ) +circular_buffer::buf_write(void *buf, int n, const T &t) { - T* p = static_cast(buf) + n; - new (p) T(t); + T *p = static_cast(buf) + n; + new (p)T(t); } -template < typename T > -inline T& -circular_buffer::buf_read( void* buf, int n ) const +template +inline T & +circular_buffer::buf_read(void *buf, int n) const { - T* p = static_cast(buf) + n; - return *p; + T *p = static_cast(buf) + n; + return *p; } -template < typename T > +template inline void -circular_buffer::buf_clear( void* buf, int n ) +circular_buffer::buf_clear(void *buf, int n) { - T* p = static_cast(buf) + n; - p->~T(); + T *p = static_cast(buf) + n; + p->~T(); } } // namespace tlm #endif - +/* __TLM_CORE_TLM_1_TLM_REQ_RSP_TLM_CHANNELS_TLM_FIFO_CIRCULAR_BUFFER_H__ */ diff --git a/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_fifo/tlm_fifo.h b/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_fifo/tlm_fifo.h index 7b44a32ee..25a183459 100644 --- a/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_fifo/tlm_fifo.h +++ b/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_fifo/tlm_fifo.h @@ -17,8 +17,10 @@ *****************************************************************************/ -#ifndef __TLM_FIFO_H__ -#define __TLM_FIFO_H__ +#ifndef \ + __SYSTEMC_EXT_TLM_CORE_TLM_1_TLM_REQ_RSP_TLM_CHANNELS_TLM_FIFO_TLM_FIFO_H__ +#define \ + __SYSTEMC_EXT_TLM_CORE_TLM_1_TLM_REQ_RSP_TLM_CHANNELS_TLM_FIFO_TLM_FIFO_H__ // // This implements put, get and peek @@ -34,171 +36,147 @@ // actual physical buffer. // -//#include - #include "tlm_core/tlm_1/tlm_req_rsp/tlm_1_interfaces/tlm_fifo_ifs.h" #include "tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_fifo/circular_buffer.h" -namespace tlm { +namespace tlm +{ template -class tlm_fifo : - public virtual tlm_fifo_get_if, - public virtual tlm_fifo_put_if, - public sc_core::sc_prim_channel +class tlm_fifo : public virtual tlm_fifo_get_if, + public virtual tlm_fifo_put_if, public sc_core::sc_prim_channel { -public: - - // constructors - - explicit tlm_fifo( int size_ = 1 ) - : sc_core::sc_prim_channel( sc_core::sc_gen_unique_name( "fifo" ) ) { - - init( size_ ); - + public: + // Constructors. + explicit tlm_fifo(int size_=1) : + sc_core::sc_prim_channel(sc_core::sc_gen_unique_name("fifo")) + { + init(size_); } - explicit tlm_fifo( const char* name_, int size_ = 1 ) - : sc_core::sc_prim_channel( name_ ) { - - init( size_ ); - + explicit tlm_fifo(const char *name_, int size_=1) : + sc_core::sc_prim_channel(name_) + { + init(size_); } - // destructor - + // Destructor.. virtual ~tlm_fifo() {} - // tlm get interface - - T get( tlm_tag * = 0 ); + // Tlm get interface. + T get(tlm_tag * =nullptr); - bool nb_get( T& ); - bool nb_can_get( tlm_tag * = 0 ) const; - const sc_core::sc_event &ok_to_get( tlm_tag * = 0 ) const { - return m_data_written_event; + bool nb_get(T &); + bool nb_can_get(tlm_tag * =nullptr) const; + const sc_core::sc_event & + ok_to_get(tlm_tag * =nullptr) const + { + return m_data_written_event; } - // tlm peek interface + // Tlm peek interface. + T peek(tlm_tag * =nullptr) const; - T peek( tlm_tag * = 0 ) const; - - bool nb_peek( T& ) const; - bool nb_can_peek( tlm_tag * = 0 ) const; - const sc_core::sc_event &ok_to_peek( tlm_tag * = 0 ) const { - return m_data_written_event; + bool nb_peek(T &) const; + bool nb_can_peek(tlm_tag * =nullptr) const; + const sc_core::sc_event & + ok_to_peek(tlm_tag * =nullptr) const + { + return m_data_written_event; } - // tlm put interface - - void put( const T& ); - - bool nb_put( const T& ); - bool nb_can_put( tlm_tag * = 0 ) const; + // Tlm put interface. + void put(const T &); - const sc_core::sc_event& ok_to_put( tlm_tag * = 0 ) const { - return m_data_read_event; + bool nb_put(const T &); + bool nb_can_put(tlm_tag * =nullptr) const; + const sc_core::sc_event & + ok_to_put(tlm_tag * =nullptr) const + { + return m_data_read_event; } - // resize if - - void nb_expand( unsigned int n = 1 ); - void nb_unbound( unsigned int n = 16 ); - - bool nb_reduce( unsigned int n = 1 ); - bool nb_bound( unsigned int n ); - - // debug interface - - bool nb_peek( T & , int n ) const; - bool nb_poke( const T & , int n = 0 ); - - int used() const { - return m_num_readable - m_num_read; - } - - int size() const { - return m_size; + // Resize if. + void nb_expand(unsigned int n=1); + void nb_unbound(unsigned int n=16); + + bool nb_reduce(unsigned int n=1); + bool nb_bound(unsigned int n); + + // Debug interface. + bool nb_peek(T &, int n) const; + bool nb_poke(const T &, int n=0); + + int used() const { return m_num_readable - m_num_read; } + int size() const { return m_size; } + + void + debug() const + { + if (is_empty()) + std::cout << "empty" << std::endl; + if (is_full()) + std::cout << "full" << std::endl; + + std::cout << "size " << size() << " - " << used() << " used " + << std::endl; + std::cout << "readable " << m_num_readable << std::endl; + std::cout << "written/read " << m_num_written << "/" << m_num_read + << std::endl; } - void debug() const { - - if( is_empty() ) std::cout << "empty" << std::endl; - if( is_full() ) std::cout << "full" << std::endl; - - std::cout << "size " << size() << " - " << used() << " used " - << std::endl; - std::cout << "readable " << m_num_readable - << std::endl; - std::cout << "written/read " << m_num_written << "/" << m_num_read - << std::endl; + // Support functions. + static const char * const kind_string; + const char *kind() const { return kind_string; } + protected: + sc_core::sc_event & + read_event(tlm_tag * =nullptr) + { + return m_data_read_event; } - // support functions - - static const char* const kind_string; - - const char* kind() const - { return kind_string; } - - -protected: - sc_core::sc_event &read_event( tlm_tag * = 0 ) { - return m_data_read_event; - } - -protected: - void update(); - - // support methods - - void init( int ); - -protected: + void init(int); circular_buffer buffer; - int m_size; // logical size of fifo + int m_size; // logical size of fifo - int m_num_readable; // #samples readable - int m_num_read; // #samples read during this delta cycle - int m_num_written; // #samples written during this delta cycle - bool m_expand; // has an expand occurred during this delta cycle ? - int m_num_read_no_notify; // #samples read without notify during this delta cycle + int m_num_readable; // #samples readable + int m_num_read; // #samples read during this delta cycle + int m_num_written; // #samples written during this delta cycle + bool m_expand; // has an expand occurred during this delta cycle ? + // #samples read without notify during this delta cycle + int m_num_read_no_notify; sc_core::sc_event m_data_read_event; sc_core::sc_event m_data_written_event; -private: - + private: // disabled - tlm_fifo( const tlm_fifo& ); - tlm_fifo& operator = ( const tlm_fifo& ); + tlm_fifo(const tlm_fifo &); + tlm_fifo &operator = (const tlm_fifo &); // // use nb_can_get() and nb_can_put() rather than the following two // private functions // - bool is_empty() const { - return used() == 0; - } + bool is_empty() const { return used() == 0; } - bool is_full() const { - //return size() == m_num_readable + m_num_written; // Old buggy code - if( size() < 0 ) - return false; - else - return size() <= m_num_readable + m_num_written; + bool + is_full() const + { + if (size() < 0) + return false; + else + return size() <= m_num_readable + m_num_written; } - }; template -const char* const tlm_fifo::kind_string = "tlm_fifo"; - +const char *const tlm_fifo::kind_string = "tlm_fifo"; /****************************************************************** // @@ -206,43 +184,36 @@ const char* const tlm_fifo::kind_string = "tlm_fifo"; // ******************************************************************/ -template< typename T > -inline -void -tlm_fifo::init( int size_ ) { - - if( size_ > 0 ) { - buffer.resize( size_ ); - } - - else if( size_ < 0 ) { - buffer.resize( -size_ ); - } - - else { - buffer.resize( 16 ); - } - - m_size = size_; - m_num_readable = 0; - m_num_read = 0; - m_num_written = 0; - m_expand = false; - m_num_read_no_notify = false; +template +inline void +tlm_fifo::init(int size_) +{ + if (size_ > 0) { + buffer.resize( size_ ); + } else if (size_ < 0) { + buffer.resize(-size_); + } else { + buffer.resize(16); + } + m_size = size_; + m_num_readable = 0; + m_num_read = 0; + m_num_written = 0; + m_expand = false; + m_num_read_no_notify = false; } -template < typename T> -inline -void +template +inline void tlm_fifo::update() { - if( m_num_read > m_num_read_no_notify || m_expand ) { - m_data_read_event.notify( sc_core::SC_ZERO_TIME ); + if (m_num_read > m_num_read_no_notify || m_expand) { + m_data_read_event.notify(sc_core::SC_ZERO_TIME); } - if( m_num_written > 0 ) { - m_data_written_event.notify( sc_core::SC_ZERO_TIME ); + if (m_num_written > 0) { + m_data_written_event.notify(sc_core::SC_ZERO_TIME); } m_expand = false; @@ -250,7 +221,6 @@ tlm_fifo::update() m_num_written = 0; m_num_readable = buffer.used(); m_num_read_no_notify = 0; - } } // namespace tlm @@ -260,4 +230,4 @@ tlm_fifo::update() #include "tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_fifo/tlm_fifo_resize.h" #endif - +/*__SYSTEMC_EXT_TLM_CORE_TLM_1_TLM_REQ_RSP_TLM_CHANNELS_TLM_FIFO_TLM_FIFO_H__*/ diff --git a/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_fifo/tlm_fifo_peek.h b/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_fifo/tlm_fifo_peek.h index e856c5657..540f72de6 100644 --- a/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_fifo/tlm_fifo_peek.h +++ b/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_fifo/tlm_fifo_peek.h @@ -17,82 +17,74 @@ *****************************************************************************/ -#ifndef __TLM_FIFO_PEEK_H__ -#define __TLM_FIFO_PEEK_H__ +#ifndef \ + __TLM_CORE_TLM_1_TLM_REQ_RSP_TLM_CHANNELS_TLM_FIFO_TLM_FIFO_PEEK_H__ +#define \ + __TLM_CORE_TLM_1_TLM_REQ_RSP_TLM_CHANNELS_TLM_FIFO_TLM_FIFO_PEEK_H__ -namespace tlm { - -template < typename T> -inline -T -tlm_fifo::peek( tlm_tag * ) const { - - while( is_empty() ) { - - // call free-standing sc_core::wait(), - // since sc_prim_channel::wait(.) is not const - - sc_core::wait( m_data_written_event ); - } - - return buffer.read_data(); +namespace tlm +{ +template +inline T +tlm_fifo::peek(tlm_tag *) const +{ + while (is_empty()) { + // call free-standing sc_core::wait(), + // since sc_prim_channel::wait(.) is not const + sc_core::wait(m_data_written_event); + } + return buffer.read_data(); } -template < typename T> -inline -bool -tlm_fifo::nb_peek( T &t ) const { - - if( used() < 1 ) { - return false; - } - - t = buffer.peek_data( 0 ); - return true; +template +inline bool +tlm_fifo::nb_peek(T &t) const +{ + if (used() < 1) { + return false; + } + t = buffer.peek_data(0); + return true; } -template < typename T> -inline -bool -tlm_fifo::nb_peek( T &t , int n ) const { - - if( n >= used() || n < -1 ) { - return false; - } - - if( n == -1 ) { - n = used() - 1; - } +template +inline bool +tlm_fifo::nb_peek(T &t, int n) const +{ + if (n >= used() || n < -1) { + return false; + } - t = buffer.peek_data( n ); - return true; + if (n == -1) { + n = used() - 1; + } + t = buffer.peek_data(n); + return true; } -template< typename T > -inline -bool -tlm_fifo::nb_can_peek( tlm_tag * ) const +template +inline bool +tlm_fifo::nb_can_peek(tlm_tag *) const { - return !is_empty(); + return !is_empty(); } -template < typename T> -inline -bool -tlm_fifo::nb_poke( const T &t , int n ) { - - if( n >= used() || n < 0 ) { - return false; - } - - buffer.poke_data( n ) = t; - return true; +template +inline bool +tlm_fifo::nb_poke(const T &t, int n) +{ + if (n >= used() || n < 0) { + return false; + } + buffer.poke_data(n) = t; + return true; } } // namespace tlm #endif +/* __TLM_CORE_TLM_1_TLM_REQ_RSP_TLM_CHANNELS_TLM_FIFO_TLM_FIFO_PEEK_H__ */ diff --git a/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_fifo/tlm_fifo_put_get.h b/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_fifo/tlm_fifo_put_get.h index 2728e0394..a9a8ee3f4 100644 --- a/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_fifo/tlm_fifo_put_get.h +++ b/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_fifo/tlm_fifo_put_get.h @@ -17,124 +17,100 @@ *****************************************************************************/ -#ifndef __TLM_FIFO_PUT_GET_IF_H__ -#define __TLM_FIFO_PUT_GET_IF_H__ +#ifndef \ + __TLM_CORE_TLM_1_TLM_REQ_RSP_TLM_CHANNELS_TLM_FIFO_TLM_FIFO_PUT_GET_H__ +#define \ + __TLM_CORE_TLM_1_TLM_REQ_RSP_TLM_CHANNELS_TLM_FIFO_TLM_FIFO_PUT_GET_H__ -namespace tlm { - -/****************************************************************** -// -// get interface -// -******************************************************************/ +namespace tlm +{ +// Get interface. template -inline -T -tlm_fifo::get( tlm_tag * ) +inline T +tlm_fifo::get(tlm_tag *) { + while (is_empty()) { + wait(m_data_written_event); + } - while( is_empty() ) { - wait( m_data_written_event ); - } - - m_num_read ++; - request_update(); - - return buffer.read(); + m_num_read++; + request_update(); + return buffer.read(); } -// non-blocking read - +// Non-blocking read. template -inline -bool -tlm_fifo::nb_get( T& val_ ) +inline bool +tlm_fifo::nb_get(T &val_) { + if (is_empty()) { + return false; + } - if( is_empty() ) { - return false; - } - - m_num_read ++; - request_update(); - - val_ = buffer.read(); + m_num_read++; + request_update(); - return true; + val_ = buffer.read(); + return true; } template -inline -bool -tlm_fifo::nb_can_get( tlm_tag * ) const { - - return !is_empty(); - +inline bool +tlm_fifo::nb_can_get(tlm_tag *) const +{ + return !is_empty(); } -/****************************************************************** -// -// put interface -// -******************************************************************/ - +// Put interface. template -inline -void -tlm_fifo::put( const T& val_ ) +inline void +tlm_fifo::put(const T &val_) { - while( is_full() ) { - wait( m_data_read_event ); + while (is_full()) { + wait(m_data_read_event); } - if( buffer.is_full() ) { - - buffer.resize( buffer.size() * 2 ); - + if (buffer.is_full()) { + buffer.resize(buffer.size() * 2); } - m_num_written ++; - buffer.write( val_ ); + m_num_written++; + buffer.write(val_); request_update(); } template -inline -bool -tlm_fifo::nb_put( const T& val_ ) +inline bool +tlm_fifo::nb_put(const T &val_) { + if (is_full()) { + return false; + } - if( is_full() ) { - return false; - } - - if( buffer.is_full() ) { - - buffer.resize( buffer.size() * 2 ); - - } + if (buffer.is_full()) { + buffer.resize(buffer.size() * 2); + } - m_num_written ++; - buffer.write( val_ ); - request_update(); + m_num_written++; + buffer.write(val_); + request_update(); - return true; + return true; } -template < typename T > -inline -bool -tlm_fifo::nb_can_put( tlm_tag * ) const { - - return !is_full(); - +template +inline bool +tlm_fifo::nb_can_put(tlm_tag *) const +{ + return !is_full(); } } // namespace tlm #endif +/* __TLM_CORE_TLM_1_TLM_REQ_RSP_TLM_CHANNELS_TLM_FIFO_TLM_FIFO_PUT_GET_H__ */ diff --git a/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_fifo/tlm_fifo_resize.h b/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_fifo/tlm_fifo_resize.h index 39932fea1..79292fd78 100644 --- a/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_fifo/tlm_fifo_resize.h +++ b/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_fifo/tlm_fifo_resize.h @@ -17,77 +17,67 @@ *****************************************************************************/ -#ifndef __TLM_FIFO_RESIZE_H__ -#define __TLM_FIFO_RESIZE_H__ - -/****************************************************************** -// -// resize interface -// -******************************************************************/ - -namespace tlm { - -template < typename T> -inline -void -tlm_fifo::nb_expand( unsigned int n ) { - - if( m_size >= 0 ) { - m_expand = true; - m_size += n; - request_update(); - } +#ifndef \ + __TLM_CORE_TLM_1_TLM_REQ_RSP_TLM_CHANNELS_TLM_FIFO_TLM_FIFO_RESIZE_H__ +#define \ + __TLM_CORE_TLM_1_TLM_REQ_RSP_TLM_CHANNELS_TLM_FIFO_TLM_FIFO_RESIZE_H__ + +// Resize interface. +namespace tlm +{ + +template +inline void +tlm_fifo::nb_expand(unsigned int n) +{ + if (m_size >= 0) { + m_expand = true; + m_size += n; + request_update(); + } } -template < typename T> -inline -void -tlm_fifo::nb_unbound( unsigned int n ) { - - m_expand = true; - m_size = -n; - - if( buffer.size() < static_cast( n ) ) { - buffer.resize( n ); - } +template +inline void +tlm_fifo::nb_unbound(unsigned int n) +{ + m_expand = true; + m_size = -n; - request_update(); + if (buffer.size() < static_cast(n)) { + buffer.resize(n); + } + request_update(); } -template < typename T> -inline -bool -tlm_fifo::nb_reduce( unsigned int n ) { - - if( m_size < 0 ) { - return false; - } - - return nb_bound( size() - n ); +template +inline bool +tlm_fifo::nb_reduce(unsigned int n) +{ + if (m_size < 0) { + return false; + } + return nb_bound(size() - n); } -template < typename T> -inline -bool -tlm_fifo::nb_bound( unsigned int new_size ) { - - bool ret = true; - - if( static_cast( new_size ) < used() ) { - - new_size = used(); - ret = false; - - } +template +inline bool +tlm_fifo::nb_bound(unsigned int new_size) +{ + bool ret = true; - m_size = new_size; - return ret; + if (static_cast(new_size) < used()) { + new_size = used(); + ret = false; + } + m_size = new_size; + return ret; } } // namespace tlm #endif +/* __TLM_CORE_TLM_1_TLM_REQ_RSP_TLM_CHANNELS_TLM_FIFO_TLM_FIFO_RESIZE_H__ */ diff --git a/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_req_rsp_channels/tlm_put_get_imp.h b/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_req_rsp_channels/tlm_put_get_imp.h index 36dbd21d6..8335cc85c 100644 --- a/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_req_rsp_channels/tlm_put_get_imp.h +++ b/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_req_rsp_channels/tlm_put_get_imp.h @@ -17,98 +17,99 @@ *****************************************************************************/ -// -// To the LRM writer : these classes are purely artifacts of the implementation. -// - -#ifndef __TLM_PUT_GET_IMP_H__ -#define __TLM_PUT_GET_IMP_H__ +#ifndef \ + __TLM_1_TLM_REQ_RSP_TLM_CHANNELS_TLM_REQ_RSP_CHANNELS_TLM_PUT_GET_IMP_H__ +#define \ + __TLM_1_TLM_REQ_RSP_TLM_CHANNELS_TLM_REQ_RSP_CHANNELS_TLM_PUT_GET_IMP_H__ #include "tlm_core/tlm_1/tlm_req_rsp/tlm_1_interfaces/tlm_master_slave_ifs.h" -namespace tlm { - -template < typename PUT_DATA , typename GET_DATA> -class tlm_put_get_imp : - private virtual tlm_put_if< PUT_DATA > , - private virtual tlm_get_peek_if< GET_DATA > +namespace tlm { -public: - tlm_put_get_imp( tlm_put_if &p , - tlm_get_peek_if &g ) : - put_fifo( p ) , get_fifo( g ) {} - - // put interface - - void put( const PUT_DATA &t ) { put_fifo.put( t ); } - - bool nb_put( const PUT_DATA &t ) { return put_fifo.nb_put( t ); } - bool nb_can_put( tlm_tag *t = 0 ) const { - return put_fifo.nb_can_put( t ); - } - const sc_core::sc_event &ok_to_put( tlm_tag *t = 0 ) const { - return put_fifo.ok_to_put( t ); - } - - // get interface - - GET_DATA get( tlm_tag * = 0 ) { return get_fifo.get(); } - - bool nb_get( GET_DATA &t ) { return get_fifo.nb_get( t ); } - - bool nb_can_get( tlm_tag *t = 0 ) const { - return get_fifo.nb_can_get( t ); - } - - virtual const sc_core::sc_event &ok_to_get( tlm_tag *t = 0 ) const { - return get_fifo.ok_to_get( t ); - } - // peek interface - - GET_DATA peek( tlm_tag * = 0 ) const { return get_fifo.peek(); } - - bool nb_peek( GET_DATA &t ) const { return get_fifo.nb_peek( t ); } - - bool nb_can_peek( tlm_tag *t = 0 ) const { - return get_fifo.nb_can_peek( t ); - } - - virtual const sc_core::sc_event &ok_to_peek( tlm_tag *t = 0 ) const { - return get_fifo.ok_to_peek( t ); - } - -private: - tlm_put_if &put_fifo; - tlm_get_peek_if &get_fifo; +template +class tlm_put_get_imp : private virtual tlm_put_if, + private virtual tlm_get_peek_if +{ + public: + tlm_put_get_imp(tlm_put_if &p, tlm_get_peek_if &g) : + put_fifo(p), get_fifo(g) + {} + + // Put interface. + void put(const PUT_DATA &t) { put_fifo.put(t); } + bool nb_put(const PUT_DATA &t) { return put_fifo.nb_put(t); } + bool + nb_can_put(tlm_tag *t=nullptr) const + { + return put_fifo.nb_can_put(t); + } + const sc_core::sc_event & + ok_to_put(tlm_tag *t=nullptr) const + { + return put_fifo.ok_to_put(t); + } + + // Get interface. + GET_DATA get(tlm_tag * =nullptr) { return get_fifo.get(); } + bool nb_get(GET_DATA &t) { return get_fifo.nb_get(t); } + bool + nb_can_get(tlm_tag *t=nullptr) const + { + return get_fifo.nb_can_get(t); + } + + virtual const sc_core::sc_event & + ok_to_get(tlm_tag *t=nullptr) const + { + return get_fifo.ok_to_get(t); + } + + // Peek interface. + GET_DATA + peek(tlm_tag * =nullptr) const + { + return get_fifo.peek(); + } + bool nb_peek(GET_DATA &t) const { return get_fifo.nb_peek(t); } + bool + nb_can_peek(tlm_tag *t=nullptr) const + { + return get_fifo.nb_can_peek(t); + } + + virtual const sc_core::sc_event & + ok_to_peek(tlm_tag *t=nullptr) const + { + return get_fifo.ok_to_peek(t); + } + + private: + tlm_put_if &put_fifo; + tlm_get_peek_if &get_fifo; }; -template < typename REQ , typename RSP > -class tlm_master_imp : - private tlm_put_get_imp< REQ , RSP > , - public virtual tlm_master_if< REQ , RSP > +template +class tlm_master_imp : private tlm_put_get_imp, + public virtual tlm_master_if { -public: - - tlm_master_imp( tlm_put_if &req , - tlm_get_peek_if &rsp ) : - tlm_put_get_imp( req , rsp ) {} - + public: + tlm_master_imp(tlm_put_if &req, tlm_get_peek_if &rsp) : + tlm_put_get_imp(req, rsp) + {} }; -template < typename REQ , typename RSP > -class tlm_slave_imp : - private tlm_put_get_imp< RSP , REQ > , - public virtual tlm_slave_if< REQ , RSP > +template +class tlm_slave_imp : private tlm_put_get_imp, + public virtual tlm_slave_if { -public: - - tlm_slave_imp( tlm_get_peek_if &req , - tlm_put_if &rsp ) : - tlm_put_get_imp( rsp , req ) {} - + public: + tlm_slave_imp(tlm_get_peek_if &req, tlm_put_if &rsp) : + tlm_put_get_imp(rsp, req) + {} }; } // namespace tlm #endif +/* __TLM_1_TLM_REQ_RSP_TLM_CHANNELS_TLM_REQ_RSP_CHANNELS_TLM_PUT_GET_IMP_H__ */ diff --git a/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_req_rsp_channels/tlm_req_rsp_channels.h b/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_req_rsp_channels/tlm_req_rsp_channels.h index 7bd5652f7..1548e0852 100644 --- a/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_req_rsp_channels/tlm_req_rsp_channels.h +++ b/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_req_rsp_channels/tlm_req_rsp_channels.h @@ -17,139 +17,124 @@ *****************************************************************************/ -#ifndef __TLM_REQ_RSP_CHANNELS_H__ -#define __TLM_REQ_RSP_CHANNELS_H__ +#ifndef \ + __TLM_REQ_RSP_TLM_CHANNELS_TLM_REQ_RSP_CHANNELS_TLM_REQ_RSP_CHANNELS_H__ +#define \ + __TLM_REQ_RSP_TLM_CHANNELS_TLM_REQ_RSP_CHANNELS_TLM_REQ_RSP_CHANNELS_H__ #include "tlm_core/tlm_1/tlm_req_rsp/tlm_adapters/tlm_adapters.h" #include "tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_fifo/tlm_fifo.h" #include "tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_req_rsp_channels/tlm_put_get_imp.h" -namespace tlm { - -template < typename REQ , typename RSP , - typename REQ_CHANNEL = tlm_fifo , - typename RSP_CHANNEL = tlm_fifo > +namespace tlm +{ +template , + typename RSP_CHANNEL=tlm_fifo> class tlm_req_rsp_channel : public sc_core::sc_module { -public: - // uni-directional slave interface - - sc_core::sc_export< tlm_fifo_get_if< REQ > > get_request_export; - sc_core::sc_export< tlm_fifo_put_if< RSP > > put_response_export; - - // uni-directional master interface - - sc_core::sc_export< tlm_fifo_put_if< REQ > > put_request_export; - sc_core::sc_export< tlm_fifo_get_if< RSP > > get_response_export; - - // master / slave interfaces - - sc_core::sc_export< tlm_master_if< REQ , RSP > > master_export; - sc_core::sc_export< tlm_slave_if< REQ , RSP > > slave_export; - - - tlm_req_rsp_channel( int req_size = 1 , int rsp_size = 1 ) : - sc_core::sc_module( sc_core::sc_module_name( sc_core::sc_gen_unique_name("tlm_req_rsp_channel") ) ) , - request_fifo( req_size ) , - response_fifo( rsp_size ) , - master( request_fifo , response_fifo ) , - slave( request_fifo , response_fifo ) - { - - bind_exports(); - - } - - tlm_req_rsp_channel( sc_core::sc_module_name module_name , - int req_size = 1 , int rsp_size = 1 ) : - sc_core::sc_module( module_name ) , - request_fifo( req_size ) , - response_fifo( rsp_size ) , - master( request_fifo , response_fifo ) , - slave( request_fifo , response_fifo ) - { - - bind_exports(); - - } - -private: - void bind_exports() { - - put_request_export( request_fifo ); - get_request_export( request_fifo ); - - put_response_export( response_fifo ); - get_response_export( response_fifo ); - - master_export( master ); - slave_export( slave ); - - } - -protected: - REQ_CHANNEL request_fifo; - RSP_CHANNEL response_fifo; - - tlm_master_imp< REQ , RSP > master; - tlm_slave_imp< REQ , RSP > slave; + public: + // Uni-directional slave interface. + sc_core::sc_export> get_request_export; + sc_core::sc_export> put_response_export; + + // Uni-directional master interface. + sc_core::sc_export> put_request_export; + sc_core::sc_export> get_response_export; + + // Master/slave interfaces. + sc_core::sc_export> master_export; + sc_core::sc_export> slave_export; + + tlm_req_rsp_channel(int req_size=1, int rsp_size=1) : + sc_core::sc_module(sc_core::sc_module_name( + sc_core::sc_gen_unique_name("tlm_req_rsp_channel"))), + request_fifo(req_size), response_fifo(rsp_size), + master(request_fifo, response_fifo), + slave(request_fifo, response_fifo) + { + bind_exports(); + } + + tlm_req_rsp_channel(sc_core::sc_module_name module_name, + int req_size=1, int rsp_size=1) : + sc_core::sc_module(module_name), + request_fifo(req_size), response_fifo(rsp_size), + master(request_fifo, response_fifo), + slave(request_fifo, response_fifo) + { + bind_exports(); + } + + private: + void + bind_exports() + { + put_request_export(request_fifo); + get_request_export(request_fifo); + + put_response_export(response_fifo); + get_response_export(response_fifo); + + master_export(master); + slave_export(slave); + } + + protected: + REQ_CHANNEL request_fifo; + RSP_CHANNEL response_fifo; + + tlm_master_imp master; + tlm_slave_imp slave; }; -template < typename REQ , typename RSP , - typename REQ_CHANNEL = tlm_fifo , - typename RSP_CHANNEL = tlm_fifo > +template , + typename RSP_CHANNEL=tlm_fifo> class tlm_transport_channel : public sc_core::sc_module { -public: - - // master transport interface - - sc_core::sc_export< tlm_transport_if< REQ , RSP > > target_export; - - // slave interfaces - - sc_core::sc_export< tlm_fifo_get_if< REQ > > get_request_export; - sc_core::sc_export< tlm_fifo_put_if< RSP > > put_response_export; - - sc_core::sc_export< tlm_slave_if< REQ , RSP > > slave_export; - - tlm_transport_channel() : - sc_core::sc_module( sc_core::sc_module_name( sc_core::sc_gen_unique_name("transport_channel" ) ) ) , - target_export("target_export") , - req_rsp( "req_rsp" , 1 , 1 ) , - t2m("ts2m") - { - do_binding(); - } - - tlm_transport_channel( sc_core::sc_module_name nm ) : - sc_core::sc_module( nm ) , - target_export("target_export") , - req_rsp( "req_rsp" , 1 , 1 ) , - t2m("tsm" ) - { - do_binding(); - } - -private: - void do_binding() { - - target_export( t2m.target_export ); - - t2m.master_port( req_rsp.master_export ); - - get_request_export( req_rsp.get_request_export ); - put_response_export( req_rsp.put_response_export ); - slave_export( req_rsp.slave_export ); - - } - - tlm_req_rsp_channel< REQ , RSP , REQ_CHANNEL , RSP_CHANNEL > req_rsp; - tlm_transport_to_master< REQ , RSP > t2m; - + public: + // Master transport interface. + sc_core::sc_export> target_export; + + // Slave interfaces. + sc_core::sc_export> get_request_export; + sc_core::sc_export> put_response_export; + + sc_core::sc_export> slave_export; + + tlm_transport_channel() : + sc_core::sc_module(sc_core::sc_module_name( + sc_core::sc_gen_unique_name("transport_channel"))), + target_export("target_export"), req_rsp("req_rsp", 1, 1), t2m("ts2m") + { + do_binding(); + } + + tlm_transport_channel(sc_core::sc_module_name nm) : + sc_core::sc_module(nm), target_export("target_export"), + req_rsp("req_rsp", 1, 1), t2m("tsm") + { + do_binding(); + } + + private: + void + do_binding() + { + target_export(t2m.target_export); + t2m.master_port(req_rsp.master_export); + + get_request_export(req_rsp.get_request_export); + put_response_export(req_rsp.put_response_export); + slave_export(req_rsp.slave_export); + } + + tlm_req_rsp_channel req_rsp; + tlm_transport_to_master t2m; }; } // namespace tlm #endif +/* __TLM_REQ_RSP_TLM_CHANNELS_TLM_REQ_RSP_CHANNELS_TLM_REQ_RSP_CHANNELS_H__ */ diff --git a/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_ports/tlm_event_finder.h b/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_ports/tlm_event_finder.h index 4ca042857..75d7ffdde 100644 --- a/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_ports/tlm_event_finder.h +++ b/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_ports/tlm_event_finder.h @@ -17,60 +17,53 @@ *****************************************************************************/ -#ifndef TLM_CORE_TLM_EVENT_FINDER_H_INCLUDED_ -#define TLM_CORE_TLM_EVENT_FINDER_H_INCLUDED_ +#ifndef __SYSTEMC_EXT_TLM_CORE_TLM_1_TLM_REQ_RSP_TLM_PORTS_TLM_EVENT_FINDER_H__ +#define __SYSTEMC_EXT_TLM_CORE_TLM_1_TLM_REQ_RSP_TLM_PORTS_TLM_EVENT_FINDER_H__ #include "tlm_core/tlm_1/tlm_req_rsp/tlm_1_interfaces/tlm_tag.h" -namespace tlm { - -template -class tlm_event_finder_t - : public sc_core::sc_event_finder +namespace tlm { -public: - - // constructor - - tlm_event_finder_t( const sc_core::sc_port_base& port_, - const sc_core::sc_event& (IF::*event_method_) ( tlm_tag * ) const ) - : sc_core::sc_event_finder( port_ ), m_event_method( event_method_ ) - {} - - // destructor (does nothing) - virtual ~tlm_event_finder_t() - {} - - virtual const sc_core::sc_event& find_event( sc_core::sc_interface* if_p = 0 ) const; +template +class tlm_event_finder_t : public sc_core::sc_event_finder +{ + public: + tlm_event_finder_t(const sc_core::sc_port_base &port_, + const sc_core::sc_event &(IF::*event_method_)( + tlm_tag *) const) : + sc_core::sc_event_finder(port_), m_event_method(event_method_) + {} -private: + virtual ~tlm_event_finder_t() {} - const sc_core::sc_event& (IF::*m_event_method) ( tlm_tag * ) const; + virtual const sc_core::sc_event & + find_event(sc_core::sc_interface *if_p=nullptr) const; -private: + private: + const sc_core::sc_event &(IF::*m_event_method)(tlm_tag *) const; + private: // disabled tlm_event_finder_t(); - tlm_event_finder_t( const tlm_event_finder_t& ); - tlm_event_finder_t& operator = ( const tlm_event_finder_t& ); + tlm_event_finder_t(const tlm_event_finder_t &); + tlm_event_finder_t &operator = (const tlm_event_finder_t &); }; - -template -inline -const sc_core::sc_event& -tlm_event_finder_t::find_event( sc_core::sc_interface* if_p ) const +template +inline const sc_core::sc_event & +tlm_event_finder_t::find_event(sc_core::sc_interface *if_p) const { - const IF* iface = ( if_p ) ? dynamic_cast( if_p ) : - dynamic_cast( port().get_interface() ); - if( iface == 0 ) { - report_error( sc_core::SC_ID_FIND_EVENT_, "port is not bound" ); + const IF *iface = if_p ? dynamic_cast(if_p) : + dynamic_cast(port().get_interface()); + if (iface == nullptr) { + report_error(sc_core::SC_ID_FIND_EVENT_, "port is not bound"); return sc_core::sc_event::none; } - return (const_cast( iface )->*m_event_method) ( 0 ); + return (const_cast(iface)->*m_event_method)(nullptr); } } // namespace tlm -#endif // TLM_CORE_TLM_EVENT_FINDER_H_INCLUDED_ +// __SYSTEMC_EXT_TLM_CORE_TLM_1_TLM_REQ_RSP_TLM_PORTS_TLM_EVENT_FINDER_H__ +#endif diff --git a/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_ports/tlm_nonblocking_port.h b/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_ports/tlm_nonblocking_port.h index 0af1e3487..370b2cae0 100644 --- a/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_ports/tlm_nonblocking_port.h +++ b/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_ports/tlm_nonblocking_port.h @@ -17,75 +17,75 @@ *****************************************************************************/ -#ifndef __TLM_NONBLOCKING_PORT_H__ -#define __TLM_NONBLOCKING_PORT_H__ +#ifndef \ + __SYSTEMC_EXT_TLM_CORE_TLM_1_TLM_REQ_RSP_TLM_PORTS_TLM_NONBLOCKING_PORT_H__ +#define \ + __SYSTEMC_EXT_TLM_CORE_TLM_1_TLM_REQ_RSP_TLM_PORTS_TLM_NONBLOCKING_PORT_H__ #include "tlm_core/tlm_1/tlm_req_rsp/tlm_1_interfaces/tlm_core_ifs.h" #include "tlm_core/tlm_1/tlm_req_rsp/tlm_ports/tlm_event_finder.h" -namespace tlm { +namespace tlm +{ -template < typename T > +template class tlm_nonblocking_get_port : -public sc_core::sc_port< tlm_nonblocking_get_if< T > , 1 > + public sc_core::sc_port, 1> { -public: - typedef tlm_nonblocking_get_if get_if_type; - - tlm_nonblocking_get_port( const char *port_name ) : - sc_core::sc_port< tlm_nonblocking_get_if< T > , 1 >( port_name ) {} - - sc_core::sc_event_finder& ok_to_get() const { - - return *new tlm_event_finder_t< get_if_type , T >( - *this, - &get_if_type::ok_to_get ); - - } - + public: + typedef tlm_nonblocking_get_if get_if_type; + + tlm_nonblocking_get_port(const char *port_name) : + sc_core::sc_port, 1>(port_name) + {} + + sc_core::sc_event_finder & + ok_to_get() const + { + return *new tlm_event_finder_t( + *this, &get_if_type::ok_to_get); + } }; -template < typename T > +template class tlm_nonblocking_peek_port : -public sc_core::sc_port< tlm_nonblocking_peek_if< T > , 1 > + public sc_core::sc_port, 1> { -public: - typedef tlm_nonblocking_peek_if peek_if_type; - - tlm_nonblocking_peek_port( const char *port_name ) : - sc_core::sc_port< tlm_nonblocking_peek_if< T > , 1 >( port_name ) {} - - sc_core::sc_event_finder& ok_to_peek() const { - - return *new tlm_event_finder_t< peek_if_type , T >( - *this, - &peek_if_type::ok_to_peek ); - - } - + public: + typedef tlm_nonblocking_peek_if peek_if_type; + + tlm_nonblocking_peek_port(const char *port_name) : + sc_core::sc_port, 1>(port_name) + {} + + sc_core::sc_event_finder & + ok_to_peek() const + { + return *new tlm_event_finder_t( + *this, &peek_if_type::ok_to_peek); + } }; - -template < typename T > +template class tlm_nonblocking_put_port : -public sc_core::sc_port< tlm_nonblocking_put_if< T > , 1 > + public sc_core::sc_port, 1> { -public: - typedef tlm_nonblocking_put_if put_if_type; - - tlm_nonblocking_put_port( const char *port_name ) : - sc_core::sc_port< tlm_nonblocking_put_if< T > , 1 >( port_name ) {} - - sc_core::sc_event_finder& ok_to_put() const { - - return *new tlm_event_finder_t< put_if_type , T >( - *this, - &put_if_type::ok_to_put ); - - } - + public: + typedef tlm_nonblocking_put_if put_if_type; + + tlm_nonblocking_put_port(const char *port_name) : + sc_core::sc_port, 1>(port_name) + {} + + sc_core::sc_event_finder & + ok_to_put() const + { + return *new tlm_event_finder_t( + *this, &put_if_type::ok_to_put); + } }; } // namespace tlm #endif +/*__SYSTEMC_EXT_TLM_CORE_TLM_1_TLM_REQ_RSP_TLM_PORTS_TLM_NONBLOCKING_PORT_H__*/ diff --git a/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_req_rsp.h b/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_req_rsp.h index 88f1d0e8c..0d4d0b966 100644 --- a/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_req_rsp.h +++ b/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_req_rsp.h @@ -17,21 +17,21 @@ *****************************************************************************/ -#ifndef __TLM_REQ_RSP_H__ -#define __TLM_REQ_RSP_H__ +#ifndef __SYsTEMC_EXT_TLM_CORE_TLM_1_TLM_REQ_RSP_TLM_REQ_RSP_H__ +#define __SYsTEMC_EXT_TLM_CORE_TLM_1_TLM_REQ_RSP_TLM_REQ_RSP_H__ -// The unannotated TLM interfaces +// The unannotated TLM interfaces. #include "tlm_core/tlm_1/tlm_req_rsp/tlm_1_interfaces/tlm_core_ifs.h" #include "tlm_core/tlm_1/tlm_req_rsp/tlm_1_interfaces/tlm_master_slave_ifs.h" -// The channels : tlm_fifo, tlm_transport_channel and tlm_req_rsp_channel +// The channels : tlm_fifo, tlm_transport_channel and tlm_req_rsp_channel. #include "tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_req_rsp_channels/tlm_req_rsp_channels.h" -// Some non blocking ports to provide static sensitivity +// Some non blocking ports to provide static sensitivity. #include "tlm_core/tlm_1/tlm_req_rsp/tlm_ports/tlm_nonblocking_port.h" -#endif /* __TLM_REQ_RSP_H__ */ +#endif /*__SYsTEMC_EXT_TLM_CORE_TLM_1_TLM_REQ_RSP_TLM_REQ_RSP_H__ */ diff --git a/src/systemc/ext/tlm_core/tlm_2/tlm_2_interfaces/tlm_2_interfaces.h b/src/systemc/ext/tlm_core/tlm_2/tlm_2_interfaces/tlm_2_interfaces.h index 8a0c543c8..386f7cb75 100644 --- a/src/systemc/ext/tlm_core/tlm_2/tlm_2_interfaces/tlm_2_interfaces.h +++ b/src/systemc/ext/tlm_core/tlm_2/tlm_2_interfaces/tlm_2_interfaces.h @@ -17,11 +17,10 @@ *****************************************************************************/ -#ifndef __TLM_2_INTERFACES_H__ -#define __TLM_2_INTERFACES_H__ +#ifndef __SYSTEMC_EXT_TLM_CORE_TLM_2_INTERFACES_TLM_2_INTERFACES_H__ +#define __SYSTEMC_EXT_TLM_CORE_TLM_2_INTERFACES_TLM_2_INTERFACES_H__ #include "tlm_core/tlm_2/tlm_2_interfaces/tlm_dmi.h" #include "tlm_core/tlm_2/tlm_2_interfaces/tlm_fw_bw_ifs.h" -#endif - +#endif /* __SYSTEMC_EXT_TLM_CORE_TLM_2_INTERFACES_TLM_2_INTERFACES_H__ */ diff --git a/src/systemc/ext/tlm_core/tlm_2/tlm_2_interfaces/tlm_dmi.h b/src/systemc/ext/tlm_core/tlm_2/tlm_2_interfaces/tlm_dmi.h index d7c3304eb..573744d28 100644 --- a/src/systemc/ext/tlm_core/tlm_2/tlm_2_interfaces/tlm_dmi.h +++ b/src/systemc/ext/tlm_core/tlm_2/tlm_2_interfaces/tlm_dmi.h @@ -17,98 +17,108 @@ *****************************************************************************/ -#ifndef __TLM_DMI_H__ -#define __TLM_DMI_H__ +#ifndef __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_2_INTERFACES_TLM_DMI_H__ +#define __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_2_INTERFACES_TLM_DMI_H__ #include -namespace tlm { +namespace tlm +{ class tlm_dmi { public: - - // Enum for indicating the access granted to the initiator. - // The initiator uses gp.m_command to indicate it intention (read/write) - // The target is allowed to promote DMI_ACCESS_READ or DMI_ACCESS_WRITE - // requests to dmi_access_read_write. - - enum dmi_access_e - { DMI_ACCESS_NONE = 0x00 // no access - , DMI_ACCESS_READ = 0x01 // read access - , DMI_ACCESS_WRITE = 0x02 // write access - , DMI_ACCESS_READ_WRITE = DMI_ACCESS_READ | DMI_ACCESS_WRITE // read/write access - }; - - tlm_dmi (void) - { - init(); - } - - void init (void) - { - m_dmi_ptr = 0x0; - m_dmi_start_address = 0x0; - m_dmi_end_address = (sc_dt::uint64)(-1); - m_dmi_access = DMI_ACCESS_NONE; - m_dmi_read_latency = sc_core::SC_ZERO_TIME; - m_dmi_write_latency = sc_core::SC_ZERO_TIME; - } - - unsigned char* get_dmi_ptr (void) const {return m_dmi_ptr;} - sc_dt::uint64 get_start_address (void) const {return m_dmi_start_address;} - sc_dt::uint64 get_end_address (void) const {return m_dmi_end_address;} - sc_core::sc_time get_read_latency (void) const {return m_dmi_read_latency;} - sc_core::sc_time get_write_latency (void) const {return m_dmi_write_latency;} - dmi_access_e get_granted_access (void) const {return m_dmi_access;} - bool is_none_allowed (void) const {return m_dmi_access == DMI_ACCESS_NONE;} - bool is_read_allowed (void) const {return (m_dmi_access & DMI_ACCESS_READ) == DMI_ACCESS_READ;} - bool is_write_allowed (void) const {return (m_dmi_access & DMI_ACCESS_WRITE) == DMI_ACCESS_WRITE;} - bool is_read_write_allowed (void) const {return (m_dmi_access & DMI_ACCESS_READ_WRITE) == DMI_ACCESS_READ_WRITE;} - - void set_dmi_ptr (unsigned char* p) {m_dmi_ptr = p;} - void set_start_address (sc_dt::uint64 addr) {m_dmi_start_address = addr;} - void set_end_address (sc_dt::uint64 addr) {m_dmi_end_address = addr;} - void set_read_latency (sc_core::sc_time t) {m_dmi_read_latency = t;} - void set_write_latency (sc_core::sc_time t) {m_dmi_write_latency = t;} - void set_granted_access (dmi_access_e a) {m_dmi_access = a;} - void allow_none (void) {m_dmi_access = DMI_ACCESS_NONE;} - void allow_read (void) {m_dmi_access = DMI_ACCESS_READ;} - void allow_write (void) {m_dmi_access = DMI_ACCESS_WRITE;} - void allow_read_write (void) {m_dmi_access = DMI_ACCESS_READ_WRITE;} + // Enum for indicating the access granted to the initiator. + // The initiator uses gp.m_command to indicate it intention (read/write) + // The target is allowed to promote DMI_ACCESS_READ or DMI_ACCESS_WRITE + // requests to dmi_access_read_write. + + enum dmi_access_e { + DMI_ACCESS_NONE = 0x00, // no access + DMI_ACCESS_READ = 0x01, // read access + DMI_ACCESS_WRITE = 0x02, // write access + DMI_ACCESS_READ_WRITE = DMI_ACCESS_READ | DMI_ACCESS_WRITE + // read/write access + }; + + tlm_dmi() { init(); } + + void + init() + { + m_dmi_ptr = nullptr; + m_dmi_start_address = 0x0; + m_dmi_end_address = (sc_dt::uint64)(-1); + m_dmi_access = DMI_ACCESS_NONE; + m_dmi_read_latency = sc_core::SC_ZERO_TIME; + m_dmi_write_latency = sc_core::SC_ZERO_TIME; + } + + unsigned char *get_dmi_ptr() const { return m_dmi_ptr; } + sc_dt::uint64 get_start_address() const { return m_dmi_start_address; } + sc_dt::uint64 get_end_address() const { return m_dmi_end_address; } + sc_core::sc_time get_read_latency() const { return m_dmi_read_latency; } + sc_core::sc_time get_write_latency() const { return m_dmi_write_latency; } + dmi_access_e get_granted_access() const { return m_dmi_access; } + bool is_none_allowed() const { return m_dmi_access == DMI_ACCESS_NONE; } + bool + is_read_allowed() const + { + return (m_dmi_access & DMI_ACCESS_READ) == DMI_ACCESS_READ; + } + bool + is_write_allowed() const + { + return (m_dmi_access & DMI_ACCESS_WRITE) == DMI_ACCESS_WRITE; + } + bool + is_read_write_allowed() const + { + return (m_dmi_access & DMI_ACCESS_READ_WRITE) == DMI_ACCESS_READ_WRITE; + } + + void set_dmi_ptr(unsigned char *p) { m_dmi_ptr = p; } + void set_start_address(sc_dt::uint64 addr) { m_dmi_start_address = addr; } + void set_end_address(sc_dt::uint64 addr) { m_dmi_end_address = addr; } + void set_read_latency(sc_core::sc_time t) { m_dmi_read_latency = t; } + void set_write_latency(sc_core::sc_time t) { m_dmi_write_latency = t; } + void set_granted_access(dmi_access_e a) { m_dmi_access = a; } + void allow_none() { m_dmi_access = DMI_ACCESS_NONE; } + void allow_read() { m_dmi_access = DMI_ACCESS_READ; } + void allow_write() { m_dmi_access = DMI_ACCESS_WRITE; } + void allow_read_write() { m_dmi_access = DMI_ACCESS_READ_WRITE; } private: + // If the forward call is successful, the target returns the dmi_ptr, + // which must point to the data element corresponding to the + // dmi_start_address. The data is organized as a byte array with the + // endianness of the target (endianness member of the tlm_dmi struct). + + unsigned char *m_dmi_ptr; + + // The absolute start and end addresses of the DMI region. If the decoder + // logic in the interconnect changes the address field e.g. by masking, the + // interconnect is responsible to transform the relative address back to an + // absolute address again. + + sc_dt::uint64 m_dmi_start_address; + sc_dt::uint64 m_dmi_end_address; + + // Granted access + + dmi_access_e m_dmi_access; + + // These members define the latency of read/write transactions. The + // initiator must initialize these members to zero before requesting a + // dmi pointer, because both the interconnect as well as the target can + // add to the total transaction latency. + // Depending on the 'type' attribute only one, or both of these attributes + // will be valid. - // If the forward call is successful, the target returns the dmi_ptr, - // which must point to the data element corresponding to the - // dmi_start_address. The data is organized as a byte array with the - // endianness of the target (endianness member of the tlm_dmi struct). - - unsigned char* m_dmi_ptr; - - // The absolute start and end addresses of the DMI region. If the decoder - // logic in the interconnect changes the address field e.g. by masking, the - // interconnect is responsible to transform the relative address back to an - // absolute address again. - - sc_dt::uint64 m_dmi_start_address; - sc_dt::uint64 m_dmi_end_address; - - // Granted access - - dmi_access_e m_dmi_access; - - // These members define the latency of read/write transactions. The - // initiator must initialize these members to zero before requesting a - // dmi pointer, because both the interconnect as well as the target can - // add to the total transaction latency. - // Depending on the 'type' attribute only one, or both of these attributes - // will be valid. - - sc_core::sc_time m_dmi_read_latency; - sc_core::sc_time m_dmi_write_latency; + sc_core::sc_time m_dmi_read_latency; + sc_core::sc_time m_dmi_write_latency; }; } // namespace tlm -#endif /* TLM_DMI_HEADER */ +#endif /* __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_2_INTERFACES_TLM_DMI_H__ */ diff --git a/src/systemc/ext/tlm_core/tlm_2/tlm_2_interfaces/tlm_fw_bw_ifs.h b/src/systemc/ext/tlm_core/tlm_2/tlm_2_interfaces/tlm_fw_bw_ifs.h index 59e81c658..3c21ca01e 100644 --- a/src/systemc/ext/tlm_core/tlm_2/tlm_2_interfaces/tlm_fw_bw_ifs.h +++ b/src/systemc/ext/tlm_core/tlm_2/tlm_2_interfaces/tlm_fw_bw_ifs.h @@ -17,43 +17,43 @@ *****************************************************************************/ -#ifndef __TLM_FW_BW_IFS_H__ -#define __TLM_FW_BW_IFS_H__ +#ifndef __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_2_INTERFACES_TLM_FW_BW_IFS_H__ +#define __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_2_INTERFACES_TLM_FW_BW_IFS_H__ #include -#include "tlm_core/tlm_2/tlm_generic_payload/tlm_generic_payload.h" + #include "tlm_core/tlm_2/tlm_2_interfaces/tlm_dmi.h" +#include "tlm_core/tlm_2/tlm_generic_payload/tlm_generic_payload.h" -namespace tlm { +namespace tlm +{ enum tlm_sync_enum { TLM_ACCEPTED, TLM_UPDATED, TLM_COMPLETED }; //////////////////////////////////////////////////////////////////////////// // Basic interfaces //////////////////////////////////////////////////////////////////////////// -template -class tlm_fw_nonblocking_transport_if : public virtual sc_core::sc_interface { -public: - virtual tlm_sync_enum nb_transport_fw(TRANS& trans, - PHASE& phase, - sc_core::sc_time& t) = 0; +template +class tlm_fw_nonblocking_transport_if : public virtual sc_core::sc_interface +{ + public: + virtual tlm_sync_enum nb_transport_fw(TRANS &trans, PHASE &phase, + sc_core::sc_time& t) = 0; }; -template -class tlm_bw_nonblocking_transport_if : public virtual sc_core::sc_interface { -public: - virtual tlm_sync_enum nb_transport_bw(TRANS& trans, - PHASE& phase, - sc_core::sc_time& t) = 0; +template +class tlm_bw_nonblocking_transport_if : public virtual sc_core::sc_interface +{ + public: + virtual tlm_sync_enum nb_transport_bw(TRANS &trans, PHASE &phase, + sc_core::sc_time &t) = 0; }; -template -class tlm_blocking_transport_if : public virtual sc_core::sc_interface { -public: - virtual void b_transport(TRANS& trans, - sc_core::sc_time& t) = 0; +template +class tlm_blocking_transport_if : public virtual sc_core::sc_interface +{ + public: + virtual void b_transport(TRANS &trans, sc_core::sc_time &t) = 0; }; ////////////////////////////////////////////////////////////////////////// @@ -115,12 +115,11 @@ public: // required to set the DMI hint to true if a DMI request on the given address // with the given transaction type (read or write) would have succeeded. -template +template class tlm_fw_direct_mem_if : public virtual sc_core::sc_interface { -public: - virtual bool get_direct_mem_ptr(TRANS& trans, - tlm_dmi& dmi_data) = 0; + public: + virtual bool get_direct_mem_ptr(TRANS &trans, tlm_dmi &dmi_data) = 0; }; // The semantics of the backwards call is as follows: @@ -152,9 +151,9 @@ public: // class tlm_bw_direct_mem_if : public virtual sc_core::sc_interface { -public: - virtual void invalidate_direct_mem_ptr(sc_dt::uint64 start_range, - sc_dt::uint64 end_range) = 0; + public: + virtual void invalidate_direct_mem_ptr(sc_dt::uint64 start_range, + sc_dt::uint64 end_range) = 0; }; ///////////////////////////////////////////////////////////////////// @@ -181,13 +180,13 @@ public: // this number must be <= num_bytes. Thus, a target can safely return 0 if it // does not support debug transactions. // -template +template class tlm_transport_dbg_if : public virtual sc_core::sc_interface { -public: - // The return value of defines the number of bytes successfully - // transferred. - virtual unsigned int transport_dbg(TRANS& trans) = 0; + public: + // The return value of defines the number of bytes successfully + // transferred. + virtual unsigned int transport_dbg(TRANS &trans) = 0; }; //////////////////////////////////////////////////////////////////////////// @@ -196,28 +195,28 @@ public: struct tlm_base_protocol_types { - typedef tlm_generic_payload tlm_payload_type; - typedef tlm_phase tlm_phase_type; + typedef tlm_generic_payload tlm_payload_type; + typedef tlm_phase tlm_phase_type; }; // The forward interface: -template -class tlm_fw_transport_if - : public virtual tlm_fw_nonblocking_transport_if - , public virtual tlm_blocking_transport_if - , public virtual tlm_fw_direct_mem_if - , public virtual tlm_transport_dbg_if +template +class tlm_fw_transport_if : + public virtual tlm_fw_nonblocking_transport_if< + typename TYPES::tlm_payload_type, typename TYPES::tlm_phase_type>, + public virtual tlm_blocking_transport_if, + public virtual tlm_fw_direct_mem_if, + public virtual tlm_transport_dbg_if {}; // The backward interface: -template -class tlm_bw_transport_if - : public virtual tlm_bw_nonblocking_transport_if - , public virtual tlm_bw_direct_mem_if +template +class tlm_bw_transport_if : + public virtual tlm_bw_nonblocking_transport_if< + typename TYPES::tlm_payload_type, typename TYPES::tlm_phase_type>, + public virtual tlm_bw_direct_mem_if {}; } // namespace tlm -#endif /* __TLM_FW_BW_IFS_H__ */ +#endif /* __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_2_INTERFACES_TLM_FW_BW_IFS_H__ */ diff --git a/src/systemc/ext/tlm_core/tlm_2/tlm_generic_payload/tlm_array.h b/src/systemc/ext/tlm_core/tlm_2/tlm_generic_payload/tlm_array.h index 1a49b0895..9890a2a2c 100644 --- a/src/systemc/ext/tlm_core/tlm_2/tlm_generic_payload/tlm_array.h +++ b/src/systemc/ext/tlm_core/tlm_2/tlm_generic_payload/tlm_array.h @@ -17,23 +17,13 @@ *****************************************************************************/ -#ifndef TLM_CORE_TLM2_TLM_ARRAY_H_INCLUDED_ -#define TLM_CORE_TLM2_TLM_ARRAY_H_INCLUDED_ +#ifndef __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_GENERIC_PAYLOADS_TLM_ARRAY_H__ +#define __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_GENERIC_PAYLOADS_TLM_ARRAY_H__ #include -#if defined(_MSC_VER) && !defined(SC_WIN_DLL_WARN) -#pragma warning(push) -#pragma warning(disable: 4251) // DLL import for std::string,vector -#endif - -namespace tlm { - -// -// To the LRM writer: the below class is an artifact of the tlm_generic_payload -// implementation and not part of the core TLM standard -// - +namespace tlm +{ // This implements a lean and fast array class that supports array expansion on // request. The class is primarily used in the tlm_generic_payload class for @@ -48,79 +38,61 @@ namespace tlm { // may invalidate all direct pointers into the array. -//the tlm_array shall always be used with T=tlm_extension_base* +// The tlm_array shall always be used with T=tlm_extension_base*. template -class tlm_array - : private std::vector +class tlm_array : private std::vector { - typedef std::vector base_type; + private: + typedef std::vector base_type; typedef typename base_type::size_type size_type; -public: - - // constructor: - tlm_array(size_type size = 0) - : base_type(size) - , m_entries() - { - //m_entries.reserve(size); // optional - } - // copy constructor: - // tlm_array(const tlm_array& orig) = default; + public: + tlm_array(size_type size=0) : base_type(size), m_entries() {} - // destructor: - // ~tlm_array() = default; + // Operators for dereferencing: + using base_type::operator []; - // operators for dereferencing: - using base_type::operator[]; - - // array size: + // Array size: using base_type::size; - // expand the array if needed: - void expand(size_type new_size) + // Expand the array if needed: + void + expand(size_type new_size) { if (new_size > size()) - { base_type::resize(new_size); - //m_entries.reserve(new_size); // optional - } } - static const char* const kind_string; - const char* kind() const { return kind_string; } + static const char *const kind_string; + const char *kind() const { return kind_string; } - //this function shall get a pointer to a array slot + // This function shall get a pointer to an array slot // it stores this slot in a cache of active slots - void insert_in_cache(T* p) - { - //sc_assert( (p-&(*this)[0]) < size() ); - m_entries.push_back( p-&(*this)[0] ); - } + void insert_in_cache(T *p) { m_entries.push_back(p - &(*this)[0]); } - //this functions clears all active slots of the array - void free_entire_cache() + // This functions clears all active slots of the array. + void + free_entire_cache() { - while(m_entries.size()) - { - if ((*this)[m_entries.back()]) //we make sure no one cleared the slot manually - (*this)[m_entries.back()]->free();//...and then we call free on the content of the slot - (*this)[m_entries.back()]=0; //afterwards we set the slot to NULL + while (m_entries.size()) { + // We make sure no one cleared the slot manually. + if ((*this)[m_entries.back()]) { + // ...and then we call free on the content of the slot + (*this)[m_entries.back()]->free(); + } + // Afterwards we set the slot to NULL + (*this)[m_entries.back()] = nullptr; m_entries.pop_back(); } } -protected: + protected: std::vector m_entries; }; template -const char* const tlm_array::kind_string = "tlm_array"; - -#if defined(_MSC_VER) && !defined(SC_WIN_DLL_WARN) -#pragma warning(pop) -#endif +const char *const tlm_array::kind_string = "tlm_array"; } // namespace tlm -#endif /* TLM_CORE_TLM2_TLM_ARRAY_H_INCLUDED_ */ +#endif /* __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_GENERIC_PAYLOADS_TLM_ARRAY_H__ */ diff --git a/src/systemc/ext/tlm_core/tlm_2/tlm_generic_payload/tlm_endian_conv.h b/src/systemc/ext/tlm_core/tlm_2/tlm_generic_payload/tlm_endian_conv.h index cf17a1ffb..7eb86fa68 100644 --- a/src/systemc/ext/tlm_core/tlm_2/tlm_generic_payload/tlm_endian_conv.h +++ b/src/systemc/ext/tlm_core/tlm_2/tlm_generic_payload/tlm_endian_conv.h @@ -18,14 +18,15 @@ *****************************************************************************/ -#ifndef __TLM_ENDIAN_CONV_H__ -#define __TLM_ENDIAN_CONV_H__ +#ifndef __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_GENERIC_PAYLOAD_TLM_ENDIAN_CONV_H__ +#define __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_GENERIC_PAYLOAD_TLM_ENDIAN_CONV_H__ #include "tlm_core/tlm_2/tlm_generic_payload/tlm_gp.h" #include // std::memset -namespace tlm { +namespace tlm +{ /* Tranaction-Level Modelling @@ -140,20 +141,13 @@ needing to store context. tlm_from_hostendian(tlm_generic_payload *txn) */ - - -#ifndef uchar -#define uchar unsigned char -#else -#define TLM_END_CONV_DONT_UNDEF_UCHAR -#endif - - /////////////////////////////////////////////////////////////////////////////// // Generic Utilities class tlm_endian_context; -class tlm_endian_context_pool { + +class tlm_endian_context_pool +{ public: tlm_endian_context *first; inline tlm_endian_context_pool(); @@ -161,54 +155,68 @@ class tlm_endian_context_pool { inline tlm_endian_context *pop(); inline void push(tlm_endian_context *c); }; + static tlm_endian_context_pool global_tlm_endian_context_pool; // an extension to keep the information needed for reconversion of response -class tlm_endian_context : public tlm_extension { +class tlm_endian_context : public tlm_extension +{ public: tlm_endian_context() : dbuf_size(0), bebuf_size(0) {} + ~tlm_endian_context() { - if(dbuf_size > 0) delete [] new_dbuf; - if(bebuf_size > 0) delete [] new_bebuf; + if (dbuf_size > 0) + delete [] new_dbuf; + if (bebuf_size > 0) + delete [] new_bebuf; } - sc_dt::uint64 address; // used by generic, word - sc_dt::uint64 new_address; // used by generic - uchar *data_ptr; // used by generic, word, aligned - uchar *byte_enable; // used by word - int length; // used by generic, word - int stream_width; // used by generic + sc_dt::uint64 address; // Used by generic, word. + sc_dt::uint64 new_address; // Used by generic. + unsigned char *data_ptr; // Used by generic, word, aligned. + unsigned char *byte_enable; // Used by word. + int length; // Used by generic, word. + int stream_width; // Used by generic. - // used by common entry point on response + // Used by common entry point on response. void (*from_f)(tlm_generic_payload *txn, unsigned int sizeof_databus); int sizeof_databus; - // reordering buffers for data and byte-enables - uchar *new_dbuf, *new_bebuf; + // Reordering buffers for data and byte-enables. + unsigned char *new_dbuf, *new_bebuf; int dbuf_size, bebuf_size; - void establish_dbuf(int len) { - if(len <= dbuf_size) return; - if(dbuf_size > 0) delete [] new_dbuf; - new_dbuf = new uchar[len]; - dbuf_size = len; - } - void establish_bebuf(int len) { - if(len <= bebuf_size) return; - if(bebuf_size > 0) delete [] new_bebuf; - new_bebuf = new uchar[len]; - bebuf_size = len; + + void + establish_dbuf(int len) + { + if (len <= dbuf_size) + return; + if (dbuf_size > 0) + delete [] new_dbuf; + new_dbuf = new unsigned char[len]; + dbuf_size = len; } - // required for extension management - void free() { - global_tlm_endian_context_pool.push(this); + void + establish_bebuf(int len) + { + if (len <= bebuf_size) + return; + if (bebuf_size > 0) + delete [] new_bebuf; + new_bebuf = new unsigned char[len]; + bebuf_size = len; } - tlm_extension_base* clone() const {return 0;} - void copy_from(tlm_extension_base const &) {return;} - // for pooling + // Required for extension management. + void free() { global_tlm_endian_context_pool.push(this); } + tlm_extension_base *clone() const { return 0; } + void copy_from(tlm_extension_base const &) { return; } + + // For pooling. tlm_endian_context *next; }; + // Assumptions about transaction contexts: // 1) only the address attribute of a transaction // is mutable. all other attributes are unchanged from the request to @@ -224,568 +232,711 @@ class tlm_endian_context : public tlm_extension { // should not remove it unless it deletes the generic payload // object. -inline tlm_endian_context *establish_context(tlm_generic_payload *txn) { - tlm_endian_context *tc = txn->get_extension(); - if(tc == 0) { - tc = global_tlm_endian_context_pool.pop(); - txn->set_extension(tc); - } - return tc; +inline tlm_endian_context * +establish_context(tlm_generic_payload *txn) +{ + tlm_endian_context *tc = txn->get_extension(); + if (tc == 0) { + tc = global_tlm_endian_context_pool.pop(); + txn->set_extension(tc); + } + return tc; } inline tlm_endian_context_pool::tlm_endian_context_pool() : first(0) {} -inline tlm_endian_context_pool::~tlm_endian_context_pool() { - while(first != 0) { - tlm_endian_context *next = first->next; - delete first; - first = next; - } +inline tlm_endian_context_pool::~tlm_endian_context_pool() +{ + while (first != 0) { + tlm_endian_context *next = first->next; + delete first; + first = next; + } } -tlm_endian_context *tlm_endian_context_pool::pop() { - if(first == 0) return new tlm_endian_context; - tlm_endian_context *r = first; - first = first->next; - return r; +tlm_endian_context * +tlm_endian_context_pool::pop() +{ + if (first == 0) + return new tlm_endian_context; + tlm_endian_context *r = first; + first = first->next; + return r; } -void tlm_endian_context_pool::push(tlm_endian_context *c) { - c->next = first; - first = c; +void tlm_endian_context_pool::push(tlm_endian_context *c) +{ + c->next = first; + first = c; } -// a set of constants for efficient filling of byte enables -template class tlm_bool { +// A set of constants for efficient filling of byte enables. +template +class tlm_bool +{ public: static D TLM_TRUE; static D TLM_FALSE; - static D make_uchar_array(uchar c) { - D d; - uchar *tmp = (uchar *)(&d); - for(ptrdiff_t i=0; i!=sizeof(D); i++) tmp[i] = c; // 64BITFIX negligable risk but easy fix // - return d; + static D + make_uchar_array(unsigned char c) + { + D d; + unsigned char *tmp = (unsigned char *)(&d); + for (ptrdiff_t i = 0; i != sizeof(D); i++) + tmp[i] = c; // 64BITFIX negligable risk but easy fix. + return d; } - // also provides an syntax-efficient tester, using a - // copy constuctor and an implicit cast to boolean - tlm_bool(D &d) : b(*((uchar*)&d) != TLM_BYTE_DISABLED) {} - operator bool() const {return b;} + + // Also provides an syntax-efficient tester, using a + // copy constuctor and an implicit cast to boolean. + tlm_bool(D &d) : b(*((unsigned char *)&d) != TLM_BYTE_DISABLED) {} + operator bool() const { return b; } private: bool b; }; -template D tlm_bool::TLM_TRUE - = tlm_bool::make_uchar_array(TLM_BYTE_ENABLED); -template D tlm_bool::TLM_FALSE - = tlm_bool::make_uchar_array(TLM_BYTE_DISABLED); - - - -/////////////////////////////////////////////////////////////////////////////// -// function set (0): Utilities -inline void copy_db0(uchar *src1, uchar *src2, uchar *dest1, uchar *dest2) { - *dest1 = *src1; - *dest2 = *src2; -} - -inline void copy_dbtrue0(uchar *src1, uchar * /* src2 */, uchar *dest1, uchar *dest2) { - *dest1 = *src1; - *dest2 = TLM_BYTE_ENABLED; -} - -inline void copy_btrue0(uchar * /* src1 */, uchar * /* src2 */, uchar * /* dest1 */, uchar *dest2) { - *dest2 = TLM_BYTE_ENABLED; -} - -inline void copy_b0(uchar * /* src1 */, uchar *src2, uchar * /* dest1 */, uchar *dest2) { - *dest2 = *src2; -} - -inline void copy_dbyb0(uchar *src1, uchar * /* src2 */, uchar *dest1, uchar *dest2) { - if(*dest2 == TLM_BYTE_ENABLED) *src1 = *dest1; -} - - -template -inline void loop_generic0(int new_len, int new_stream_width, - int orig_stream_width, int sizeof_databus, - sc_dt::uint64 orig_start_address, sc_dt::uint64 new_start_address, int be_length, - uchar *ie_data, uchar *ie_be, uchar *he_data, uchar *he_be) { - - for(int orig_sword = 0, new_sword = 0; new_sword < new_len; - new_sword += new_stream_width, orig_sword += orig_stream_width) { - - sc_dt::uint64 ie_addr = orig_start_address; - for(int orig_dword = orig_sword; - orig_dword < orig_sword + orig_stream_width; orig_dword += sizeof(D)) { - - for(int curr_byte = orig_dword + sizeof(D) - 1; - curr_byte >= orig_dword; curr_byte--) { - - ptrdiff_t he_index = ((ie_addr++) ^ (sizeof_databus - 1)) - - new_start_address + new_sword; // 64BITFIX // - COPY(ie_data+curr_byte, - ie_be+(curr_byte % be_length), // 64BITRISK no risk of overflow, always positive // - he_data+he_index, he_be+he_index); - } +template +D tlm_bool::TLM_TRUE = tlm_bool::make_uchar_array(TLM_BYTE_ENABLED); +template +D tlm_bool::TLM_FALSE = tlm_bool::make_uchar_array(TLM_BYTE_DISABLED); + + + +inline void +copy_db0(unsigned char *src1, unsigned char *src2, + unsigned char *dest1, unsigned char *dest2) +{ + *dest1 = *src1; + *dest2 = *src2; +} + +inline void +copy_dbtrue0(unsigned char *src1, unsigned char * /* src2 */, + unsigned char *dest1, unsigned char *dest2) +{ + *dest1 = *src1; + *dest2 = TLM_BYTE_ENABLED; +} + +inline void +copy_btrue0(unsigned char * /* src1 */, unsigned char * /* src2 */, + unsigned char * /* dest1 */, unsigned char *dest2) +{ + *dest2 = TLM_BYTE_ENABLED; +} + +inline void +copy_b0(unsigned char * /* src1 */, unsigned char *src2, + unsigned char * /* dest1 */, unsigned char *dest2) +{ + *dest2 = *src2; +} + +inline void +copy_dbyb0(unsigned char *src1, unsigned char * /* src2 */, + unsigned char *dest1, unsigned char *dest2) +{ + if (*dest2 == TLM_BYTE_ENABLED) + *src1 = *dest1; +} + + +template +inline void +loop_generic0(int new_len, int new_stream_width, int orig_stream_width, + int sizeof_databus, sc_dt::uint64 orig_start_address, + sc_dt::uint64 new_start_address, int be_length, + unsigned char *ie_data, unsigned char *ie_be, + unsigned char *he_data, unsigned char *he_be) +{ + for (int orig_sword = 0, new_sword = 0; new_sword < new_len; + new_sword += new_stream_width, orig_sword += orig_stream_width) { + sc_dt::uint64 ie_addr = orig_start_address; + for (int orig_dword = orig_sword; + orig_dword < orig_sword + orig_stream_width; + orig_dword += sizeof(D)) { + for (int curr_byte = orig_dword + sizeof(D) - 1; + curr_byte >= orig_dword; curr_byte--) { + ptrdiff_t he_index = ((ie_addr++) ^ (sizeof_databus - 1)) - + new_start_address + new_sword; // 64BITFIX + COPY(ie_data + curr_byte, + // 64BITRISK no risk of overflow, always positive. + ie_be + (curr_byte % be_length), + he_data + he_index, he_be + he_index); + } + } } - } } /////////////////////////////////////////////////////////////////////////////// // function set (0): Response -template inline void -tlm_from_hostendian_generic(tlm_generic_payload *txn, unsigned int sizeof_databus) { - if(txn->is_read()) { - tlm_endian_context *tc = txn->template get_extension(); - loop_generic0(txn->get_data_length(), - txn->get_streaming_width(), tc->stream_width, sizeof_databus, tc->address, - tc->new_address, txn->get_data_length(), tc->data_ptr, 0, txn->get_data_ptr(), - txn->get_byte_enable_ptr()); - } +/////////////////////////////////////////////////////////////////////////////// + +template +inline void +tlm_from_hostendian_generic(tlm_generic_payload *txn, + unsigned int sizeof_databus) +{ + if (txn->is_read()) { + tlm_endian_context *tc = + txn->template get_extension(); + loop_generic0(txn->get_data_length(), + txn->get_streaming_width(), tc->stream_width, sizeof_databus, + tc->address, tc->new_address, txn->get_data_length(), + tc->data_ptr, 0, txn->get_data_ptr(), + txn->get_byte_enable_ptr()); + } } /////////////////////////////////////////////////////////////////////////////// // function set (0): Request -template inline void -tlm_to_hostendian_generic(tlm_generic_payload *txn, unsigned int sizeof_databus) { - tlm_endian_context *tc = establish_context(txn); - tc->from_f = &(tlm_from_hostendian_generic); - tc->sizeof_databus = sizeof_databus; - - // calculate new size: nr stream words multiplied by big enough stream width - int s_width = txn->get_streaming_width(); - int length = txn->get_data_length(); - if(s_width >= length) s_width = length; - int nr_stream_words = length/s_width; - - // find out in which bus word the stream word starts and ends - sc_dt::uint64 new_address = (txn->get_address() & ~(sizeof_databus - 1)); - sc_dt::uint64 end_address = ((txn->get_address() + s_width - 1) - & ~(sizeof_databus - 1)); - - int new_stream_width = end_address - new_address + sizeof_databus; - int new_length = new_stream_width * nr_stream_words; - - // store context - tc->data_ptr = txn->get_data_ptr(); - tc->address = txn->get_address(); - tc->new_address = new_address; - tc->stream_width = s_width; - uchar *orig_be = txn->get_byte_enable_ptr(); - int orig_be_length = txn->get_byte_enable_length(); - - // create data and byte-enable buffers - txn->set_address(new_address); - tc->establish_dbuf(new_length); - txn->set_data_ptr(tc->new_dbuf); - tc->establish_bebuf(new_length); - txn->set_byte_enable_ptr(tc->new_bebuf); - std::memset(txn->get_byte_enable_ptr(), TLM_BYTE_DISABLED, new_length); - txn->set_streaming_width(new_stream_width); - txn->set_data_length(new_length); - txn->set_byte_enable_length(new_length); - - // copy data and/or byte enables - if(txn->is_write()) { - if(orig_be == 0) { - loop_generic0(new_length, - new_stream_width, s_width, sizeof_databus, tc->address, - new_address, new_length, tc->data_ptr, 0, txn->get_data_ptr(), - txn->get_byte_enable_ptr()); - } else { - loop_generic0(new_length, - new_stream_width, s_width, sizeof_databus, tc->address, - new_address, orig_be_length, tc->data_ptr, orig_be, txn->get_data_ptr(), - txn->get_byte_enable_ptr()); - } - } else { // read transaction - if(orig_be == 0) { - loop_generic0(new_length, - new_stream_width, s_width, sizeof_databus, tc->address, - new_address, new_length, tc->data_ptr, 0, txn->get_data_ptr(), - txn->get_byte_enable_ptr()); +template +inline void +tlm_to_hostendian_generic(tlm_generic_payload *txn, + unsigned int sizeof_databus) +{ + tlm_endian_context *tc = establish_context(txn); + tc->from_f = &(tlm_from_hostendian_generic); + tc->sizeof_databus = sizeof_databus; + + // Calculate new size: nr stream words multiplied by big enough stream + // width. + int s_width = txn->get_streaming_width(); + int length = txn->get_data_length(); + if (s_width >= length) + s_width = length; + int nr_stream_words = length / s_width; + + // Find out in which bus word the stream word starts and ends. + sc_dt::uint64 new_address = (txn->get_address() & ~(sizeof_databus - 1)); + sc_dt::uint64 end_address = ((txn->get_address() + s_width - 1) & + ~(sizeof_databus - 1)); + + int new_stream_width = end_address - new_address + sizeof_databus; + int new_length = new_stream_width * nr_stream_words; + + // Store context. + tc->data_ptr = txn->get_data_ptr(); + tc->address = txn->get_address(); + tc->new_address = new_address; + tc->stream_width = s_width; + unsigned char *orig_be = txn->get_byte_enable_ptr(); + int orig_be_length = txn->get_byte_enable_length(); + + // Create data and byte-enable buffers. + txn->set_address(new_address); + tc->establish_dbuf(new_length); + txn->set_data_ptr(tc->new_dbuf); + tc->establish_bebuf(new_length); + txn->set_byte_enable_ptr(tc->new_bebuf); + std::memset(txn->get_byte_enable_ptr(), TLM_BYTE_DISABLED, new_length); + txn->set_streaming_width(new_stream_width); + txn->set_data_length(new_length); + txn->set_byte_enable_length(new_length); + + // Copy data and/or byte enables. + if (txn->is_write()) { + if (orig_be == 0) { + loop_generic0( + new_length, new_stream_width, s_width, sizeof_databus, + tc->address, new_address, new_length, tc->data_ptr, 0, + txn->get_data_ptr(), txn->get_byte_enable_ptr()); + } else { + loop_generic0(new_length, new_stream_width, + s_width, sizeof_databus, tc->address, new_address, + orig_be_length, tc->data_ptr, orig_be, + txn->get_data_ptr(), txn->get_byte_enable_ptr()); + } } else { - loop_generic0(new_length, - new_stream_width, s_width, sizeof_databus, tc->address, - new_address, orig_be_length, tc->data_ptr, orig_be, txn->get_data_ptr(), - txn->get_byte_enable_ptr()); + // Read transaction. + if (orig_be == 0) { + loop_generic0(new_length, + new_stream_width, s_width, sizeof_databus, tc->address, + new_address, new_length, tc->data_ptr, 0, + txn->get_data_ptr(), txn->get_byte_enable_ptr()); + } else { + loop_generic0(new_length, new_stream_width, + s_width, sizeof_databus, tc->address, new_address, + orig_be_length, tc->data_ptr, orig_be, + txn->get_data_ptr(), txn->get_byte_enable_ptr()); + } } - } } - /////////////////////////////////////////////////////////////////////////////// // function set (1): Utilities -template -inline void copy_d1(uchar *src1, uchar *src2, uchar *dest1, uchar *dest2) { - *((D *)dest1) = *((D *)src1); - *((D *)dest2) = tlm_bool::TLM_TRUE; -} +/////////////////////////////////////////////////////////////////////////////// -template -inline void copy_db1(uchar *src1, uchar *src2, uchar *dest1, uchar *dest2) { - *((D *)dest1) = *((D *)src1); - *((D *)dest2) = *((D *)src2); +template +inline void +copy_d1(unsigned char *src1, unsigned char *src2, + unsigned char *dest1, unsigned char *dest2) +{ + *((D *)dest1) = *((D *)src1); + *((D *)dest2) = tlm_bool::TLM_TRUE; } -template -inline void true_b1(uchar *src1, uchar *src2, uchar *dest1, uchar *dest2) { - *((D *)dest2) = tlm_bool::TLM_TRUE; +template +inline void +copy_db1(unsigned char *src1, unsigned char *src2, + unsigned char *dest1, unsigned char *dest2) +{ + *((D *)dest1) = *((D *)src1); + *((D *)dest2) = *((D *)src2); } -template -inline void copy_b1(uchar *src1, uchar *src2, uchar *dest1, uchar *dest2) { - *((D *)dest2) = *((D *)src2); +template +inline void +true_b1(unsigned char *src1, unsigned char *src2, + unsigned char *dest1, unsigned char *dest2) +{ + *((D *)dest2) = tlm_bool::TLM_TRUE; } -template -inline void copy_dbyb1(uchar *src1, uchar *src2, uchar *dest1, uchar *dest2) { - if(*src2 != TLM_BYTE_DISABLED) *((D *)src1) = *((D *)dest1); +template +inline void +copy_b1(unsigned char *src1, unsigned char *src2, + unsigned char *dest1, unsigned char *dest2) +{ + *((D *)dest2) = *((D *)src2); } -template -inline void copy_dbytrue1(uchar *src1, uchar *src2, uchar *dest1, uchar *dest2) { - *((D *)src1) = *((D *)dest1); +template +inline void +copy_dbyb1(unsigned char *src1, unsigned char *src2, + unsigned char *dest1, unsigned char *dest2) +{ + if (*src2 != TLM_BYTE_DISABLED) + *((D *)src1) = *((D *)dest1); } -template inline void false_b1(uchar *dest1) { - *((D *)dest1) = tlm_bool::TLM_FALSE; +template +inline void +copy_dbytrue1(unsigned char *src1, unsigned char *src2, + unsigned char *dest1, unsigned char *dest2) +{ + *((D *)src1) = *((D *)dest1); } -template inline void no_b1(uchar *dest1) { +template +inline void +false_b1(unsigned char *dest1) +{ + *((D *)dest1) = tlm_bool::TLM_FALSE; } -template -inline int loop_word1( - int bytes_left, int len0, int lenN, int sizeof_databus, - uchar *start, uchar *end, uchar *src, uchar *bsrc, uchar *dest, uchar *bdest) { - ptrdiff_t d2b_src = bsrc - src; // 64BITFIX was int // - ptrdiff_t d2b_dest = bdest - dest; // 64BITFIX was int // - uchar *original_dest = dest; - - while(true) { - // len0 bytes at start of a bus word - if((src >= start) && (src < end)) { - for(int i=0; i= start) && (src < end)) { - COPY(src, src+d2b_src, dest, dest+d2b_dest); - bytes_left -= sizeof(D); - } else { - FILLFALSE(dest+d2b_dest); - } - dest += sizeof(D); - if(bytes_left <= 0) return int(dest - original_dest); - src -= sizeof(D); - } +template +inline void +no_b1(unsigned char *dest1) +{} - // lenN bytes at end of bus word - if((src >= start) && (src < end)) { - for(int i=0; i +inline int +loop_word1(int bytes_left, int len0, int lenN, int sizeof_databus, + unsigned char *start, unsigned char *end, + unsigned char *src, unsigned char *bsrc, + unsigned char *dest, unsigned char *bdest) +{ + ptrdiff_t d2b_src = bsrc - src; // 64BITFIX was int + ptrdiff_t d2b_dest = bdest - dest; // 64BITFIX was int + unsigned char *original_dest = dest; + + while (true) { + // len0 bytes at start of a bus word. + if ((src >= start) && (src < end)) { + for (int i = 0; i < len0; i++) { + COPYuchar(src, src + d2b_src, dest, dest + d2b_dest); + src++; + dest++; + } + bytes_left -= len0; + if (bytes_left <= 0) + return int(dest - original_dest); + } else { + for (int i = 0; i < len0; i++) { + FILLFALSEuchar(dest + d2b_dest); + src++; + dest++; + } + } + src -= 2 * sizeof(D); + + // Sequence of full data word fragments. + for (unsigned int i = 1; i < sizeof_databus / sizeof(D); i++) { + if ((src >= start) && (src < end)) { + COPY(src, src + d2b_src, dest, dest + d2b_dest); + bytes_left -= sizeof(D); + } else { + FILLFALSE(dest + d2b_dest); + } + dest += sizeof(D); + if (bytes_left <= 0) + return int(dest - original_dest); + src -= sizeof(D); + } + + // lenN bytes at end of bus word. + if ((src >= start) && (src < end)) { + for (int i = 0; i < lenN; i++) { + COPYuchar(src, src + d2b_src, dest, dest + d2b_dest); + src++; + dest++; + } + bytes_left -= lenN; + if (bytes_left <= 0) + return int(dest - original_dest); + } else { + for (int i = 0; i < lenN; i++) { + FILLFALSEuchar(dest + d2b_dest); + src++; + dest++; + } + } + src += 2 * sizeof_databus; } - src += 2 * sizeof_databus; - } } /////////////////////////////////////////////////////////////////////////////// // function set (1): Response -template inline void -tlm_from_hostendian_word(tlm_generic_payload *txn, unsigned int sizeof_databus) { - if(txn->is_read()) { - tlm_endian_context *tc = txn->template get_extension(); - sc_dt::uint64 b_mask = sizeof_databus - 1; - int d_mask = sizeof(DATAWORD) - 1; - int a_offset = static_cast(tc->address & b_mask); - int len0 = (sizeof_databus - a_offset) & d_mask; - int lenN = sizeof(DATAWORD) - len0; - uchar *d_start = tc->data_ptr; - uchar *d_end = ptrdiff_t(tc->length) + d_start; // 64BITFIX probably redundant // - uchar *d = ptrdiff_t(((sizeof_databus - a_offset) & ~d_mask) + lenN) + d_start; // 64BITFIX probably redundant // - - // iterate over transaction copying data qualified by byte-enables - if(tc->byte_enable == 0) { - loop_word1, - ©_dbytrue1, &no_b1, &no_b1 >( - tc->length, len0, lenN, sizeof_databus, d_start, d_end, d, - 0, txn->get_data_ptr(), 0); - } else { - loop_word1, - ©_dbyb1, &no_b1, &no_b1 >( - tc->length, len0, lenN, sizeof_databus, d_start, d_end, d, - tc->byte_enable - d_start + d, txn->get_data_ptr(), 0); +/////////////////////////////////////////////////////////////////////////////// + +template +inline void +tlm_from_hostendian_word(tlm_generic_payload *txn, unsigned int sizeof_databus) +{ + if (txn->is_read()) { + tlm_endian_context *tc = + txn->template get_extension(); + sc_dt::uint64 b_mask = sizeof_databus - 1; + int d_mask = sizeof(DATAWORD) - 1; + int a_offset = static_cast(tc->address & b_mask); + int len0 = (sizeof_databus - a_offset) & d_mask; + int lenN = sizeof(DATAWORD) - len0; + unsigned char *d_start = tc->data_ptr; + unsigned char *d_end = + ptrdiff_t(tc->length) + d_start; // 64BITFIX probably redundant + unsigned char *d = + ptrdiff_t(((sizeof_databus - a_offset) & ~d_mask) + lenN) + + d_start; // 64BITFIX probably redundant + + // Iterate over transaction copying data qualified by byte-enables. + if (tc->byte_enable == 0) { + loop_word1, + ©_dbytrue1, &no_b1, + &no_b1>( + tc->length, len0, lenN, sizeof_databus, + d_start, d_end, d, 0, txn->get_data_ptr(), 0); + } else { + loop_word1, + ©_dbyb1, &no_b1, + &no_b1>( + tc->length, len0, lenN, sizeof_databus, + d_start, d_end, d, + tc->byte_enable - d_start + d, + txn->get_data_ptr(), 0); + } } - } } /////////////////////////////////////////////////////////////////////////////// // function set (1): Request -template inline void -tlm_to_hostendian_word(tlm_generic_payload *txn, unsigned int sizeof_databus) { - tlm_endian_context *tc = establish_context(txn); - tc->from_f = &(tlm_from_hostendian_word); - tc->sizeof_databus = sizeof_databus; - - sc_dt::uint64 b_mask = sizeof_databus - 1; - int d_mask = sizeof(DATAWORD) - 1; - sc_dt::uint64 a_aligned = txn->get_address() & ~b_mask; - int a_offset = static_cast(txn->get_address() & b_mask); - int len0 = (sizeof_databus - a_offset) & d_mask; - int lenN = sizeof(DATAWORD) - len0; - uchar *d_start = txn->get_data_ptr(); - uchar *d_end = ptrdiff_t(txn->get_data_length()) + d_start; // 64BITFIX probably redundant // - uchar *d = ptrdiff_t(((sizeof_databus - a_offset) & ~d_mask) + lenN) + d_start; // 64BITFIX probably redundant // - - // create new data and byte enable buffers - int long_enough = txn->get_data_length() + 2 * sizeof_databus; - tc->establish_dbuf(long_enough); - uchar *new_data = tc->new_dbuf; - tc->establish_bebuf(long_enough); - uchar *new_be = tc->new_bebuf; - - if(txn->is_read()) { - tc->data_ptr = d_start; - tc->address = txn->get_address(); - tc->byte_enable = txn->get_byte_enable_ptr(); - tc->length = txn->get_data_length(); - if(txn->get_byte_enable_ptr() == 0) { - // iterate over transaction creating new byte enables from all-true - txn->set_data_length(loop_word1, - &true_b1, &false_b1, &false_b1 >( - txn->get_data_length(), len0, lenN, sizeof_databus, - d_start, d_end, d, 0, new_data, new_be)); - } else { - // iterate over transaction copying byte enables - txn->set_data_length(loop_word1, - ©_b1, &false_b1, &false_b1 >( - txn->get_data_length(), len0, lenN, sizeof_databus, d_start, d_end, - d, txn->get_byte_enable_ptr() - d_start + d, new_data, new_be)); - } - } else { - // WRITE - if(txn->get_byte_enable_ptr() == 0) { - // iterate over transaction copying data and creating new byte-enables - txn->set_data_length(loop_word1, - ©_d1, &false_b1, &false_b1 >( - txn->get_data_length(), len0, lenN, sizeof_databus, - d_start, d_end, d, 0, new_data, new_be)); +/////////////////////////////////////////////////////////////////////////////// + +template +inline void +tlm_to_hostendian_word(tlm_generic_payload *txn, unsigned int sizeof_databus) +{ + tlm_endian_context *tc = establish_context(txn); + tc->from_f = &(tlm_from_hostendian_word); + tc->sizeof_databus = sizeof_databus; + + sc_dt::uint64 b_mask = sizeof_databus - 1; + int d_mask = sizeof(DATAWORD) - 1; + sc_dt::uint64 a_aligned = txn->get_address() & ~b_mask; + int a_offset = static_cast(txn->get_address() & b_mask); + int len0 = (sizeof_databus - a_offset) & d_mask; + int lenN = sizeof(DATAWORD) - len0; + unsigned char *d_start = txn->get_data_ptr(); + unsigned char *d_end = + ptrdiff_t(txn->get_data_length()) + d_start; + // 64BITFIX probably redundant. + unsigned char *d = + ptrdiff_t(((sizeof_databus - a_offset) & ~d_mask) + lenN) + d_start; + // 64BITFIX probably redundant. + + // Create new data and byte enable buffers. + int long_enough = txn->get_data_length() + 2 * sizeof_databus; + tc->establish_dbuf(long_enough); + unsigned char *new_data = tc->new_dbuf; + tc->establish_bebuf(long_enough); + unsigned char *new_be = tc->new_bebuf; + + if (txn->is_read()) { + tc->data_ptr = d_start; + tc->address = txn->get_address(); + tc->byte_enable = txn->get_byte_enable_ptr(); + tc->length = txn->get_data_length(); + if (txn->get_byte_enable_ptr() == 0) { + // Iterate over transaction creating new byte enables from all-true + txn->set_data_length( + loop_word1, + &true_b1, &false_b1, + &false_b1>( + txn->get_data_length(), len0, lenN, + sizeof_databus, d_start, d_end, d, 0, + new_data, new_be)); + } else { + // iterate over transaction copying byte enables + txn->set_data_length( + loop_word1, + ©_b1, &false_b1, + &false_b1>( + txn->get_data_length(), len0, lenN, + sizeof_databus, d_start, d_end, d, + txn->get_byte_enable_ptr() - d_start + d, + new_data, new_be)); + } } else { - // iterate over transaction copying data and byte-enables - txn->set_data_length(loop_word1, - ©_db1, &false_b1, &false_b1 >( - txn->get_data_length(), len0, lenN, sizeof_databus, d_start, d_end, - d, txn->get_byte_enable_ptr() - d_start + d, new_data, new_be)); + // WRITE + if (txn->get_byte_enable_ptr() == 0) { + // Iterate over transaction copying data and creating new + // byte-enables. + txn->set_data_length( + loop_word1, + ©_d1, &false_b1, + &false_b1>( + txn->get_data_length(), len0, lenN, + sizeof_databus, d_start, d_end, d, 0, + new_data, new_be)); + } else { + // Iterate over transaction copying data and byte-enables. + txn->set_data_length( + loop_word1, + ©_db1, &false_b1, + &false_b1>( + txn->get_data_length(), len0, lenN, + sizeof_databus, d_start, d_end, d, + txn->get_byte_enable_ptr() - d_start + d, + new_data, new_be)); + } } - } - txn->set_byte_enable_length(txn->get_data_length()); - txn->set_streaming_width(txn->get_data_length()); - txn->set_data_ptr(new_data); - txn->set_byte_enable_ptr(new_be); - txn->set_address(a_aligned); + txn->set_byte_enable_length(txn->get_data_length()); + txn->set_streaming_width(txn->get_data_length()); + txn->set_data_ptr(new_data); + txn->set_byte_enable_ptr(new_be); + txn->set_address(a_aligned); } /////////////////////////////////////////////////////////////////////////////// // function set (2): Utilities -template inline void copy_d2(D *src1, D *src2, D *dest1, D *dest2) { - *dest1 = *src1; -} - -template inline void copy_db2(D *src1, D *src2, D *dest1, D *dest2) { - *dest1 = *src1; - *dest2 = *src2; -} - -template -inline void copy_dbyb2(D *src1, D *src2, D *dest1, D *dest2) { - if(tlm_bool(*src2)) *dest1 = *src1; -} +/////////////////////////////////////////////////////////////////////////////// -template -inline void loop_aligned2(D *src1, D *src2, D *dest1, D *dest2, - int words, int words_per_bus) { - ptrdiff_t src1to2 = (char *)src2 - (char *)src1; // 64BITFIX was int and operands were cast to int // - ptrdiff_t dest1to2 = (char *)dest2 - (char *)dest1; // 64BITFIX was int and operands were cast to int // - - D *done = src1 + ptrdiff_t(words); // 64BITFIX // - D *bus_start = src1; - src1 += ptrdiff_t(words_per_bus - 1); // 64BITFIX // - - while(true) { - COPY(src1, (D *)(src1to2+(char *)src1), dest1, (D *)(dest1to2+(char *)dest1)); // 64BITFIX // - dest1++; - if((--src1) < bus_start) { - bus_start += ptrdiff_t(words_per_bus); // 64BITFIX // - if(bus_start == done) break; - src1 = bus_start + ptrdiff_t(words_per_bus - 1); // 64BITFIX // +template +inline void copy_d2(D *src1, D *src2, D *dest1, D *dest2) { *dest1 = *src1; } + +template +inline void +copy_db2(D *src1, D *src2, D *dest1, D *dest2) +{ + *dest1 = *src1; + *dest2 = *src2; +} + +template +inline void +copy_dbyb2(D *src1, D *src2, D *dest1, D *dest2) +{ + if (tlm_bool(*src2)) + *dest1 = *src1; +} + +template +inline void +loop_aligned2(D *src1, D *src2, D *dest1, D *dest2, int words, + int words_per_bus) +{ + // 64BITFIX was int and operands were cast to int. + ptrdiff_t src1to2 = (char *)src2 - (char *)src1; + // 64BITFIX was int and operands were cast to int. + ptrdiff_t dest1to2 = (char *)dest2 - (char *)dest1; + + D *done = src1 + ptrdiff_t(words); // 64BITFIX. + D *bus_start = src1; + src1 += ptrdiff_t(words_per_bus - 1); // 64BITFIX. + + while (true) { + COPY(src1, (D *)(src1to2 + (char *)src1), dest1, + (D *)(dest1to2 + (char *)dest1)); // 64BITFIX. + dest1++; + if ((--src1) < bus_start) { + bus_start += ptrdiff_t(words_per_bus); // 64BITFIX. + if (bus_start == done) + break; + src1 = bus_start + ptrdiff_t(words_per_bus - 1); // 64BITFIX. + } } - } } /////////////////////////////////////////////////////////////////////////////// // function set (2): Response -template inline void -tlm_from_hostendian_aligned(tlm_generic_payload *txn, unsigned int sizeof_databus) { - int words_per_bus = sizeof_databus/sizeof(DATAWORD); - if(words_per_bus == 1) return; - int words = (txn->get_data_length())/sizeof(DATAWORD); - tlm_endian_context *tc = txn->template get_extension(); - - if(txn->get_byte_enable_ptr() == 0) { - // no byte enables - if(txn->is_read()) { - // RD without byte enables. Copy data to original buffer - loop_aligned2 >( - (DATAWORD *)(txn->get_data_ptr()), - 0, (DATAWORD *)(tc->data_ptr), 0, words, words_per_bus); - } - } else { - // byte enables present - if(txn->is_read()) { - // RD with byte enables. Copy data qualified by byte-enables - loop_aligned2 >( - (DATAWORD *)(txn->get_data_ptr()), - (DATAWORD *)(txn->get_byte_enable_ptr()), - (DATAWORD *)(tc->data_ptr), 0, words, words_per_bus); +/////////////////////////////////////////////////////////////////////////////// + +template +inline void +tlm_from_hostendian_aligned( + tlm_generic_payload *txn, unsigned int sizeof_databus) +{ + int words_per_bus = sizeof_databus / sizeof(DATAWORD); + if (words_per_bus == 1) + return; + int words = (txn->get_data_length()) / sizeof(DATAWORD); + tlm_endian_context *tc = txn->template get_extension(); + + if (txn->get_byte_enable_ptr() == 0) { + // no byte enables + if (txn->is_read()) { + // RD without byte enables. Copy data to original buffer. + loop_aligned2>( + (DATAWORD *)(txn->get_data_ptr()), 0, + (DATAWORD *)(tc->data_ptr), 0, words, words_per_bus); + } + } else { + // byte enables present + if (txn->is_read()) { + // RD with byte enables. Copy data qualified by byte-enables. + loop_aligned2>( + (DATAWORD *)(txn->get_data_ptr()), + (DATAWORD *)(txn->get_byte_enable_ptr()), + (DATAWORD *)(tc->data_ptr), 0, words, words_per_bus); + } } - } } /////////////////////////////////////////////////////////////////////////////// // function set (2): Request -template inline void -tlm_to_hostendian_aligned(tlm_generic_payload *txn, unsigned int sizeof_databus) { - tlm_endian_context *tc = establish_context(txn); - tc->from_f = &(tlm_from_hostendian_aligned); - tc->sizeof_databus = sizeof_databus; - - int words_per_bus = sizeof_databus/sizeof(DATAWORD); - if(words_per_bus == 1) return; - int words = (txn->get_data_length())/sizeof(DATAWORD); - - DATAWORD *original_be = (DATAWORD *)(txn->get_byte_enable_ptr()); - DATAWORD *original_data = (DATAWORD *)(txn->get_data_ptr()); - - // always allocate a new data buffer - tc->establish_dbuf(txn->get_data_length()); - txn->set_data_ptr(tc->new_dbuf); - - if(original_be == 0) { - // no byte enables - if(txn->is_write()) { - // WR no byte enables. Copy data - loop_aligned2 >(original_data, 0, - (DATAWORD *)(txn->get_data_ptr()), 0, - words, words_per_bus); - } else { - // RD no byte enables. Save original data pointer - tc->data_ptr = (uchar *)original_data; - } - } else { - // byte enables present - // allocate a new buffer for them - tc->establish_bebuf(txn->get_data_length()); - txn->set_byte_enable_ptr(tc->new_bebuf); - txn->set_byte_enable_length(txn->get_data_length()); +/////////////////////////////////////////////////////////////////////////////// - if(txn->is_write()) { - // WR with byte enables. Copy data and BEs - loop_aligned2 >(original_data, original_be, - (DATAWORD *)(txn->get_data_ptr()), - (DATAWORD *)(txn->get_byte_enable_ptr()), words, words_per_bus); +template +inline void +tlm_to_hostendian_aligned( + tlm_generic_payload *txn, unsigned int sizeof_databus) +{ + tlm_endian_context *tc = establish_context(txn); + tc->from_f = &(tlm_from_hostendian_aligned); + tc->sizeof_databus = sizeof_databus; + + int words_per_bus = sizeof_databus / sizeof(DATAWORD); + if (words_per_bus == 1) + return; + int words = (txn->get_data_length()) / sizeof(DATAWORD); + + DATAWORD *original_be = (DATAWORD *)(txn->get_byte_enable_ptr()); + DATAWORD *original_data = (DATAWORD *)(txn->get_data_ptr()); + + // Always allocate a new data buffer. + tc->establish_dbuf(txn->get_data_length()); + txn->set_data_ptr(tc->new_dbuf); + + if (original_be == 0) { + // No byte enables. + if (txn->is_write()) { + // WR no byte enables. Copy data. + loop_aligned2>( + original_data, 0, (DATAWORD *)(txn->get_data_ptr()), 0, + words, words_per_bus); + } else { + // RD no byte enables. Save original data pointer. + tc->data_ptr = (unsigned char *)original_data; + } } else { - // RD with byte enables. Save original data pointer - tc->data_ptr = (uchar *)original_data; - // Copy byte enables to new buffer - loop_aligned2 >(original_be, 0, - (DATAWORD *)(txn->get_byte_enable_ptr()), 0, - words, words_per_bus); + // Byte enables present. + // Allocate a new buffer for them. + tc->establish_bebuf(txn->get_data_length()); + txn->set_byte_enable_ptr(tc->new_bebuf); + txn->set_byte_enable_length(txn->get_data_length()); + + if (txn->is_write()) { + // WR with byte enables. Copy data and BEs. + loop_aligned2>( + original_data, original_be, + (DATAWORD *)(txn->get_data_ptr()), + (DATAWORD *)(txn->get_byte_enable_ptr()), + words, words_per_bus); + } else { + // RD with byte enables. Save original data pointer. + tc->data_ptr = (unsigned char *)original_data; + // Copy byte enables to new buffer. + loop_aligned2>( + original_be, 0, (DATAWORD *)(txn->get_byte_enable_ptr()), + 0, words, words_per_bus); + } } - } } /////////////////////////////////////////////////////////////////////////////// // function set (3): Response -template inline void -tlm_from_hostendian_single(tlm_generic_payload *txn, unsigned int sizeof_databus) { - // nothing needs to be done here -} +/////////////////////////////////////////////////////////////////////////////// + +template +inline void +tlm_from_hostendian_single( + tlm_generic_payload *txn, unsigned int sizeof_databus) +{} /////////////////////////////////////////////////////////////////////////////// // function set (3): Request -template inline void -tlm_to_hostendian_single(tlm_generic_payload *txn, unsigned int sizeof_databus) { - tlm_endian_context *tc = establish_context(txn); - tc->from_f = &(tlm_from_hostendian_single); - tc->sizeof_databus = sizeof_databus; - - // only need to change the address, always safe to work in-place - sc_dt::uint64 mask = sizeof_databus-1; - sc_dt::uint64 a = txn->get_address(); - txn->set_address((a & ~mask) | - (sizeof_databus - (a & mask) - sizeof(DATAWORD))); +/////////////////////////////////////////////////////////////////////////////// + +template +inline void +tlm_to_hostendian_single(tlm_generic_payload *txn, unsigned int sizeof_databus) +{ + tlm_endian_context *tc = establish_context(txn); + tc->from_f = &(tlm_from_hostendian_single); + tc->sizeof_databus = sizeof_databus; + + // Only need to change the address, always safe to work in-place. + sc_dt::uint64 mask = sizeof_databus - 1; + sc_dt::uint64 a = txn->get_address(); + txn->set_address((a & ~mask) | + (sizeof_databus - (a & mask) - sizeof(DATAWORD))); } /////////////////////////////////////////////////////////////////////////////// // helper function which works for all responses -inline void tlm_from_hostendian(tlm_generic_payload *txn) { - tlm_endian_context *tc = txn->get_extension(); - (*(tc->from_f))(txn, tc->sizeof_databus); -} - +/////////////////////////////////////////////////////////////////////////////// -#ifndef TLM_END_CONV_DONT_UNDEF_UCHAR -#undef uchar -#endif +inline void +tlm_from_hostendian(tlm_generic_payload *txn) +{ + tlm_endian_context *tc = txn->get_extension(); + (*(tc->from_f))(txn, tc->sizeof_databus); +} } // namespace tlm - -#endif // multiple-inclusion protection - +#endif +/* __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_GENERIC_PAYLOAD_TLM_ENDIAN_CONV_H__ */ diff --git a/src/systemc/ext/tlm_core/tlm_2/tlm_generic_payload/tlm_generic_payload.h b/src/systemc/ext/tlm_core/tlm_2/tlm_generic_payload/tlm_generic_payload.h index 3e25e56f2..c3b6b6bb0 100644 --- a/src/systemc/ext/tlm_core/tlm_2/tlm_generic_payload/tlm_generic_payload.h +++ b/src/systemc/ext/tlm_core/tlm_2/tlm_generic_payload/tlm_generic_payload.h @@ -17,13 +17,12 @@ *****************************************************************************/ -#ifndef __TLM_GENERIC_PAYLOAD_H__ -#define __TLM_GENERIC_PAYLOAD_H__ +#ifndef __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_GENERIC_TLM_GENERIC_PAYLOAD_H__ +#define __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_GENERIC_TLM_GENERIC_PAYLOAD_H__ +#include "tlm_core/tlm_2/tlm_generic_payload/tlm_endian_conv.h" +#include "tlm_core/tlm_2/tlm_generic_payload/tlm_gp.h" #include "tlm_core/tlm_2/tlm_generic_payload/tlm_helpers.h" #include "tlm_core/tlm_2/tlm_generic_payload/tlm_phase.h" -#include "tlm_core/tlm_2/tlm_generic_payload/tlm_gp.h" -#include "tlm_core/tlm_2/tlm_generic_payload/tlm_endian_conv.h" - -#endif +#endif /* __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_GENERIC_TLM_GENERIC_PAYLOAD_H__ */ diff --git a/src/systemc/ext/tlm_core/tlm_2/tlm_generic_payload/tlm_gp.h b/src/systemc/ext/tlm_core/tlm_2/tlm_generic_payload/tlm_gp.h index 99bb1e969..0204aed76 100644 --- a/src/systemc/ext/tlm_core/tlm_2/tlm_generic_payload/tlm_gp.h +++ b/src/systemc/ext/tlm_core/tlm_2/tlm_generic_payload/tlm_gp.h @@ -17,51 +17,43 @@ *****************************************************************************/ -// 12-Jan-2009 John Aynsley Bug fix. has_mm() and get_ref_count() should both be const -// 23-Mar-2009 John Aynsley Add method update_original_from() -// 20-Apr-2009 John Aynsley Bug fix for 64-bit machines: unsigned long int -> unsigned int -// 5-May-2011 JA and Philipp Hartmann Add tlm_gp_option, set_gp_option, get_gp_option -// 11-May-2011 John Aynsley Add run-time check to release() +#ifndef __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_GENERIC_PAYLOAD_TLM_GP_H__ +#define __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_GENERIC_PAYLOAD_TLM_GP_H__ - -#ifndef TLM_CORE_TLM2_TLM_GP_H_INCLUDED_ -#define TLM_CORE_TLM2_TLM_GP_H_INCLUDED_ - -#include "sysc/kernel/sc_cmnhdr.h" // SC_API -#include "sysc/utils/sc_report.h" // sc_assert -#include "sysc/datatypes/int/sc_nbdefs.h" // sc_dt::uint64 +#include +#include // std::type_info #include "tlm_core/tlm_2/tlm_generic_payload/tlm_array.h" -#include // std::type_info - -namespace tlm { +namespace tlm +{ class tlm_generic_payload; -class tlm_mm_interface { -public: - virtual void free(tlm_generic_payload*) = 0; - virtual ~tlm_mm_interface() {} +class tlm_mm_interface +{ + public: + virtual void free(tlm_generic_payload *) = 0; + virtual ~tlm_mm_interface() {} }; //--------------------------------------------------------------------------- // Classes and helpers for the extension mechanism //--------------------------------------------------------------------------- // Helper function: -SC_API unsigned int max_num_extensions(); +unsigned int max_num_extensions(); // This class can be used for storing pointers to the extension classes, used // in tlm_generic_payload: -class SC_API tlm_extension_base +class tlm_extension_base { -public: - virtual tlm_extension_base* clone() const = 0; + public: + virtual tlm_extension_base *clone() const = 0; virtual void free() { delete this; } virtual void copy_from(tlm_extension_base const &) = 0; -protected: + protected: virtual ~tlm_extension_base() {} - static unsigned int register_extension(const std::type_info&); + static unsigned int register_extension(const std::type_info &); }; // Base class for all extension classes, derive your extension class in @@ -73,27 +65,29 @@ protected: template class tlm_extension : public tlm_extension_base { -public: - virtual tlm_extension_base* clone() const = 0; + public: + virtual tlm_extension_base *clone() const = 0; virtual void copy_from(tlm_extension_base const &ext) = 0; virtual ~tlm_extension() {} const static unsigned int ID; }; template -const unsigned int tlm_extension::ID - = tlm_extension_base::register_extension(typeid(T)); +const unsigned int tlm_extension::ID = + tlm_extension_base::register_extension(typeid(T)); //--------------------------------------------------------------------------- // enumeration types //--------------------------------------------------------------------------- -enum tlm_command { +enum tlm_command +{ TLM_READ_COMMAND, TLM_WRITE_COMMAND, TLM_IGNORE_COMMAND }; -enum tlm_response_status { +enum tlm_response_status +{ TLM_OK_RESPONSE = 1, TLM_INCOMPLETE_RESPONSE = 0, TLM_GENERIC_ERROR_RESPONSE = -1, @@ -103,7 +97,8 @@ enum tlm_response_status { TLM_BYTE_ENABLE_ERROR_RESPONSE = -5 }; -enum tlm_gp_option { +enum tlm_gp_option +{ TLM_MIN_PAYLOAD, TLM_FULL_PAYLOAD, TLM_FULL_PAYLOAD_ACCEPTED @@ -116,115 +111,146 @@ enum tlm_gp_option { // The generic payload class: //--------------------------------------------------------------------------- -SC_API_TEMPLATE_DECL_ tlm_array; - -class SC_API tlm_generic_payload { - -public: - //--------------- - // Constructors - //--------------- +extern template class tlm_array; - // Default constructor +class tlm_generic_payload +{ + public: tlm_generic_payload(); - explicit tlm_generic_payload(tlm_mm_interface* mm); + explicit tlm_generic_payload(tlm_mm_interface *mm); - void acquire() { sc_assert(m_mm != 0); m_ref_count++; } + void + acquire() + { + sc_assert(m_mm != 0); + m_ref_count++; + } - void release() { + void + release() + { sc_assert(m_mm != 0 && m_ref_count > 0); - if (--m_ref_count==0) + if (--m_ref_count == 0) m_mm->free(this); } int get_ref_count() const { return m_ref_count; } - void set_mm(tlm_mm_interface* mm) { m_mm = mm; } + void set_mm(tlm_mm_interface *mm) { m_mm = mm; } bool has_mm() const { return m_mm != 0; } void reset(); -private: - //disabled copy ctor and assignment operator. - tlm_generic_payload(const tlm_generic_payload& x) /* = delete */; - tlm_generic_payload& operator= (const tlm_generic_payload& x) /* = delete */; + private: + // Disabled copy ctor and assignment operator. + tlm_generic_payload(const tlm_generic_payload &x); + tlm_generic_payload &operator = (const tlm_generic_payload &x); -public: - // non-virtual deep-copying of the object - void deep_copy_from(const tlm_generic_payload & other); + public: + // Non-virtual deep-copying of the object. + void deep_copy_from(const tlm_generic_payload &other); - // To update the state of the original generic payload from a deep copy - // Assumes that "other" was created from the original by calling deep_copy_from - // Argument use_byte_enable_on_read determines whether to use or ignores byte enables - // when copying back the data array on a read command + // To update the state of the original generic payload from a deep copy. + // Assumes that "other" was created from the original by calling + // deep_copy_from Argument use_byte_enable_on_read determines whether to + // use or ignores byte enables when copying back the data array on a read + // command. - void update_original_from(const tlm_generic_payload & other, - bool use_byte_enable_on_read = true); + void update_original_from(const tlm_generic_payload &other, + bool use_byte_enable_on_read=true); - void update_extensions_from(const tlm_generic_payload & other); + void update_extensions_from(const tlm_generic_payload &other); - // Free all extensions. Useful when reusing a cloned transaction that doesn't have memory manager. - // normal and sticky extensions are freed and extension array cleared. + // Free all extensions. Useful when reusing a cloned transaction that + // doesn't have memory manager. Normal and sticky extensions are freed and + // extension array cleared. void free_all_extensions(); - //-------------- - // Destructor - //-------------- virtual ~tlm_generic_payload(); //---------------- - // API (including setters & getters) + // API (including setters & getters). //--------------- - // Command related method - bool is_read() const {return (m_command == TLM_READ_COMMAND);} - void set_read() {m_command = TLM_READ_COMMAND;} - bool is_write() const {return (m_command == TLM_WRITE_COMMAND);} - void set_write() {m_command = TLM_WRITE_COMMAND;} - tlm_command get_command() const {return m_command;} - void set_command(const tlm_command command) {m_command = command;} - - // Address related methods - sc_dt::uint64 get_address() const {return m_address;} - void set_address(const sc_dt::uint64 address) {m_address = address;} - - // Data related methods - unsigned char* get_data_ptr() const {return m_data;} - void set_data_ptr(unsigned char* data) {m_data = data;} - - // Transaction length (in bytes) related methods - unsigned int get_data_length() const {return m_length;} - void set_data_length(const unsigned int length) {m_length = length;} - - // Response status related methods - bool is_response_ok() const {return (m_response_status > 0);} - bool is_response_error() const {return (m_response_status <= 0);} - tlm_response_status get_response_status() const {return m_response_status;} - void set_response_status(const tlm_response_status response_status) - {m_response_status = response_status;} - std::string get_response_string() const; - - // Streaming related methods - unsigned int get_streaming_width() const {return m_streaming_width;} - void set_streaming_width(const unsigned int streaming_width) {m_streaming_width = streaming_width; } - - // Byte enable related methods - unsigned char* get_byte_enable_ptr() const {return m_byte_enable;} - void set_byte_enable_ptr(unsigned char* byte_enable){m_byte_enable = byte_enable;} - unsigned int get_byte_enable_length() const {return m_byte_enable_length;} - void set_byte_enable_length(const unsigned int byte_enable_length){m_byte_enable_length = byte_enable_length;} + // Command related method. + bool is_read() const { return (m_command == TLM_READ_COMMAND); } + void set_read() { m_command = TLM_READ_COMMAND; } + bool is_write() const { return (m_command == TLM_WRITE_COMMAND); } + void set_write() { m_command = TLM_WRITE_COMMAND; } + tlm_command get_command() const { return m_command; } + void set_command(const tlm_command command) { m_command = command; } + + // Address related methods. + sc_dt::uint64 get_address() const { return m_address; } + void set_address(const sc_dt::uint64 address) { m_address = address; } + + // Data related methods. + unsigned char *get_data_ptr() const { return m_data; } + void set_data_ptr(unsigned char *data) { m_data = data; } + + // Transaction length (in bytes) related methods. + unsigned int get_data_length() const { return m_length; } + void set_data_length(const unsigned int length) { m_length = length; } + + // Response status related methods. + bool is_response_ok() const { return (m_response_status > 0); } + bool is_response_error() const { return (m_response_status <= 0); } + tlm_response_status + get_response_status() const + { + return m_response_status; + } + void + set_response_status(const tlm_response_status response_status) + { + m_response_status = response_status; + } + std::string get_response_string() const; + + // Streaming related methods. + unsigned int get_streaming_width() const { return m_streaming_width; } + void + set_streaming_width(const unsigned int streaming_width) + { + m_streaming_width = streaming_width; + } + + // Byte enable related methods. + unsigned char *get_byte_enable_ptr() const { return m_byte_enable; } + void + set_byte_enable_ptr(unsigned char *byte_enable) + { + m_byte_enable = byte_enable; + } + unsigned int + get_byte_enable_length() const + { + return m_byte_enable_length; + } + void + set_byte_enable_length(const unsigned int byte_enable_length) + { + m_byte_enable_length = byte_enable_length; + } // This is the "DMI-hint" a slave can set this to true if it // wants to indicate that a DMI request would be supported: - void set_dmi_allowed(bool dmi_allowed) { m_dmi = dmi_allowed; } - bool is_dmi_allowed() const { return m_dmi; } + void + set_dmi_allowed(bool dmi_allowed) + { + m_dmi = dmi_allowed; + } + bool + is_dmi_allowed() const + { + return m_dmi; + } // Use full set of attributes in DMI/debug? tlm_gp_option get_gp_option() const { return m_gp_option; } - void set_gp_option( const tlm_gp_option gp_opt ) { m_gp_option = gp_opt; } - -private: + void set_gp_option(const tlm_gp_option gp_opt) { m_gp_option = gp_opt; } + private: /* --------------------------------------------------------------------- */ /* Generic Payload attributes: */ /* --------------------------------------------------------------------- */ @@ -260,19 +286,18 @@ private: /* - m_streaming_width : */ /* --------------------------------------------------------------------- */ - sc_dt::uint64 m_address; - tlm_command m_command; - unsigned char* m_data; - unsigned int m_length; - tlm_response_status m_response_status; - bool m_dmi; - unsigned char* m_byte_enable; - unsigned int m_byte_enable_length; - unsigned int m_streaming_width; - tlm_gp_option m_gp_option; - -public: - + sc_dt::uint64 m_address; + tlm_command m_command; + unsigned char *m_data; + unsigned int m_length; + tlm_response_status m_response_status; + bool m_dmi; + unsigned char *m_byte_enable; + unsigned int m_byte_enable_length; + unsigned int m_streaming_width; + tlm_gp_option m_gp_option; + + public: /* --------------------------------------------------------------------- */ /* Dynamic extension mechanism: */ /* --------------------------------------------------------------------- */ @@ -310,79 +335,81 @@ public: // Stick the pointer to an extension into the vector, return the // previous value: - template T* set_extension(T* ext) + template + T * + set_extension(T *ext) { - return static_cast(set_extension(T::ID, ext)); + return static_cast(set_extension(T::ID, ext)); } - // non-templatized version with manual index: - tlm_extension_base* set_extension(unsigned int index, - tlm_extension_base* ext); + // Non-templatized version with manual index: + tlm_extension_base *set_extension( + unsigned int index, tlm_extension_base *ext); // Stick the pointer to an extension into the vector, return the - // previous value and schedule its release - template T* set_auto_extension(T* ext) + // previous value and schedule its release. + template + T * + set_auto_extension(T *ext) { - return static_cast(set_auto_extension(T::ID, ext)); + return static_cast(set_auto_extension(T::ID, ext)); } - // non-templatized version with manual index: - tlm_extension_base* set_auto_extension(unsigned int index, - tlm_extension_base* ext); - - // Check for an extension, ext will point to 0 if not present - template void get_extension(T*& ext) const - { - ext = get_extension(); - } - template T* get_extension() const + // Non-templatized version with manual index: + tlm_extension_base *set_auto_extension( + unsigned int index, tlm_extension_base *ext); + + // Check for an extension, ext will point to 0 if not present. + template + void get_extension(T *& ext) const { ext = get_extension(); } + template + T * + get_extension() const { return static_cast(get_extension(T::ID)); } // Non-templatized version with manual index: - tlm_extension_base* get_extension(unsigned int index) const; - - //this call just removes the extension from the txn but does not - // call free() or tells the MM to do so - // it return false if there was active MM so you are now in an unsafe situation - // recommended use: when 100% sure there is no MM - template void clear_extension(const T* ext) - { - clear_extension(); - } - - //this call just removes the extension from the txn but does not - // call free() or tells the MM to do so - // it return false if there was active MM so you are now in an unsafe situation - // recommended use: when 100% sure there is no MM - template void clear_extension() - { - clear_extension(T::ID); - } - - //this call removes the extension from the txn and does - // call free() or tells the MM to do so when the txn is finally done - // recommended use: when not sure there is no MM - template void release_extension(T* ext) + tlm_extension_base *get_extension(unsigned int index) const; + + // This call just removes the extension from the txn but does not + // call free() or tells the MM to do so it return false if there was + // active MM so you are now in an unsafe situation recommended use: + // when 100% sure there is no MM. + template + void clear_extension(const T *ext) { clear_extension(); } + + // This call just removes the extension from the txn but does not + // call free() or tells the MM to do so it return false if there was + // active MM so you are now in an unsafe situation recommended use: when + // 100% sure there is no MM. + template + void clear_extension() { clear_extension(T::ID); } + + // This call removes the extension from the txn and does call free() or + // tells the MM to do so when the txn is finally done recommended use: + // when not sure there is no MM. + template + void release_extension(T *ext) { release_extension(); } - //this call removes the extension from the txn and does - // call free() or tells the MM to do so when the txn is finally done - // recommended use: when not sure there is no MM - template void release_extension() + // This call removes the extension from the txn and does call free() or + // tells the MM to do so when the txn is finally done recommended use: + // when not sure there is no MM + template + void release_extension() { release_extension(T::ID); } -private: + private: // Non-templatized version with manual index void clear_extension(unsigned int index); // Non-templatized version with manual index void release_extension(unsigned int index); -public: + public: // Make sure the extension array is large enough. Can be called once by // an initiator module (before issuing the first transaction) to make // sure that the extension array is of correct size. This is only needed @@ -390,13 +417,12 @@ public: // allocated after C++ static construction time. void resize_extensions(); -private: - tlm_array m_extensions; - tlm_mm_interface* m_mm; - unsigned int m_ref_count; + private: + tlm_array m_extensions; + tlm_mm_interface *m_mm; + unsigned int m_ref_count; }; } // namespace tlm - -#endif /* TLM_CORE_TLM2_TLM_GP_H_INCLUDED_ */ +#endif /* __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_GENERIC_PAYLOAD_TLM_GP_H__ */ diff --git a/src/systemc/ext/tlm_core/tlm_2/tlm_generic_payload/tlm_helpers.h b/src/systemc/ext/tlm_core/tlm_2/tlm_generic_payload/tlm_helpers.h index da3abb4f9..74c6d935f 100644 --- a/src/systemc/ext/tlm_core/tlm_2/tlm_generic_payload/tlm_helpers.h +++ b/src/systemc/ext/tlm_core/tlm_2/tlm_generic_payload/tlm_helpers.h @@ -17,64 +17,54 @@ *****************************************************************************/ -/* --------------------------------------------------------------------------------------- - @file tlm_helpers.h - - @brief - - Original Authors: - Charles Wilson, ESLX - ---------------------------------------------------------------------------------------- */ +#ifndef __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_GENERIC_PAYLOAD_TLM_HELPERS_H__ +#define __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_GENERIC_PAYLOAD_TLM_HELPERS_H__ -#ifndef __TLM_HELPERS_H__ -#define __TLM_HELPERS_H__ - -//#include -//#include - -namespace tlm { +namespace tlm +{ enum tlm_endianness { TLM_UNKNOWN_ENDIAN, TLM_LITTLE_ENDIAN, TLM_BIG_ENDIAN }; -inline tlm_endianness get_host_endianness(void) +inline tlm_endianness +get_host_endianness() { - static tlm_endianness host_endianness = TLM_UNKNOWN_ENDIAN; - - if (host_endianness == TLM_UNKNOWN_ENDIAN) { - unsigned int number = 1; - unsigned char *p_msb_or_lsb = (unsigned char*)&number; - - host_endianness = (p_msb_or_lsb[0] == 0) ? TLM_BIG_ENDIAN : TLM_LITTLE_ENDIAN; - } - return host_endianness; + static tlm_endianness host_endianness = TLM_UNKNOWN_ENDIAN; + + if (host_endianness == TLM_UNKNOWN_ENDIAN) { + unsigned int number = 1; + unsigned char *p_msb_or_lsb = (unsigned char *)&number; + host_endianness = (p_msb_or_lsb[0] == 0) ? + TLM_BIG_ENDIAN : TLM_LITTLE_ENDIAN; + } + return host_endianness; } -inline bool host_has_little_endianness(void) +inline bool +host_has_little_endianness() { - static tlm_endianness host_endianness = TLM_UNKNOWN_ENDIAN; - static bool host_little_endian = false; - - if (host_endianness == TLM_UNKNOWN_ENDIAN) { - unsigned int number = 1; - unsigned char *p_msb_or_lsb = (unsigned char*)&number; + static tlm_endianness host_endianness = TLM_UNKNOWN_ENDIAN; + static bool host_little_endian = false; - host_little_endian = (p_msb_or_lsb[0] == 0) ? false : true; - } + if (host_endianness == TLM_UNKNOWN_ENDIAN) { + unsigned int number = 1; + unsigned char *p_msb_or_lsb = (unsigned char *)&number; - return host_little_endian; + host_little_endian = (p_msb_or_lsb[0] == 0) ? false : true; + } + + return host_little_endian; } -inline bool has_host_endianness(tlm_endianness endianness) +inline bool +has_host_endianness(tlm_endianness endianness) { - if (host_has_little_endianness()) { - return endianness == TLM_LITTLE_ENDIAN; - - } else { - return endianness == TLM_BIG_ENDIAN; - } -} + if (host_has_little_endianness()) { + return endianness == TLM_LITTLE_ENDIAN; + } else { + return endianness == TLM_BIG_ENDIAN; + } +} } // namespace tlm -#endif /* __TLM_HELPERS_H__ */ +#endif /* __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_GENERIC_PAYLOAD_TLM_HELPERS_H__ */ diff --git a/src/systemc/ext/tlm_core/tlm_2/tlm_generic_payload/tlm_phase.h b/src/systemc/ext/tlm_core/tlm_2/tlm_generic_payload/tlm_phase.h index a06ccc443..767cb886c 100644 --- a/src/systemc/ext/tlm_core/tlm_2/tlm_generic_payload/tlm_phase.h +++ b/src/systemc/ext/tlm_core/tlm_2/tlm_generic_payload/tlm_phase.h @@ -17,92 +17,101 @@ *****************************************************************************/ -#ifndef TLM_CORE_TLM2_TLM_PHASE_H_INCLUDED_ -#define TLM_CORE_TLM2_TLM_PHASE_H_INCLUDED_ +#ifndef __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_GENERIC_PAYLOAD_TLM_PHASE_H__ +#define __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_GENERIC_PAYLOAD_TLM_PHASE_H__ -#include #include #include #include -#include "sysc/kernel/sc_cmnhdr.h" // SC_API -#include "sysc/kernel/sc_macros.h" // SC_CONCAT_HELPER_, SC_STRINGIFY_HELPER_ +#define SC_CONCAT_HELPER_(a, b) SC_CONCAT_HELPER_DEFERRED_(a, b) +#define SC_CONCAT_HELPER_DEFERRED_(a, b) SC_CONCAT_HELPER_MORE_DEFERRED_(a, b) +#define SC_CONCAT_HELPER_MORE_DEFERRED_(a, b) a ## b -namespace tlm { +#define SC_STRINGIFY_HELPER_(a) SC_STRINGIFY_HELPER_DEFERRED_(a) +#define SC_STRINGIFY_HELPER_DEFERRED_(a) SC_STRINGIFY_HELPER_MORE_DEFERRED_(a) +#define SC_STRINGIFY_HELPER_MORE_DEFERRED_(a) #a -enum SC_API tlm_phase_enum +namespace tlm { - UNINITIALIZED_PHASE=0, - BEGIN_REQ=1, - END_REQ, - BEGIN_RESP, - END_RESP + +enum tlm_phase_enum +{ + UNINITIALIZED_PHASE = 0, + BEGIN_REQ = 1, + END_REQ, + BEGIN_RESP, + END_RESP }; -class SC_API tlm_phase +class tlm_phase { -public: - tlm_phase(); - tlm_phase(unsigned int id); // TODO: should be dropped + public: + tlm_phase(); + tlm_phase(unsigned int id); - tlm_phase(tlm_phase_enum standard); - tlm_phase& operator=(tlm_phase_enum standard); + tlm_phase(tlm_phase_enum standard); + tlm_phase &operator = (tlm_phase_enum standard); - operator unsigned int() const { return m_id; } - const char* get_name() const; + operator unsigned int() const { return m_id; } + const char *get_name() const; -protected: - // register extended phase - tlm_phase( const std::type_info & type, const char* name ); + protected: + // Register extended phase. + tlm_phase(const std::type_info &type, const char *name); -private: - unsigned int m_id; + private: + unsigned int m_id; }; -inline -tlm_phase::tlm_phase() - : m_id( UNINITIALIZED_PHASE ) -{} +inline tlm_phase::tlm_phase() : m_id(UNINITIALIZED_PHASE) {} -inline -tlm_phase::tlm_phase( tlm_phase_enum standard ) - : m_id( standard ) -{} +inline tlm_phase::tlm_phase(tlm_phase_enum standard) : m_id(standard) {} -inline -tlm_phase& tlm_phase::operator=( tlm_phase_enum standard ) +inline tlm_phase & +tlm_phase::operator = (tlm_phase_enum standard) { - m_id = standard; - return *this; + m_id = standard; + return *this; } -inline -std::ostream& operator<<(std::ostream& s, const tlm_phase& p) +inline std::ostream & +operator << (std::ostream &s, const tlm_phase &p) { - s << p.get_name(); - return s; + s << p.get_name(); + return s; } #define TLM_DECLARE_EXTENDED_PHASE(name_arg) \ - static class SC_CONCAT_HELPER_(tlm_phase_, name_arg) \ - : public ::tlm::tlm_phase \ - { \ +static class SC_CONCAT_HELPER_(tlm_phase_, name_arg) : \ + public ::tlm::tlm_phase \ +{ \ typedef SC_CONCAT_HELPER_(tlm_phase_, name_arg) this_type; \ public: \ - SC_CONCAT_HELPER_(tlm_phase_, name_arg)() /* register extended phase */ \ - : ::tlm::tlm_phase( typeid(*this), SC_STRINGIFY_HELPER_(name_arg) ) \ + SC_CONCAT_HELPER_(tlm_phase_, name_arg)() : \ + /* register extended phase */ \ + ::tlm::tlm_phase(typeid(*this), SC_STRINGIFY_HELPER_(name_arg)) \ {} \ \ - static const this_type& get_phase() /* needed only for IEEE 1666-2011 */ \ - { static this_type this_; return this_; } \ - } \ - const name_arg + static const this_type &get_phase() \ + /* needed only for IEEE 1666-2011 */ \ + { \ + static this_type this_; \ + return this_; \ + } \ +} const name_arg // for backwards-compatibility -#define DECLARE_EXTENDED_PHASE( NameArg ) \ - TLM_DECLARE_EXTENDED_PHASE( NameArg ) +#define DECLARE_EXTENDED_PHASE(NameArg) TLM_DECLARE_EXTENDED_PHASE(NameArg) } // namespace tlm -#endif /* TLM_CORE_TLM2_TLM_PHASE_H_INCLUDED_ */ -// Taf! +#undef SC_CONCAT_HELPER_ +#undef SC_CONCAT_HELPER_DEFERRED_ +#undef SC_CONCAT_HELPER_MORE_DEFERRED_ + +#undef SC_STRINGIFY_HELPER_ +#undef SC_STRINGIFY_HELPER_DEFERRED_ +#undef SC_STRINGIFY_HELPER_MORE_DEFERRED_ + +#endif /* __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_GENERIC_PAYLOAD_TLM_PHASE_H__ */ diff --git a/src/systemc/ext/tlm_core/tlm_2/tlm_quantum/tlm_global_quantum.h b/src/systemc/ext/tlm_core/tlm_2/tlm_quantum/tlm_global_quantum.h index 5c08acf28..74ae57aa5 100644 --- a/src/systemc/ext/tlm_core/tlm_2/tlm_quantum/tlm_global_quantum.h +++ b/src/systemc/ext/tlm_core/tlm_2/tlm_quantum/tlm_global_quantum.h @@ -17,12 +17,13 @@ *****************************************************************************/ -#ifndef TLM_CORE_TLM2_TLM_GLOBAL_QUANTUM_H_INCLUDED_ -#define TLM_CORE_TLM2_TLM_GLOBAL_QUANTUM_H_INCLUDED_ +#ifndef __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_QUANTUM_TLM_GLOBAL_QUANTUM_H__ +#define __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_QUANTUM_TLM_GLOBAL_QUANTUM_H__ -#include "sysc/kernel/sc_time.h" +#include -namespace tlm { +namespace tlm +{ // // tlm_global_quantum class @@ -38,45 +39,38 @@ namespace tlm { // the global quantum is set. // -class SC_API tlm_global_quantum +class tlm_global_quantum { -public: - // - // Returns a reference to the tlm_global_quantum singleton - // - static tlm_global_quantum& instance(); - -public: - - // - // Setter/getter for the global quantum - // - void set(const sc_core::sc_time& t) - { - m_global_quantum = t; - } - - const sc_core::sc_time& get() const - { - return m_global_quantum; - } - - // - // This function will calculate the maximum value for the next local - // quantum for an initiator. All initiators should synchronize on - // integer multiples of the global quantum value. The value for the - // local quantum of an initiator can be smaller, but should never be - // greater than the value returned by this method. - // - sc_core::sc_time compute_local_quantum(); - -protected: - tlm_global_quantum(); - -protected: - sc_core::sc_time m_global_quantum; + public: + // + // Returns a reference to the tlm_global_quantum singleton + // + static tlm_global_quantum &instance(); + + public: + + // + // Setter/getter for the global quantum + // + void set(const sc_core::sc_time &t) { m_global_quantum = t; } + const sc_core::sc_time &get() const { return m_global_quantum; } + + // + // This function will calculate the maximum value for the next local + // quantum for an initiator. All initiators should synchronize on + // integer multiples of the global quantum value. The value for the + // local quantum of an initiator can be smaller, but should never be + // greater than the value returned by this method. + // + sc_core::sc_time compute_local_quantum(); + + protected: + tlm_global_quantum(); + + protected: + sc_core::sc_time m_global_quantum; }; } // namespace tlm -#endif // TLM_CORE_TLM2_TLM_GLOBAL_QUANTUM_H_INCLUDED_ +#endif /* __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_QUANTUM_TLM_GLOBAL_QUANTUM_H__ */ diff --git a/src/systemc/ext/tlm_core/tlm_2/tlm_quantum/tlm_quantum.h b/src/systemc/ext/tlm_core/tlm_2/tlm_quantum/tlm_quantum.h index f06a4633a..dc7fdc296 100644 --- a/src/systemc/ext/tlm_core/tlm_2/tlm_quantum/tlm_quantum.h +++ b/src/systemc/ext/tlm_core/tlm_2/tlm_quantum/tlm_quantum.h @@ -17,9 +17,9 @@ *****************************************************************************/ -#ifndef TLM_CORE_TLM2_TLM_QUANTUM_H_INCLUDED_ -#define TLM_CORE_TLM2_TLM_QUANTUM_H_INCLUDED_ +#ifndef ____SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_QUANTUM_TLM_QUANTUM_H__ +#define ____SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_QUANTUM_TLM_QUANTUM_H__ #include "tlm_core/tlm_2/tlm_quantum/tlm_global_quantum.h" -#endif // TLM_CORE_TLM2_TLM_QUANTUM_H_INCLUDED_ +#endif /* ____SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_QUANTUM_TLM_QUANTUM_H__ */ diff --git a/src/systemc/ext/tlm_core/tlm_2/tlm_sockets/tlm_base_socket_if.h b/src/systemc/ext/tlm_core/tlm_2/tlm_sockets/tlm_base_socket_if.h index c847835d7..5dcd40129 100644 --- a/src/systemc/ext/tlm_core/tlm_2/tlm_sockets/tlm_base_socket_if.h +++ b/src/systemc/ext/tlm_core/tlm_2/tlm_sockets/tlm_base_socket_if.h @@ -17,12 +17,13 @@ *****************************************************************************/ -#ifndef TLM_CORE_TLM_BASE_SOCKET_IF_H_INCLUDED_ -#define TLM_CORE_TLM_BASE_SOCKET_IF_H_INCLUDED_ +#ifndef __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_SOCKETS_TLM_BASE_SOCKET_IF_H__ +#define __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_SOCKETS_TLM_BASE_SOCKET_IF_H__ -#include "sysc/utils/sc_typeindex.h" +#include -namespace tlm { +namespace tlm +{ enum tlm_socket_category { @@ -38,19 +39,19 @@ enum tlm_socket_category class tlm_base_socket_if { -public: - virtual sc_core::sc_port_base & get_port_base() = 0; - virtual sc_core::sc_port_base const & get_port_base() const = 0; - virtual sc_core::sc_export_base & get_export_base() = 0; - virtual sc_core::sc_export_base const & get_export_base() const = 0; - virtual unsigned int get_bus_width() const = 0; - virtual sc_core::sc_type_index get_protocol_types() const = 0; - virtual tlm_socket_category get_socket_category() const = 0; - -protected: - virtual ~tlm_base_socket_if() {} + public: + virtual sc_core::sc_port_base &get_port_base() = 0; + virtual sc_core::sc_port_base const &get_port_base() const = 0; + virtual sc_core::sc_export_base &get_export_base() = 0; + virtual sc_core::sc_export_base const &get_export_base() const = 0; + virtual unsigned int get_bus_width() const = 0; + virtual sc_core::sc_type_index get_protocol_types() const = 0; + virtual tlm_socket_category get_socket_category() const = 0; + + protected: + virtual ~tlm_base_socket_if() {} }; } // namespace tlm -#endif // TLM_CORE_TLM_BASE_SOCKET_IF_H_INCLUDED_ +#endif // __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_SOCKETS_TLM_BASE_SOCKET_IF_H__ diff --git a/src/systemc/ext/tlm_core/tlm_2/tlm_sockets/tlm_initiator_socket.h b/src/systemc/ext/tlm_core/tlm_2/tlm_sockets/tlm_initiator_socket.h index b703ec210..93ed2fddb 100644 --- a/src/systemc/ext/tlm_core/tlm_2/tlm_sockets/tlm_initiator_socket.h +++ b/src/systemc/ext/tlm_core/tlm_2/tlm_sockets/tlm_initiator_socket.h @@ -17,224 +17,188 @@ *****************************************************************************/ -#ifndef TLM_CORE_TLM_INITIATOR_SOCKET_H_INCLUDED_ -#define TLM_CORE_TLM_INITIATOR_SOCKET_H_INCLUDED_ +#ifndef __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_SOCKETS_TLM_INITIATOR_SOCKET_H__ +#define __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_SOCKETS_TLM_INITIATOR_SOCKET_H__ #include "tlm_core/tlm_2/tlm_sockets/tlm_base_socket_if.h" #include "tlm_core/tlm_2/tlm_2_interfaces/tlm_fw_bw_ifs.h" -#if defined(__clang__) || \ - (defined(__GNUC__) && ((__GNUC__ * 1000 + __GNUC_MINOR__) >= 4006)) -// ignore warning about deliberately hidden "bind()" overloads -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Woverloaded-virtual" -#endif - -namespace tlm { +namespace tlm +{ -template , - typename BW_IF = tlm_bw_transport_if<> > +template , + typename BW_IF=tlm_bw_transport_if<>> class tlm_base_initiator_socket_b { -public: - virtual ~tlm_base_initiator_socket_b() {} - - virtual sc_core::sc_port_b & get_base_port() = 0; - virtual sc_core::sc_port_b const & get_base_port() const = 0; - virtual BW_IF & get_base_interface() = 0; - virtual BW_IF const & get_base_interface() const = 0; - virtual sc_core::sc_export & get_base_export() = 0; - virtual sc_core::sc_export const & get_base_export() const = 0; + public: + virtual ~tlm_base_initiator_socket_b() {} + + virtual sc_core::sc_port_b &get_base_port() = 0; + virtual sc_core::sc_port_b const &get_base_port() const = 0; + virtual BW_IF &get_base_interface() = 0; + virtual BW_IF const &get_base_interface() const = 0; + virtual sc_core::sc_export &get_base_export() = 0; + virtual sc_core::sc_export const &get_base_export() const = 0; }; +template +class tlm_base_target_socket_b; -template class tlm_base_target_socket_b; - -template class tlm_base_target_socket; - -template , - typename BW_IF = tlm_bw_transport_if<>, - int N = 1, - sc_core::sc_port_policy POL = sc_core::SC_ONE_OR_MORE_BOUND> -class tlm_base_initiator_socket : public tlm_base_socket_if, - public tlm_base_initiator_socket_b, - public sc_core::sc_port +template +class tlm_base_target_socket; + +template , + typename BW_IF=tlm_bw_transport_if<>, int N=1, + sc_core::sc_port_policy POL=sc_core::SC_ONE_OR_MORE_BOUND> +class tlm_base_initiator_socket : + public tlm_base_socket_if, + public tlm_base_initiator_socket_b, + public sc_core::sc_port { -public: - typedef FW_IF fw_interface_type; - typedef BW_IF bw_interface_type; - typedef sc_core::sc_port port_type; - - typedef sc_core::sc_export export_type; - - typedef tlm_base_target_socket_b base_target_socket_type; - typedef tlm_base_initiator_socket_b base_type; - - template - friend class tlm_base_target_socket; - -public: - tlm_base_initiator_socket() - : port_type(sc_core::sc_gen_unique_name("tlm_base_initiator_socket")) - , m_export(sc_core::sc_gen_unique_name("tlm_base_initiator_socket_export")) - { - } - - explicit tlm_base_initiator_socket(const char* name) - : port_type(name) - , m_export(sc_core::sc_gen_unique_name((std::string(name) + "_export").c_str())) - { - } - - virtual const char* kind() const - { - return "tlm_base_initiator_socket"; - } - - // - // Bind initiator socket to target socket - // - Binds the port of the initiator socket to the export of the target - // socket - // - Binds the port of the target socket to the export of the initiator - // socket - // - virtual void bind(base_target_socket_type& s) - { - // initiator.port -> target.export - (get_base_port())(s.get_base_interface()); - // target.port -> initiator.export - (s.get_base_port())(get_base_interface()); - } - - void operator() (base_target_socket_type& s) - { - bind(s); - } - - // - // Bind initiator socket to initiator socket (hierarchical bind) - // - Binds both the export and the port - // - virtual void bind(base_type& s) - { - // port - (get_base_port())(s.get_base_port()); - // export - (s.get_base_export())(get_base_export()); - } - - void operator() (base_type& s) - { - bind(s); - } - - // - // Bind interface to socket - // - Binds the interface to the export of this socket - // - virtual void bind(bw_interface_type& ifs) - { - (get_base_export())(ifs); - } - - void operator() (bw_interface_type& s) - { - bind(s); - } - - // Implementation of tlm_base_socket_if functions - virtual sc_core::sc_port_base & get_port_base() - { return *this; } - virtual sc_core::sc_port_base const & get_port_base() const - { return *this; } - virtual sc_core::sc_export_base & get_export_base() - { return m_export; } - virtual sc_core::sc_export_base const & get_export_base() const - { return m_export; } - virtual unsigned int get_bus_width() const - { return BUSWIDTH; } - virtual tlm_socket_category get_socket_category() const - { return TLM_INITIATOR_SOCKET; } - - // Implementation of tlm_base_target_socket_b functions - virtual sc_core::sc_port_b & get_base_port() - { return *this; } - virtual sc_core::sc_port_b const & get_base_port() const - { return *this; } - - virtual BW_IF & get_base_interface() - { return m_export; } - virtual BW_IF const & get_base_interface() const - { return m_export; } - - virtual sc_core::sc_export & get_base_export() - { return m_export; } - virtual sc_core::sc_export const & get_base_export() const - { return m_export; } - -protected: - export_type m_export; + public: + typedef FW_IF fw_interface_type; + typedef BW_IF bw_interface_type; + typedef sc_core::sc_port port_type; + + typedef sc_core::sc_export export_type; + + typedef tlm_base_target_socket_b< + BUSWIDTH, fw_interface_type, bw_interface_type> + base_target_socket_type; + typedef tlm_base_initiator_socket_b< + BUSWIDTH, fw_interface_type, bw_interface_type> base_type; + + template + friend class tlm_base_target_socket; + + public: + tlm_base_initiator_socket() : + port_type(sc_core::sc_gen_unique_name("tlm_base_initiator_socket")), + m_export(sc_core::sc_gen_unique_name( + "tlm_base_initiator_socket_export")) + {} + + explicit tlm_base_initiator_socket(const char *name) : port_type(name), + m_export(sc_core::sc_gen_unique_name( + (std::string(name) + "_export").c_str())) + {} + + virtual const char* kind() const { return "tlm_base_initiator_socket"; } + + // + // Bind initiator socket to target socket + // - Binds the port of the initiator socket to the export of the target + // socket + // - Binds the port of the target socket to the export of the initiator + // socket + // + virtual void + bind(base_target_socket_type &s) + { + // initiator.port -> target.export + (get_base_port())(s.get_base_interface()); + // target.port -> initiator.export + (s.get_base_port())(get_base_interface()); + } + + void operator () (base_target_socket_type &s) { bind(s); } + + // + // Bind initiator socket to initiator socket (hierarchical bind) + // - Binds both the export and the port + // + virtual void + bind(base_type &s) + { + // port + (get_base_port())(s.get_base_port()); + // export + (s.get_base_export())(get_base_export()); + } + + void operator() (base_type &s) { bind(s); } + + // + // Bind interface to socket + // - Binds the interface to the export of this socket + // + virtual void bind(bw_interface_type &ifs) { (get_base_export())(ifs); } + void operator() (bw_interface_type &s) { bind(s); } + + // Implementation of tlm_base_socket_if functions + virtual sc_core::sc_port_base &get_port_base() { return *this; } + virtual sc_core::sc_port_base const & + get_port_base() const + { + return *this; + } + virtual sc_core::sc_export_base &get_export_base() { return m_export; } + virtual sc_core::sc_export_base const & + get_export_base() const + { + return m_export; + } + virtual unsigned int get_bus_width() const { return BUSWIDTH; } + virtual tlm_socket_category + get_socket_category() const + { + return TLM_INITIATOR_SOCKET; + } + + // Implementation of tlm_base_target_socket_b functions + virtual sc_core::sc_port_b &get_base_port() { return *this; } + virtual sc_core::sc_port_b const & + get_base_port() const + { + return *this; + } + + virtual BW_IF &get_base_interface() { return m_export; } + virtual BW_IF const &get_base_interface() const { return m_export; } + + virtual sc_core::sc_export &get_base_export() { return m_export; } + virtual sc_core::sc_export const & + get_base_export() const + { + return m_export; + } + + protected: + export_type m_export; }; // // Convenience socket classes // -template -class tlm_initiator_socket : - public tlm_base_initiator_socket, - tlm_bw_transport_if, - N, POL> +template +class tlm_initiator_socket : public tlm_base_initiator_socket< + BUSWIDTH, tlm_fw_transport_if, + tlm_bw_transport_if, N, POL> { -public: - tlm_initiator_socket() : - tlm_base_initiator_socket, - tlm_bw_transport_if, - N, POL>() - { - } - - explicit tlm_initiator_socket(const char* name) : - tlm_base_initiator_socket, - tlm_bw_transport_if, - N, POL>(name) - { - } - - virtual const char* kind() const - { - return "tlm_initiator_socket"; - } - - virtual sc_core::sc_type_index get_protocol_types() const - { - return typeid(TYPES); - } + public: + tlm_initiator_socket() : tlm_base_initiator_socket< + BUSWIDTH, tlm_fw_transport_if, + tlm_bw_transport_if, N, POL>() + {} + + explicit tlm_initiator_socket(const char *name) : + tlm_base_initiator_socket, + tlm_bw_transport_if, N, POL>(name) + {} + + virtual const char *kind() const { return "tlm_initiator_socket"; } + + virtual sc_core::sc_type_index + get_protocol_types() const + { + return typeid(TYPES); + } }; } // namespace tlm -#if defined(__clang__) || \ - (defined(__GNUC__) && ((__GNUC__ * 1000 + __GNUC_MINOR__) >= 4006)) -#pragma GCC diagnostic pop -#endif - -#endif // TLM_CORE_TLM_INITIATOR_SOCKET_H_INCLUDED_ +#endif /* __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_SOCKETS_TLM_INITIATOR_SOCKET_H__ */ diff --git a/src/systemc/ext/tlm_core/tlm_2/tlm_sockets/tlm_sockets.h b/src/systemc/ext/tlm_core/tlm_2/tlm_sockets/tlm_sockets.h index 013e29286..75697292b 100644 --- a/src/systemc/ext/tlm_core/tlm_2/tlm_sockets/tlm_sockets.h +++ b/src/systemc/ext/tlm_core/tlm_2/tlm_sockets/tlm_sockets.h @@ -17,10 +17,10 @@ *****************************************************************************/ -#ifndef __TLM_SOCKETS_H__ -#define __TLM_SOCKETS_H__ +#ifndef __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_SOCKETS_TLM_SOCKETS_H__ +#define __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_SOCKETS_TLM_SOCKETS_H__ #include "tlm_core/tlm_2/tlm_sockets/tlm_initiator_socket.h" #include "tlm_core/tlm_2/tlm_sockets/tlm_target_socket.h" -#endif /* __TLM_SOCKETS_H__ */ +#endif /* __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_SOCKETS_TLM_SOCKETS_H__ */ diff --git a/src/systemc/ext/tlm_core/tlm_2/tlm_sockets/tlm_target_socket.h b/src/systemc/ext/tlm_core/tlm_2/tlm_sockets/tlm_target_socket.h index 030643294..ba0fcc207 100644 --- a/src/systemc/ext/tlm_core/tlm_2/tlm_sockets/tlm_target_socket.h +++ b/src/systemc/ext/tlm_core/tlm_2/tlm_sockets/tlm_target_socket.h @@ -17,239 +17,207 @@ *****************************************************************************/ -#ifndef TLM_CORE_TLM_TARGET_SOCKET_H_INCLUDED_ -#define TLM_CORE_TLM_TARGET_SOCKET_H_INCLUDED_ +#ifndef __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_SOCKETS_TLM_TARGET_SOCKET_H__ +#define __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_SOCKETS_TLM_TARGET_SOCKET_H__ #include "tlm_core/tlm_2/tlm_sockets/tlm_base_socket_if.h" #include "tlm_core/tlm_2/tlm_2_interfaces/tlm_fw_bw_ifs.h" +namespace tlm +{ -namespace tlm { - -template , - typename BW_IF = tlm_bw_transport_if<> > +template , + typename BW_IF=tlm_bw_transport_if<>> class tlm_base_target_socket_b { -public: - virtual ~tlm_base_target_socket_b() {} + public: + virtual ~tlm_base_target_socket_b() {} - virtual sc_core::sc_port_b & get_base_port() = 0; - virtual sc_core::sc_export & get_base_export() = 0; - virtual FW_IF & get_base_interface() = 0; + virtual sc_core::sc_port_b &get_base_port() = 0; + virtual sc_core::sc_export &get_base_export() = 0; + virtual FW_IF &get_base_interface() = 0; }; -template class tlm_base_initiator_socket_b; - -template class tlm_base_initiator_socket; - -template , - typename BW_IF = tlm_bw_transport_if<>, - int N = 1, - sc_core::sc_port_policy POL = sc_core::SC_ONE_OR_MORE_BOUND> -class tlm_base_target_socket : public tlm_base_socket_if, - public tlm_base_target_socket_b, - public sc_core::sc_export +template +class tlm_base_initiator_socket_b; + +template +class tlm_base_initiator_socket; + +template , + typename BW_IF=tlm_bw_transport_if<>, int N=1, + sc_core::sc_port_policy POL=sc_core::SC_ONE_OR_MORE_BOUND> +class tlm_base_target_socket : + public tlm_base_socket_if, + public tlm_base_target_socket_b, + public sc_core::sc_export { -public: - typedef FW_IF fw_interface_type; - typedef BW_IF bw_interface_type; - typedef sc_core::sc_port port_type; - - typedef sc_core::sc_export export_type; - typedef tlm_base_initiator_socket_b base_initiator_socket_type; - - typedef tlm_base_target_socket_b base_type; - - template - friend class tlm_base_initiator_socket; - -public: - tlm_base_target_socket() - : export_type(sc_core::sc_gen_unique_name("tlm_base_target_socket")) - , m_port(sc_core::sc_gen_unique_name("tlm_base_target_socket_port")) - { - } - - explicit tlm_base_target_socket(const char* name) - : export_type(name) - , m_port(sc_core::sc_gen_unique_name((std::string(name) + "_port").c_str())) - { - } - - virtual const char* kind() const - { - return "tlm_base_target_socket"; - } - - // - // Bind target socket to initiator socket - // - Binds the port of the initiator socket to the export of the target - // socket - // - Binds the port of the target socket to the export of the initiator - // socket - // - virtual void bind(base_initiator_socket_type& s) - { - // initiator.port -> target.export - (s.get_base_port())(get_base_interface()); - // target.port -> initiator.export - get_base_port()(s.get_base_interface()); - } - - void operator() (base_initiator_socket_type& s) - { - bind(s); - } - - // - // Bind target socket to target socket (hierarchical bind) - // - Binds both the export and the port - // - virtual void bind(base_type& s) - { - // export - (get_base_export())(s.get_base_export()); - // port - (s.get_base_port())(get_base_port()); - } - - void operator() (base_type& s) - { - bind(s); - } - - // - // Bind interface to socket - // - Binds the interface to the export - // - virtual void bind(fw_interface_type& ifs) - { - export_type* exp = &get_base_export(); - if( this == exp ) { - export_type::bind( ifs ); // non-virtual function call - } else { - exp->bind( ifs ); + public: + typedef FW_IF fw_interface_type; + typedef BW_IF bw_interface_type; + typedef sc_core::sc_port port_type; + + typedef sc_core::sc_export export_type; + typedef tlm_base_initiator_socket_b< + BUSWIDTH, fw_interface_type, bw_interface_type> + base_initiator_socket_type; + + typedef tlm_base_target_socket_b< + BUSWIDTH, fw_interface_type, bw_interface_type> base_type; + + template + friend class tlm_base_initiator_socket; + + public: + tlm_base_target_socket() : + export_type(sc_core::sc_gen_unique_name("tlm_base_target_socket")), + m_port(sc_core::sc_gen_unique_name("tlm_base_target_socket_port")) + {} + + explicit tlm_base_target_socket(const char *name) : + export_type(name), m_port(sc_core::sc_gen_unique_name( + (std::string(name) + "_port").c_str())) + {} + + virtual const char *kind() const { return "tlm_base_target_socket"; } + + // + // Bind target socket to initiator socket + // - Binds the port of the initiator socket to the export of the target + // socket + // - Binds the port of the target socket to the export of the initiator + // socket + // + virtual void + bind(base_initiator_socket_type &s) + { + // initiator.port -> target.export + (s.get_base_port())(get_base_interface()); + // target.port -> initiator.export + get_base_port()(s.get_base_interface()); } - } - - void operator() (fw_interface_type& s) - { - bind(s); - } - - // - // Forward to 'size()' of port class - // - int size() const - { - return m_port.size(); - } - - // - // Forward to 'operator->()' of port class - // - bw_interface_type* operator->() - { - return m_port.operator->(); - } - - // - // Forward to 'operator[]()' of port class - // - bw_interface_type* operator[](int i) - { - return m_port.operator[](i); - } - - // Implementation of tlm_base_socket_if functions - virtual sc_core::sc_port_base & get_port_base() - { return m_port; } - virtual sc_core::sc_port_base const & get_port_base() const - { return m_port; } - virtual sc_core::sc_export_base & get_export_base() - { return *this; } - virtual sc_core::sc_export_base const & get_export_base() const - { return *this; } - virtual unsigned int get_bus_width() const - { return BUSWIDTH; } - virtual tlm_socket_category get_socket_category() const - { return TLM_TARGET_SOCKET; } - - // Implementation of tlm_base_target_socket_b functions - virtual sc_core::sc_port_b & get_base_port() - { return m_port; } - virtual sc_core::sc_port_b const & get_base_port() const - { return m_port; } - - virtual FW_IF & get_base_interface() - { return *this; } - virtual FW_IF const & get_base_interface() const - { return *this; } - - virtual sc_core::sc_export & get_base_export() - { return *this; } - virtual sc_core::sc_export const & get_base_export() const - { return *this; } - -protected: - port_type m_port; -}; + void operator () (base_initiator_socket_type &s) { bind(s); } + + // + // Bind target socket to target socket (hierarchical bind) + // - Binds both the export and the port + // + virtual void + bind(base_type &s) + { + // export + (get_base_export())(s.get_base_export()); + // port + (s.get_base_port())(get_base_port()); + } -// -// Convenience blocking and non-blocking socket classes -// + void operator () (base_type &s) { bind(s); } + + // + // Bind interface to socket + // - Binds the interface to the export + // + virtual void + bind(fw_interface_type &ifs) + { + export_type *exp = &get_base_export(); + if (this == exp) { + export_type::bind(ifs); + } else { + exp->bind( ifs ); + } + } -template + void operator () (fw_interface_type &s) { bind(s); } + + // + // Forward to 'size()' of port class. + // + int size() const { return m_port.size(); } + + // + // Forward to 'operator->()' of port class. + // + bw_interface_type *operator->() { return m_port.operator->(); } + + // + // Forward to 'operator[]()' of port class. + // + bw_interface_type *operator[](int i) { return m_port.operator[](i); } + + // Implementation of tlm_base_socket_if functions. + virtual sc_core::sc_port_base &get_port_base() { return m_port; } + virtual sc_core::sc_port_base const & + get_port_base() const + { + return m_port; + } + virtual sc_core::sc_export_base &get_export_base() { return *this; } + virtual sc_core::sc_export_base const & + get_export_base() const + { + return *this; + } + virtual unsigned int get_bus_width() const { return BUSWIDTH; } + virtual tlm_socket_category + get_socket_category() const + { + return TLM_TARGET_SOCKET; + } + + // Implementation of tlm_base_target_socket_b functions + virtual sc_core::sc_port_b &get_base_port() { return m_port; } + virtual sc_core::sc_port_b const & + get_base_port() const + { + return m_port; + } + + virtual FW_IF &get_base_interface() { return *this; } + virtual FW_IF const &get_base_interface() const { return *this; } + + virtual sc_core::sc_export &get_base_export() { return *this; } + virtual sc_core::sc_export const & + get_base_export() const + { + return *this; + } + + protected: + port_type m_port; +}; + +template class tlm_target_socket : - public tlm_base_target_socket , - tlm_bw_transport_if, - N, POL> + public tlm_base_target_socket< + BUSWIDTH, tlm_fw_transport_if, + tlm_bw_transport_if, N, POL> { -public: - tlm_target_socket() : - tlm_base_target_socket, - tlm_bw_transport_if, - N, POL>() - { - } - - explicit tlm_target_socket(const char* name) : - tlm_base_target_socket, - tlm_bw_transport_if, - N, POL>(name) - { - } - - virtual const char* kind() const - { - return "tlm_target_socket"; - } - - virtual sc_core::sc_type_index get_protocol_types() const - { - return typeid(TYPES); - } + public: + tlm_target_socket() : + tlm_base_target_socket< + BUSWIDTH, tlm_fw_transport_if, + tlm_bw_transport_if, N, POL>() + {} + + explicit tlm_target_socket(const char *name) : + tlm_base_target_socket< + BUSWIDTH, tlm_fw_transport_if, + tlm_bw_transport_if, N, POL>(name) + {} + + virtual const char* kind() const { return "tlm_target_socket"; } + + virtual sc_core::sc_type_index + get_protocol_types() const + { + return typeid(TYPES); + } }; } // namespace tlm -#endif // TLM_CORE_TLM_TARGET_SOCKET_H_INCLUDED_ +#endif /* __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_SOCKETS_TLM_TARGET_SOCKET_H__ */ diff --git a/src/systemc/ext/tlm_core/tlm_2/tlm_version.h b/src/systemc/ext/tlm_core/tlm_2/tlm_version.h index 3cf230077..36c36debe 100644 --- a/src/systemc/ext/tlm_core/tlm_2/tlm_version.h +++ b/src/systemc/ext/tlm_core/tlm_2/tlm_version.h @@ -17,20 +17,16 @@ *****************************************************************************/ -/* --------------------------------------------------------------------------------------- - @file tlm_version.h - - @brief TLM version header - +/* --------------------------------------------------------------------------- Original Author: Charles Wilson, XtremeEDA Corporation @description - This header contains preprocessor and compiler symbols to allow for the determination - of the TLM version information. This conforms to IEEE 1666-2005 section 8.5.5 - 8.5.7 - . + This header contains preprocessor and compiler symbols to allow for the + determination of the TLM version information. This conforms to + IEEE 1666-2005 section 8.5.5 - 8.5.7 The following are provided: - . + preprocessor: TLM_VERSION_MAJOR numeric TLM_VERSION_MINOR numeric TLM_VERSION_PATCH numeric @@ -40,7 +36,7 @@ TLM_IS_PRERELEASE bool (1,0) TLM_VERSION string {2.0.0_DR3-TLMWG} TLM_COPYRIGHT string - . + compiler: tlm_version_major const unsigned int tlm_version_minor const unsigned int tlm_version_patch const unsigned int @@ -50,131 +46,110 @@ tlm_is_prerelease const bool tlm_version const string tlm_copyright const string - . + accessors: inline const char* tlm_release (void) inline const char* tlm_version (void) inline const char* tlm_copyright (void) +--------------------------------------------------------------------------- */ ---------------------------------------------------------------------------------------- */ - -#ifndef __TLM_VERSION_H__ -#define __TLM_VERSION_H__ +#ifndef __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_VERSION_H__ +#define __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_VERSION_H__ namespace tlm { -#define TLM_VERSION_MAJOR 2 ///< version major level ( numeric ) -#define TLM_VERSION_MINOR 0 ///< version minor level ( numeric ) -#define TLM_VERSION_PATCH 4 ///< version patch level ( numeric ) -#define TLM_VERSION_ORIGINATOR "Accellera" ///< TLM creator string -#define TLM_VERSION_SEPARATOR "." ///< version string separator +#define TLM_VERSION_MAJOR 2 ///< version major level ( numeric ) +#define TLM_VERSION_MINOR 0 ///< version minor level ( numeric ) +#define TLM_VERSION_PATCH 4 ///< version patch level ( numeric ) +#define TLM_VERSION_ORIGINATOR "Accellera" ///< TLM creator string +#define TLM_VERSION_SEPARATOR "." ///< version string separator -#define TLM_IS_PRERELEASE 0 ///< pre-release flag ( 1 / 0 ) +#define TLM_IS_PRERELEASE 0 ///< pre-release flag (1/0) #if TLM_IS_PRERELEASE -# define TLM_VERSION_PRERELEASE "pub_rev" ///< pre-release version string +# define TLM_VERSION_PRERELEASE "pub_rev" ///< pre-release version string #else -# define TLM_VERSION_PRERELEASE "" ///< pre-release version string +# define TLM_VERSION_PRERELEASE "" ///< pre-release version string #endif -#define TLM_VERSION_RELEASE_YEAR "2017" ///< release year ( YYYY ) -#define TLM_VERSION_RELEASE_MONTH "10" ///< release month ( MM ) -#define TLM_VERSION_RELEASE_DAY "12" ///< release day ( DD ) +#define TLM_VERSION_RELEASE_YEAR "2017" ///< release year ( YYYY ) +#define TLM_VERSION_RELEASE_MONTH "10" ///< release month ( MM ) +#define TLM_VERSION_RELEASE_DAY "12" ///< release day ( DD ) #define TLM_COPYRIGHT \ "Copyright (c) 1996-" TLM_VERSION_RELEASE_YEAR " by all Contributors\n" \ "ALL RIGHTS RESERVED" -/************************** do not modify below this line *******************************/ +/******************** do not modify below this line *************************/ -/******************************* preprocessor symbols ***********************************/ +/************************* preprocessor symbols *****************************/ -#define TLM_VERSION_RELEASE_DATE TLM_VERSION_RELEASE_YEAR \ - TLM_VERSION_RELEASE_MONTH \ - TLM_VERSION_RELEASE_DAY +#define TLM_VERSION_RELEASE_DATE TLM_VERSION_RELEASE_YEAR \ + TLM_VERSION_RELEASE_MONTH \ + TLM_VERSION_RELEASE_DAY -#define TLM_VERSION_STR(x) TLM_VERSION_STR_HELPER(x) -#define TLM_VERSION_STR_HELPER(x) #x +#define TLM_VERSION_STR(x) TLM_VERSION_STR_HELPER(x) +#define TLM_VERSION_STR_HELPER(x) #x -#define TLM_VERSION_STRING_MAJOR TLM_VERSION_STR(TLM_VERSION_MAJOR) -#define TLM_VERSION_STRING_MINOR TLM_VERSION_STR(TLM_VERSION_MINOR) -#define TLM_VERSION_STRING_PATCH TLM_VERSION_STR(TLM_VERSION_PATCH) +#define TLM_VERSION_STRING_MAJOR TLM_VERSION_STR(TLM_VERSION_MAJOR) +#define TLM_VERSION_STRING_MINOR TLM_VERSION_STR(TLM_VERSION_MINOR) +#define TLM_VERSION_STRING_PATCH TLM_VERSION_STR(TLM_VERSION_PATCH) -#define TLM_VERSION_STRING_MMP TLM_VERSION_STRING_MAJOR TLM_VERSION_SEPARATOR \ - TLM_VERSION_STRING_MINOR TLM_VERSION_SEPARATOR \ - TLM_VERSION_STRING_PATCH +#define TLM_VERSION_STRING_MMP TLM_VERSION_STRING_MAJOR TLM_VERSION_SEPARATOR \ + TLM_VERSION_STRING_MINOR TLM_VERSION_SEPARATOR \ + TLM_VERSION_STRING_PATCH -#define TLM_VERSION_STRING_PRE_START "_" -#define TLM_VERSION_STRING_PRE_END "-" +#define TLM_VERSION_STRING_PRE_START "_" +#define TLM_VERSION_STRING_PRE_END "-" -#if ( TLM_IS_PRERELEASE == 1 ) +#if (TLM_IS_PRERELEASE == 1) -#define TLM_VERSION_STRING_PRERELEASE TLM_VERSION_PRERELEASE -#define TLM_VERSION_STRING_RELEASE_DATE "" +# define TLM_VERSION_STRING_PRERELEASE TLM_VERSION_PRERELEASE +# define TLM_VERSION_STRING_RELEASE_DATE "" -#else /* TLM_IS_PRERELEASE == 1 */ +#else /* TLM_IS_PRERELEASE == 1 */ -#define TLM_VERSION_STRING_PRERELEASE "" -#define TLM_VERSION_STRING_RELEASE_DATE TLM_VERSION_RELEASE_DATE +# define TLM_VERSION_STRING_PRERELEASE "" +# define TLM_VERSION_STRING_RELEASE_DATE TLM_VERSION_RELEASE_DATE -#endif /* TLM_IS_PRERELEASE == 1 */ +#endif /* TLM_IS_PRERELEASE == 1 */ -#define TLM_VERSION_STRING TLM_VERSION_STRING_MMP \ - TLM_VERSION_STRING_PRE_START \ - TLM_VERSION_STRING_PRERELEASE \ - TLM_VERSION_STRING_PRE_END \ - TLM_VERSION_ORIGINATOR +#define TLM_VERSION_STRING TLM_VERSION_STRING_MMP \ + TLM_VERSION_STRING_PRE_START \ + TLM_VERSION_STRING_PRERELEASE \ + TLM_VERSION_STRING_PRE_END \ + TLM_VERSION_ORIGINATOR -#define TLM_VERSION_STRING_2 "TLM " \ - TLM_VERSION_STRING_MMP \ - " --- " \ - TLM_VERSION_RELEASE_YEAR \ - "-" \ - TLM_VERSION_RELEASE_MONTH \ - "-" \ - TLM_VERSION_RELEASE_DAY +#define TLM_VERSION_STRING_2 "TLM " \ + TLM_VERSION_STRING_MMP \ + " --- " \ + TLM_VERSION_RELEASE_YEAR \ + "-" \ + TLM_VERSION_RELEASE_MONTH \ + "-" \ + TLM_VERSION_RELEASE_DAY -#define TLM_VERSION TLM_VERSION_STRING +#define TLM_VERSION TLM_VERSION_STRING -/********************************* compiler symbols **************************************/ +/*************************** compiler symbols ********************************/ -const unsigned int tlm_version_major ( TLM_VERSION_MAJOR ); -const unsigned int tlm_version_minor ( TLM_VERSION_MINOR ); -const unsigned int tlm_version_patch ( TLM_VERSION_PATCH ); +const unsigned int tlm_version_major(TLM_VERSION_MAJOR); +const unsigned int tlm_version_minor(TLM_VERSION_MINOR); +const unsigned int tlm_version_patch(TLM_VERSION_PATCH); -const bool tlm_is_prerelease ( TLM_IS_PRERELEASE ); +const bool tlm_is_prerelease(TLM_IS_PRERELEASE); -const std::string tlm_version_string ( TLM_VERSION_STRING ); -const std::string tlm_version_originator ( TLM_VERSION_ORIGINATOR ); -const std::string tlm_version_prerelease ( TLM_VERSION_PRERELEASE ); -const std::string tlm_version_release_date ( TLM_VERSION_STRING_RELEASE_DATE ); -const std::string tlm_copyright_string ( TLM_COPYRIGHT ); -const std::string tlm_version_string_2 ( TLM_VERSION_STRING_2 ); +const std::string tlm_version_string(TLM_VERSION_STRING); +const std::string tlm_version_originator(TLM_VERSION_ORIGINATOR); +const std::string tlm_version_prerelease(TLM_VERSION_PRERELEASE); +const std::string tlm_version_release_date(TLM_VERSION_STRING_RELEASE_DATE); +const std::string tlm_copyright_string(TLM_COPYRIGHT); +const std::string tlm_version_string_2(TLM_VERSION_STRING_2); -inline const char* -tlm_release -( void -) -{ - return tlm_version_string.c_str (); -} - -inline const char* -tlm_version -( void -) -{ - return tlm_version_string_2.c_str (); -} - -inline const char* -tlm_copyright -( void -) -{ - return tlm_copyright_string.c_str (); -} +inline const char *tlm_release() { return tlm_version_string.c_str(); } +inline const char *tlm_version() { return tlm_version_string_2.c_str(); } +inline const char *tlm_copyright() { return tlm_copyright_string.c_str(); } } // namespace tlm -#endif /* __TLM_VERSION_H__ */ +#endif /* __SYSTEMC_EXT_TLM_CORE_TLM_2_TLM_VERSION_H__ */ -- cgit v1.2.3