inctrl.h

来自「基于4个mips核的noc设计」· C头文件 代码 · 共 108 行

H
108
字号
/* *  TU Eindhoven *  Eindhoven, The Netherlands * *  Name            :   inctrl.h * *  Author          :   A.S.Slusarczyk@tue.nl * *  Date            :   13-09-2003 * *  Function        :   Input controller of the e-cube router * * */#ifndef INCTRL_H_INCLUDED#define INCTRL_H_INCLUDED#include <systemc.h>#include "net_dim.h"SC_MODULE(INPUT_CTRL){    sc_in< bool > clk, rst;  // address of this router in its dimension  sc_in< sc_uint<ADDRESS_LEN> > my_address;  // indication if it's input control for channel 0 or 1  sc_in< bool > ch0, ch1;     // communication with neighboring router (data processor)  sc_in< bool > req;  sc_out< bool > ack;  sc_in< sc_bv<FLIT_LEN> > data;    // crossbar-side of the controller  sc_out< sc_uint<2> > out_select;    // requested output queue (1,2,3)  sc_out< bool > request_switch;      // request strobe  sc_out< sc_bv<FLIT_LEN> > data_out; // data forwarded to the output queue  sc_out< bool > out_req;             // req forwarded to the output queue  sc_in< bool > out_ack;              // ack from the output queue      // internals  // input data latch  sc_signal< bool > latch;  sc_signal< sc_bv<FLIT_LEN> > data_latch;  void dlatch();    // control FSM  enum control_state { IDLE, OPEN, WAIT_ACK, NEXT, SEND, WAIT_END };#ifdef VERILOG  sc_signal< control_state > current_state, next_state;#else  sc_signal<unsigned> current_state, next_state;#endif    sc_signal< bool > header_select;   // output modified header instead of data	  void control_logic();  void control_change_state();    // output route selector  sc_signal< bool > end_of_route;       // asserted when address is 0  sc_signal< sc_uint<2> > out_select_n; // next value for the registered out_select signal  void route_select();  void switch_out_select();  // modification of the header  sc_signal< bool > start_of_packet, end_of_packet;  sc_signal< sc_bv<FLIT_LEN> > header;  // header with the decremented address  void header_adjust();    // selector of data source (data in or modified header)  void data_select();  SC_CTOR(INPUT_CTRL)	{	  SC_METHOD(dlatch);	  sensitive_pos << clk;	  	  SC_METHOD(control_logic);	  sensitive << current_state << req << out_ack << start_of_packet << end_of_packet;	  SC_METHOD(control_change_state); 	  sensitive_pos << clk << rst;	  	  SC_METHOD(route_select);	  sensitive << data << data_latch << latch << my_address << ch0 << ch1;	  SC_METHOD(header_adjust);	  sensitive << data_latch << end_of_route; 	  SC_METHOD(data_select);	  sensitive << data_latch << header << header_select;	  SC_METHOD(switch_out_select);	  sensitive_pos << clk;	}};#endif

⌨️ 快捷键说明

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