00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
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 }
00189
00190 #endif // RC_PORT_TRAITS_H_
00191
00192
00193
00194
00195