⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 packet.h

📁 SystemC可以由C语言直接开发硬件
💻 H
字号:
/************************************************************************
 * file name:	packet.h
 * description:	test file.
 * modification history
 * --------------------
 * 2003-5-2 16:40:21, created by zhuwei
 */ 

#ifndef _PACKET_H
#define _PACKET_H

/* includes----------------------------------------------------------- */
#include "systemc.h"

/* defines------------------------------------------------------------ */
/* typedefs----------------------------------------------------------- */
struct packet_type 
{
	long info;
	int seq;
	int retry;

	inline bool operator == (const packet_type& rhs) const
	{
		return (rhs.info == info && rhs.seq == seq &&
			rhs.retry == retry);
	}
/*-------------------zhuwei add(2003-5-3 10:20:34)--------------------*/

	/* Remember to provide all the operators when you defined your packet_type,
	 * or you will get an error: "error C2679: binary '<<' : no operator defined 
	 * which takes a right-hand operand of type 'const struct packet_type' (or 
	 * there is no acceptable conversion) "
	 */

    inline packet_type& operator = (const packet_type& rhs) 
	{
		info = rhs.info;
		seq = rhs.seq;
		retry = rhs.retry;
		return *this;
    }


/*
    inline friend void sc_trace(sc_trace_file *tf, const packet_type & v,
    const sc_string& NAME ) 
	{
		sc_trace(tf,v.info, NAME + ".info");
		sc_trace(tf,v.seq, NAME + ".seq");
		sc_trace(tf,v.retry, NAME + ".retry");
    }
*/
    inline friend ostream& operator << ( ostream& os,  packet_type const & v ) 
	{
		os << v.info << "." << v.seq << "." << v.retry;
		return os;
    }
/*----------------------end(2003-5-3 10:20:34)------------------------*/
};
/* externs------------------------------------------------------------ */
extern void sc_trace(sc_trace_file *tf, const packet_type& v,const sc_string& NAME);

/* globals------------------------------------------------------------ */
/* forward declarations----------------------------------------------- */

#endif /* _PACKET_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -