mux.cpp

来自「基于4个mips核的noc设计」· C++ 代码 · 共 97 行

CPP
97
字号
/* *  TU Eindhoven *  Eindhoven, The Netherlands * *  Name            :   mux.cc * *  Author          :   Sander Stuijk (sander@ics.ele.tue.nl) * *  Date            :   July 23, 2002 * *  Function        :   Multiplexer * *  History         : *      23-07-02    :   Initial version. *      13-12-02    :   Synthesizable version A.S.Slusarczyk@tue.nl * */ #include "mux.h"void MUX2::mux_thread(){	sc_bv<DWORD> data;		//-> while (true) {		#ifdef VERBOSE			clog << "MUX '" << name() << "'" <<endl;		#endif				// Read correct input		if(sc_uint<1>(sel.read()) == 0)			data = in0.read();		else			data = in1.read();				// Write output		out.write(data);				// wait for new event		//-> wait();//-> 	}}void MUX3::mux_thread(){	sc_bv<DWORD> data;	sc_uint<2> sel_t;		//-> while (true) {		#ifdef VERBOSE			clog << "MUX '" << name() << "'" <<endl;		#endif				// Read correct input		sel_t = sel.read();		if(sel_t == 0)			data = in0.read();		else if (sel_t == 1)			data = in1.read();		else			data = in2.read();					// Write output		out.write(data);				// wait for new event		//-> wait();//-> 	}}void MUX3_AWORDREG::mux_thread(){	sc_bv<AWORDREG> data;	sc_uint<2> sel_t;		//-> while (true) {		#ifdef VERBOSE			clog << "MUX '" << name() << "'" <<endl;		#endif				// Read correct input		sel_t = sel.read();		if(sel_t == 0)			data = in0.read();		else if (sel_t == 1)			data = in1.read();		else			data = in2.read();					// Write output		out.write(data);				// wait for new event		//-> wait();//-> 	}}

⌨️ 快捷键说明

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