Switch::Switch(sc_module_name name, int n, int m, int bufferSize) : sc_module(name), n(n), m(m), bufferSize(bufferSize) { //All packet in- and outputs in = new sc_in<packet> [n]; out = new sc_out<packet> [m]; // Is set to true if there is a pending packet on that address. pPending = new sc_in<bool> [n]; //pReceived = new sc_out<bool>[n]; cBusy = new sc_in<bool> [m]; buffer = new packet*[m]; bufferCount = new int[m]; for (int i = 0; i < m; ++i) { buffer[i] = new packet[bufferSize]; bufferCount[i] = 0; } SC_HAS_PROCESS( Switch); SC_METHOD( distribute); sensitive << clk.pos(); }
FSM::FSM(sc_module_name name, int _limit) : sc_module(name){ limit = _limit; InitialState = S0; CurrentState = InitialState; Xtoggle = false; SC_HAS_PROCESS(FSM); SC_THREAD(fsm_functionality); sensitive << tick; }
// Constructor Control::Control (sc_module_name name, int _start_addr, int _end_addr) : sc_module (name){ start_addr = _start_addr; end_addr = _end_addr; rawData = 0; nextnumber = 0; SC_HAS_PROCESS(Control); SC_THREAD(mainc); }
top (sc_module_name name) : sc_module (name), clk("Clk", period){ fsm = new FSM("Statemachine", 100, 30); //Creating a new state machine with limit = 100. fsm->tick(clk); fsm->portA(Aout); fsm->X(Xin); Xcount = 0; Acount = 0; Xinput = false; SC_HAS_PROCESS(top); SC_CTHREAD(testbed, clk); }
top (sc_module_name name) : sc_module (name) , B_inst_Start("Start Button", 0), B_inst1("B1",1), B_inst2("B2",2), B_inst3("B3",3), B_inst4("B4",4), B_inst5("B5",5), B_inst6("B6",6), B_inst7("B7",7), B_inst8("B8",8), B_inst9("B9",9), control_inst("Control"), bus_inst("Bus") { B_inst_Start.buttonOutPort(bus_inst); B_inst1.buttonOutPort(bus_inst); B_inst2.buttonOutPort(bus_inst); B_inst3.buttonOutPort(bus_inst); B_inst4.buttonOutPort(bus_inst); B_inst5.buttonOutPort(bus_inst); B_inst6.buttonOutPort(bus_inst); B_inst7.buttonOutPort(bus_inst); B_inst8.buttonOutPort(bus_inst); B_inst9.buttonOutPort(bus_inst); bus_inst.button[0](B_inst_Start); bus_inst.button[1](B_inst1); bus_inst.button[2](B_inst2); bus_inst.button[3](B_inst3); bus_inst.button[4](B_inst4); bus_inst.button[5](B_inst5); bus_inst.button[6](B_inst6); bus_inst.button[7](B_inst7); bus_inst.button[8](B_inst8); bus_inst.button[9](B_inst9); control_inst.controlOutPort(bus_inst); bus_inst.controlport(control_inst); SC_HAS_PROCESS(top); SC_THREAD(testbed); }
gateway::gateway(sc_module_name name, uint8_t id, uint32_t bufferSize, uint8_t ramId, uint8_t computeList[], uint32_t computeCount, uint32_t pixelBufferSize) : module(name, id, bufferSize), ramId(ramId), state(Zustaende::IDLE), computeCount(computeCount), computeBusyCnt(0), pixelBufferSize(pixelBufferSize) { PRINT_DEBUG("gateway - Konstruktor"); if(computeCount == 0) { // todo error handling throw "gateway::gateway(): computeCount == 0"; } if(pixelBufferSize == 0) { // todo error handling throw "gateway::gateway(): pixelBufferSize == 0"; //this->pixelBufferSize = 10; } this->computeList = new ComputeList_T[this->computeCount]; for(size_t i = 0; i < (size_t)this->computeCount; ++i) { this->computeList[i].id = computeList[i]; this->computeList[i].busy = false; } this->pixelBuffer = new PaketBuffer(this->pixelBufferSize); SC_HAS_PROCESS(gateway); SC_METHOD(checkStart); sensitive << clk.pos(); PRINT_DEBUG("gateway - Konstruktor ende"); }
consumer(sc_core::sc_module_name name) : sc_core::sc_module(name) { SC_HAS_PROCESS(consumer); SC_THREAD(run); }