rc_port_traits.h

Go to the documentation of this file.
00001 // vim:set et sts=4 ts=4 tw=75 sw=4 ai ci cin cino=g0,t0:
00002 /*
00003  * Copyright (C) 2007, Technical Computer Science Group,
00004  *                     University of Bonn
00005  *
00006  * This file is part of the ReChannel library.
00007  *
00008  * The ReChannel library is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU General Public License as
00010  * published by the Free Software Foundation; either version 2 of the
00011  * License, or (at your option) any later version.
00012  *
00013  * This library is distributed in the hope that it will be
00014  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016  * General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this library; see the file COPYING. If not, write to the
00020  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
00021  * Boston, MA 02110-1301, USA.
00022  *
00023  * Authors: Andreas Raabe and Armin Felke. Implementation by Armin Felke.
00024  *          {raabe, felke}@cs.uni-bonn.de
00025  */
00043 #ifndef RC_PORT_TRAITS_H_
00044 #define RC_PORT_TRAITS_H_
00045 
00046 #include <systemc.h>
00047 #include <boost/type_traits/is_base_of.hpp>
00048 #include <boost/type_traits/is_same.hpp>
00049 
00050 #include "ReChannel/util/rc_report.h"
00051 
00052 namespace ReChannel {
00053 
00076 
00077 template<class PORT>
00078 struct rc_port_traits
00079 {
00081     RC_STATIC_ASSERT_T(
00082         port_type_validity_check,
00083         (boost::is_base_of<sc_port_base, PORT>::value
00084         && !boost::is_same<sc_port_base, PORT>::value));
00086     RC_STATIC_ASSERT_T(
00087         interface_typedef_availability_check,
00088         (boost::is_base_of<
00089             sc_interface, typename PORT::if_type>::value));
00090 
00091     typedef PORT type;
00092     typedef typename PORT::if_type if_type;
00093 };
00094 
00095 template<class IF, int N, sc_port_policy POL>
00096 struct rc_port_traits<sc_port<IF, N, POL> >
00097 {
00098     typedef sc_port<IF, N, POL> type;
00099     typedef IF if_type;
00100 };
00101 
00108 
00109 template<class T>
00110 struct rc_port_traits<sc_fifo_in<T> >
00111 {
00112     typedef sc_fifo_in<T>    type;
00113     typedef sc_fifo_in_if<T> if_type;
00114 };
00115 
00116 template<class T>
00117 struct rc_port_traits<sc_fifo_out<T> >
00118 {
00119     typedef sc_fifo_out<T>    type;
00120     typedef sc_fifo_out_if<T> if_type;
00121 };
00122 
00123 template<class T>
00124 struct rc_port_traits<sc_in<T> >
00125 {
00126     typedef sc_in<T>           type;
00127     typedef sc_signal_in_if<T> if_type;
00128 };
00129 
00130 template<class T>
00131 struct rc_port_traits<sc_inout<T> >
00132 {
00133     typedef sc_inout<T>           type;
00134     typedef sc_signal_inout_if<T> if_type;
00135 };
00136 
00137 template<class T>
00138 struct rc_port_traits<sc_out<T> >
00139 {
00140     typedef sc_out<T>           type;
00141     typedef sc_signal_out_if<T> if_type;
00142 };
00143 
00144 template<>
00145 struct rc_port_traits<sc_in_resolved>
00146 {
00147     typedef sc_in_resolved type;
00148     typedef sc_signal_in_if<sc_dt::sc_logic> if_type;
00149 };
00150 
00151 template<>
00152 struct rc_port_traits<sc_inout_resolved>
00153 {
00154     typedef sc_inout_resolved type;
00155     typedef sc_signal_inout_if<sc_dt::sc_logic> if_type;
00156 };
00157 
00158 template<>
00159 struct rc_port_traits<sc_out_resolved>
00160 {
00161     typedef sc_out_resolved type;
00162     typedef sc_signal_out_if<sc_dt::sc_logic> if_type;
00163 };
00164 
00165 template<int W>
00166 struct rc_port_traits<sc_in_rv<W> >
00167 {
00168     typedef sc_in_rv<W> type;
00169     typedef sc_signal_in_if<sc_dt::sc_lv<W> > if_type;
00170 };
00171 
00172 template<int W>
00173 struct rc_port_traits<sc_inout_rv<W> >
00174 {
00175     typedef sc_inout_rv<W> type;
00176     typedef sc_signal_inout_if<sc_dt::sc_lv<W> > if_type;
00177 };
00178 
00179 template<int W>
00180 struct rc_port_traits<sc_out_rv<W> >
00181 {
00182     typedef sc_out_rv<W> type;
00183     typedef sc_signal_out_if<sc_dt::sc_lv<W> > if_type;
00184 };
00185 
00188 } // namespace ReChannel
00189 
00190 #endif // RC_PORT_TRAITS_H_
00191 
00192 //
00193 // $Id: rc_port_traits.h,v 1.3 2007/10/09 00:22:26 felke Exp $
00194 // $Source: /var/cvs/projekte/ReChannel-v2/src/ReChannel/util/rc_port_traits.h,v $
00195 //

Generated on Tue Jan 1 23:13:40 2008 for ReChannel by  doxygen 1.5.3